rdfjs/rdfxml-streaming-parser.js

Let baseIRI option take precedence over empty base IRI in data

ekulno opened this issue · 3 comments

I have a rdf-xml file with an empty base IRI and a resource with rdf:about="foo". When trying to parse this file with rdfxml-stream-parser, I get an error:

ParseError: Invalid URI: foo

I was hoping I'd be able to work around this by supplying a baseIRI in the options of the RdfXmlParser class. But the empty base IRI in the data takes precedence over my supplied baseIRI. This is different from the N3 stream parser, which will prioritize the baseIRI given in the options if the base IRI in the data is an empty string. If this approach could be applied to rdfxml-streaming-parser this would be helpful for me as it would allow me to parse http://www.w3.org/ns/earl# , which has an empty base IRI and a resource with the empty string as a relative IRI.

That actually seems to indicate a bug in this parser (here).
xml:base can actually be relative to the current document IRI, which is the case when setting it to an empty string.

Thanks for reporting!

Fixed in 1.3.5.

Thank you for the quick response and fix!