query-79922631bb3b11010850d282abc02837

rq turtle/ttl

Tagishsimon

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?oc ?ocLabel  (count(?item) as ?number_of_women) where {

  #############################################################
  # select (an approximation of) the top level occupation classes

  #select occupations (instance of occupation) which have no occupation as a direct superclass
  ?oc wdt:P31 wd:Q28640 
    filter not exists { 
      ?superocc wdt:P31 wd:Q28640 . 
      ?oc wdt:P279 ?superocc .
    }

  # find all of their (non direct) specialisation
  ?suboc wdt:P31 wd:Q28640 .
  ?suboc wdt:P279+ ?oc .
  #############################################################

  # dealing with the "woman" part

  # ?item is a woman, which has any of the specialization of the occupation ?oc  
  ?item wdt:P106 ?suboc.


  {
    # subquery to select only the woman with no article on enwiki - made to be able to limit the size of the sample to avoid timout
    select ?item where {
      ?item wdt:P21 wd:Q6581072 .
      ?item wdt:P31 wd:Q5 
            filter not exists {
              ?article schema:about ?item .
              ?article schema:inLanguage "en" .
            }
    } limit 10000 # change the limit to change the size of the woman sample
  }

  #############################################################

  SERVICE wikibase:label {
   bd:serviceParam wikibase:language "en" .
  }

} group by ?oc ?ocLabel order by desc(?number_of_subclass)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?article") v5("?item"):::projected v1("?number_of_subclass") v7("?number_of_women") v3("?oc"):::projected v4("?suboc") v2("?superocc") c2(["wd:Q28640"]):::iri c7(["en"]):::literal c9(["wd:Q6581072"]):::iri c12(["bd:serviceParam"]):::iri c10(["wd:Q5"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P31"--> e0c2 e0v2 --"wdt:P279"--> e0v1 e0v2("?oc"):::projected e0v1("?superocc"):::projected e0c2(["wd:Q28640"]):::iri end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> c2 f0 --> v3 f0 --> c3 v2 --"wdt:P31"--> c2 v3 --"wdt:P279"--> v2 v3 --"wdt:P31"--> c2 v4 --"wdt:P31"--> c2 v4 --"wdt:P279"--> v3 v5 --"wdt:P106"--> v4 f1[["not "]] subgraph f1e1["Exists Clause"] e1v1 --"schema:about"--> e1v2 e1v1 --"schema:inLanguage"--> e1c3 e1v1("?article"):::projected e1v2("?item"):::projected e1c3(["en"]):::literal end f1--EXISTS--> f1e1 f1 --> v6 f1 --> c5 f1 --> v5 f1 --> c6 f1 --> c7 v6 --"schema:about"--> v5 v6 --"schema:inLanguage"--> c7 v5 --"wdt:P21"--> c9 v5 --"wdt:P31"--> c10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c7 end bind3[/"count(?item)"/] v5 --o bind3 bind3 --as--o v7