query-7ded1abc3fe705962298715e3ce26b85
title:Byzantinists by citizenship and gender SELECT ?nLabel (COUNT(?male_) AS ?male) (COUNT(?female_) AS ?female) (COUNT(?other_) AS ?other) WHERE { ?item wdt:P106 wd:Q26132815 ; wdt:P27 ?n ; wdt:P21 ?g . bind (coalesce(IF(?g = wd:Q6581097, 1, 1/0)) as ?male_) bind (coalesce(IF(?g = wd:Q6581072, 1, 1/0)) as ?female_) bind (coalesce(IF(?g not in (wd:Q6581097, wd:Q6581072), 1, 1/0)) as ?other_) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". } } GROUP BY ?nLabel ORDER BY ?nLabel
Use at
- https://query.wikidata.org/sparql
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#>
#title:Byzantinists by citizenship and gender
SELECT ?nLabel (COUNT(?male_) AS ?male) (COUNT(?female_) AS ?female) (COUNT(?other_) AS ?other)
WHERE {
?item wdt:P106 wd:Q26132815 ; wdt:P27 ?n ; wdt:P21 ?g .
bind (coalesce(IF(?g = wd:Q6581097, 1, 1/0)) as ?male_)
bind (coalesce(IF(?g = wd:Q6581072, 1, 1/0)) as ?female_)
bind (coalesce(IF(?g not in (wd:Q6581097, wd:Q6581072), 1, 1/0)) as ?other_)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
GROUP BY ?nLabel
ORDER BY ?nLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?female")
v6("?female_"):::projected
v4("?g")
v2("?item")
v8("?male")
v5("?male_"):::projected
v3("?n")
v1("?nLabel"):::projected
v10("?other")
v7("?other_"):::projected
c6(["bd:serviceParam"]):::iri
c8(["#91;AUTO_LANGUAGE#93;"]):::literal
c2(["wd:Q26132815"]):::iri
v2 --"wdt:P106"--> c2
v2 --"wdt:P27"--> v3
v2 --"wdt:P21"--> v4
bind0[/"if(?g = 'wd:Q6581097','1^^xsd:integer','1^^xsd:integer' / '0^^xsd:integer')"/]
v4 --o bind0
bind0 --as--o v5
bind1[/"if(?g = 'wd:Q6581072','1^^xsd:integer','1^^xsd:integer' / '0^^xsd:integer')"/]
v4 --o bind1
bind1 --as--o v6
bind2[/"if(?g != 'wd:Q6581097'?g != 'wd:Q6581072','1^^xsd:integer','1^^xsd:integer' / '0^^xsd:integer')"/]
v4 --o bind2
bind2 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end
bind6[/"count(?male_)"/]
v5 --o bind6
bind6 --as--o v8
bind7[/"count(?female_)"/]
v6 --o bind7
bind7 --as--o v9
bind8[/"count(?other_)"/]
v7 --o bind8
bind8 --as--o v10