query-33f19958914965d82c8c082b1d7c77d2

rq turtle/ttl

{{sparql|query={{GenderPercent|query=?item wdt:P31 wd:Q5 . ?item wdt:P27 wd:Q142 . # french people }}

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
select (?countitemg/?countitemt*100 as ?item_percent) ?item_gender {
  { 
    select (count(?item) as ?countitemg ) ?item_gender where { 
       ?item wdt:P31 wd:Q5 . ?item wdt:P27 wd:Q142 . # french people
       ?item wdt:P21 ?item_gender filter (!isBlank(?item_gender)) .
    } group by ?item_gender
  } 
  {
    select (count(?item) as ?countitemt) where {      
       ?item wdt:P31 wd:Q5 . ?item wdt:P27 wd:Q142 . # french people
    }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?countitemg"):::projected v4("?countitemt"):::projected v2("?item") v1("?item_gender"):::projected v5("?item_percent") c2(["wd:Q5"]):::iri c4(["wd:Q142"]):::iri f0[["not isBlank(?item_gender)"]] f0 --> v1 v2 --"wdt:P31"--> c2 v2 --"wdt:P27"--> c4 v2 --"wdt:P21"--> v1 bind2[/"count(?item)"/] v2 --o bind2 bind2 --as--o v3 v2 --"wdt:P31"--> c2 v2 --"wdt:P27"--> c4 bind4[/"count(?item)"/] v2 --o bind4 bind4 --as--o v4 bind5[/"?countitemg / ?countitemt * '100^^xsd:integer'"/] v3 --o bind5 v4 --o bind5 bind5 --as--o v5