Playing with Freebase – List of television spin-offs

I started playing with Freebase a few days ago. It’s like a cross between the Wikipedia and a database. It also has an API and a Javascript template language MJT.

Yesterday Alec Flett suggested using the API to make a list of television spin-off shows using the API and MJT.

Here’s the hand-written page on the Wikipedia: List of television spin-offs

Here’s my auto-generated list. (Freebase account required). It’s the first time I’ve written anything using MJT. Feedback very welcome.

Screenshot of auto-generated TV Spinoff list

Here’s a screen-shot to prove that it works 😉

How the code works:

  1. Execute a query for all TV Programs with Spin-offs
  2. Create a hash-table of programs that are spin-offs
  3. Display all the root TV programs
  4. Display all the spin-off TV programs
  5. For-each spin-off, move its DOM element to be a child of its parent TV program

The program also highlights the 30-odd TV Programs with claim to be spin-offs of themselves. Looks like the data could do with some cleaning up.

Bugs to fix:

  • Internet Explorer support (currently only works in Firefox)
  • Alphabetically sort sub-branches of tree as well
  • Stop using Wikipedia CSS file
  • Find a more elegant way to invoke Javascript after a database query finishes

Updates: Nov 07 – fixed broken link

Advertisements

4 Responses to Playing with Freebase – List of television spin-offs

  1. Great information. I will surely be a part of Freebase.

  2. Alec says:

    Dude, this rocks. Nice job! I really like the “Self-referring” bits too – definitely a way to find data quality issues!

  3. Will Moffat says:

    Cheers Alec 🙂
    The code could do with a clean-up. Suggestions very welcome.

  4. Frank says:

    This is great, it amazing to see the possibilities of Freebase grow day by day. Can’t wait until it opens to the public so that the data can grow.

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: