[Developers] Get Freebase id from Wikipedia link

Christopher R. Maden crism at metaweb.com
Tue May 20 19:28:10 UTC 2008


Vivek Puri <vp at startupsquad.com> wrote:
> While it is possible to determine the url of a wikipedia article for a given
> Freebase topic id, how do i go about the other way round. Let's say i want
> to find the topic id in freebase for the following wikipedia url:
> http://en.wikipedia.org/wiki/Taz_(singer)<http://en.wikipedia.org/wiki/Taz_%28singer%29>.
> What should be the api call to do that?

You need to encode any non-ASCII characters as $hhhh where hhhh is the Unicode number for that character.  Then turn spaces into underscores.

Taz_$0028singer$0029

Then you can look for that key in the (in this case) English Wikipedia namespace:

{"key":{"value":"Taz_$0028singer$0029",
"namespace":"/wikipedia/en"}}

or just make an ID out of it:

{"id":"/wikipedia/en/Taz_$0028singer$0029"}

~Chris
-- 
Christopher R. Maden
Data Architect
Metaweb Technologies, Inc.
<URL: http://www.metaweb.com/ >


More information about the Developers mailing list