MQL: Finding the Wikipedia page for a Freebase Topic

November 27, 2007

Freebase contains many articles mined from the Wikipedia. For example, this page about Edinburgh.

You might want to show the Wikipedia page in your own web application. Given the Freebase topic ID, in this case /en/edinburgh

This MQL query will return the Wikipedia ‘curid’

"id" : "/en/edinburgh",
"key" : [{
"namespace" : "/wikipedia/en_id",
"value" : null

Run in Query Editor


The Wikipedia URL is then:

Update: You can find the Wikipedia article name + all the redirect names with this query but as far as I know there’s no way to distinguish between redirects and the current article name.

Step by step MQL with Jimi Hendrix

July 12, 2007

When I show developers Freebase and the query language MQL, the first thing they often try to do is extract all the info they can out of the database for a generic topic.

This is actually quite a good learning experience, as you have to learn lots of MQL concepts:

  • How “*” expands (default values v objects, type specified or not)
  • Multiple queries v nested queries
  • Reflection

I had been keeping my own notes, but I thought they might be worth sharing so I whipped up a nice stylesheet and here they are:

Step by step MQL with Jimi Hendrix

Still lots of uncompleted TODO points but I’d be interested in your feedback. Is this something worth working on?