AllConsuming Reading Lists in RDF

After playing with 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: 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 rdfs:seeAlso property:

<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.

12 thoughts on “AllConsuming Reading Lists in RDF

  1. Aah, now that’s useful! I kept meaning to write that XSLT myself but never got around to it. Good stuff!

  2. Very nice indeed, now all I need is an account on allconsuming…
    BTW, the XPath for accountName should be “substring-after(header/@description, ‘ for ‘)” (it currently has …/@title).
    Apart from the review “link” between between you and each of the books, shouldn’t there be a “currentlyReading” property?
    Oh, and re local cron jobs, I do that myself for my Amazon wishlist…

  3. Thanks Morten, good catch on the accountName, haven’t a clue why I didn’t see that myself.
    I think I’ll whip up a simple vocab for reading lists, unless you know of one already. I could base it all on the AllConsuming categories, but these didn’t quite gel with me: reading and re-reading for example. It’s useful to have the extra granularity, but for a simple view of “what books is ldodds currently reading?” I need to combine these categories.

  4. Very nice work! 🙂
    If there is one thing I’d like to see – its the author(s) of the book.
    It is present in the info extracted from AllConsuming, but not in the RDF version.

  5. Yes, the authors are there, but I wasn’t sure how best to parse them: they’re just a comma-separated list of names. I could just split on commas, but that gets tricky for names like “Joe Bloggs, Jr”.
    I’m intending to dig a bit more into how AllConsuming handles names of that forms.
    And no, it’s not linked from my FOAF yet because I wanted to fix up the bugs Morten reported. Later today…

  6. Update:
    I’ve written a simple schema for describing reading lists. This allows me to properly state: X is reading Y, X has read Y, etc. The transform now uses this schema. I’ve stated that the isbn property is Inverse-Functional. The ISBN documentation states that ISBNs shouldn’t be re-used, so I believe this OK. So reading lists can now be smushed together.
    The transform now correctly identifies which AllConsuming list you’ve requested and adds the appropriate properties. So you can now use the GetPurchasedBooksList, GetCompletedBooksList, GetFavouriteBooksList, and GetRereadingBooksList actions in the REST interface. The latter is interesting because I’m able to make two assertions: that you’ve read the book, and that you’re currently reading it.
    There were a couple of other bug fixes to the transform (corrected XPath as noted by Morten in comments above), removing trailing full-stop on account name.
    Remaining work is to add author names to the books, but I’m wary about parsing this in XSLT because of likelihood of having commas in the authors name. Need to check how Amazon returns these.
    If there’s interest in transforming the other AllConsuming actions into RDF, then I could investigate this also.

Comments are closed.