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

Re: RDF.rb and format discovery

From: Nicholas Humfrey <nicholas.humfrey@bbc.co.uk>
Date: Wed, 30 Jun 2010 11:32:16 +0100
To: "Hellekin O. Wolf" <hellekin@cepheide.org>, <public-rdf-ruby@w3.org>
Message-ID: <C850DBC0.2BB20%nicholas.humfrey@bbc.co.uk>
Hello,

I think this is something that RDF.rb should be doing automatically for you.
At the moment, the RDF::Graph.load() method is pretty dumb.

There is a ticket open to implement a better HTTP client:
http://github.com/bendiken/rdf/issues/issue/12

Do you think that covers your problem?

nick.

On 30/06/2010 10:03, "Hellekin O. Wolf" <hellekin@cepheide.org> wrote:

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


nick.


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					
Received on Wednesday, 30 June 2010 10:32:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 June 2010 10:32:48 GMT