ale*_*ria 2 sparql jena virtuoso transitive-dependency fuseki
我有以下查询
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?type
WHERE
{
{
SELECT *
WHERE
{
?x rdfs:subClassOf ?type .
}
}
OPTION (TRANSITIVE, t_distinct, t_in (?x), t_out (?type) ) .
FILTER (?x = <http://dbpedia.org/ontology/Hospital>)
}
Run Code Online (Sandbox Code Playgroud)
当我将它发送到Virtuoso端点但它在我的Jena实例上不起作用时它工作正常.具体我得到以下错误:
INFO [1] 400 Parse error:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?type
WHERE
{
{
SELECT *
WHERE
{
?x rdfs:subClassOf ?type .
}
}
OPTION (TRANSITIVE, t_distinct, t_in (?x), t_out (?type) ) .
FILTER (?x = <http://dbpedia.org/ontology/Hospital>)
}
Lexical error at line 12, column 39. Encountered: " " (32), after : "OPTION" (17 ms)
Run Code Online (Sandbox Code Playgroud)
如果这是一个Virtuoso特定的功能,我将很高兴知道这个查询的等价物将与*Jena /标准SPARQL一起使用.预期产量应为:
http://dbpedia.org/ontology/Building
http://dbpedia.org/ontology/ArchitecturalStructure
http://dbpedia.org/ontology/Place
http://dbpedia.org/ontology/d0:Location
Run Code Online (Sandbox Code Playgroud)
代表"医院"的所有超类
这是预期的行为.这部分查询:
OPTION (TRANSITIVE, t_distinct, t_in (?x), t_out (?type) )
Run Code Online (Sandbox Code Playgroud)
不是标准的SPARQL 1.1,但它是Virtuoso特定的扩展.
Jena是符合SPARQL 1.1的实现.
以下查询使用标准SPARQL 1.1语法执行相同的操作,并且应该与Fuseki和Virtuoso一起使用(仅在dbpedia端点上测试并获得相同的结果):
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>)
}
Run Code Online (Sandbox Code Playgroud)
使用的功能是"属性路径".
见http://www.w3.org/TR/sparql11-query/
| 归档时间: |
|
| 查看次数: |
734 次 |
| 最近记录: |