- From: Gregg Kellogg <gregg@greggkellogg.net>
- Date: Sun, 18 Jan 2015 23:49:36 -0800
- To: Jeffrey Witt <jcwitt@loyola.edu>
- Cc: "public-rdf-ruby@w3.org" <public-rdf-ruby@w3.org>
- Message-Id: <054B2639-E285-4032-B9F2-7201D15C4F57@greggkellogg.net>
Sorry you're running into these documentation problems. I answered on Stack Overflow, and will go through the documentation again and update. Some specifics about RDF::Graph were changed between 1.0 and 1.1, and you can no longer instantiate a graph using a URI, as graphs are not named. You can, however, load a graph from a URI, presuming that the location you reference actually contains triples. Alas, rdf.rubyforge.org is no longer maintained, and doesn't in any case. I'll make sure these are updated to point into the Github repos where you can find properly formatted RDF. Although obviously not perfect, you can find documentation at rubydoc.info, and consolodated RDF/Linkeddata documentation at http://rdf.greggkellogg.net/yard/index.html. Gregg Kellogg gregg@greggkellogg.net > On Jan 18, 2015, at 4:52 PM, Jeffrey Witt <jcwitt@loyola.edu> wrote: > > HI there, > > I already posted this question on stack overflow (http://stackoverflow.com/questions/28016297/trouble-initializing-graph-new-using-ruby-rdf-rb-gem <http://stackoverflow.com/questions/28016297/trouble-initializing-graph-new-using-ruby-rdf-rb-gem>), but I wasn’t getting any help. > > I wonder if anyone can help me with the following problem. > > I am trying to intitialize a graph following the documentation for the ruby RDF gem. (http://www.rubydoc.info/gems/rdf/RDF/Graph <http://www.rubydoc.info/gems/rdf/RDF/Graph>) > > Documentation provides the following example: > > graph = Graph.new("http://rubygems.org/") > I've tried to run this exact command and I get an error (which I don't really understand). (Note that I have successful loaded a graph when using a file from my local machine, so I think there is some trouble with the attempt to load a graph from an http url.) > > I'm running the command through the command line interface Gem Thor. Below is the executable file and then the error returned. > > file lbp > > #!/usr/bin/env ruby > > require 'rdf' > require 'rdf/rdfxml' > require 'rdf/ntriples' > require 'thor' > require 'pry' > > class LbpCli < Thor > desc "hello", "say hello to NAME" > def hello(name) > puts "Hello #{name}!" > end > > desc "init", "create projectifles dirs in current working directory" > def init(dir="projectfiles") > directories = ["#{dir}/Conf", "#{dir}/Textfiles", "#{dir}/citationlists"] > FileUtils.mkpath(directories) > end > > desc "projecfile", "make projetfile from SCTA" > def projectfile > graph = RDF::Graph.new("http://rubygems.org") > end > end > > LbpCli.start(ARGV) > projectfile is the relevant method. Below is the command run and the error returned. > > file lbp run with method projectfile > > $ ./lbp projectfile > /Users/JCWitt/.rvm/gems/ruby-2.2.0@lbp/gems/rdf-1..1.7/lib/rdf/model/graph.rb:126:in `initialize': Can't apply context unless initialized with `data` supporting contexts (ArgumentError) > from ./lbp:28:in `new' > from ./lbp:28:in `projectfile' > from /Users/JCWitt/.rvm/gems/ruby-2.2.0@lbp/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' > from /Users/JCWitt/.rvm/gems/ruby-2.2.0@lbp/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' > from /Users/JCWitt/.rvm/gems/ruby-2.2.0@lbp/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch' > from /Users/JCWitt/.rvm/gems/ruby-2.2.0@lbp/gems/thor-0.19.1/lib/thor/base.rb:440:in `start' > from ./lbp:45:in `<main>' > Thanks for any help you can provide, > jeff
Received on Monday, 19 January 2015 07:50:08 UTC