简体   繁体   中英

Multiple MINUS clause in a sparql query

I am trying to run the following SPARQL query on the public endpoint of DBPedia:

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.

Can anyone give me pieces of advice to rewrite my query so the multiple MINUS clauses are taken into account by DBPedia?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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