My Photo
Name:
Location: Amsterdam, Netherlands

Tuesday 24 June 2008

How to do hCalendar in RDFa

Now that the BBC has announced that it is dropping use of hCalendar because of its accessibility problems, it is time to show how to define events using RDFa.

The events vocabulary for RDF was defined from 2002 by Dan Connolly and Libby Miller in RDF Calendar. Its use is identified by including the following declaration in your document, for instance as an attribute on the <html> element:

xmlns:event="http://www.w3.org/2002/12/cal#"

The markup for an event, in this case a TV program, can then look like this:

<div typeof="event:Vevent">
<h3 property="event:summary">Have I Got Old News For You</h3>
<p property="event:location">BBC2</p>
<p><span property="event:dtstart" content="2008-06-28T21:00:00">Saturday 28 June,
9</span>-<span property="event:dtend" content="2008-06-28T21:30:00">9.30pm</p>
<p property="event:description">Team captains Paul Merton and Ian Hislop
are joined by returning guest host Jeremy Clarkson and
panellists Danny Baker and Germaine Greer for the
topical news quiz. <abbr title="in stereo">[S]</abbr></p>
</div>

There are no requirements on the order of enclosed elements. For instance here is a description of a conference:

<div typeof="event:Vevent">
<h3 property="event:summary">WWW 2009</h3>
<p property="event:description">18th International World Wide Web Conference</p>
<p>To be held from <span property="event:dtstart" content="2009-04-20">20th April 2009</span>
until <span property="event:dtend" content="2009-04-24">24th April</span>, in
<span property="event:location">Madrid, Spain</span>.</p>
</div>

If you want to validate your page, then replace the DOCTYPE you use with

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

Labels:

2 Comments:

Anonymous Anonymous said...

Hello! In the first example, I would think that the use of the RDF calendar ontology is a bit weird in this context (scheduled broadcasts), especially for the event:location bit. I would rather go for the more flexible ontology at http://motools.sourceforge.net/event/event.html, and the terms extending it in the PO ontology (http://www.bbc.co.uk/ontologies/programmes/, currently used in the BBC Programmes RDF at http://bbc-programmes.dyndns.org/ ), which tackles just that: broadcasts of programmes on a particular service at a particular time.

It would just mean replacing event:Vevent by po:Broadcast and event:location by po:broadcasted on, where po stands for "http://purl.org/ontology/po/".

Cheers!
y

26 June 2008 at 14:41  
Blogger Steven Pemberton said...

It's true that using location to record the channel is slightly strange, but the problem is if you want the browser to add events to your agenda in the future, we have to have a format that the browser will recognise. My agenda has an entry for location, but not for channel. If we change every field to record slight changes in the semantics the chances are those fields will be ignored.

1 July 2008 at 09:41  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home