gkellogg/rdf-rdfxml — Issue #11: 0.3.5 + JRuby 1.6.5 + Nogokiri 1.5.0 Java fails
Author: cpence
Created: 2011-12-06 17:52:10+00:00
State: open

Exporting an RDF document as XML on this combination fails with the following error:

Java::OrgW3cDom::DOMException: NAMESPACE_ERR: An attempt is made to create or change an object
in a way which is incorrect with regard to namespaces.

The document is generated by the following code:

graph = ::RDF::Graph.new
doc = ::RDF::Node.new

name = '...'
graph << [doc, ::RDF::DC.creator, name]
year = '...'
graph << [doc, ::RDF::DC.issued, year]

citation = '...'
graph << [doc, ::RDF::DC.bibliographicCitation, citation]

ourl = ::RDF::Literal.new("...", :datatype => ::RDF::URI.new("info:ofi/fmt:kev:mtx:ctx"))
graph << [doc, ::RDF::DC.bibliographicCitation, ourl]

journal = '...'
graph << [doc, ::RDF::DC.relation, journal]
title = '...'
graph << [doc, ::RDF::DC.title, title]
graph << [doc, ::RDF::DC.type, 'Journal Article']
doi = '...'
graph << [doc, ::RDF::DC.identifier, "info:doi/#{doi}"]

::RDF::Writer.for(:rdf).buffer do |writer|
writer << graph
end

(Sorry about the extra `::` everywhere, this function is in my own `RDF` module.)

Can't figure out what's up here, other than some strangeness with the Pure Java version of Nokogiri. There's an [open bug](https://github.com/tenderlove/nokogiri/issues/492) over at Nokogiri involving use of `remove_namespace`, but a cursory glance of the RDFXML code doesn't show it to be using that function.

Any idea what's up here? (Is my RDF actually secretly invalid somehow?) Thanks!