ruby-rdf / rdf-rdfxml

Ruby RDF/XML reader/writer for RDF.rb.
http://rubygems.org/gems/rdf-rdfxml
The Unlicense
17 stars 7 forks source link

exception serializing graph #6

Closed balhoff closed 13 years ago

balhoff commented 13 years ago

I am encountering an exception when trying to serialize a graph - example code here:

https://gist.github.com/824997

It works as expected when I serialize to N-triples and convert to RDF-XML using rapper and then open in Protege.

The exception is: /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:370:in predicate': undefined methodpop' for nil:NilClass (NoMethodError) from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:339:in subject' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:337:ineach' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:337:in subject' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:334:ineach' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:334:in subject' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:408:inpredicate' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:339:in subject' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:337:ineach' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:337:in subject' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:334:ineach' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:334:in subject' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:157:inwrite_epilogue' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:155:in each' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:155:inwrite_epilogue' from /Library/Ruby/Gems/1.8/gems/rdf-0.3.1/lib/rdf/writer.rb:188:in initialize' from /Library/Ruby/Gems/1.8/gems/rdf-rdfxml-0.3.1/lib/rdf/rdfxml/writer.rb:87:ininitialize' from /Library/Ruby/Gems/1.8/gems/rdf-0.3.1/lib/rdf/writer.rb:140:in new' from /Library/Ruby/Gems/1.8/gems/rdf-0.3.1/lib/rdf/writer.rb:140:inbuffer' from /Library/Ruby/Gems/1.8/gems/rdf-0.3.1/lib/rdf/writer.rb:139:in open' from /Library/Ruby/Gems/1.8/gems/rdf-0.3.1/lib/rdf/writer.rb:139:inbuffer' from test.rb:27

balhoff commented 13 years ago

Sorry - I just realized there was a bug in my test script. I was using the RDF::List directly in a statement instead of list.subject. Sorry for the noise!

gkellogg commented 13 years ago

Never-the-less, the error reporting could have been better. I added some other changes to specs I had left out of the last release and added specific checks to be sure that subject, predicate, and object are all appropriate RDF value types.