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.
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
April 25, 2007 at 6:36 am
Great information. I will surely be a part of Freebase.
April 25, 2007 at 4:17 pm
Dude, this rocks. Nice job! I really like the “Self-referring” bits too - definitely a way to find data quality issues!
April 25, 2007 at 4:42 pm
Cheers Alec
The code could do with a clean-up. Suggestions very welcome.
May 9, 2007 at 1:08 pm
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.