Malline:Esimerkkikaaviot/Population of London example
Description muokkaa
Population graph of selected Wikidata item. Graph is simplified version of mw:Template:Graph:Population history
Graph template muokkaa
{{Esimerkkikaaviot/Population of London example/graph}}
Query muokkaa
SELECT ?item ?year (MAX(?population) as ?population) WHERE {
# set the item here - e.g. city, country
BIND(wd:Q84 as ?item)
?item p:P1082 ?popstatement .
?popstatement ps:P1082 ?population .
OPTIONAL {
?popstatement pq:P585 ?date .
BIND(year(?date) as ?year)
}
} GROUP BY ?year ?item ORDER BY ASC(?year)