Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working #1

Closed
bhuga opened this issue Mar 14, 2010 · 2 comments
Closed

Not working #1

bhuga opened this issue Mar 14, 2010 · 2 comments

Comments

@bhuga
Copy link

bhuga commented Mar 14, 2010

This is not working for me with either REXML or Nokogiri:

repo1 = RDF::Repository.new
repo1 << RDF::Statement.new([example.a, example.prop, example.b])
RDF::Writer.open('./out.trix', :format => :trix) do | writer |
  repo1.each_statement do | statement | 
    writer << statement
  end
end

Gives:
ArgumentError: Node.replace requires a Node argument, and cannot accept a Document.
(You probably want to select a node from the Document with at() or search(), or create a new Node via Node.new().)

from /opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.1/lib/nokogiri/xml/node.rb:724:in `verify_nodeishness'
from /opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.1/lib/nokogiri/xml/node.rb:240:in `<<'
from /opt/local/lib/ruby/gems/1.8/gems/rdf-trix-0.0.3/lib/rdf/trix/writer.rb:174:in `format_triple'

And:
RDF::Writer.for(:trix).new(File.open('./out.trix','w'), :library => :rexml) do | writer |
repo1.each_statement do | statement |
writer << statement
end
end

Gives:

NoMethodError: undefined method `parent=' for nil:NilClass
from /opt/local/lib/ruby/1.8/rexml/parent.rb:19:in `<<'
from /opt/local/lib/ruby/gems/1.8/gems/rdf-trix-0.0.3/lib/rdf/trix/writer.rb:174:in `format_triple'
from /opt/local/lib/ruby/gems/1.8/gems/rdf-trix-0.0.3/lib/rdf/trix/writer/rexml.rb:88:in `call'
from /opt/local/lib/ruby/gems/1.8/gems/rdf-trix-0.0.3/lib/rdf/trix/writer/rexml.rb:88:in `create_element'
@bhuga
Copy link
Author

bhuga commented Mar 14, 2010

The statements here are wrong, but the problem persists, nonetheless:

?> dc = RDF::DC
=> RDF::Vocabularyhttp:purlorgdcterms 
>> z = RDF::Statement.new :subject => dc.author, :predicate => dc.title, :object => dc.creator, :context => RDF::OWL.sameas
=> #<RDF::Statement:0xc640a8(<http://purl.org/dc/terms/author> <http://purl.org/dc/terms/title> <http://purl.org/dc/terms/creator> .)>
>> r = RDF::Repository.new
=> #<RDF::Repository:0x18c3ed4 @data=[], @title=nil, @uri=nil, @options={}>
>> r << z
=> #<RDF::Repository:0x18c3ed4 @data=[#<RDF::Statement:0xc60d0e(<http://purl.org/dc/terms/author> http:purlorgdctermstitle http:purlorgdctermscreator ], titlenil, urinil, options{}
>> RDF::Writer.for(:trix).new(File.open('./out.trix','w'), :library => :rexml) do | writer |
?> repo1.each_statement do | statement | writer << statement end end
NoMethodError: undefined method `parent=' for nil:NilClass
from /opt/local/lib/ruby/1.8/rexml/parent.rb:19:in `<<'
from /opt/local/lib/ruby/gems/1.8/gems/rdf-trix-0.0.3/lib/rdf/trix/writer.rb:174:in `format_triple'
from /opt/local/lib/ruby/gems/1.8/gems/rdf-trix-0.0.3/lib/rdf/trix/writer/rexml.rb:88:in `call'

And with nokogiri:

?> z
=> #<RDF::Statement:0xc640a8(<http://purl.org/dc/terms/author> <http://purl.org/dc/terms/title> <http://purl.org/dc/terms/creator> .)>
>> RDF::Writer.for(:trix).new(File.open('./out.trix','w')) do | writer |
?> repo1.each_statement do | statement | writer << statement end end
ArgumentError: Node.replace requires a Node argument, and cannot accept a Document.
(You probably want to select a node from the Document with at() or search(), or create a new Node via Node.new().)

from /opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.1/lib/nokogiri/xml/node.rb:724:in `verify_nodeishness'
from /opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.1/lib/nokogiri/xml/node.rb:240:in `<<'
from /opt/local/lib/ruby/gems/1.8/gems/rdf-trix-0.0.3/lib/rdf/trix/writer.rb:174:in `format_triple'

(Why isn't there a preview button here?!)

@bhuga
Copy link
Author

bhuga commented Mar 14, 2010

When I grow a brain and use the right repo, it works. I will try and track down the 'no context URL' issue.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant