query-fb41983bd7a5ab3c87e23a5282b794cd

rq turtle/ttl

number of depicted subjects by gender

uncomment the last part of line 7 to limit the query to human subjects,

and change ?depicted to DISTINCT ?depicted in line 5 to only count each subject once regardless of how many works depict them

SELECT ?gender ?genderLabel ?count WITH { SELECT ?gender (COUNT(?depicted) AS ?count) WHERE { ?work wdt:P180 ?depicted. ?depicted # wdt:P31 wd:Q5; wdt:P21 ?gender. } GROUP BY ?gender } AS %results WHERE { INCLUDE %results. FILTER(!wikibase:isSomeValue(?gender)) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?count)

(note that this query doesn’t group any genders together automatically, but when using this data,

you should probably do so manually – e. g. include transgender in the numbers for , in accordance with their “subclass of” statements)

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#>
# number of depicted subjects by gender
# uncomment the last part of line 7 to limit the query to human subjects,
# and change ?depicted to DISTINCT ?depicted in line 5 to only count each subject once regardless of how many works depict them
SELECT ?gender ?genderLabel ?count WHERE {
   {
  SELECT ?gender (COUNT(?depicted) AS ?count) WHERE {
    ?work wdt:P180 ?depicted.
    ?depicted # wdt:P31 wd:Q5;
              wdt:P21 ?gender.
  }
  GROUP BY ?gender
}
  FILTER(!wikibase:isSomeValue(?gender))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?count)
# (note that this query doesn’t group any genders together automatically, but when using this data,
# you should probably do so manually – e. g. include transgender <gender> in the numbers for <gender>, in accordance with their “subclass of” statements)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?count"):::projected v4("?depicted") v2("?gender"):::projected v3("?work") c4(["bd:serviceParam"]):::iri c6(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not http://wikiba.se/ontology#isSomeValue(?gender)"]] f0 --> v2 v3 --"wdt:P180"--> v4 v4 --"wdt:P21"--> v2 bind2[/"count(?depicted)"/] v4 --o bind2 bind2 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 end