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

RDF-XML qname hacks attempt to modify frozen URIs in RDF.rb HEAD (0.3.0) #2

Closed bhuga closed 13 years ago

bhuga commented 13 years ago

Sorry, about all of this parsing trouble, Gregg :)

RDF.rb 0.3.0 freezes intern'd URIs to ensure thread safety. This is in HEAD and currently breaks the qname hack that rdf-rdfxml uses, which always attempts to assign a vocabulary to an intern'd URI (from qname_hacks.rb):

def self.[](property)
  @prop_uri ||= {}
  @prop_uri[property] ||= begin
    uri = RDF::URI.intern([to_s, property.to_s].join(''))
    uri.vocab = self  # => TypeError for frozen vocab
    uri
  end
end

This will be an API change for RDF.rb 0.3.0, so it'll need to be worked around somehow. I think that these URIs can probably do without interning and be okay (though of course it means that the rdf-xml parser would not be thread-safe, which is its own problem).

bhuga commented 13 years ago

See https://github.com/bendiken/rdf/issues#issue/52, where immutable URIs are discussed.

gkellogg commented 13 years ago

Fixed in rdf-rdfxml 0.3.0, which will be released to RubyGems shortly.

njh commented 13 years ago

Working for me in rdf-rdfxml version 0.3.0.