Wikidatafetcher service

Hi everybody,

The wikidata fetcher work better and better, so it's time to show you a little how to use it !

First, what is wikidata ? Wikidata is a website that store a lot of datas for a lot of things. You can find on it, the birthdate of a famous person, or the opposite of "black", or the currency of a country ...

The wikidatafetcher service will connect to the website and return what you are looking for ( if it find it ! )

For now there is still some datas that it can't return even if it exist, but i'm working on it :D

The good thing with this website is the amount of lang that it contain . But there is a problem : to interconnect all the languages, the properties are replaced by IDs and so you can't ask him the property "anthem" but you must use the ID "P85" . Not very usefull !!

So i'm using a file that map the properties to their IDs . A better thing could be to use the map function of programAB, but it seem to not agree accents . that is a problem for french or spanish by exemple .

To make programAB return the informations found on wikidata, i just use in aiml, a pattern "say * " that do the job of a repeater ...

I've added a lot of comments that i hope are enough to help you understand the bases . Not all functions are in the script that you will find after these lines . You will see a function getDate(), but there is also getGlobeCoordinates(),getQuantity(), and some other for different data type that give more flexibility .

I will show you some of the datas, that we can't find for now . Let's have a look of a wikidata page :

The service grab only the first value for each property, so if you're looking for the awards received by Isaac Assimov, you will only get "Hugo award" , because all the values for a property are called snak and for now, the service return only the main snak . I can access all snak, but they are returned not by a value but by a kind of adress . I must understand how to works with it ...

If you're asking for the property "educated at ", it will return "columbia university" but not the end time "1939" because "1939" is called a "qualifier" and i didn't wrote the function for that now .

And another problem is the homonyms . when you ask "labrador", are you talking about the region of canada, or about an electoral district ... Sometime you get the good one, sometime the bad , or sometime you get a disambiguation page ( i don't know how to use it for now )

Any way, you will see that wikidatafetcher service provide already a lot of datas :D  !

Here is some files that will permit you to ask some information like "who is adam sandler, what is the opposite of black", or "what is the father of luke skywalker" !

The python script :

The properties_ID file ( don't forget to change it's path in the python script ! ) :

The aiml file (the python script use the bot name "wikidata") :


Here is the list of the properties, to make the file properties_ID, i've just did a copy of these pages for english and french and copy all + notepad++ and excel to create a clean file . If someone need an help for another language, ask :D  :

I hope all this is understandable and i didn't forgot important things ... Have fun !

Here is the files for french :


moz4r's picture

Great work thank you I wil

Great work thank you

I wil test this

moz4r's picture

Coucou beetle ! I didn'd

Coucou beetle !

I didn'd found wikidata  "fruit" propertie but do you think this question is possible :

"what is the fruit of cherry tree"



moz4r's picture

I found it : i just rename

I found it :

i just rename fruit:P1672

this fetcher is so powerfull !!

mecax's picture

help with wikidatafetcher in spanish

hello beetlejuice , You would help me to use wikidatafetcher in Spanish?