问题描述
我正在尝试在 DBPedia 的公共端点上运行以下 SPARQL 查询:
select distinct ?o ?olabel where {
{ select distinct ?s where {
?s <http://www.w3.org/1999/02/22-rdf-Syntax-ns#type>/<http://www.w3.org/2000/01/rdf-schema#subClassOf>{,6} <http://dbpedia.org/ontology/FictionalCharacter>
. ?s <http://dbpedia.org/property/creator> ?oo } limit 100000 }
. ?s <http://dbpedia.org/property/creator> ?o
MINUS { ?o <http://www.w3.org/1999/02/22-rdf-Syntax-ns#type>/<http://www.w3.org/2000/01/rdf-schema#subClassOf>{,6} <http://dbpedia.org/class/yago/Communicator109610660>}
# MINUS { ?o <http://www.w3.org/1999/02/22-rdf-Syntax-ns#type>/<http://www.w3.org/2000/01/rdf-schema#subClassOf>{,6} <http://dbpedia.org/class/yago/Creator109614315>}
. ?o <http://www.w3.org/2000/01/rdf-schema#label> ?olabel . FILTER (lang(?olabel)=''||lang(?olabel)='en')
} LIMIT 100
它工作正常。 但后来我取消注释注释行。 然后查询失败。
据我了解,SPARQL 中授权多个 MINUS 子句。
谁能给我一些建议来重写我的查询,以便 DBPedia 考虑多个 MINUS 子句?
解决方法
标准的好处之一是我们可以在规范中查找内容,因此在查看 https://www.w3.org/TR/sparql11-query/#grammar 处的产生式 66、56 和 54 后,我可以确认标准允许使用多个 MINUS 子句.