Description
Hi,
This error might be related to issue: #20, but it's super-easy to reproduce when attempting to parse the W3C Bookmark vocabulary here.
To reproduce the error, simply save the trivial JavaScript below as index.js
and then execute:
npm init
npm i rdfxml-streaming-parser
curl http://www.w3.org/2002/01/bookmark# -o bookmark.rdf
node index
Index.js:
const RdfXmlParser = require("rdfxml-streaming-parser").RdfXmlParser;
const fs = require('fs');
const myParser = new RdfXmlParser();
fs.createReadStream('./bookmark.rdf')
.pipe(myParser)
.on('data', console.log)
.on('error', console.error)
.on('end', () => console.log('All triples were parsed!'));
I see the following error:
[rdfxml]$ node index
Error: Found invalid baseIRI '' for value ''
at Object.resolve (/home/pmcb55/Work/Projects/tmp/rdfxml/node_modules/relative-to-absolute-iri/lib/Resolve.js:22:19)
at RdfXmlParser.valueToUri (/home/pmcb55/Work/Projects/tmp/rdfxml/node_modules/rdfxml-streaming-parser/lib/RdfXmlParser.js:153:63)
at RdfXmlParser.onTagResource (/home/pmcb55/Work/Projects/tmp/rdfxml/node_modules/rdfxml-streaming-parser/lib/RdfXmlParser.js:335:73)
at RdfXmlParser.onTag (/home/pmcb55/Work/Projects/tmp/rdfxml/node_modules/rdfxml-streaming-parser/lib/RdfXmlParser.js:231:18)
at SAXStream.emit (events.js:314:20)
at SAXParser.me._parser.<computed> [as onopentag] (/home/pmcb55/Work/Projects/tmp/rdfxml/node_modules/sax/lib/sax.js:258:17)
at emit (/home/pmcb55/Work/Projects/tmp/rdfxml/node_modules/sax/lib/sax.js:624:35)
at emitNode (/home/pmcb55/Work/Projects/tmp/rdfxml/node_modules/sax/lib/sax.js:629:5)
at openTag (/home/pmcb55/Work/Projects/tmp/rdfxml/node_modules/sax/lib/sax.js:825:5)
at SAXParser.write (/home/pmcb55/Work/Projects/tmp/rdfxml/node_modules/sax/lib/sax.js:1391:13)
[rdfxml]$
I'm using RdfXmlParser in a generic vocab processing library, which parses a user-configurable list of vocabularies, so configuring RdfXmlParser just to specifically handle this particular vocabulary wouldn't be pretty (i.e., the out-of-box RdfXmlParser has worked fine for any RDF/XML vocabs I've encountered so far, so getting it to work with http://www.w3.org/2002/01/bookmark# without changing anything would be really good!).
BTW, I assume http://www.w3.org/2002/01/bookmark# is a valid RDF/XML vocab (I refuse to even try to grok RDF/XML!), as EasyRDF converts that URL to Turtle without any complaint. (So my workaround right now is to copy that converted Turtle to a local file, and configure my tool to parse that local Turtle instead of the official RDF/XML served up from http://www.w3.org/2002/01/bookmark# :( !)