query-d8fa5400dc05d5231834a9762681ff12
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?given ?givenLabel ?malecount ?femalecount ?ratio_absolute ?ratio_normalised
where
{
{
select ?givenLabel (sum(?malecount) as ?malecount) (sum(?femalecount) as ?femalecount) where
{ {
select ?given (count(?given) as ?malecount) where
{
?item wdt:P735 ?given.
?item wdt:P27 wd:Q30.
?item wdt:P21 wd:Q6581097.
} group by ?given } {
select ?given (count(?given) as ?femalecount) where
{
?item wdt:P735 ?given.
?item wdt:P27 wd:Q30.
?item wdt:P21 wd:Q6581072.
} group by ?given }
?given rdfs:label ?givenLabel . filter(lang(?givenLabel)="en")
} group by ?givenLabel having(?malecount+?femalecount>49)} bind(?femalecount*100/?malecount as ?ratio_absolute)
bind(?femalecount*485/?malecount as ?ratio_normalised)
} order by desc(?ratio_absolute)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?femalecount"):::projected
v6("?given"):::projected
v4("?givenLabel"):::projected
v5("?item")
v7("?malecount"):::projected
v7("?ratio_absolute"):::projected
v7("?ratio_normalised"):::projected
c7(["wd:Q6581097"]):::iri
c5(["wd:Q30"]):::iri
c8(["wd:Q6581072"]):::iri
f0[["?malecount + ?femalecount > '49^^xsd:integer'"]]
f0 --> v7
f0 --> v7
f1[["?givenLabel = 'en'"]]
f1 --> v4
v5 --"wdt:P735"--> v6
v5 --"wdt:P27"--> c5
v5 --"wdt:P21"--> c7
bind3[/"count(?given)"/]
v6 --o bind3
bind3 --as--o v7
v5 --"wdt:P735"--> v6
v5 --"wdt:P27"--> c5
v5 --"wdt:P21"--> c8
bind5[/"count(?given)"/]
v6 --o bind5
bind5 --as--o v7
v6 --"rdfs:label"--> v4
bind8[/"sum(?malecount)"/]
v7 --o bind8
bind8 --as--o v7
bind9[/"sum(?femalecount)"/]
v7 --o bind9
bind9 --as--o v7
bind10[/"?femalecount * '100^^xsd:integer' / ?malecount"/]
v7 --o bind10
v7 --o bind10
bind10 --as--o v7
bind11[/"?femalecount * '485^^xsd:integer' / ?malecount"/]
v7 --o bind11
v7 --o bind11
bind11 --as--o v7