Tuesday, March 17, 2009

Writing to Freebase with IronPython

Freebase is "A social database about things you know and love". It has a public API to access and update structured data. The API is based on the Metaweb Query Language (MQL) and naturally there are Python bindings to the API.

The API Guy has a blog entry about writing to Freebase using IronPython, including code samples:
My mom was in town visiting this weekend, and when I went to demo Freebase for her, I asked her to name a famous person. She suggested Pope John Paul II, so we looked him up. Most of the information that you would expect Freebase to know about him, it did. But there was one glaring omission: it didn’t know that he was Catholic.

Since Freebase knows 263 people who have ever been a professional Pope, I decided that it would take a little too long to update them each by hand. And so I set out to scribble up a few lines of Python to use the Freebase API libs for Python.
In order to use the Freebase Python lib from IronPython you need the simplejson library.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.