People Who Referred To This Book Were Taking This Course

In First Dabblings With @daveyp’s MOSAIC Library Competition Data API I posted a recipe for using the Mosaic HEI library loans data to augment UCAS course search results pages with a link to a list of books related to each course based on a minimum specified number of people borrowing those books whilst taking a course with the same course code in previous years.

This post is exactly the same, but completely different: augmenting Amazon book pages with a list of qualifications that were being studied by people who borrowed the same book from a university library. If you it’s obvious to you why it’s the same, you have a Good Attitude. If you think it’s completely different, you need ejukating…

So – to start: if you haven’t already done so, go and read @daveyp’s blog post on Simple API for JISC MOSAIC Project Developer Competition data [competition announcement], because that’s what we’re playing with…

Looking at the API calls, there is one we can use that will pull back the courses associated with a particular ISBN:

http://library.hud.ac.uk/mosaic/api.pl?isbn=0500237522

So if we can grab an ISBN from an Amazon book page, we can then got to a list of related courses from the book page, or even augment the page with related courses. (Linking from, or augmenting Amazon book pages with Library related data has a long history. For example, see Jon Udell’s LibraryLookup Project, LibraryLookup Greasemonkey scripts, Coming Together around Library 2.0, OU Library Traveller – Title Lookup etc.)

Anyway, something like this regular expression will book an ISBN out of a URI:

javascript:
var isbn = window.location.href.match(/([\/-]|is[bs]n|searchData=)(\d{7,9}[\dX])/i)[2];

[based on a 2002 script by Jon Udell]

so we can readily create a bookmarklet that will take the ISBN and display the Mosaic results for a lookup of the ISBN on that page:

javascript:
(function (){
 var isbn = window.content.location.href.match(/([\/-]|is[bs]n|searchData=)(\d{7,9}[\dX])/i)[2];
 window.location="http://library.hud.ac.uk/mosaic/api.pl?isbn="+isbn;
})()

So for example if you visit the Amaqzon page for this book and run the bookmarklet, you’ll get the Mosaic API results for the corresponding ISBN. (ISBNs also appear in many other book relatd URIs, so the bookmarklet is likely to work in many other places too; except library catalogues, of course. They rarely, if ever, expose the ISBN of a book in a way that means you can reliably identify and extract it.)

So can you see why this is pretty much exactly the same mashup pattern as before?

1) grab an identifier that we know to be universal, in a given context;
2) use that identifier as a key value in the appropriate API call and construct a URI to call the appropriate query;
3) do something with the result (or not!)

One problem with using a single ISBN however is that many versions of the same book may exist, each with their own ISBN. In some cases, the librarians are right – you need to know exactly which edition of a book you should be looking at. Most of the time, however, you just want a copy of the book that has the same title and author as the one you were told to find. Hardback, paperback, whatever…

In the context of the course lookup, what this might mean is that given the ISBN of a book being browsed on Amazon, or elsewhere, you want to look up courses associated with that particular ISBN, or with ISBNs of the different variants of the same book.

There are a couple of tools that do this – xISBN (from WorldCat), and ThingISBN (from LibraryThing) – and they work as follows: given an ISBN, return the ISBNs of all the other variants of that book.

Both are implemented as RESTful webservices, so given the ISBN you can easily generate a URI that will return an XML file containing the variant ISBNs. (See the ISBN Playground for a list of more than a few URIs constructed around an ISBN key. Linked data without the RDF, maybe? Or pivot data, at least…;-)

A quick tweet to @daveyp over the weekend, and as if by magic, the ability to call the Mosaic API with more than one ISBN appeared:

http://library.hud.ac.uk/mosaic/api.pl?isbn=0500237522,0471706558

Another tweet, and an xisbn service was implemented on the server side (using ThingISBN maybe? I’m not sure…?):

http://library.hud.ac.uk/mosaic/api.pl?isbn=0745618022&mode=xisbn

Which is to say, look up all the courses associated with all ISBN variants of the specified ISBN.

So if we retweak the bookmarklet, we can look up to see whether there are any courses associated with a particular book (or its other ISBN variants) if its ISBN appears in the URI:

javascript:
(function (){
 var isbn = window.location.href.match(/([\/-]|is[bs]n|searchData=)(\d{7,9}[\dX])/i)[2]
 window.location="http://library.hud.ac.uk/mosaic/api.pl?isbn="+isbn+"&mode=xisbn";
})()

And the use case? An engine for generating contextual, book specific qualification adverts, perhaps?;-) Or an extension to a library traveler script/toolbar?

PS Just by the by, whilst looking through the Mosaic XML, I noticed that it appeared to assume the presence of ISBN10 formatted ISBNs, which prompted me to ask @daveyp whether ISBNs, or other ‘universal’ identifiers (such as ISSNs, and maybe even ebooks identifiers, DOIs and suchlike (though I didn’t ask him about the latter two)) could be catered for. Apparently, the spec has nothing currently to say on such things….

PPS See also The ISBN Is Dead (via @lorcanD) for a commentary on the lack of support that the ISBN has from some quarters… like Amazon, who apparently only use ISBNs sort of – the number that actually appears in the URI is an Amazon ASIN (which may or may not correspond to an ISBN…).

Author: Tony Hirst

I'm a Senior Lecturer at The Open University, with an interest in #opendata policy and practice, as well as general web tinkering...

%d bloggers like this: