query-51b5e2ddd5e1e5fb52eb1bbfd0828764

rq turtle/ttl

But since Listeria can only handle Q-items, I have been trying to get a Q-item in there, by 'joining' with the lang<>Q-item of the Wikipedia. I got as far as something like the following but it does not work as expected:

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
SELECT ?item ?count
WHERE {
   {
  SELECT ?lang (COUNT(DISTINCT ?article) AS ?count) WHERE {
    ?article schema:about/wdt:P31 wd:Q7889 .
    FILTER (SUBSTR(str(?article), 11, 15) = ".wikipedia.org/") .
    ?article schema:inLanguage ?lang .
  } 
  GROUP BY ?lang
}
   {
  SELECT ?item WHERE {
     {
  SELECT ?lang (COUNT(DISTINCT ?article) AS ?count) WHERE {
    ?article schema:about/wdt:P31 wd:Q7889 .
    FILTER (SUBSTR(str(?article), 11, 15) = ".wikipedia.org/") .
    ?article schema:inLanguage ?lang .
  } 
  GROUP BY ?lang
}
    ?item wdt:P31 wd:Q10876391.
    ?item wdt:P424 ?lang.
  }
}
} ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?article") v4("?count"):::projected v4("?item"):::projected v3("?lang") a1((" ")) a2((" ")) c6(["wd:Q7889"]):::iri c8(["wd:Q10876391"]):::iri f0[["substring(str(?article),'11^^xsd:integer','15^^xsd:integer') = '.wikipedia.org/'"]] f0 --> v2 v2 --"schema:about"--> a1 a1 --"wdt:P31"--> c6 v2 --"schema:inLanguage"--> v3 bind2[/"count(?article)"/] v2 --o bind2 bind2 --as--o v4 f3[["substring(str(?article),'11^^xsd:integer','15^^xsd:integer') = '.wikipedia.org/'"]] f3 --> v2 v2 --"schema:about"--> a2 a2 --"wdt:P31"--> c6 v2 --"schema:inLanguage"--> v3 bind5[/"count(?article)"/] v2 --o bind5 bind5 --as--o v4 v4 --"wdt:P31"--> c8 v4 --"wdt:P424"--> v3