Freebase London meeting

August 18, 2008

I’ll be at the Freebase London meetup on Wednesday night. If you’re interested in mashing-up open data, server-side javascript or just curious about Freebase then do come along and say hi.

One of the topics of conversation is sure to be the awesome prototype Freebase interface that David created, Freebase Parallax. Read the release notes and watch the video, it’s 8 minutes but it really gives you an idea of the power of Freebase.


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

Result:
{
"code":"/api/status/ok",
"result":[{
"id":"/en/edinburgh",
"key":[{
"namespace":"/wikipedia/en_id",
"value":"9602"
}]
}]
}

The Wikipedia URL is then:
http://en.wikipedia.org/wiki/index.html?curid=9602

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.


Tagging demo with Freebase Suggest

November 8, 2007

I whipped up a quick example of tagging with Freebase Suggest.

This is just the client-side user interface. Integration with an existing tagging system is left as an exercise for the reader 😉

Screenshot of Tagging demo


Freebase Suggest demos

October 14, 2007

As an excuse to avoid packing my suitcase (an activity which I detest about as much clothes shopping) I wrote a few examples for Freebase Suggest.

The live demos are on the Freebase Suggest project page.

(Geek note: The 3rd demo includes a first attempt at a Freebase MiniTopic plugin for jQuery. This is a really easy way to generate an infobox or summary of a Freebase topic for your own page)

Freebase Suggest in action


Freebase apps without cookies

August 9, 2007

Freebase just announced that

Within a week or so we will be removing the registration requirement in order to view Freebase.

Soon all my demo apps will work without requiring a Freebase invite. Cool!


Avoiding timeouts – Using MQL cursors with MJT

August 4, 2007

If you start to develop Freebase applications you then at some point you will inevitably see the error message “Query timeout”

For example, if you wanted to get a list of Musical Artists in Freebase you might try this query

{
“query”:[{
“id”:null,
“limit”:0,
“name”:null,
“type”:”/music/artist”
}]
}

But as there are almost 1/3 million artists in the database this query will timeout. That’s just as well, otherwise you would be loading a 30MB JavaScript file!

That was an extreme example, but as more users register with Freebase, my Map of Freebase Users occasionally timeouts. (It’s actually the MJT library which imposes the deadline here, not necessary the database which timeouts). Even if your application isn’t timing out, you find that your browser becomes unresponsive as it loads large JavaScript files from the database.

The solution is to use MQL cursors

I’ve created an example using MQL cursors in MJT which demonstrates a number of concepts:

  • Using MQL cursors
  • Calling MJT templates with arguments
  • Incremental queries (the page updates without reloading)

BBCode – live editor

July 12, 2007

I’m working on a BBCode generating bookmarklet for Freebase data. I didn’t want to pollute online forums with lots of test posts so I whipped up my own BBCode live editor.

Type BBCode into the top textarea and the rendered HTML will appear after a second of inactivity.

There are other live editors on the web but since I’m running my own I can easily configure it to support the different dialects out there.

Will’s live editor in action:

  1. bolded text
  2. italicized text
  3. underlined text
  4. http://wikipedia.org
  5. Wikipedia

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?


Auto-suggest with MJT – two demos

July 9, 2007

Nick’s demo

The latest version of MJT supports auto-complete. See Nick’s simple example.

Will’s demo

image Here’s my example (currently specific to films) Notice how the thumbnail updates as you navigate the menu 🙂 I had to add an extra ‘onchange’ hook, see source code for details.


Map of Freebase users – updated

July 9, 2007

I made some updates to my Map of Freebase Users (see old post and Freebase topic)

  • Lots more user photos (using /common/topic/image rather than picture_s)
  • Does not randomize if map location is unqiue (Thanks Dannyman!)
  • Disabled clustering – it seemed to be a performance hit. It’s easy to make maps with 1000’s of markers so I may have to reconsider this.
  • Markers are added to the to map in a separate thread. GUI is more responsive
  • Built-in error reporting
  • Code is now valid xhtml

TODO:

  • Use cursors to make data-loading more responsive. This should also fix the timeouts that Dan reported.
  • IE support (but only if somebody bugs me)