query-b26c53ff711afcede95981e79fba3394
Bates Motel directors
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
SELECT (COUNT(?episode) AS ?episodes) ?directorLabel (MIN(xsd:integer(?ordinal)) AS ?firstEpisode) (MAX(xsd:integer(?ordinal)) AS ?lastEpisode) ?director
WHERE {
?episode p:P179 ?seriesBlock . ?seriesBlock v:P179 wd:Q323722 . ?seriesBlock pq:P1545 ?ordinal .
?episode wdt:P57 ?director
SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
}
GROUP BY ?director ?directorLabel
ORDER BY DESC(?episodes) ?firstEpisode
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?director"):::projected
v3("?episode"):::projected
v7("?episodes")
v7("?firstEpisode")
v7("?lastEpisode")
v5("?ordinal"):::projected
v4("?seriesBlock")
c7(["bd:serviceParam"]):::iri
c9(["en"]):::literal
c3(["wd:Q323722"]):::iri
v3 --"p:P179"--> v4
v4 --"p:statement/P179"--> c3
v4 --"p:qualifier/P1545"--> v5
v3 --"p:direct/P57"--> v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind3[/"count(?episode)"/]
v3 --o bind3
bind3 --as--o v7
bind4[/"min(http://www.w3.org/2001/XMLSchema#integer(?ordinal))"/]
v5 --o bind4
bind4 --as--o v7
bind5[/"max(http://www.w3.org/2001/XMLSchema#integer(?ordinal))"/]
v5 --o bind5
bind5 --as--o v7