1

I have a problem with the Wikidata API which I cant figure out. I'm searching if a Wikipedia article exists for a given landmark.

For example the temple "Tiger's Nest" in Bhutan.

The temple's name on Wikipedia is "Paro Taktsang", but if you search with the searchbox at the upper right corner on Wikipedia homepage for "Tiger's nest", it will find the page of "Paro Taktsang". Like it should.

But my bot uses Wikidata to search for pages of landmarks. When my bot searches for the name Wikipedia uses ("Paro Taktsang") it will find the data I need:

Click here for result of this url:

http://www.wikidata.org/w/api.php?
action=wbgetentities
&sites=enwiki
&titles=Paro Taktsang
&languages=en
&format=xml

But, when I search for "Tiger's Nest" it doesn't find anything. How can I search Wikidata like Wikipedia's search function. So "Tiger's Nest" will redirect me to "Paro Taktsang"?

Termininja
  • 6,620
  • 12
  • 48
  • 49
NLAnaconda
  • 1,534
  • 3
  • 14
  • 38

2 Answers2

2

What about this :

https://www.wikidata.org/w/index.php?title=Special%3ASearch&profile=default&search=Sharm+el+Sheikh&fulltext=Search

Wikidata portal actually provides a full text search interface, do you know which is the underline WEB API ?

Cheers

1

Wikipedia has an inherent redirect mechanism governed by the redirects database that maps the redirects from pageids to the new pagename. In the example you mentioned, Tiger's nest redirects to Paro Taktsang as there will be a mapping from Tiger's Nest's pageid to the page Paro Taktsang. This redirects table can be found in Wikipedia dumps.

The same however cannot be said for wikidata. Wikidata dumps seem to be available only as a json of the articles here http://dumps.wikimedia.org/other/wikidata/ and no redirects mapping can be found

However in some cases of aliases of places the autosuggest/autocorrect in Wikidata translates the alias into proper name.If you type "The Big Apple" in the search box, it will suggest you New York City but it wont redirect to New York city if you hit return. It will instead show it to you as a "did you mean?"

A possible solution for you might be getting the proper name of the place from wikipedia (either by using the dumps or the API) and then querying Wikidata to get the information you want.

Shreyas Chavan
  • 1,079
  • 1
  • 7
  • 17
  • Wikidata does indeed provide redirects dump. Find it here [Wikidata dumps](http://dumps.wikimedia.org/wikidatawiki/latest/) – Shreyas Chavan Jul 20 '15 at 19:30