2

I am now trying to query the aliases of specific person names (which correspond to the article title in Wikipedia) using Wikidata API.

I am using R and there is a WikidataR package for Wikidata query. E.g., the person name "Martin Luther", I use the "find_item" and the returned ID is as follows:

Results:
1    Martin Luther (Q9554) - German monk, priest, and professor of theology, seminal figure in Protestant Reformation 
2    Martin Luther (Q342938) - Wikipedia disambiguation page 
3    Martin Luther (Q62290) - German diplomat 
4    Martin Luther (Q328096) - 1953 film biography 
5    Martin Luther (Q989866) - 1923 silent movie about Martin Luther 
6    Martin Luther (Q13479610) 
7    Martin Luther (Q1904488) - planned 1983 movie 
8    Martin Luther (Q6776037) - artwork by Ernst Friedrich August Rietschel 
9    Martin Luther King, Jr. (Q8027) - American clergyman, activist, and leader in the American Civil Rights Movement 
10   Martin Luther King, Jr. Day (Q751738) - United States holiday 

In the returned result, only 1, 3,9 point to the human beings. And if I use the first ID Q9554 and get_item function, I can get the following output:

Wikidata item Q9554 

Label:       Martin Luther  [150 other languages available]
Aliases:     Martin Luther, Luther, Junker Jörg, 路德马丁,, לוטהער, מארטין, לותר, Лютер Мартин, Martin LUTHER, chevalier Georges, frère Martin, Martin Luder 
Description: German monk, priest, and professor of theology, seminal figure in Protestant Reformation   [15 other languages available]
Claims:      72 
Sitelinks:   189 

So if I want to get the aliases of "Martin Luther", I need the ID of him in Wikidata instead of the direct query. As it is possible to query wikipedia using person name directly, is there any possible way to query wikidata using person name ? If it is not possible, how can I set the condition to query the wikidata API only to return the IDs of persons (such as 1, 3,9 in the example)? Thx.

Termininja
  • 6,620
  • 12
  • 48
  • 49
Frown
  • 259
  • 1
  • 12
  • I have never used WikidataR, but you can do a search over the API and probably also with WikidataR. A name is often ambiguous, so you will often get a list of returns and it is your job to find the correct person in their. - Another solution is to map your data first to Wikidata-IDs and then make the calls using the IDs. Then you don't have to worry about changing search results. – tobias47n9e Nov 17 '15 at 07:09
  • @tobias47n9e Many thx, but is it possible to set the condition that it only returns the person names instead of other types of IDs such as pictures? – Frown Nov 19 '15 at 08:47
  • Can you edit your question with what you have so far and make it more concrete and answerable. – tobias47n9e Nov 22 '15 at 09:33
  • @tobias47n9e Sorry about the ambiguity. Is this updated version more clear? – Frown Nov 22 '15 at 12:42
  • 1
    Is there a function in WikidataR to (1) get the Wikipedia page according to the name (2) then get the connected Wikidata item and (3) get the aliases you are interested in? Pywikibot can do this and it might give you better results for you name list. But multiple people sharing the same name will always be an issue. That is why storing identfiers is so important. – tobias47n9e Nov 22 '15 at 18:26

0 Answers0