Subject: [CODE4LIB] rdf files as linked data

From: Eric Lease Morgan <[email-masked]>
Date: Mon, 20 Jul 2009 18:15:15 -0400

What process would I need to go through in order to expose sets of RDF  
files as linked data?

My Alex Catalogue includes the full text of approximately 15,000  
electronic texts. Each text is represented in a (MyLibrary) database,  
and because of that I am able to create reams of reports against the  
collection. For example, I use this infrastructure to index the  
content with Solr/Lucene. Recently I have implemented on-the-fly  
concordances. I have created HTML files complete with a floating  
palette supporting various services against the texts. I am currently  
in the process of using statistical analysis to extract keywords and  
two-word phrases from the texts to use as descriptors. In the near  
future I hope to associate a URI with each work and/or author to  
supplement the user experience with content from the Web. I have a  
bunch more ideas too, but they are too numerous to mention.

More than a couple of years ago I created sets RDF files against the  
documents. Thomas More's Utopia is a good example. [1] The RDF is not  
always perfect, mostly for encoding reasons. The RDF is not always  
complete nor as easily parsable as possible. For example, names and  
titles would ideally point to URIs or consistently formatted. But on  
the whole it is great first step since each RDF file contains the full  
text of each text.

Given I have these RDF files and I am able to easily update them (more  
or less), what are some of the things I need to do in order expose  
them more systematically and in a way that can truly be called linked  
data?

[1] http://infomotions.com/etexts/literature/english/1500-1599/more-utopia-221.rdf

-- 
Eric Lease Morgan

---

From: stuart yeates <[email-masked]>
Date: Tue, 21 Jul 2009 13:33:47 +1200

> What process would I need to go through in order to expose sets of RDF  

[snip]

> [1] http://infomotions.com/etexts/literature/english/1500-1599/more-utopia-221.rdf

It seems to me that the presence of the following tags qualifies the RDF 
as linked data:

<dc:rights>http://creativecommons.org/licenses/GPL/2.0/</dc:rights>
<dc:source 
rdf:resource="gopher://wiretap.spies.com:70/00/Library/Classic/utopia.txt"/>

Of course, the usefulness of linked data increases drastically with the 
number of dimensions along which it's linked.

I'm interested by:

<dc:subject>
    <rdf:Bag>
      <rdf:li>man</rdf:li>
      <rdf:li>people</rdf:li>
      ....
   </rdf:Bag>
</dc:subject>

Given that dc:subject is repeatable, and there doesn't appear to be 
anything being said about cardinality, wouldn't this be simpler as:

<dc:subject>man</dc:subject>
<dc:subject>people</dc:subject>
...

Certainly the later converts to fewer tuples, since there is no bag to 
track the membership of.

Your  <alex:local_mirror />, <alex:concordance /> and <alex:plain_html 
/> tags seem to be remarkably similar to  dc.relation.isFormatOf. Maybe 
you could recast these in terms of dc?

cheers
stuart
-- 
Stuart Yeates
http://www.nzetc.org/       New Zealand Electronic Text Centre
http://researcharchive.vuw.ac.nz/     Institutional Repository

---

From: Ed Summers <[email-masked]>
Date: Mon, 20 Jul 2009 22:04:31 -0400

Heya Eric:

The main thing you'd want to do would be to make sure URIs like:

  http://infomotions.com/etexts/literature/english/1500-1599/more-utopia-221

returned something useful for both people and machine agents. The
nitty gritty details of how to do this can roughly be found in the
Cool URIs for the Semantic Web [1], or How to Publish Linked Data [2].
A slight variation would be to use something like RDFa [3] to embed
metadata in your HTML docs, or GRDDL [4] to provide a stylesheet to
transform some HTML to RDF.

The end goal of linked data, is to provide contextual links from your
stuff to other resources on the web, aka timbl's rule #4:

  Include links to other URIs. so that they can discover more things. [3]

So for example you might want to assert that:

  <http://infomotions.com/etexts/literature/english/1500-1599/more-utopia-221>
owl:sameAs <http://dbpedia.org/page/Utopia_(book) .

or:

 <http://infomotions.com/etexts/literature/english/1500-1599/more-utopia-221>
dcterms:creator <http://dbpedia.org/resource/Thomas_More> .

It's when you link out to other resources on the web that things get
interesting, more useful, and potentially more messy :-) For example
instead of owl:sameAs perhaps an assertion using FRBR or RDA would be
more appropriate.

Thanks for asking the question. The public-lod list [4] at the w3c is
also a really friendly/helpful group of people making data sets
available as linked-data.

//Ed

[1] http://www.w3.org/TR/cooluris/
[2] http://www4.wiwiss.fu-berlin.de/bizer/pub/LinkedDataTutorial/
[3] http://www.w3.org/TR/xhtml-rdfa-primer/
[4] http://www.w3.org/TR/grddl-primer/
[5] http://www.w3.org/DesignIssues/LinkedData.html
[6] http://lists.w3.org/Archives/Public/public-lod/

---

From: Ross Singer <[email-masked]>
Date: Mon, 20 Jul 2009 22:58:03 -0400

I'll pile on with a with a couple of other things:

1. I second Ed's point about conneg:
http://infomotions.com/etexts/literature/english/1500-1599/more-utopia-221
should probably return a 300 code with pointers to your various file
types.
2. Replace dc with dcterms (http://purl.org/dc/terms/)
3. While Ed's point about linking to other resources would be nice,
first I'd focus on the resources you have and can control.  Rather
than a literal for dc:creator, can you mint URIs for all of your
authors?  How about subjects?
4.  Your URIs in your rdf:Description[@rdf:about] aren't terribly
helpful on their own.  Either give the full URI here or add an
xml:base="http://infomotions.com/etexts/literature/english/1500-1599/"
attribute to the tag -- that should improve things.
5.  I think your dc:contributor tag might be running aground of
httpRange-14 -- I'm pretty sure you didn't help Thomas More write his
story.  This, I think, is the absolute hardest thing to get right with
RDF/LOD.  A nice example of sidestepping this sort of collision is
Toby Inkster's RDF-ification of Amazon Web Services:
http://purl.org/NET/book/isbn/0140449108#book -- in this example, the
'record metadata' lives at the base URI
(http://purl.org/NET/book/isbn/0140449108) and the real world object
lives at http://purl.org/NET/book/isbn/0140449108#book.  This way Toby
can claim responsibility for making the data the available, but not
assert that he had any part in creating the work itself.  The two
resources are linked to each other, but are each unique, independent
URIs.  If you do do this, though, it messes up what I said in point
#1.

The concordances would also be really neat to see -- building off of
WordNet would be pretty cool with all of these old texts.

Good luck, it's great to see.
-Ross.

---

From: Ross Singer <[email-masked]>
Date: Mon, 20 Jul 2009 23:05:16 -0400

Oops, scratch my warning at the end of point 5.  It shouldn't affect
the point 1 strategy at all.  Like I said, httpRange-14 is confusing
:)

-Ross.

---

From: Eric Lease Morgan <[email-masked]>
Date: Tue, 21 Jul 2009 00:30:20 -0400

On Jul 20, 2009, at 6:15 PM, Eric Lease Morgan wrote:

> files as linked data?...

Thank you for the replies, and I still have a lot to read up on.

In the meantime, I wrote a 25 line Perl script [1] that takes a key as  
input and redirects the user-agent to an HTML or RDF representation of  
a resource. Try:

   http://id.infomotions.com/?id=more-utopia-221

Next steps include:

   * make "cooler" URLs
   * build more accurate HTTP response headers
   * clean up my RDF files
   * include more URIs in my RDF files
   * consider applying linked data techniques to my other sets of  
content

[1] http://id.infomotions.com/redirect.pl

-- 
Eric Lease Morgan

---

From: Ed Summers <[email-masked]>
Date: Tue, 21 Jul 2009 11:26:23 -0400

Nice work Eric! You are right to focus on making the data resolvable
first. Ross' advice to work on exposing and interlinking more of your
own data next, instead of trying to link out elsewhere, is good I
think.

I noticed from your compact (and elegant) little Perl script that you
are expecting an HTTP agent to send an Accept header of
"application/rdf+xml" if it wants the rdf. While this may happen
sometimes, many linked data harvesting clients send a more expressive
Accept header. For example the rapper command line tool [1] sends a
header of:

  Accept: application/rdf+xml, text/rdf;q=0.6, */*;q=0.1

Fortunately Perl's libwww [2] has support for content negotiation, and
it looks like it plays nicely w/ CGI.pm which you are already using.
If you want to make sure the right thing is happening you can watch
what comes back over the wire with curl [3].

--
ed@hammer:~$ curl -i --header "Accept: application/rdf+xml,
text/rdf;q=0.6, */*;q=0.1"
http://id.infomotions.com/?id=more-utopia-221
HTTP/1.1 303 See Other
Date: Tue, 21 Jul 2009 15:19:04 GMT
Server: Apache/2.2.8 (Fedora)
Vary: Accept,Accept-Encoding
Location: http://infomotions.com/etexts/literature/english/1500-1599/more-utopia-221.htm
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1
--

Hope this helps, and isn't too confusing. If you need help w/ the
content negotiation bits let me know.

//Ed

PS. Another thing to add to your wishlist would be to support JSON
representations if you happen to have them handy. I think it's worth
demonstrating the convergence of REST and Linked Data.

[1] http://librdf.org/raptor/rapper.html
[2] http://search.cpan.org/~gaas/libwww-perl-5.829/lib/HTTP/Negotiate.pm
[3] http://curl.haxx.se/