query-3ca0ebf32c51a5c86d9f06612d138847

rq turtle/ttl

Academic fields sorted by the count of LGBT+ researchers publishing on the topic

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT 
?topic
?topicLabel
(group_concat(if(bound(?personName), ?personName, ?personEnglishLabel); separator=", ") as ?authors)
(COUNT(?topic) AS ?count) 
WHERE {
  {
    ?person wdt:P91 ?orientation . 
    FILTER (?orientation != wd:Q1035954 )
  } UNION {
    ?person wdt:P21 ?gender .
    VALUES ?gender { wd:Q1097630 wd:Q303479 wd:Q189125 wd:Q1052281 wd:Q2449503 wd:Q48270 wd:Q1399232 wd:Q3277905 wd:Q746411 wd:Q350374 wd:Q660882 }
  }
  ?work wdt:P50 ?person ; wdt:P921 ?topic .
  OPTIONAL {
    ?person wdt:P1559 ?personName
  }
  OPTIONAL {
    ?person rdfs:label ?personEnglishLabel
    FILTER (lang(?personEnglishLabel) = "en")
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
GROUP BY ?topic ?topicLabel
ORDER BY DESC(?count)
LIMIT 1000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?authors") v10("?count") v6("?gender") v3("?orientation") v4("?person") v2("?personEnglishLabel"):::projected v8("?personName"):::projected v7("?topic"):::projected v6("?work") c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P21"--> v6 bind0[/VALUES ?gender/] bind0-->v6 bind00(["wd:Q1097630"]) bind00 --> bind0 bind01(["wd:Q303479"]) bind01 --> bind0 bind02(["wd:Q189125"]) bind02 --> bind0 bind03(["wd:Q1052281"]) bind03 --> bind0 bind04(["wd:Q2449503"]) bind04 --> bind0 bind05(["wd:Q48270"]) bind05 --> bind0 bind06(["wd:Q1399232"]) bind06 --> bind0 bind07(["wd:Q3277905"]) bind07 --> bind0 bind08(["wd:Q746411"]) bind08 --> bind0 bind09(["wd:Q350374"]) bind09 --> bind0 bind010(["wd:Q660882"]) bind010 --> bind0 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f1[["?orientation != 'wd:Q1035954'"]] f1 --> v3 v4 --"wdt:P91"--> v3 end union0r <== or ==> union0l end v6 --"wdt:P50"--> v4 v6 --"wdt:P921"--> v7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P1559".-> v8 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."rdfs:label".-> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind4[/"if(bound(?personName),?personName,?personEnglishLabel)"/] v8 --o bind4 v2 --o bind4 bind4 --as--o v9 bind5[/"count(?topic)"/] v7 --o bind5 bind5 --as--o v10