- From: Jeremy J Carroll <jjc@syapse.com>
- Date: Wed, 8 Jul 2015 08:40:53 -0700
- To: Olivier Rossel <olivier.rossel@gmail.com>
- Cc: public-sparql-dev@w3.org
Double filter not exist or use a count select ?s ?typeOfActor { { select ?s (count (?actor) as ?count) {?s <http://dbpedia.org/property/actor> ?actor } } { select ?s ?typeOfActor (count (?actor) as ?count) { ?s <http://dbpedia.org/property/actor> ?actor . ?actor a ?typeOfActor } } group by ?typeOfActor ?s } or select ?s ?typeOfActor { ?s <http://dbpedia.org/property/actor> ?actor . ?actor a ?typeOfActor FILTER NOT EXISTS { ?s <http://dbpedia.org/property/actor> ?actor2 . FILTER NOT EXISTS { ?actor2 a ?typeOfActor } } } I would be surprised if either were quick! Maybe the numbers are sufficiently small Jeremy > On Jul 8, 2015, at 7:43 AM, Olivier Rossel <olivier.rossel@gmail.com> wrote: > > Hi all. > > I wonder how I can get an intersection in SPARQL. > > Here is the use case: > In DBPedia, there is a predicate called <http://dbpedia.org/property/actor>. > > In this triple pattern: > ?s <http://dbpedia.org/property/actor> ?actor . ?actor a ?typeOfActor > > ?typeOfActor can be: > > http://www.w3.org/2002/07/owl#Thing > http://schema.org/Person > http://xmlns.com/foaf/0.1/Person > http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Agent > http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#NaturalPerson > http://wikidata.dbpedia.org/resource/Q215627 > http://wikidata.dbpedia.org/resource/Q5 > http://dbpedia.org/ontology/Agent > http://dbpedia.org/ontology/Person > http://dbpedia.org/class/yago/Actor109765278 > http://dbpedia.org/class/yago/ActorsFromLiverpool > http://dbpedia.org/class/yago/Adult109605289 > http://dbpedia.org/class/yago/CausalAgent100007347 > http://dbpedia.org/class/yago/Educator110045713 > http://dbpedia.org/class/yago/Entertainer109616922 > http://dbpedia.org/class/yago/LivingThing100004258 > http://dbpedia.org/class/yago/Object100002684 > http://dbpedia.org/class/yago/Organism100004475 > http://dbpedia.org/class/yago/Performer110415638 > http://dbpedia.org/class/yago/Person100007846 > http://dbpedia.org/class/yago/Professional110480253 > http://dbpedia.org/class/yago/Teacher110694258 > http://dbpedia.org/class/yago/Whole100003553 > http://dbpedia.org/class/yago/YagoLegalActorGeo > > My need is to retrieve only the ?typeOfActor that are common to all > the ?actor(s). > > I still have no clue how to do that in SPARQL. > > Any help would be very welcome. > > (and any strategy to do that in SPARQL 1.0 would be interesting too) >
Received on Wednesday, 8 July 2015 15:41:22 UTC