query-5dd18a21906a28d74a073ea1f137e2bf
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item (CONCAT(?abbr, ':', ?seasonOrd, '⨉', ?thing) as ?code) WHERE {
?item wdt:P31 wd:Q61220733.
MINUS { ?item wdt:P31 wd:Q21664088. }
?item wdt:P179 ?series.
?series wdt:P1813 ?abbr.
?item wdt:P4908 ?season.
?season p:P179 [ pq:P1545 ?seasonOrd ].
?item p:P4908 [ pq:P1545 ?episodeOrd ].
bind(if(strlen(?episodeOrd)=1,concat("0",?episodeOrd),?episodeOrd) as ?thing)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?abbr"):::projected
v8("?code")
v6("?episodeOrd")
v1("?item"):::projected
v4("?season")
v5("?seasonOrd"):::projected
v2("?series")
v7("?thing"):::projected
a1((" "))
a2((" "))
c2(["wd:Q61220733"]):::iri
c3(["wd:Q21664088"]):::iri
v1 --"p:direct/P31"--> c2
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v1 --"p:direct/P31"--> c3
end
v1 --"p:direct/P179"--> v2
v2 --"p:direct/P1813"--> v3
v1 --"p:direct/P4908"--> v4
a1 --"p:qualifier/P1545"--> v5
v4 --"p:P179"--> a1
a2 --"p:qualifier/P1545"--> v6
v1 --"p:P4908"--> a2
bind1[/"if(string-length(?episodeOrd) = '1^^xsd:integer',concat('0',?episodeOrd),?episodeOrd)"/]
v6 --o bind1
bind1 --as--o v7
bind2[/"concat(?abbr,':',?seasonOrd,'⨉',?thing)"/]
v3 --o bind2
v5 --o bind2
v7 --o bind2
bind2 --as--o v8