After playing with del.icio.us and zool’s RDF port of their API I wondered what other services I could link to from my FOAF.
Having spent a happy hour or so in Waterstones at the weekend purchasing some extra goodies to top up my already bulging bookshelves it dawned on me: AllConsuming.net has a REST interface so it should be a snap to create an RDF version of Erik’s API using some XSLT.
Here’s some notes on my first attempt at transforming the current reading list.
Here’s the URL to fetch my current reading list from AllConsuming:
You’ll notice that it has a
username parameter which is my AllConsuming username. Substitute your username in the URL to fetch your own list.
We can then take a stylesheet allconsuming2foaf.xsl and use the W3C XSLT service to apply it to my data.
The URL is pretty unfriendly, but you can use the form on the XSLT service page to plug in your URL and the URL of my stylesheet.
There are a couple of things worth noting in the output. Firstly I’m using the Wordnet namespace to indicate that each item is a Book. The Dublin Core title, and identifier elements are used to record the book title and ISBN. I wanted to use off-the-shelf vocabularies where possible.
Secondly, AllConsuming allows you to record some brief comments about a book. To capture that data I’ve used Danny’s Review Vocabulary to indicate that a given book has a review, as well as indicating who the reviewer is. The generated RDF includes some details about me: my homepage as well as the fact that I have an OnlineAccount with AllConsuming.
To make the personal description slightly richer, I adapted the stylesheet to take two parameters:
seeAlso which should be the URL of your FOAF description, and
mbox_sha1sum which should be your encrypted email address. You can see these demonstrated in this version of my data.
Lastly the AllConsuming REST interface include the URLs of both the AllConsuming and Amazon pages for each book. To capture this data I used the
foaf:page property to state “here’s a page about this book”. I scouted about for a couple of book price comparison sites that could be linked to via ISBN and added links to those pages also.
To link to this data from your FOAF description, simply add the following
<foaf:Document rdf:about="...transformed data url...">
<dc:title>Current Reading List</dc:title>
Simply substitute the URL to your transformed AllConsuming data in the appropriate place. To save load on the XSLT service and AllConsuming you may just want to download the file and store it locally, updating it whenever you update your reading list.
Next steps are to tweak the stylesheet to cope with some of the other actions in the AllConsuming REST interface: there are some minor inconsistencies in the response formats which I’m not cleanly dealing with yet.