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

Re: Bug in rdf-raptor?

From: Arto Bendiken <arto.bendiken@gmail.com>
Date: Tue, 6 Apr 2010 11:43:34 +0200
Message-ID: <o2z47fe11b71004060243md3d356e2tfcda3c20206ffe72@mail.gmail.com>
To: Nicholas Humfrey <nicholas.humfrey@bbc.co.uk>
Cc: public-rdf-ruby@w3.org
Hi Nick,

On Tue, Apr 6, 2010 at 11:10 AM, Nicholas Humfrey
<nicholas.humfrey@bbc.co.uk> wrote:
> Hello,
>
> I am planning on writing a ruby gem to makes it easy to consume RDF from BBC
> Programmes. I started by having a play with rdf-raptor:
>
> require 'rubygems'
> require 'rdf'
> require 'rdf/raptor'
>
> puts RDF::Raptor.available?         #=> true
> puts RDF::Raptor.version            #=> "1.4.21"
>
> RDF::Reader.open('http://www.bbc.co.uk/programmes/b00rmssw.rdf') do |reader|
>   reader.each_statement do |statement|
>     puts statement.inspect
>   end
> end
>
> And the output was:
> #<RDF::Statement:0x810896e4(<file:///programmes/b00rmssw.rdf>
> <http://www.w3.org/2000/01/rdf-schema#label> "Description of the episode
> GCHQ: Cracking the Code" .)>

Looking at the RDF/XML file at
http://www.bbc.co.uk/programmes/b00rmssw.rdf, it seems that all its
resource descriptions are given with relative URLs and there is no
explicit base URI defined. So, if Raptor should parse that file
without an effective base URI, you'd probably get subject URLs like
the ones you saw.

Therefore this is likely a bug in RDF::Raptor in that the gem
certainly ought to be passing in the input URL to Raptor as the
default base URI.

I'll fix this later today and release a new version of the gem, but in
the meantime the workaround is trivial enough - just define an
explicit base URI as follows and everything should work fine:

    RDF::Reader.open(url =
'http://www.bbc.co.uk/programmes/b00rmssw.rdf', :base_uri => url)

-- 
Arto Bendiken | http://datagraph.org/
Received on Tuesday, 6 April 2010 09:44:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 6 April 2010 09:44:08 GMT