laalto is right, almost any Semantic Web library is going to do this through a recursive search for subClassOf. The only way you could get around this is to have an inference / reasoning mechanism that will add extra triples to the graph when the original graph is analyzed.
So, for example, it will automatically add the following:
<my:Eukaryota> <rdf:type> <my:Organism>. <my:Mammal> <rdf:type> <my:Organism>. <my:Mammal> <rdf:type> <my:Eukaryota>. <my:Primate> <rdfs:type> <my:Organism>. <my:Primate> <rdfs:type> <my:Eukaryota>. <my:Primate> <rdfs:type> <my:Mammal>. # etc...
How do you do it in jena. I'm not sure anyone who knows that Jena will have to answer this question.
As in the case of SPARQL laalto, you are absolutely right, in some cases, although you can make a simple query, for example, the following: if the three-element store and the associated SPARQL endpoint have some output options
PREFIX my: <http://yournamespace.com> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns
source share