query-ee2d366e948f03b7895684a82bbd8c3e

rq turtle/ttl

The output of "The Simpsons series episodes list by season" example is incorrectThe current query seems not working showing 0 results. The proper and easier way to fix it is this:

Use at

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 pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?show ?showLabel ?seasonNumber ?episode ?episodeLabel
WHERE {
  BIND(wd:Q886 as ?show) .
  ?season wdt:P361 ?show;
          wdt:P527 ?episode;
          p:P179 [pq:P1545 ?seasonNumber] .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} 
ORDER BY xsd:integer(?seasonNumber)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?episode"):::projected v3("?season") v1("?seasonNumber"):::projected v2("?show"):::projected a1((" ")) c6(["bd:serviceParam"]):::iri c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/"'wd:Q886'"/] bind0 --as--o v2 v3 --"p:direct/P361"--> v2 v3 --"p:direct/P527"--> v4 a1 --"p:qualifier/P1545"--> v1 v3 --"p:P179"--> a1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end