13

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

Nicolas Raoul
  • 8,426
  • 5
  • 28
  • 61
  • @Nicolas_Raoul, getting a property like P281 postal code is easy? But how? I tried to use SPARQL: http://opendata.stackexchange.com/questions/10334/get-items-properties-know-qid but maybe you know better way. – Alexan Dec 29 '16 at 21:02
  • 1
    I already asked http://opendata.stackexchange.com/questions/10334/get-items-properties-know-qid – Alexan Jan 01 '17 at 17:15

2 Answers2

14

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.

Patrick Hoefler
  • 5,790
  • 4
  • 31
  • 47
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.

Alexan
  • 442
  • 4
  • 13