sparql 查询中的多个 MINUS 子句

问题描述

我正在尝试在 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 子句.

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...