Imagine the following Taxonomy (acyclic & directed graph):
<my:Eukaryota> <rdfs:subClassOf> <my:Organism>.
<my:Mammal> <rdfs:subClassOf> <my:Eukaryota>.
<my:Primate> <rdfs:subClassOf> <my:Mammal>.
<my:HomoSapiens> <rdfs:subClassOf> <my:Primate>.
<my:Bacteria> <rdfs:subClassOf> <my:Organism>.
<my:Escherichia> <rdfs:subClassOf> <my:Bacteria>.
1) Is it possible with the Jena OWL API to check if a given resource (e.g. HomoSapiens) is a subclass of 'Mammal' without recursively retrieving all the parents nodes ?
2) The same question with SPARQL.
Thanks
If you're already using Jena, you can use use Pellet's SPARQL-DL query engine, which should let you query individuals in an ontology-aware way.
Alternately, you can use Jena's InfModel
instead of Model
interface, attach a reasoner (and ontology) to it, and then run the query RobV mentions. You can use Pellet's reasoner for this if you wanted. You don't need to use the OntModel
if you just want to do reasoning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With