query-06b2f931e9838aa09d443ea70b77ee97
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
where
{
{
select ?givenLabel (sum(?malecount) as ?malecount) (sum(?femalecount) as ?femalecount) where
{ {
select ?given (count(?given) as ?malecount) where
{
?item wdt:P735 ?given.
{?given wdt:P31 wd:Q202444 .}
UNION
{?given wdt:P31 wd:Q12308941 .}
?item wdt:P21 wd:Q6581097.
} group by ?given } {
select ?given (count(?given) as ?femalecount) where
{
?item wdt:P735 ?given.
{?given wdt:P31 wd:Q202444.}
UNION
{?given wdt:P31 wd:Q11879590 .}
?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)
} order by desc(?ratio)
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"):::projected
c6(["wd:Q12308941"]):::iri
c9(["wd:Q11879590"]):::iri
c8(["wd:Q6581097"]):::iri
c5(["wd:Q202444"]):::iri
c10(["wd:Q6581072"]):::iri
f0[["?malecount + ?femalecount > '49^^xsd:integer'"]]
f0 --> v7
f0 --> v7
f1[["?givenLabel = 'en'"]]
f1 --> v4
v5 --"wdt:P735"--> v6
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P31"--> c6
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P31"--> c5
end
union0r <== or ==> union0l
end
v5 --"wdt:P21"--> c8
bind3[/"count(?given)"/]
v6 --o bind3
bind3 --as--o v7
v5 --"wdt:P735"--> v6
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P31"--> c9
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P31"--> c5
end
union1r <== or ==> union1l
end
v5 --"wdt:P21"--> c10
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