Terence Eden
Terence Eden

Reputation: 14304

Wikidata SPARQL multiple filters

I am trying to find cast members who appear together in different films.

For example:

This gets all the Temple of Doom actors:

SELECT ?actor ?actorLabel WHERE {
  ?movie wdt:P161 ?actor .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  FILTER(?movie = wd:Q179215)
}
LIMIT 100

I would have thought I could change the filter to be

FILTER(?movie = wd:Q179215 && ?movie = wd:Q181795)

but that doesn't return any items.

I've tried using

select ?actor ?actorLabel where {
  ?actor wdt:P106 wd:Q33999 .
   wd:Q181795 wdt:P161 ?actor .
   wd:Q181803 wdt:P161 ?actor .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} 

But that misses out lots of actors. Even just doing it with a single film only returns an incomplete cast list.

Upvotes: 2

Views: 534

Answers (1)

Pratik
Pratik

Reputation: 978

The operator you are expecting is OR not AND.

Try using

FILTER(?movie = wd:Q179215 || ?movie = wd:Q181795)

Upvotes: 0

Related Questions