Playing with Freebase - List of television spin-offs
April 24, 2007I 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.
Here’s a screen-shot to prove that it works
How the code works:
- Execute a query for all TV Programs with Spin-offs
- Create a hash-table of programs that are spin-offs
- Display all the root TV programs
- Display all the spin-off TV programs
- 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
Posted by Will Moffat

