Search code examples
sparqlontologysesame

Sesame : how to remove the inference during queries?


I'm looking for a solution in order to "remove" the inference during a query launched on Sesame. I must use a "Native Java Store RDF Schema" repository and I have this query : I have an instance, a NamedIndividual, and I want the uri of the class whose instance it is :

    SELECT DISTINCT ?uri WHERE  {   
        <http://www.semanticweb.org/ontotest#myInstance> rdf:type ?uri .
        FILTER (?uri rdf:type owl:Class)         
    }

The problem is that I get severals URI (whom the good URI) instead of one because of the inference. I get the superclasses of the ontology then there is no link with the class of the instance. How to obtain the right result without change the repository ?


Solution

  • Set the setIncludeInferred(false) on your Query object before executing it through the API to avoid using inferred statements.