Is it possible to check if an OWLClassExpression contains another OWLClassExpression using the OWL API?
Taxonomy Example: Taxonomy Image (there are no disjoint classes)
1st Class Expression: "E and C"
2nd Class Expression: "A"
3rd Class Expression: "D"
I would want a way of knowing that the 2nd contains the 1st, but the 3rd does not contain the first.
What I mean with "contains" is: if I instantiate an individual which belongs to the 1st (both E and C classes) than, that individual is also from the 2nd (A class).
You need to use an OWLReasoner
to do this. The test is carried out by creating the axiom you wish to verify - e.g., A subClassOf E and C
- and testing if the ontology entails it (OWLReasoner::isEntailed(OWLAxiom)
).
OWLReasoner
implementations are available outside the OWL API - see Pellet, Openllet, HermiT, FaCT++, JFact (all available on their respective websites, and, apart from FaCT++, all available on Maven Central