query-0e1e16d97dcdb3016d1fd6125610484e
Population of countries sharing a border with Indonesia
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:LineChart
SELECT ?country ?year ?population ?countryLabel WHERE {
  {
    SELECT ?country ?year (AVG(?population) AS ?population) WHERE {
      {
        SELECT ?country (str(YEAR(?date)) AS ?year) ?population WHERE {
          ?country wdt:P47 wd:Q252;   # shares border with Indonesia
                   p:P1082 ?populationStatement.
          ?populationStatement ps:P1082 ?population;
                               pq:P585 ?date.
        }
      }
    }
    GROUP BY ?country ?year
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
- https://www.wikidata.org/wiki/User:Bennylin
- https://www.wikidata.org/wiki/Wikidata:WikiProject_Indonesia/Kueri
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?country"):::projected 
  v4("?date")
  v6("?population"):::projected 
  v2("?populationStatement")
  v5("?year"):::projected 
  c7(["bd:serviceParam"]):::iri 
  c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal 
  c2(["wd:Q252"]):::iri 
  v1 --"p:direct/P47"-->  c2
  v1 --"p:P1082"-->  v2
  v2 --"p:statement/P1082"-->  v6
  v2 --"p:qualifier/P585"-->  v4
  bind0[/"str(year-from-dateTime(?date))"/]
  v4 --o bind0
  bind0 --as--o v5
  bind2[/"average(?population)"/]
  v6 --o bind2
  bind2 --as--o v6
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c7 --"wikibase:language"-->  c9
  end