Premier post court d’une série que j’espère longue, proposant des requêtes SPARQL construites étape par étape à passer sur Wikidata Query Service.
Étape 1 : Acteurs du film Le Seigneur des anneaux : La Communauté de l’anneau (Q127367) :
SELECT ?actor ?actorLabel WHERE { wd:Q127367 wdt:P161 ?actor # members of the cast of "The Lord of the Rings: The Fellowship of the Ring" by Peter Jackson SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Étape 2 : Acteurs du même film avec leurs rôles :
SELECT ?actor ?actorLabel ?role ?roleLabel WHERE { wd:Q127367 p:P161 ?actorStatement . # statements for members of the cast of The Lord of the Rings: The Fellowship of the Ring ?actorStatement ps:P161 ?actor . # value of those statements ?actorStatement pq:P453 ?role . # qualifier with property P453 (character role) for those statements SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Étape 2b : Acteurs du même film, si possible avec leurs rôles :
SELECT ?actor ?actorLabel ?role ?roleLabel WHERE { wd:Q127367 p:P161 ?actorStatement . # cast statements of The Lord of the Rings: The Fellowship of the Ring ?actorStatement ps:P161 ?actor . # value of those statements OPTIONAL { ?actorStatement pq:P453 ?role . } # trying to get the qualifier with property P453 (character role) for those statements SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Où l’on voit que Sarah McLeod a eu un rôle, mais qu’on ne sait pas lequel.
Étape 3 : Acteurs de tous les films de la trilogie du Seigneur des anneaux de Peter Jackson (Q190214), si possible avec leurs rôles, en dédoublonnant :
SELECT DISTINCT ?actor ?actorLabel ?role ?roleLabel WHERE { ?movie wdt:P179 wd:Q190214 . # movie is part of the "'Lord of the Rings' by Peter Jackson" film series (Q190214) ?movie p:P161 ?actorStatement . # movie has actors cast ?actorStatement ps:P161 ?actor . # of which we get the Qid OPTIONAL { ?actorStatement pq:P453 ?role . } # and try to get the character role SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Où l’on voit que Sarah McLeod n’est pas la seule malheureuse.
Étape 4 : Acteurs de tous les films de la même série de films, dont le rôle était celui d’un Hobbit :
SELECT DISTINCT ?actor ?actorLabel ?role ?roleLabel ?image WHERE { ?movie wdt:P179 wd:Q190214 . # movie is part of Peter Jackson's LotR trilogy ?movie p:P161 ?actorStatement . # movie has actors cast ?actorStatement ps:P161 ?actor . # of which we get the Qid OPTIONAL { ?actor wdt:P18 ?image } . # and an image if one is declared ?actorStatement pq:P453 ?role . # the actors were cast as given roles ?role wdt:P31 wd:Q74359 . # roles that happen to be that of Hobbits SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Étape 5 : Galerie photo de tous les acteurs de tous les films de la série de films, dont le rôle était celui d’un Hobbit :
#defaultView:ImageGrid # photo gallery of actors who played Hobbits in Peter Jackson's Lord of the Rings trilogy SELECT DISTINCT ?actor ?actorLabel ?role ?roleLabel ?image WHERE { ?movie wdt:P179 wd:Q190214 . # movie is part of Peter Jackson's trilogy ?movie p:P161 ?actorStatement . # movie has actors cast ?actorStatement ps:P161 ?actor . # of which we get the Qid OPTIONAL { ?actor wdt:P18 ?image } . # and an image if one is declared ?actorStatement pq:P453 ?role . # the actors were cast as given roles ?role wdt:P31 wd:Q74359 . # roles that happen to be that of Hobbits SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Résultat final :
Remerciements
Merci à Harmonia Amanda pour l’idée, et à Coyau pour #defaultView ❤
Et merci à tous ceux qui indiqueront les rôles que Sarah McLeod, Calum Gittins, Bruce Spence, Bruce Phillips, Bret McKenzie, Thomas Robins, Peter Jackson, Paul Norell, Bruce Hopkins, Stephen Ure, et Joel Tobeck ont eu dans les films de la trilogie du Seigneur des anneaux de Peter Jackson ❣❤❣
Leave a Reply