query-a5321848fec0ba9e409246a361d65280
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 ?countryLabel ?population  ((?population * 100 ) / ?suma AS ?percentage) WHERE
{
  ?country wdt:P297 ?cc ; # ISO Code
           wdt:P37 wd:Q1321 . # Spanish as official lang
  ?country wdt:P1082 ?population
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es,en". }
  {
    SELECT (SUM(?population) AS ?suma) WHERE
    {
      ?country wdt:P297 ?cc ; # ISO Code
               wdt:P37 wd:Q1321 . # Spanish as official lang
      ?country wdt:P1082 ?population
    }
  }
}
ORDER BY DESC(?percentage)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?cc")
  v2("?country")
  v6("?percentage")
  v4("?population"):::projected 
  v5("?suma"):::projected 
  c6(["bd:serviceParam"]):::iri 
  c3(["wd:Q1321"]):::iri 
  c8(["#91;AUTO_LANGUAGE#93;,es,en"]):::literal 
  v2 --"wdt:P297"-->  v3
  v2 --"wdt:P37"-->  c3
  v2 --"wdt:P1082"-->  v4
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c6 --"wikibase:language"-->  c8
  end
  v2 --"wdt:P297"-->  v3
  v2 --"wdt:P37"-->  c3
  v2 --"wdt:P1082"-->  v4
  bind1[/"sum(?population)"/]
  v4 --o bind1
  bind1 --as--o v5
  bind2[/"?population * '100^^xsd:integer' / ?suma"/]
  v4 --o bind2
  v5 --o bind2
  bind2 --as--o v6