query-012278de17927fc7f4ef17ab3d42a8a2

rq turtle/ttl

Languages

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX target: <http://www.wikidata.org/entity/Q2005>

SELECT DISTINCT
  ?works
  (CONCAT("#topic/", SUBSTR(STR(target:), 32), "/language/", SUBSTR(STR(?language), 32)) AS ?worksUrl)

  ?language ?languageLabel 
  (CONCAT("#language/", SUBSTR(STR(?language), 32)) AS ?languageUrl)
  ?languageDescription

  ?example_work ?example_workLabel 
  (CONCAT("#work/", SUBSTR(STR(?example_work), 32)) AS ?example_workUrl)
WHERE {
   {
  SELECT 
    (COUNT(?work) AS ?works)
    ?language 
    (SAMPLE(?work) AS ?example_work)
  WHERE {
    ?work wdt:P921 / (wdt:P31| wdt:P279 | wdt:P361 | wdt:P1269)? # Expensive: *
              target: ;
          wdt:P407 ?language .
  }
  GROUP BY ?language
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?works)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?example_work"):::projected v7("?example_workUrl") v3("?language"):::projected v6("?languageUrl") v2("?work") v4("?works"):::projected v5("?worksUrl") a1((" ")) c9(["bd:serviceParam"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2([http://www.wikidata.org/entity/Q2005]):::iri v2 --"wdt:P921"--> a1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; a1 --"wdt:P1269"--> c2 end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; a1 --"wdt:P361"--> c2 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; a1 --"wdt:P279"--> c2 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; a1 --"wdt:P31"--> c2 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end v2 --"wdt:P407"--> v3 bind2[/"count(?work)"/] v2 --o bind2 bind2 --as--o v4 bind3[/"sample(?work)"/] v2 --o bind3 bind3 --as--o v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind4[/"concat('#topic/',substring(str(http://www.wikidata.org/entity/Q2005),'32^^xsd:integer'),'/language/',substring(str(?language),'32^^xsd:integer'))"/] v3 --o bind4 bind4 --as--o v5 bind5[/"concat('#language/',substring(str(?language),'32^^xsd:integer'))"/] v3 --o bind5 bind5 --as--o v6 bind6[/"concat('#work/',substring(str(?example_work),'32^^xsd:integer'))"/] v4 --o bind6 bind6 --as--o v7