Now that we have created semantic information, readable by machines (or rather, marked certain information as such), is there any way of benefiting as an ordinary human being? I believe so. I will outline one simple example and you will get the idea. After having created a semantic event in the previous blog post, we will extend the functionality by creating an "Add to Calendar" feature to the website. This link will create an entry in (let's say) Microsoft Outlook.
To do this, first some preparations.
Create a File Type 'Internet Calendar' with file extension .ics and mime type 'text/calendar' (which you may have to add to your environment as well).
Create an application page of this File Type.
Now create a Translation with some parameters that we can call in a way similar to this:
| Smartsite SXML |
|
|---|---|
{icalendar("20100614T170000","20100614T230000","Kennissessie met Smartsite","Kennissessie",Delft,3,"P0D1H0M")}
|
|
The aguments listed here are:
and refer to the Microformat hCalendar. For more information: http://microformats.org/wiki/hcalendar. Of course, it is up to you to add other arguments that may be relevant. Some arguments require some obscure format, so you may want to create some indirection here. 'P0D1H0M' is the notation for a trigger (reminder), that will go off 0 days, 1 hour and 0 minutes before the actual start of the event.
The replacement for the translation is something like this:
| Smartsite SXML |
|
|---|---|
<se:text>
BEGIN:vCalendar
VERSION:2.0
METHOD:PUBLISH
BEGIN:vEvent
DTSTART:{translation.arg(startdate,default='01-01-2010',rem='Start date for event')}
DTEND:{translation.arg(enddate,default='01-01-2010',rem='End date for event')}
UID:{itemdata.field('code')}
DTSTAMP:{datetime.now()}
DESCRIPTION:{translation.arg(description,default='unknown',rem='Description for event')}
SUMMARY:{translation.arg(summary,default='unknown',rem='Summary for event')}
LOCATION:{translation.arg(location,default='unknown',rem='Location for event')}
PRIORITY:{translation.arg(priority,default='3',rem='Priority for event')}
BEGIN:vAlarm
TRIGGER;RELATED=START:{translation.arg(trigger,default='P0DT0H15M',rem='Alert trigger for event')}
ACTION:DISPLAY
DESCRIPTION:Reminder
END:vAlarm
END:vEvent
END:vCalendar
</se:text>
|
|
When the application page is rendered, the arguments are entered and the final output will be:
| Smartsite SXML |
|
|---|---|
BEGIN:vCalendar VERSION:2.0 METHOD:PUBLISH BEGIN:vEvent DTSTART:20090314T170000 DTEND:20090314T230000 UID:GUID-107EF6A74C4C4CFF9B8BA81CC7872DAA DTSTAMP:2010-05-25T12:34:56 DESCRIPTION:Kennissessie met Smartsite SUMMARY:Kennissessie LOCATION:Delft PRIORITY:3 BEGIN:vAlarm TRIGGER;RELATED=START:P0D1H0M ACTION:DISPLAY DESCRIPTION:Reminder END:vAlarm END:vEvent END:vCalendar |
|
By linking from the semantic event to this application page, you will have created a human benefit of all your semantic work.
The ultimate way to merge all this together might be to create a generic content type Event, and provide several renditions of this content type: HTML with the mark-up illustrated in previous blog posts, as a Microformat, as an RSS feed (?), et cetera.
Of course, you can do this with other Microformats as well. Happy experimenting!