query-72218264eb8b3d123d86d89eaaaabf41
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?countryLabel ?population ((?population * 100 ) / ?suma AS ?percentage) WHERE {
?country wdt:P31 wd:Q6256;
wdt:P37 ?officiallanguage ;
wdt:P1082 ?population.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
{
SELECT DISTINCT (SUM(?population) AS ?suma) WHERE {
?country wdt:P31 wd:Q6256;
wdt:P37 ?officiallanguage ;
wdt:P1082 ?population.
FILTER(?officiallanguage=wd:Q1321) # List only countries with Spanish as official lang
}
}
FILTER(?officiallanguage=wd:Q1321) # List only countries with Spanish as official lang
}
ORDER BY DESC (?percentage)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?country")
v2("?officiallanguage")
v6("?percentage")
v4("?population"):::projected
v5("?suma"):::projected
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q6256"]):::iri
f0[["?officiallanguage = 'wd:Q1321'"]]
f0 --> v2
v3 --"wdt:P31"--> c3
v3 --"wdt:P37"--> v2
v3 --"wdt:P1082"--> v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
f1[["?officiallanguage = 'wd:Q1321'"]]
f1 --> v2
v3 --"wdt:P31"--> c3
v3 --"wdt:P37"--> v2
v3 --"wdt:P1082"--> v4
bind3[/"sum(?population)"/]
v4 --o bind3
bind3 --as--o v5
bind4[/"?population * '100^^xsd:integer' / ?suma"/]
v4 --o bind4
v5 --o bind4
bind4 --as--o v6