SPARQL Query Error with OPTION(TRANSITIVE) on Jena

江枫思渺然 提交于 2019-12-06 05:30:56

This is the expected behavior. This part of the query:

OPTION (TRANSITIVE, t_distinct, t_in (?x), t_out (?type) ) 

is not standard SPARQL 1.1 but it is a Virtuoso specific extension.

Jena is a SPARQL 1.1 compliant implementation.

The following query does the same thing using standard SPARQL 1.1 syntax, and should work with both Fuseki and Virtuoso (just tested on the dbpedia endpoint and got the same result):

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?type
WHERE
{
  {
   SELECT *
   WHERE
    {
       ?x rdfs:subClassOf+ ?type .
    }
  }
  FILTER (?x = <http://dbpedia.org/ontology/Hospital>)
}

The feature used is the "property path".

See http://www.w3.org/TR/sparql11-query/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!