I am using OWL-Api and hermiT reasoner, while trying to retrieve the partOf subClasses using hermiT, it give back the right result, so the partOf subclasses, but it also give back the inferenced subclasses (which i don't need).
This is the function used to retrieve the partOf subClasses:
//ricerca delle classi che hanno come parti quella attuale
System.out.println("Questa classe è parte di: ");
OWLClassExpression domain = df.getOWLObjectIntersectionOf((Stream<? extends OWLClassExpression>) ontologia.objectPropertyDomainAxioms(partOf));
NodeSet<OWLClass> subClassesInDomain = hermit.getSubClasses(domain, false);
if(subClassesInDomain.isEmpty()) {
System.out.println("\tQuesta classe non è parte di nessun'altra");
}
else {
for(Node<OWLClass> parteDi : subClassesInDomain) {
OWLClass classe2 = parteDi.getRepresentativeElement();
System.out.println("\t"+ classe2.getIRI().getFragment());;
}
}
In this image, it is provided the actual result of the operation. given result
In this, it is shown the result i need. wanted result
Is there a way to disable hermiT inference engine only for this operation?
hermit.getSubClasses(domain, false);
Change this to
hermit.getSubClasses(domain, true);
To retrieve only direct subclasses.