query-ca0dbcb8bec69e2169ff0eaf4f99ec6e

rq turtle/ttl

Percentage women for some literary awardsNote: this query excludes some people who are neither men nor women, that I'm not sure how to query for

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:BarChart
#title:Gender balance (%age women) for literary awards
SELECT  ?award ?awardLabel (ROUND(?women * 1000/(?men + ?women) )/ 10 AS ?percent) WHERE {
{  SELECT (COUNT(?recipient_male) AS ?men) (COUNT(?recipient_female) AS ?women) ?award WHERE {
    ?award wdt:P31 wd:Q378427 .
    { 
      ?recipient_male wdt:P166 ?award .
      ?recipient_male wdt:P21 wd:Q6581097 .
    }
    UNION 
    {
      ?recipient_female wdt:P166 ?award .
      ?recipient_female wdt:P21 wd:Q6581072 .
    }  
  }
  GROUP BY ?award HAVING(?men + ?women > 50)
           }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?percent

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?award"):::projected v7("?men"):::projected v7("?percent") v6("?recipient_female") v5("?recipient_male") v7("?women"):::projected c9(["bd:serviceParam"]):::iri c6(["wd:Q6581097"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q378427"]):::iri c7(["wd:Q6581072"]):::iri f0[["?men + ?women > '50^^xsd:integer'"]] f0 --> v7 f0 --> v7 v4 --"wdt:P31"--> c3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v6 --"wdt:P166"--> v4 v6 --"wdt:P21"--> c7 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v5 --"wdt:P166"--> v4 v5 --"wdt:P21"--> c6 end union0r <== or ==> union0l end bind3[/"count(?recipient_male)"/] v5 --o bind3 bind3 --as--o v7 bind4[/"count(?recipient_female)"/] v6 --o bind4 bind4 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind5[/"numeric-round(?women * '1000^^xsd:integer' / ?men + ?women) / '10^^xsd:integer'"/] v7 --o bind5 v7 --o bind5 bind5 --as--o v7