Step by step MQL with Jimi Hendrix

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?


6 Responses to Step by step MQL with Jimi Hendrix

  1. David says:

    I found this useful, thanks. I’m trying to understand keys in the en/wikipedia namespace at the moment, & keep getting a bit tripped up by how characters are escaped – e.g. ‘(‘ to $0028 …

  2. David says:

    OK I think it’s very simple. Alphanumerics stays as they are; ‘_’ and space become ‘_’; and everything else gets encoded as hex.

  3. Will Moffat says:

    Hi David, thanks for the positive feedback. If you have any suggestions for improvements then let me know.

  4. Robert says:

    Great guide – thanks!

    I’ve just started playing around with mjt, and would really appreciate some examples pitched at the same level, in particular something that showed a total newbie how to handle the topic Description field. I know that Descriptions are held separately, in the ‘blob store’, but haven’t come across any simple example of how to access that.

    On a separate tack, I read your ‘About Will’ bit with much interest. I live in Edinburgh (and indeed lectured at the Uni, in Ecological Science). I’m also committed to “using tehnology for the benefit of society”, and have been heavily involved in developing nice, easily-accessible software for environmental modelling for just that purpose – see – a cool startup! I’m very interested in Web 2.0 approaches applied to environmental modelling – see and linked presentation for a taster. I’m much taken with the potential of Freebase for science, but feel that it’s not quite there yet. Do get in touch if any of this interests you.

  5. Will Moffat says:

    Hi Robert, thanks for the positive feedback.

    You need to get the /common/topic/article id using mql and then you can access the blob store using the ‘raw’ or ‘blurb’ service. See

    This certainly should be a help topic on Freebase. I’m out of the office for a few weeks, so please post to the developers mailing list if you have any questions.

    Freebase is keeping me pretty busy these days but next time I pass through Edinburgh it would be good to meet up.

  6. Robert says:

    Thanks Will for getting back to me so quickly, and for the pointers. I’ve also seen this forum posting – – and
    sections 4.8/4.9 of ‘Building Apps Using Freebase Data’, but I’m still stuck, and could really could do with a *minimal* web page with the necessary code – perhaps 20 lines would do it?

    I’m signed up to the forum, so will post there, and maybe someone will feel inspired to knock up an example.

    Look forward to meeting up when you’re back home.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: