SPARQL联合查询“SERVICE”返回Virtuoso RDFZZ错误:意外变量名称'stubvar14'

时间:2015-04-10 11:16:03

标签: sparql dbpedia federated-queries

我想从两个不同的SPARQL端点获取人员列表,因此我在de.dbpedia上使用此查询:

PREFIX category-en: <http://dbpedia.org/resource/Category:>
SELECT distinct *
WHERE {
?name dcterms:subject category-de:Haus_Liechtenstein.
?name rdf:type foaf:Person.
SERVICE <http://dbpedia.org/sparql> {
?name dcterms:subject category-en:Princely_Family_of_Liechtenstein.
?name rdf:type foaf:Person.
}
MINUS {?name dbpedia-owl:deathDate ?d}
}

然后我得到以下错误:

  

Virtuoso RDFZZ错误DB.DBA.SPARQL_REXEC('http://dbpedia.org/sparql',   ...)收到意外变量名称'stubvar14'的结果

知道我做错了什么吗?非常感谢!

1 个答案:

答案 0 :(得分:2)

所以问题是尽管这两个查询分别工作正常,但组合查询中的service部分试图根据第二个集合过滤第一个集合。我认为你缺少的是工会:

PREFIX category-en: <http://dbpedia.org/resource/Category:>
SELECT distinct count(?name)
WHERE {
{
    ?name dcterms:subject category-de:Haus_Liechtenstein.
    ?name rdf:type foaf:Person.
}
union{
    SERVICE silent <http://dbpedia.org/sparql>{
    ?name dcterms:subject category-en:Princely_Family_of_Liechtenstein.
    ?name rdf:type foaf:Person.
}
}
MINUS {?name dbpedia-owl:deathDate ?d}
}