I have two ontologies, photo1 and index. Photo1 contains ABox assertions, and index contains Tbox assertions.
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology photo1 = manager.loadOntologyFromOntologyDocument(new File("files/ontologies/OBMA2/photo1.owl"));
OWLDataFactory factory = manager.getOWLDataFactory();
reasoner = new FaCTPlusPlusReasonerFactory().createReasoner(photo1);
reasoner = (FaCTPlusPlusReasoner) reasoner;
System.out.println(reasoner.getInstances(factory.getOWLThing(), false));
The above prints:
Nodeset[
Node( <http://www.semanticweb.org/noor/ontologies/2013/6/photo1.owl#photo1> ),
Node( <http://www.semanticweb.org/noor/ontologies/2013/6/photo1.owl#photo1-tiger2> ),
Node( <http://www.semanticweb.org/noor/ontologies/2013/6/photo1.owl#photo1-tiger1> )
]
However, now, I'm loading the Tbox and adding all ABox axioms from photo1 and then getting instances of owl:Thing
as follows:
OWLOntologyManager managerTbox = OWLManager.createOWLOntologyManager();
OWLOntology Tbox = manager.loadOntologyFromOntologyDocument(new File("files/ontologies/index.owl"));
OWLDataFactory factoryTbox = manager.getOWLDataFactory();
OWLReasoner reasonerTbox = new FaCTPlusPlusReasonerFactory().createReasoner(Tbox);
//adding the axioms from the photo1 abox to Tbox's abox
managerTbox.addAxioms(Tbox, photo1.getABoxAxioms(true));
reasonerTbox = (FaCTPlusPlusReasoner) reasonerTbox;
System.out.println(reasonerTbox.getInstances(factoryTbox.getOWLThing(), false));
Now, even though I have added all axioms from Photo1's ABox to TBox's ABox, I get no output:
Nodeset[]