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

extra blank node in XML output #5

Closed balhoff closed 13 years ago

balhoff commented 13 years ago

I am trying to create some OWL content using RDF.rb. When I output using rdf-rdfxml, extra blank nodes are left behind. I think this is the result of conversion of RDF lists to parseType="Collection". The RDF output is valid but the unneeded blank nodes cause a problem for the Java OWL-API parser. Perhaps it should be more lenient, but I wondered if it was a bug in rdf-rdfxml that these blank nodes are left behind. Here are N-triples for a test graph followed by the output from rdf-rdfxml (the extra blank node is ):

N-triples: http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Class . :g2189674740 http://www.w3.org/1999/02/22-rdf-syntax-ns#rest :g2189669720 . :g2189674740 http://www.w3.org/1999/02/22-rdf-syntax-ns#first . :g2189674740 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/1999/02/22-rdf-syntax-ns#List . http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Class . :g2189669720 http://www.w3.org/1999/02/22-rdf-syntax-ns#rest http://www.w3.org/1999/02/22-rdf-syntax-ns#nil . :g2189669720 http://www.w3.org/1999/02/22-rdf-syntax-ns#first . :g2189669720 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/1999/02/22-rdf-syntax-ns#List . :g2189589100 http://www.w3.org/2002/07/owl#intersectionOf :g2189588440 . :g2189589100 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Class . :g2189588440 http://www.w3.org/1999/02/22-rdf-syntax-ns#rest :g2189583420 . :g2189588440 http://www.w3.org/1999/02/22-rdf-syntax-ns#first . :g2189588440 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/1999/02/22-rdf-syntax-ns#List . :g2189609980 http://www.w3.org/2002/07/owl#someValuesFrom . :g2189609980 http://www.w3.org/2002/07/owl#onProperty . :g2189609980 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Class . :g2189609980 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Restriction . :g2189583420 http://www.w3.org/1999/02/22-rdf-syntax-ns#rest http://www.w3.org/1999/02/22-rdf-syntax-ns#nil . :g2189583420 http://www.w3.org/1999/02/22-rdf-syntax-ns#first :g2189609980 . :g2189583420 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/1999/02/22-rdf-syntax-ns#List . :g2189675400 http://www.w3.org/2002/07/owl#intersectionOf :g2189674740 . _:g2189675400 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Class .

http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#ObjectProperty . RDF/XML: ns0:Class ns0:Class /ns0:Class /ns0:intersectionOf /ns0:Class ns0:Class /ns0:intersectionOf /ns0:Class /rdf:RDF Thanks, Jim
gkellogg commented 13 years ago

Interesting, as I've done a lot of OWL generation as well, and hadn't noticed the problem.

Indeed, processors should tolerate extra triples, as it's not unusual for processors to generate extra triples, however, I don't see why this one would be generated. It must be a problem with accounting for blank nodes consumed during hierarchical output.

Thanks for the bug report!

gkellogg commented 13 years ago

This is fixed in 0.3.1, which I just pushed to RubyGems. I did more refactoring of predicate writing.

balhoff commented 13 years ago

Thanks for the quick fix! I wrote a small test file to check the results and now I'm seeing an exception during serialization. However I get the same error when using 0.3.0, so I opened a new issue (#6).