query-9c06ff35a4b732521388bf21487ebc8b
statement linking an episode to the series increments regardless of whether a new season has started (this is the same query but with a different item bound to ?series): (P179)part of the series qualifier on a (P1545)series ordinal , for example, the (Q1079)Breaking Bad Whereas with
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?season ?seasonNumber ?episode ?episodeLabel ?episodeNumber WHERE {
BIND(wd:Q1079 as ?series)
?episode wdt:P361 ?season ;
p:P179 ?episodeSeriesStatement .
?season wdt:P31 wd:Q3464665 ;
p:P179 ?seasonSeriesStatement ;
wdt:P361 ?series .
?seasonSeriesStatement ps:P179 ?series ;
pq:P1545 ?seasonNumber .
?episodeSeriesStatement ps:P179 ?series ;
pq:P1545 ?episodeNumber .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY xsd:integer(?seasonNumber) xsd:integer(?episodeNumber)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?episode"):::projected
v2("?episodeNumber"):::projected
v6("?episodeSeriesStatement")
v5("?season"):::projected
v1("?seasonNumber"):::projected
v7("?seasonSeriesStatement")
v3("?series")
c8(["bd:serviceParam"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c4(["wd:Q3464665"]):::iri
bind0[/"'wd:Q1079'"/]
bind0 --as--o v3
v4 --"p:direct/P361"--> v5
v4 --"p:P179"--> v6
v5 --"p:direct/P31"--> c4
v5 --"p:P179"--> v7
v5 --"p:direct/P361"--> v3
v7 --"p:statement/P179"--> v3
v7 --"p:qualifier/P1545"--> v1
v6 --"p:statement/P179"--> v3
v6 --"p:qualifier/P1545"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end