Reputation: 25
I am using OWL API, and created a non-buffering reasoner in hope that so I would not need to make a call to flush()
, all the time (i.e. the reasoner is always synchronised).
@Test
public void reasonerQueryTest() throws OWLOntologyCreationException {
OWLOntologyManager owlManager = OWLManager.createOWLOntologyManager();
OWLOntology o = owlManager.createOntology();
ReasonerFactory reasonerFactory = new ReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(o);
reasoner.precomputeInferences(InferenceType.CLASS_ASSERTIONS);
OWLDataFactory factory = owlManager.getOWLDataFactory();
OWLNamedIndividual a = owlManager.getOWLDataFactory().getOWLNamedIndividual(IRI.create(":a"));
OWLClass b = owlManager.getOWLDataFactory().getOWLClass(IRI.create(":b"));
OWLClassAssertionAxiom classAssertionAxiom = factory.getOWLClassAssertionAxiom(b,a);
o.add(classAssertionAxiom);
reasoner.flush(); //NEEDED TO GET DESIRED OUTPUT
owlManager.addAxiom(o,classAssertionAxiom);
System.out.println(reasoner.getInstances(b,false).getFlattened());
}
In this particular example I am obtaining instances of a class. The desired output is [<:a>]
. To get the desired output I need to make a call to the flush method. How is the flush method working here since the reasoner has no buffer ?
Thanks a lot !
Flush method needed. How is it working ? And how can I remove the need for using the flush() method.
Upvotes: 0
Views: 43