use of fr.lirmm.graphik.graal.core.ruleset.IndexedByBodyPredicatesRuleSet in project graal by graphik-team.
the class DefaultGraphOfRuleDependencies method computeDependencies.
protected void computeDependencies(DependencyChecker... checkers) {
// preprocess
IndexedByBodyPredicatesRuleSet index = new IndexedByBodyPredicatesRuleSet(this.graph.vertexSet());
Iterable<Rule> candidates = null;
Set<String> marked = new TreeSet<String>();
for (Rule r1 : this.graph.vertexSet()) {
marked.clear();
CloseableIteratorWithoutException<Atom> it = r1.getHead().iterator();
while (it.hasNext()) {
Atom a = it.next();
candidates = index.getRulesByBodyPredicate(a.getPredicate());
if (candidates != null) {
for (Rule r2 : candidates) {
if (marked.add(r2.getLabel())) {
Set<Substitution> unifiers = computeDependency(r1, r2, checkers);
if (!unifiers.isEmpty()) {
this.setDependency(r1, unifiers, r2);
}
}
}
}
}
}
}
Aggregations