How to get the class of individual in owl with the reasoner
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new StringDocumentSource(KOALA));
IRI ontologyIRI = IRI.create("http://www.semanticweb.org/xxxxx/ontologies/2017/10/ontology");
OWLDataFactory factory = manager.getOWLDataFactory();
OWLIndividual john = factory.getOWLNamedIndividual(IRI.create(ontologyIRI + "#John"));
OWLDataPropertyExpression hasConnexion= factory.getOWLDataProperty(IRI.create(ontologyIRI + "#hasConnexion"));
OWLDataPropertyAssertionAxiom axiom = factory.getOWLDataPropertyAssertionAxiom(hasConnexion, john, 3);
AddAxiom addAxiom = new AddAxiom(ontology, axiom);
manager.applyChange(addAxiom);
manager.saveOntology(ontology, new StreamDocumentTarget(System.out));
//reasoner
OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createReasoner(ontology);
OWLClass myClass= fac.getOWLClass(IRI.create("http://www.semanticweb.org/xxxxx/ontologies/2017/10/ontology#hasConnexion"));
NodeSet<OWLNamedIndividual> individuals = reasoner.getInstances(myClass,
false);
for (Node<OWLNamedIndividual> i : individuals)
{
System.out.println(i.getClass());
}
I expect the result to be the class of every individual but the reasoner gives no result. In protege it's work well but when i take my ontology and try to make it with owl api, i don't got any result