Avoiding timeouts – Using MQL cursors with MJT

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)
Advertisements

One Response to Avoiding timeouts – Using MQL cursors with MJT

  1. spence says:

    thank you!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: