query-8f6969f8ff4d486fc6d32100e429f149

rq turtle/ttl

Language Wikipedia's serving African countries, by language SELECT ?item ?itemLabel ?language ?languageLabel (group_concat(distinct ?countryLabel;separator="; ") as ?countries) WHERE { ?item wdt:P31 wd:Q10876391. # it's a language wikipedia ?item wdt:P407 ?language . # in this language ?language wdt:P17 ?country . # language is associated with country ?country wdt:P30 wd:Q15 . # country is in the continent of Africa SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?item rdfs:label ?itemLabel . ?country rdfs:label ?countryLabel . ?language rdfs:label ?languageLabel .} # get labels for values } group by ?item ?itemLabel ?language ?languageLabel # show only one row per language wikipedia / language order by ?itemLabel # sort the results

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Language Wikipedia's serving African countries, by language
SELECT ?item ?itemLabel ?language ?languageLabel (group_concat(distinct ?countryLabel;separator="; ") as ?countries)
WHERE 
{
  ?item wdt:P31 wd:Q10876391.     # it's a language wikipedia 
  ?item wdt:P407 ?language .      # in this language
  ?language wdt:P17 ?country .    # language is associated with country
  ?country wdt:P30 wd:Q15 .       # country is in the continent of Africa
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
                         ?item rdfs:label ?itemLabel .
                         ?country rdfs:label ?countryLabel .
                         ?language rdfs:label ?languageLabel .}
                                   # get labels for values
} group by ?item ?itemLabel ?language ?languageLabel
                                  # show only one row per language wikipedia / language
order by ?itemLabel               # sort the results

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?countries") v4("?country") v5("?countryLabel"):::projected v2("?item"):::projected v1("?itemLabel"):::projected v3("?language"):::projected v6("?languageLabel"):::projected c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2(["wd:Q10876391"]):::iri c6(["wd:Q15"]):::iri v2 --"wdt:P31"--> c2 v2 --"wdt:P407"--> v3 v3 --"wdt:P17"--> v4 v4 --"wdt:P30"--> c6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 v2 --"rdfs:label"--> v1 v4 --"rdfs:label"--> v5 v3 --"rdfs:label"--> v6 end bind1[/"?countryLabel"/] v5 --o bind1 bind1 --as--o v7