query-adc1914a04ee7bbf1dd58903f30e178f
Jura1Popperipopp
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/>
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#>
#defaultView:LineChart
SELECT ?sex (STR(?year) AS ?year_) (COUNT(?sex) AS ?count) ?sexLabel
WHERE
{
{
SELECT DISTINCT ?item ?year
WHERE
{
{
SELECT DISTINCT ?year
WHERE
{
[] wdt:P5176 [] ; wdt:P1181 ?year .
FILTER(?year >= 1900 && ?year <= YEAR(NOW()))
}
} ?item p:P39 ?positionStatement .
?positionStatement ps:P39 wd:Q10655178 .
?positionStatement pq:P580 ?start .
OPTIONAL { ?positionStatement pq:P582 ?end . }
BIND(YEAR(?start) AS ?startYear )
BIND(YEAR(COALESCE(?end, NOW())) AS ?endYear )
FILTER (?startYear <= ?year && ?year <= ?endYear )
}
} ?item wdt:P31 wd:Q5 .
?item wdt:P21 ?sex .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
GROUP BY ?year ?sex ?sexLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?count")
v7("?end")
v8("?endYear")
v4("?item")
v5("?positionStatement")
v8("?sex"):::projected
v6("?start")
v8("?startYear")
v2("?year"):::projected
v9("?year_")
a1((" "))
a2((" "))
c6(["wd:Q10655178"]):::iri
c13(["bd:serviceParam"]):::iri
c10(["wd:Q5"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?startYear <= ?year?year <= ?endYear"]]
f0 --> v8
f0 --> v2
f0 --> v8
f1[["?year >= '1900^^xsd:integer'?year <= year-from-dateTime(NOW())"]]
f1 --> v2
a1 --"p:direct/P5176"--> a2
a1 --"p:direct/P1181"--> v2
v4 --"p:P39"--> v5
v5 --"p:statement/P39"--> c6
v5 --"p:qualifier/P580"--> v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P582".-> v7
end
bind2[/"year-from-dateTime(?start)"/]
v6 --o bind2
bind2 --as--o v8
bind3[/"year-from-dateTime(?endNOW())"/]
v7 --o bind3
bind3 --as--o v8
v4 --"p:direct/P31"--> c10
v4 --"p:direct/P21"--> v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end
bind5[/"str(?year)"/]
v2 --o bind5
bind5 --as--o v9
bind6[/"count(?sex)"/]
v8 --o bind6
bind6 --as--o v10