query-aad11de80daef4540117b1232b896a63
tool/ query idea: cast members' age at time of movie releaseI think this would be a great tool that lots of people would find useful. maybe it's more dynamic than the usual here; let me know. QUERY: how old are the "top" (5-20) cast members of a movie at the time the movie is released? rough example*film : Closer (2004) Jude Law - 32 Natalie Portman - 23 Julia Roberts - 37 Clive Owen - 40 maybe throw the director in there too- Mike Nichols - 73 14:15, 16 July 2020 (UTC)) talk (Skakkle maybe this is completely unrealistic, but I at least want to see what you guys think or how to take steps to build something like this. thanks.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?d ?cast ?castLabel ?dob ?age
{
BIND( wd:Q212098 as ?film)
?film wdt:P577 ?d
FILTER NOT EXISTS { ?film wdt:P577 ?d1 FILTER( ?d1 < ?d) }
?film ( wdt:P161 | wdt:P57 ) ?cast .
OPTIONAL { ?cast wdt:P569 ?dob }
BIND( YEAR(?d)-YEAR(?dob) as ?age)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?age"):::projected
v4("?cast"):::projected
v2("?d"):::projected
v1("?d1")
v5("?dob"):::projected
v4("?film")
c6(["bd:serviceParam"]):::iri
c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["?d1 < ?d"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0v3 --"wdt:P577"--> e0v1
e0v2("?d"):::projected
e0v1("?d1"):::projected
e0v3("?film"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v2
f0 --> v4
f0 --> c1
f1[["?d1 < ?d"]]
f1 --> v1
f1 --> v2
v4 --"wdt:P577"--> v1
bind2[/"'wd:Q212098'"/]
bind2 --as--o v4
v4 --"wdt:P577"--> v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P57"--> v4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P161"--> v4
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P569".-> v5
end
bind3[/"year-from-dateTime(?d) - year-from-dateTime(?dob)"/]
v2 --o bind3
v5 --o bind3
bind3 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end