use of fr.lirmm.graphik.graal.forward_chaining.BreadthFirstChase in project graal by graphik-team.
the class ChaseTest method test.
@Test
public void test() throws ParseException, ChaseException {
Ontology onto = new DefaultOntology();
onto.add(DlgpParser.parseRule("p(X) :- q(X)."));
onto.add(DlgpParser.parseRule("q(X) :- p(X)."));
InMemoryAtomSet store = new DefaultInMemoryGraphStore();
store.add(DlgpParser.parseAtom("p(a)."));
Chase chase = new BreadthFirstChase(onto, store);
Assert.assertTrue(chase.hasNext());
chase.next();
Assert.assertTrue(chase.hasNext());
chase.next();
Assert.assertFalse(chase.hasNext());
}
use of fr.lirmm.graphik.graal.forward_chaining.BreadthFirstChase in project graal by graphik-team.
the class DefaultKnowledgeBase method semiSaturate.
@Override
public void semiSaturate() throws KnowledgeBaseException {
if (!this.isSemiSaturated) {
this.compileRule();
Chase chase = new BreadthFirstChase(this.ruleCompilation.getSaturation(), this.store);
chase.setProfiler(this.getProfiler());
try {
chase.next();
} catch (ChaseException e) {
throw new KnowledgeBaseException(e);
}
this.isSemiSaturated = true;
}
}
Aggregations