W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > June 2010

RDF.rb and format discovery

From: Hellekin O. Wolf <hellekin@cepheide.org>
Date: Wed, 30 Jun 2010 09:03:16 +0000
To: public-rdf-ruby@w3.org
Message-ID: <20100630090316.GF30851@now.cepheide.org>
Hi, 

I was looking into supporting more formats for FOAFSSL-ruby, including
the recently released rdf-rdfa and rdf-n3 gems.

But what I found looks like hell:

 - there doesn't seem to be a reliable way of discovering the FOAF
file format,
 - different formats will fail with different errors,
 - when no format is given, RDF::Graph won't detect the right one (and
give unpredictable results)

The original way of doing it in FOAFSSL-ruby is to try it, and
fallback to a different format on failure.  It works, but it's so ugly
my grand-mother died.  When I tried to add new formats, I had to find
another solution.

I went for the following (ugly) algorithm (now, my grand-mother is
already dead):

 1. lookup the file extension in the given WebID
 2. lookup the Content-Type after an HTTP HEAD to the WebID
 3. GET the file and identify it from its contents
 4. fail if the format isn't known by now.

That gives a pretty good image of a house of cards, if any.

Any idea how to deal properly with auto-discovery of formats?

==
hk
Received on Wednesday, 30 June 2010 09:04:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 June 2010 09:04:25 GMT