Hi everybody,

We have a new service : WikiDataFetcher . This service grab data from wikis website ( for now wikidata )

It's still work in progress, but there is already few functions ( getDescription(), getTime(), getUrl(), etc .. )

wikidata store data by entities with an ID , by exemple, Adam Sandler have the ID Q132952 .

each entity contain several elements :

To use wikiDataFetcher , you will need an ID for the properties , but not for the label . the better thing is to show you a demo file ! see at the bottom of this post !

There is a lot of possibily with this service ; It's possible to use it with AIML so when the bot don't know the answer, it can have a look on the web to find it , wikidata is multilingual so the description can bi returned in english, but also in french, italian, spanish ...

It's possible to ask the bot " what is the french word for duck" and get the answer " canard "

I've not writed the code for that yet, but after, it will be possible to use aliases (sun = helios = sol ) and more ...

so, here is the python file to test it ( i paste it, i don't remember how to link it from my home folder ! )

I'll try to make a video to show you how to use it with a chatbot !

For now the right method must be called to get data, but in the future, there will be a global method (getData()) that will automaticly use the right method .

 

[home/beetlejuice/wikiDataFetcher_demo.py]  

# To know the IDs of property, visit : https://www.wikidata.org/wiki/Wikidata:List_of_properties/en

wdf = Runtime.createAndStart("wikiDataFetcher""WikiDataFetcher")

query = "Eiffel Tower"
wdf.setWebSite("enwiki"

# Display the label
wdf.setLanguage("en")
print "Label from query : " + wdf.getLabel(query)

# Set language to english
wdf.setLanguage("en")

# Display the description 
print "Description EN : " + wdf.getDescription(query)

# Change language to French and display again the description
wdf.setLanguage("fr")
print "Description FR : " + wdf.getDescription(query)

# Display the identification number of the document
print "Identification number of the Eiffel Tower is : " + wdf.getId(query)

# Display the description from document identification number ( South pole )
wdf.setLanguage("en")
print "Label from ID Q933 is : " + wdf.getLabelById("Q933")

# Display the description from document identification number ( South pole )
wdf.setLanguage("en")
print "Description from ID Q933 : " + wdf.getDescriptionById("Q933")

# Display Date or time  (day, month, year, hour, minute, second, after, before
# This one don't work for the Eiffel Tower so : Not Found !
ID = "P569"
print "BirthDate : " + wdf.getTime(query,ID,"day") +"/" + wdf.getTime(query,ID,"month") + "/" + wdf.getTime(query,ID,"year")

# Display Date or time  (day, month, year, hour, minute, second, after, before
ID = "P571"
print "Built in : " + wdf.getTime(query,ID,"year")

# Display a property ( high of the eiffel tower )2048
print "high : " + wdf.getQuantity(query,"P2048")

# Display the official website url
print "Url : " + wdf.getUrl(query,"P856")

 

 

kwatters

8 years 9 months ago

Zombie process have started seeking out Brains!!!....  Brains!!!   Brains!!!!.....

This is great stuff,  it's on the list to allow for an in-line OOB response tag...  I think it would make the ProgramAB + WikiDataFetcher integration much much easier.

Great stuff!

GroG

8 years 9 months ago

Great Work Beetle !!!

This is a wonderful service..  of all the backend data services I think I love the idea of Wikipedia the most !!

Thx guys :D

Now, it's not needed to capitalyse the firts letters of the queries, it's done automaticly . ( eiffel tower work as well than Eiffel Tower)

There is also a new function called getData(String query, String ID) that can collect Value from different datatype. But there is still some old , because is the value dataType is "time", getData() will return by exemple

9/9/1968 - 00H00m

So it's more usefull to use getDate(String query, String ID, String what) because "what" can be day,month,year,hour,minute or second . So it's possible to get only the year or display  09/09/2012 or 2012/09/09 ...

it's will be the same for the globe coordinates value that will be able to return longitude, latitude ...( not done yet .

 

GroG

8 years 9 months ago

I see it ! ...

funny that you put it in and figured out the serviceData.json stuff, and now no one will have to update that file anymore (Yay!)..

Looks good, I took the liberty of getting an icon, but fill free to change it if you want

 

Below you will see what replaced the serviceData.json.  Now each service has a static method called getMetaData.  Within this method, you can add a description, categories, Peers & dependencies.. heh I can see I missed your dependency .. didn't know what it was before, but I'll add it now...