W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > January 2011

Having problem with rdf.rb 0.3.1

From: Greg Lappen <greg@lapcominc.com>
Date: Thu, 27 Jan 2011 15:15:45 -0500
Message-ID: <AANLkTi=jmVRn5676qcYejN6Kg44tpDVewqJD_pxD0yn-@mail.gmail.com>
To: public-rdf-ruby@w3.org
Hello all,

Not sure how active this email list is (hopefully someone out there is
listening!) but I am using the rdf gem to try loading some rdf data from the
web, and it's bombing out.  Here's what I get:

[greg@localhost openmedia]$ irb
irb
ree-1.8.7-2010.02 > require 'rdf'
require 'rdf'
 => true
ree-1.8.7-2010.02 > graph = RDF::Graph.load("
http://dbpedia.org/data/Elvis_Presley.ntriples")
graph = RDF::Graph.load("http://dbpedia.org/data/Elvis_Presley.ntriples")
{:base_uri=>#<RDF::URI:0x8097e32c(
http://dbpedia.org/data/Elvis_Presley.ntriples)>,
:content_type=>"text/rdf+n3", :file_name=>"
http://dbpedia.org/data/Elvis_Presley.ntriples"}
NameError: undefined local variable or method `content_type' for
RDF::Reader:Class
from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/reader.rb:126:in
`open'
 from
/Users/greg/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/open-uri.rb:135:in
`open_uri'
from
/Users/greg/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/open-uri.rb:518:in
`open'
 from
/Users/greg/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/open-uri.rb:30:in
`open'
from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/util/file.rb:28:in
`open_file'
 from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/reader.rb:117:in
`open'
from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/mixin/mutable.rb:40:in
`load'
 from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/model/graph.rb:95:in
`load!'
from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/model/graph.rb:56:in
`load'
 from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/model/graph.rb:84:in
`call'
from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/model/graph.rb:84:in
`initialize'
 from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/model/graph.rb:55:in
`new'
from /Users/greg/.rvm/gems/ree-1.8.7-2010.02@openmedia/gems/rdf-0.3.1/lib/rdf/model/graph.rb:55:in
`load'
 from (irb):2

It appears that the rdf gem cannot find a reader/format, and tries to throw
an error, but that is failing due to an undefined local variable called
"content_type".

I put some debugging in, and determined that inside RDF::Reader#open,
format_options is this:
{:base_uri=>#<RDF::URI:0x8097e32c(
http://dbpedia.org/data/Elvis_Presley.ntriples)>,
:content_type=>"text/rdf+n3", :file_name=>"
http://dbpedia.org/data/Elvis_Presley.ntriples"}

So I tried this next:

graph = RDF::Graph.load("http://dbpedia.org/data/Elvis_Presley.ntriples",
:format=>:ntriples)

which gave this error:
RDF::FormatError: unknown RDF format: ntriples

Anyone know what the correct way to specify the format, or what I'm doing
wrong here?

Thanks much!  Just getting started in rdf and was able to very quickly write
an rdf storage adapter for couchdb thanks to your skeleton adapter project
on github, so thanks for the awesome work on this gem!

Greg
Received on Thursday, 27 January 2011 21:51:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 27 January 2011 21:51:07 GMT