Mjt, on the way to Freebase widgets

June 22, 2007

Mjt is an open source templating engine for pulling Freebase data onto your website or into an app. You add a few lines of javascript (the script lives at their site) and can pull in live information about people, places, movies, albums or anything listed. It’s still early, between version 0.4 and 0.5, but you can start using the service if concurrently logged in to Freebase.

I played with this by adapting the demo to pull up some influence data I’ve uploaded. This query gives me the name, birthdate and id of people I’ve said were influenced by Hegel.

<div mjt.task="q">
mjt.mqlread({
name: "Georg Wilhelm Friedrich Hegel",
id: null,
type: "/user/mikelove/default_domain/influence_node",
influenced: [{
date_of_birth: null,
id: null,
name: null,
type: "/people/person"
}]
})
</div>

Which you then drop into a list:

<div mjt.when="ready">
<a href="${topic_url(q.result.id)}">$q.result.name</a> influenced:
<ul>
<li mjt.for="figure in q.result.influenced">
<a href="${topic_url(figure.id)}">$figure.name</a>, $figure.date_of_birth
</li>
</ul>
</div>

And on pageload it looks like this, with links back to Freebase pages:

Georg Wilhelm Friedrich Hegel influenced:

When playing with this I realized I would want to do fun stuff with this on my blog, but I can’t because I don’t host my own blog. You still need to throw a script into <head> and an onload command into <body>. Freebase widgets would be interesting, or a plugin that would find and enable key phrases in your posts by pulling data into the hover text, as in: John Cage. I bet people would be eager to layer more information on their page with no effort, and it would virally spread use and additions as a percentage of people would click through to the Freebase topic page.

Josh Koenig reminds me that this is just like Sunlight Foundation’s PopUp Politicians widget.

3 Responses to “Mjt, on the way to Freebase widgets”


  1. Good point about the issues with using Mjt without access to
    the page itself… I took a crack at it and made a wrapper script
    (mjtinline.js) that should allow you to include Mjt templating
    in a blog entry. It’s still pretty experimental, and I won’t
    be around to maintain it for the next few weeks, but I hope it
    works for you…

    Here’s your example using mjtinline.js:
    http://mjtemplate.org/examples/inlinescript.html

  2. mikelove Says:

    Works great for me – thanks for the quick response.

    The autosuggest using JQuery is impressive too.

    I think distributed interesting displays of the information with links back to Freebase will do a lot for the project.

  3. jpeek345 Says:

    Thank-you both.


Leave a Reply