11

Let's say I have a Wikidata item QID Q19675, and want to get the name of that item in Spanish.

While getting a property like P281 postal code is easy, how to get the name, which for some reason is not a normal property? Preferably via the REST API.

Wikidata item name

11

You probably want this:

https://www.wikidata.org/w/api.php?action=wbgetentities&props=labels&ids=Q19675&languages=es

The API command in English: Get information about some entities (action=wbgetentities), namely the label properties (props=labels) of item Q19675 (ids=Q19675) in Spanish (languages=es).

For more details, have a look at the full documentation of wbgetentities.

  • but cab I use Wikidata Query Service SPARQL for this? – Alexan Oct 24 '16 at 0:44
  • @Alex Yes, but please ask a new question, because this one focuses on the REST API. – Patrick Hoefler Oct 24 '16 at 8:19
7

You can get it also using SPARQL:

SELECT DISTINCT * WHERE {
  wd:Q19675 rdfs:label ?label . 
  FILTER (langMatches( lang(?label), "ES" ) )  
}

See it on Wikidata Query Service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.