If you have the item IDs already, the query is relatively simple:

SELECT ?item ?population WHERE {
  VALUES ?item { wd:Q38 wd:Q148 wd:Q884 }
  ?item wdt:P1082 ?population.
}

https://w.wiki/KjA

You can add more values for the ?item (and spread them across several
lines as well), the three above are just an example.

Cheers,
Lucas

On 18.03.20 22:58, Zsolt Ero wrote:
> Hi,
> 
> I'm contributing to develop an open source scraper for COVID-19 data
> and we are looking to download the population data from Wikidata for
> regions around the world.
> 
> First, we'd like to get province / state / county items but later on
> probably much finer granularity. We have Wikidata Q id-s from Natural
> Earth, we just don't know how to get the population data from Wikidata
> without scraping. I've seen that there is either a 71 GB gzip JSON
> archive or the query service on https://query.wikidata.org/.
> 
> What I'm looking for would be very simple, just {"Q1234567":
> population} pairs in a JSON, I guess the query service would be ideal,
> but I have no idea how to use it (even after looking at the tutorial).
> 
> Can you help me write this very simple query?
> 
> Zsolt
> 
> _______________________________________________
> Wikidata mailing list
> Wikidata@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikidata
> 

_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata

Reply via email to