query-8a0e0d5a967a04af440d82847c872f50
. }}GenderPercent{{Yet another solution : generates the query through the newly created template {{GenderPercent|query= # architects on Wikidata ?item wdt:P31 wd:Q5 . ?item wdt:P106 wd:Q42973 . }} will for example give
Use at
- https://query.wikidata.org/sparql
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 {
# architects on Wikidata
?item wdt:P31 wd:Q5 .
?item wdt:P106 wd:Q42973 .
?item wdt:P21 ?item_gender filter (!isBlank(?item_gender)) .
} group by ?item_gender
}
{
select (count(?item) as ?countitemt) where {
# architects on Wikidata
?item wdt:P31 wd:Q5 .
?item wdt:P106 wd:Q42973 .
}
}
}
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:Q42973"]):::iri
f0[["not isBlank(?item_gender)"]]
f0 --> v1
v2 --"wdt:P31"--> c2
v2 --"wdt:P106"--> c4
v2 --"wdt:P21"--> v1
bind2[/"count(?item)"/]
v2 --o bind2
bind2 --as--o v3
v2 --"wdt:P31"--> c2
v2 --"wdt:P106"--> 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