Last active
November 18, 2023 23:53
-
-
Save anarchivist/0cdde79c5a311baa4169f965e5c68ced to your computer and use it in GitHub Desktop.
Wikidata query for Movies starring Nicolas Cage that are not direct to video/video on demand
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
# Films starring Nicolas Cage that are not direct to video/video on demand | |
# Intended to help making it easier to load this data into a Letterboxd list | |
# See https://letterboxd.com/about/importing-data/ for more info | |
SELECT ?item | |
?itemLabel | |
?LetterboxdURI | |
(?itemLabel AS ?Title) | |
(YEAR(MIN(?date)) AS ?Year) | |
(GROUP_CONCAT(DISTINCT ?directorLabel; SEPARATOR = ", ") AS ?Directors) | |
WHERE { | |
?item | |
# include all subclasses of film (e.g. feature film, etc.) - excludes film series | |
p:P31/ps:P31/wdt:P279* wd:Q11424; | |
# by using P161, we are implicitly excluding things where Cage is a voice actor | |
wdt:P161 wd:Q42869; | |
wdt:P57 ?director; | |
wdt:P577 ?date . | |
wd:P6127 wdt:P1630 ?formatterurl . | |
?director rdfs:label ?directorLabel . | |
OPTIONAL { ?item wdt:P6127 ?letterboxdId . } | |
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } | |
VALUES ?distributionFilter { | |
wd:Q723685 | |
wd:Q844580 | |
} | |
FILTER(NOT EXISTS { ?item wdt:P437 ?distributionFilter . }) | |
# Films without Letterboxd IDs can be safely presumed to be unavailable | |
FILTER(EXISTS { ?item wdt:P6127 ?letterboxdId . }) | |
FILTER((LANG(?directorLabel)) = "en") | |
BIND(IRI(REPLACE(?letterboxdId, "^(.+)$", ?formatterurl)) AS ?LetterboxdURI) | |
} | |
GROUP BY ?item ?itemLabel ?LetterboxdURI | |
ORDER BY (?Year) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment