-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I got a crash when trying to serialize a graph containing rdf:XMLLiteral terms. I went and pulled them out of the store, and the few terms in the repository that are XML literals, the datatype is a String:
[11] pry(#<Intertwingler::CLI>)> lol.dump :turtle
NoMethodError: undefined method `invalid?' for "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral":String (NoMethodError)
return false if datatype? && datatype.invalid?
^^^^^^^^^
from /var/lib/gems/3.2.0/gems/rdf-3.3.2/lib/rdf/model/literal.rb:447:in `valid?'
I have tracked down the culprit; looks like and it's ostensibly specific to XML literals:
require 'rdf'
require 'rdf/ntriples'
require 'rdf/xsd'
test = RDF::NTriples::Reader.parse_object('"<strong xmlns=\"http://www.w3.org/1999/xhtml\">hi</strong>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>')
test.datatype
# "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"Now: run this code again, commenting out require 'rdf/xsd'.
It looks like the RDF::XSD constructor does not coerce the datatype:
Line 40 in e55b14b
| @datatype = datatype || DATATYPE |
…probably just putting RDF::URI(datatype) would fix this bug.
Metadata
Metadata
Assignees
Labels
No labels