{"id":316,"date":"2009-07-02T11:39:04","date_gmt":"2009-07-02T16:39:04","guid":{"rendered":"http:\/\/dilettantes.code4lib.org\/?p=316"},"modified":"2009-07-02T11:42:58","modified_gmt":"2009-07-02T16:42:58","slug":"linked-open-librarything","status":"publish","type":"post","link":"https:\/\/rossfsinger.me\/blog\/2009\/07\/linked-open-librarything\/","title":{"rendered":"Linked Open LibraryThing"},"content":{"rendered":"<p>For <a href=\"http:\/\/iandavis.com\/blog\/\" target=\"_blank\">Ian Davis<\/a>&#8216; birthday, <a href=\"http:\/\/www.dannyayers.com\/\" target=\"_blank\">Danny Ayers<\/a> sent out an email asking people to make some previously unavailable datasets accessible as linked data as Ian&#8217;s present.\u00c2\u00a0 It was a pretty neat idea.\u00c2\u00a0 One that I wish I had thought of.<\/p>\n<p>Given that Ian is my boss (prior to about a month ago, Ian was just nebulously &#8220;above me&#8221; somewhere in the Talis hierarchy, but I now report to him directly) one could cynically make the claim that by providing Ian a &#8216;linked data gift&#8217; that I would just be currying favor by being a kiss-ass.\u00c2\u00a0 You could make that claim, sure, but evidently you are not aware of how <a href=\"http:\/\/code4lib.org\/conference\/2009\/davis\" target=\"_blank\">I hurt the company<\/a>.<\/p>\n<p>Anyway, as my contribution, I decided to take the <a href=\"http:\/\/www.librarything.com\/feeds\/\" target=\"_blank\">data dumps<\/a> from <a href=\"http:\/\/librarything.com\/\" target=\"_blank\">LibraryThing<\/a> that <a href=\"http:\/\/www.librarything.com\/profile\/timspalding\" target=\"_blank\">Tim Spalding<\/a> pretty graciously makes available <strong><em>[whoa, in the time that I first started this post until now, the data has gone AWOL, I suppose I did this just in time]<\/em><\/strong>.\u00c2\u00a0 The data isn&#8217;t always very current and not all of the files are terribly useful (the tags one, for example, doesn&#8217;t offer much since the tags aren&#8217;t associated with anything &#8212; it&#8217;s just words and their counts), but it&#8217;s data and between ThingISBN and the WikipediaCitations I thought it would be worth it.<\/p>\n<p>I wanted to take a very pragmatic approach to this: no triple store, no search, no rdf libraries, minimal interface.\u00c2\u00a0 Mostly this was inspired by <a href=\"http:\/\/inkdroid.org\/\" target=\"_blank\">Ed Summers<\/a>&#8216; work with the <a href=\"http:\/\/id.loc.gov\/authorities\/\" target=\"_blank\">Library of Congress Authorities<\/a>, but, also, if Tim (or, whoever at LibraryThing) saw that making LibraryThing linked data was as easy as a few template tweaks (as opposed to a major change in their development stack) this exercise was much more likely to actually make its way into LibraryThing.<\/p>\n<p>What I ended up with (the first pass released before the end of Ian&#8217;s birthday, I might add) was <a href=\"http:\/\/dilettantes.code4lib.org\/LODThing\/isbns\/0062515861.html\" target=\"_blank\">LODThing<\/a>: a very simple application written in Ruby&#8217;s <a href=\"http:\/\/www.sinatrarb.com\/\" target=\"_blank\">Sinatra framework<\/a>, <a href=\"http:\/\/datamapper.org\/doku.php\" target=\"_blank\">DataMapper<\/a> and <a href=\"http:\/\/sqlite.org\/\" target=\"_blank\">SQLite<\/a>.\u00c2\u00a0 The entire application is less than 230 lines of Ruby (including the web app and data loader) plus 2 HAML templates and 2 builder templates for the HTML\/RDFa and RDF\/XML, respectively.\u00c2\u00a0 The SQL database has three tables, including the join table.\u00c2\u00a0 This is really simple stuff.\u00c2\u00a0 The only real reason it took a couple days to create was trying to get the data loaded into SQLite from these huge XML files.\u00c2\u00a0 <a href=\"http:\/\/nokogiri.rubyforge.org\/nokogiri\/\" target=\"_blank\">Nokogiri<\/a> is fast (well, Ruby fast), but a 200 MB XML file is pretty big.\u00c2\u00a0 It was nice to get acquainted with Nokogiri&#8217;s pull parser, though.<\/p>\n<p>There are a few things to take away from this exercise.<\/p>\n<ol>\n<li>When data is freely available, it&#8217;s really quite simple to reconstitute it into linked data without any need to depart from your traditional technology stack.\u00c2\u00a0 There is nothing even remotely semantic-webby about LODThing except its output.<\/li>\n<li>We now have an interesting set of URIs and relationships to start to express and model FRBR relationships.<\/li>\n<li>The Wikipedia citations data is <em>extremely<\/em> useful and could certainly be fleshed out more.\u00c2\u00a0 One could imagine querying DBpedia or Freebase on these concepts and identifying if the Wikipedia article is actually referring to the work itself and use that.\u00c2\u00a0 Right now LODThing makes no claims about the relationships except that it&#8217;s a reference from Wikipedia.<\/li>\n<\/ol>\n<p>LODThing isn&#8217;t really intended for human consumption, so there&#8217;s no real &#8220;default way in&#8221;.\u00c2\u00a0 The easiest way to use it is to make a URI from an ISBN:<\/p>\n<ul>\n<li><a href=\"http:\/\/dilettantes.code4lib.org\/LODThing\/isbns\/0618260307\" target=\"_blank\">http:\/\/dilettantes.code4lib.org\/LODThing\/isbns\/0618260307<\/a><\/li>\n<li><a href=\"http:\/\/dilettantes.code4lib.org\/LODThing\/isbns\/0060987324\" target=\"_blank\">http:\/\/dilettantes.code4lib.org\/LODThing\/isbns\/0060987324<\/a><\/li>\n<li><a href=\"http:\/\/dilettantes.code4lib.org\/LODThing\/isbns\/0141182474\" target=\"_blank\">http:\/\/dilettantes.code4lib.org\/LODThing\/isbns\/0141182474<\/a><\/li>\n<\/ul>\n<p>If you know the LibraryThing &#8216;work ID&#8217;, you can get in that way, too:<\/p>\n<ul>\n<li><a href=\"http:\/\/dilettantes.code4lib.org\/LODThing\/works\/3206242\" target=\"_blank\">http:\/\/dilettantes.code4lib.org\/LODThing\/works\/3206242<\/a><\/li>\n<li><a href=\"http:\/\/dilettantes.code4lib.org\/LODThing\/works\/894\" target=\"_blank\">http:\/\/dilettantes.code4lib.org\/LODThing\/works\/894<\/a><\/li>\n<li><a href=\"http:\/\/dilettantes.code4lib.org\/LODThing\/works\/1472\" target=\"_blank\">http:\/\/dilettantes.code4lib.org\/LODThing\/works\/1472<\/a><\/li>\n<\/ul>\n<p>Also, you can all of these resources as RDF\/XML by replacing the .html with .rdf.<\/p>\n<p>So, Tim, you wrote on the <a href=\"http:\/\/www.librarything.com\/api\" target=\"_blank\">LT API page<\/a> that you would love to see what people are doing with your data, here you go.\u00c2\u00a0 It would be even more awesome if it made it&#8217;s way back into LT &#8212; after all, it would alleviate some of the need for you to have a special API for this stuff.<\/p>\n<p>Also, special thanks to <a href=\"http:\/\/tobyinkster.co.uk\/\" target=\"_blank\">Toby Inkster<\/a> for providing a ton of help in getting this to resemble something that a linked data aware agent would actually want and finally turning the httpRange-14 light bulb on over my head.\u00c2\u00a0 He also immediately linked to it from his Amazon API LODifiier, which is sort of cool, too.<\/p>\n<p>I&#8217;ll be happy to throw the sources into a github repository if anybody&#8217;s interested in them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For Ian Davis&#8216; birthday, Danny Ayers sent out an email asking people to make some previously unavailable datasets accessible as linked data as Ian&#8217;s present.\u00c2\u00a0 It was a pretty neat idea.\u00c2\u00a0 One that I wish I had thought of. Given that Ian is my boss (prior to about a month ago, Ian was just nebulously [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[65],"tags":[],"class_list":["post-316","post","type-post","status-publish","format-standard","hentry","category-linked-data"],"_links":{"self":[{"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/posts\/316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/comments?post=316"}],"version-history":[{"count":6,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions"}],"predecessor-version":[{"id":322,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions\/322"}],"wp:attachment":[{"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/media?parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/categories?post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/tags?post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}