简体   繁体   中英

SPARQL query results in Protege does not recognize transitive property

I have almost the same requirement expresed in this question: Get all nodes in a transitive relation

I am using Protege 3.4.8. This is an Owl-Lite project. I have a transitive property "contains", which is defined as an object property of type Node Node has descendants of type A, B and C

I have individuals that link to each other through contains property like this:

A contains B contains C

When I run the following SPARQL query:

SELECT ?A ?B
WHERE
{
    ?A :contains ?B         
}

I get :

A1 B1
B1 C1

Due to transitive nature of contains, I'd expect to get

A1 C1 

too. What am I doing wrong here? The question I've linked to includes Jena in the answer, would it make a difference to do this on a Jena model?

Ok,

Further searches led me to this page: http://opentox.org/data/documents/development/RDF%20files/JavaOnly/query-reasoning-with-jena-and-sparql

The following quote from this page (probably) explains the reasons behind the behaviour I'm seeing:

"For our purposes SPARQL queries could be executed either directly through the SPARQL query panel in Protege or from inside a JAVA application using the specialised Jena library methods. Both approaches are able to handle queries concerning explicit object and property relations but Jena libraries have the advantage of using a reasoner. Thus queries executed using Jena library methods can return results taking in account also the transitive and inferred relations."

SPARQL is a RDF query language, so not all SPARQL engines should implement the OWL entailment (ie, use OWL semantics for evaluating the query). Further details at http://www.w3.org/TR/sparql11-entailment/

Not sure which implementation is actually using Protege under the hood...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM