- From: Jeffrey Witt <jcwitt@loyola.edu>
- Date: Mon, 19 Jan 2015 00:52:03 +0000
- To: "public-rdf-ruby@w3.org" <public-rdf-ruby@w3.org>
- Message-ID: <D0E1BF60.24F8C%jcwitt@loyola.edu>
HI there, I already posted this question on stack overflow (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) 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:09:50 UTC