XML TV Listings in RDF

September 7th, 2003  |  Published in bots, python, xml  |  7 Comments

In preparation for a TiVoBot that I’m planning to write as a wrapper for scheduling digital WinTV recordings, I’ve been looking at TV listings data produced by tools from the XMLTV project. I started out using the XML directly and storing it using Berkeley DB XML but soon found (like most of my projects) that I’d be happier if the data was expressed as an RDF model.


The current XMLTV DTD turns out to be pretty RDF-friendly in its structure. This XML example looks very similar as RDF (graph). The major changes I made in the translation were in assigning URIs to channels and programme categories, using identifiers such as https://xmlns.com/2003/rdftv/channel#bbc3.bbc.co.uk and https://xmlns.com/2003/rdftv/category/ananova#News/CurrentAffair, and giving the tv data a namespace under https://xmlns.com. The conversion is performed by some XSLT.

Taking a complete TV feed as RDF, I can now write query code using Redland and Python to print out details of all films on TV this week.

Responses

  1. inkel says:

    September 8th, 2003 at 10:31 pm (#)

    Great idea!

    I was thinking in a way to express data like this, so I can say in my FOAF profile that I’m a fan of John Doe and then query data looking for people with similar interests.

    I’ll be posting about this in my spanish weblog, it’s a great, great idea.

    inkel

  2. inkelog says:

    September 8th, 2003 at 10:42 pm (#)

    Listados de XML TV en RDF

    None

  3. Danny says:

    September 12th, 2003 at 10:05 am (#)

    Excellent! I was amazed when I stumbled on xmltv that no-one had so far joined it with RSS 1.0 for viewing in aggregators. Jared Krinke had done some work on it, but decided that current aggregators were just too dumb. But I’m sure your XSLT should only need small tweaks to get it ready for next-generation aggregators (it should be ok for IdeaGraph as-is ;-).

  4. Deraj says:

    September 12th, 2003 at 4:49 pm (#)

    Very cool work. If only I hadn’t already finished my project that instead uses an SQL database for storing/querying listings…

    My only complaint is that as far as I can tell (from your example) the channels are included within the URIs. I was hoping for a more universal URI scheme so that the RDF data would be the same between two people. That way they could both add data about the same program.

    Or perhaps I’m really just wanting something else. Listings hold data about program AIRINGS and not necessarily the programs themselves. Perhaps these two concepts could be split into two different resources for such purposes?

  5. Raw Blog says:

    September 14th, 2003 at 9:19 am (#)

    TV RDF

    hackdiary: XML TV Listings in RDF Matt Biddulph’s using XSLT to convert the xmltv listings (from Ananova) into RDF, with…

  6. HOLLOBLOG ( says:

    September 15th, 2003 at 3:13 am (#)

    TV RDF

    hackdiary

  7. Cormac Twomey says:

    September 16th, 2003 at 9:44 pm (#)

    Great work, but I have to agree with Deraj – to properly express tv listings in RDF a way to express airings is definitely needed – given a certain episode of Friends, say, when is it being aired?

    This requires that tv:programmes receive an rdf:about unique identifier. I reckon that the best thing to do here might be to use an xsl string manipulation function to generate an id from a concatenation of title and sub-title, although this is fairly hacky. But we have little more to go on in the XMLTV model. Thoughts?