简体   繁体   English

sparql 查询中的多个 MINUS 子句

[英]Multiple MINUS clause in a sparql query

I am trying to run the following SPARQL query on the public endpoint of DBPedia:我正在尝试在 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

It works ok.它工作正常。 But then I uncomment the commented line.但后来我取消注释注释行。 And then the query fails.然后查询失败。

From what I understand, multiple MINUS clauses are authorized in SPARQL.据我了解,SPARQL 中授权了多个 MINUS 子句。

Can anyone give me pieces of advice to rewrite my query so the multiple MINUS clauses are taken into account by DBPedia?谁能给我一些建议来重写我的查询,以便 DBPedia 考虑多个 MINUS 子句?

One of the nice things about standards is that we can look things up in the specifications, so after looking at productions 66, 56, and 54 at https://www.w3.org/TR/sparql11-query/#grammar I can confirm that multiple MINUS clauses are allowed by the standard.关于标准的好处之一是我们可以在规范中查找内容,因此在查看https://www.w3.org/TR/sparql11-query/#grammar的产品 66、56 和 54 之后,我可以确认标准允许多个 MINUS 子句。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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