query-c80640ca4c7082e280e2c0d4ed7a23d6

rq turtle/ttl

.on Mastodon and on TwitterOriginally posted

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?language ?languageLabel ?statusLabel ?lexemes WHERE {
   {
  SELECT ?language ?status (COUNT(?lexeme) AS ?lexemes) WHERE {
    VALUES ?status {
      wd:Q20672087 # 2 vulnerable
      wd:Q20672088 # 3 definitely endangered
      wd:Q20672089 # 4 severely endangered
      wd:Q20672090 # 5 critically endangered
      wd:Q20672091 # 6 extinct
    }
    ?language wdt:P1999 ?status.
    OPTIONAL { ?lexeme dct:language ?language. }
  }
  GROUP BY ?language ?status
}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?lexemes) DESC(?statusLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?language"):::projected v5("?lexeme") v6("?lexemes"):::projected v3("?status") v2("?statusLabel"):::projected c4(["bd:serviceParam"]):::iri c6(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?status/] bind0-->v3 bind00(["wd:Q20672087"]) bind00 --> bind0 bind01(["wd:Q20672088"]) bind01 --> bind0 bind02(["wd:Q20672089"]) bind02 --> bind0 bind03(["wd:Q20672090"]) bind03 --> bind0 bind04(["wd:Q20672091"]) bind04 --> bind0 v4 --"wdt:P1999"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."dct:language".-> v4 end bind2[/"count(?lexeme)"/] v5 --o bind2 bind2 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 end