query-5f0e674533210b908c50deeb5eb3ff40
TODO
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/>
SELECT ?label (count(?film) AS ?count)
WHERE {
[] wdt:P31/wdt:P279* wd:Q24716199; wikibase:directClaim ?p .
?film wdt:P31/wdt:P279* wd:Q11424; ?p [ wdt:P2899 ?age ] .
BIND(IF( 0 <= ?age && ?age < 3, "00-02",
IF( 3 <= ?age && ?age < 6, "03-05",
IF( 6 <= ?age && ?age < 9, "06-08",
IF( 9 <= ?age && ?age < 12, "09-11",
IF( 12 <= ?age && ?age < 15, "12-14",
IF( 15 <= ?age && ?age < 18, "15-17",
IF( 18 <= ?age, "18+", "" ) ) ) ) ) ) )
AS ?label)
} GROUP BY ?label ORDER BY ASC(?label)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?age")
v5("?count")
v3("?film"):::projected
v5("?label"):::projected
v2("?p")
a1((" "))
a2((" "))
a3((" "))
a4((" "))
c3(["wd:Q24716199"]):::iri
c5(["wd:Q11424"]):::iri
a1 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c3
a1 --"wikibase:directClaim"--> v2
v3 --"wdt:P31"--> a3
a3 --"wdt:P279"--> c5
a4 --"wdt:P2899"--> v4
v3 -->v2--> a4
bind0[/"if('0^^xsd:integer' <= ?age?age < '3^^xsd:integer','00-02',if('3^^xsd:integer' <= ?age?age < '6^^xsd:integer','03-05',if('6^^xsd:integer' <= ?age?age < '9^^xsd:integer','06-08',if('9^^xsd:integer' <= ?age?age < '12^^xsd:integer','09-11',if('12^^xsd:integer' <= ?age?age < '15^^xsd:integer','12-14',if('15^^xsd:integer' <= ?age?age < '18^^xsd:integer','15-17',if('18^^xsd:integer' <= ?age,'18+','')))))))"/]
v4 --o bind0
bind0 --as--o v5
bind2[/"count(?film)"/]
v3 --o bind2
bind2 --as--o v5