query-86e53e585d756d941e2d0a429677d29b
12:44, 9 July 2020 (UTC)) talk (Popperipopp
Use at
- https://query.wikidata.org/sparql
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/>
#defaultView:AreaChart
SELECT
(str(?y) as ?year)
# (COUNT(DISTINCT ?f) as ?count_f) (COUNT(DISTINCT ?m) as ?count_m) (COUNT(DISTINCT ?item) as ?count_all)
( ROUND( COUNT(DISTINCT ?f) / COUNT(DISTINCT ?item) * 100) as ?pc_f)
WHERE
{
{
SELECT DISTINCT ?y { [] wdt:P5176 [] ; wdt:P1181 ?y . FILTER(?y > 1970 && ?y < 2021 ) }
}
?pos ps:P39 wd:Q10655178 .
?pos pq:P580 ?start .
OPTIONAL { ?pos pq:P582 ?end }
BIND( COALESCE( YEAR(?end), YEAR(NOW()) ) as ?yend)
FILTER( ?y >= YEAR(?start) && ?y <= ?yend )
?item p:P39 ?pos .
OPTIONAL { ?item wdt:P21 wd:Q6581097 . BIND(?item as ?m) }
OPTIONAL { ?item wdt:P21 wd:Q6581072 . BIND(?item as ?f) }
}
GROUP BY ?y
ORDER BY ?y
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?end")
v8("?f")
v6("?item")
v7("?m")
v10("?pc_f")
v4("?pos")
v2("?start")
v1("?y"):::projected
v9("?year")
v6("?yend")
a1((" "))
a2((" "))
c11(["wd:Q6581097"]):::iri
c6(["wd:Q10655178"]):::iri
c12(["wd:Q6581072"]):::iri
f0[["?y >= year-from-dateTime(?start)?y <= ?yend"]]
f0 --> v1
f0 --> v2
f0 --> v6
f1[["?y > '1970^^xsd:integer'?y < '2021^^xsd:integer'"]]
f1 --> v1
a1 --"p:direct/P5176"--> a2
a1 --"p:direct/P1181"--> v1
v4 --"p:statement/P39"--> c6
v4 --"p:qualifier/P580"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P582".-> v5
end
bind2[/"year-from-dateTime(?end)year-from-dateTime(NOW())"/]
v5 --o bind2
bind2 --as--o v6
v6 --"p:P39"--> v4
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:direct/P21".-> c11
bind3[/"?item"/]
v6 --o bind3
bind3 --as--o v7
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:direct/P21".-> c12
bind4[/"?item"/]
v6 --o bind4
bind4 --as--o v8
end
bind7[/"str(?y)"/]
v1 --o bind7
bind7 --as--o v9
bind8[/"numeric-round( / * '100^^xsd:integer')"/]
null --o bind8
null --o bind8
bind8 --as--o v10