Last active
July 24, 2020 13:05
-
-
Save rolandcrosby/985799723aee234708ba25738b2355fd to your computer and use it in GitHub Desktop.
Wikidata SPARQL query to retrieve films that have won the Palme d'Or at Cannes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
?film | |
?title | |
?directors | |
?year | |
WHERE | |
{ | |
SELECT | |
?film | |
?title | |
(GROUP_CONCAT(?directorLabel; SEPARATOR=" & ") AS ?directors) | |
(STR(YEAR(?date)) AS ?year) | |
WHERE | |
{ | |
# P31: instance of; P279: subclass of; Q11424: Film | |
?film wdt:P31/wdt:P279* wd:Q11424; | |
# P166: award received; Q179808: Palme d'Or; P585: point in time | |
p:P166 [ ps:P166 wd:Q179808; pq:P585 ?date ]. | |
OPTIONAL { | |
# P57: director | |
?film wdt:P57 ?director | |
} | |
SERVICE wikibase:label { | |
bd:serviceParam wikibase:language "en" . | |
?director rdfs:label ?directorLabel . | |
?film rdfs:label ?title | |
} | |
} | |
GROUP BY | |
?film | |
?title | |
?date | |
} | |
ORDER BY ?year |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ?film (CONCAT("https://imdb.com/title/", ?imdbID) AS ?url) ?year ?title ?directors WHERE { | |
SELECT ?film ?title ?imdbID (GROUP_CONCAT(?directorLabel; SEPARATOR = " & ") AS ?directors) (STR(YEAR(?date)) AS ?year) WHERE { | |
?film (wdt:P31/(wdt:P279*)) wd:Q11424; | |
p:P166 ?award. | |
?award ps:P166 wd:Q179808; | |
pq:P585 ?date. | |
OPTIONAL { ?film wdt:P57 ?director. } | |
OPTIONAL { ?film wdt:P345 ?imdbID. } | |
SERVICE wikibase:label { | |
bd:serviceParam wikibase:language "en". | |
?director rdfs:label ?directorLabel. | |
?film rdfs:label ?title. | |
} | |
} | |
GROUP BY ?film ?title ?date ?imdbID | |
} | |
ORDER BY DESC (?year) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment