query-b416831bd7a658297123b1efa83c971e

rq turtle/ttl

Kvindeforhold på den danske Wikipedia per dekade

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
#defaultView:LineChart
SELECT
  (STR(?year_) AS ?year) 
  (COALESCE(SAMPLE(?number_of_females), 0)
   / (COALESCE(SAMPLE(?number_of_females), 0)
      + SAMPLE(?number_of_males)) AS ?female_ratio)
WHERE {
  { 
    SELECT
      ?year_
      (COUNT(?person) AS ?number_of_females)
    WHERE {
       {
  SELECT
    (MIN(?years) AS ?year_)
    ?person
  WHERE {
    ?person wdt:P31 wd:Q5 .
    ?person wdt:P21 ?gender .
    ?article schema:about ?person .
    ?article schema:isPartOf <https://da.wikipedia.org/> .
    ?person wdt:P569 ?datetime . 
    FILTER (?datetime >= "1850-01-01T00:00:00Z"^^xsd:dateTime)    
    BIND(CONCAT(SUBSTR(STR(YEAR(?datetime)), 1, 3), "0-9") AS ?years)
  }
  GROUP BY ?person
}      ?person wdt:P21 wd:Q6581072 .
    }
    GROUP BY ?year_
  }
  UNION
  {
    SELECT
      ?year_
      (COUNT(?person) AS ?number_of_males)
    WHERE {
       {
  SELECT
    (MIN(?years) AS ?year_)
    ?person
  WHERE {
    ?person wdt:P31 wd:Q5 .
    ?person wdt:P21 ?gender .
    ?article schema:about ?person .
    ?article schema:isPartOf <https://da.wikipedia.org/> .
    ?person wdt:P569 ?datetime . 
    FILTER (?datetime >= "1850-01-01T00:00:00Z"^^xsd:dateTime)    
    BIND(CONCAT(SUBSTR(STR(YEAR(?datetime)), 1, 3), "0-9") AS ?years)
  }
  GROUP BY ?person
}      ?person wdt:P21 wd:Q6581097
    }
    GROUP BY ?year_
  }  
}
GROUP BY ?year_
ORDER BY DESC(?year)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?article") v2("?datetime") v10("?female_ratio") v4("?gender") v8("?number_of_females") v9("?number_of_males") v3("?person") v10("?year") v9("?year_"):::projected v9("?years") c3(["wd:Q5"]):::iri c10(["wd:Q6581097"]):::iri c9(["wd:Q6581072"]):::iri c7([https://da.wikipedia.org/]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["?datetime >= '1850-01-01T00:00:00Z^^xsd:dateTime'"]] f0 --> v2 v3 --"wdt:P31"--> c3 v3 --"wdt:P21"--> v4 v5 --"schema:about"--> v3 v5 --"schema:isPartOf"--> c7 v3 --"wdt:P569"--> v2 bind1[/"concat(substring(str(year-from-dateTime(?datetime)),'1^^xsd:integer','3^^xsd:integer'),'0-9')"/] v2 --o bind1 bind1 --as--o v9 bind3[/"min(?years)"/] v9 --o bind3 bind3 --as--o v9 v3 --"wdt:P21"--> c10 bind5[/"count(?person)"/] v3 --o bind5 bind5 --as--o v9 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f6[["?datetime >= '1850-01-01T00:00:00Z^^xsd:dateTime'"]] f6 --> v2 v3 --"wdt:P31"--> c3 v3 --"wdt:P21"--> v4 v5 --"schema:about"--> v3 v5 --"schema:isPartOf"--> c7 v3 --"wdt:P569"--> v2 bind7[/"concat(substring(str(year-from-dateTime(?datetime)),'1^^xsd:integer','3^^xsd:integer'),'0-9')"/] v2 --o bind7 bind7 --as--o v9 bind9[/"min(?years)"/] v9 --o bind9 bind9 --as--o v9 v3 --"wdt:P21"--> c9 bind11[/"count(?person)"/] v3 --o bind11 bind11 --as--o v8 end union0r <== or ==> union0l end bind15[/"str(?year_)"/] v9 --o bind15 bind15 --as--o v10 bind16[/"'0^^xsd:integer' / '0^^xsd:integer' + "/] null --o bind16 null --o bind16 null --o bind16 bind16 --as--o v10