S
S
sashapakistan2019-05-08 11:20:08
API
sashapakistan, 2019-05-08 11:20:08

How to get the code from Wikipedia by the name of the county or city?

There is an example of a request to get the population for Vietnam in json format:

https://query.wikidata.org/sparql?format=json&query=SELECT ?country ?countryLabel ?population WHERE {
      ?country wdt:P31 wd:Q6256.
      ?country wdt:P17 wd:Q881.
      ?country wdt:P1082 ?population.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

I can't figure out what these codes are like wdt and wd b where to get them.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2019-05-09
@sashapakistan

Cool topic)
Query language basics say that values ​​after the wd: prefix correspond to wikipedia objects (here is your "country" entity ), and values ​​after the wtd: prefix correspond to a property (something like "relation type": "is an object of a class" )
The list of properties of
the List of entities cannot exist (this is the table of contents of the entire wikidata), but an internal search returns the necessary identifiers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question