-
Notifications
You must be signed in to change notification settings - Fork 14
Description
rdflib-js produces blank nodes with underscore after : character. When the jsonld.js library tries to parse it with rdf-canonize the QUAD regex does not match with such a blank node and throws an error.
following snippet in NQuads.js does not parse the blank node: _:_g_L15C515
// parse quad
const match = line.match(REGEX.quad);
if(match === null) {
throw new Error('N-Quads parse error on line ' + lineNumber + '.');
}Quoting from NQuads specification:
RDF blank nodes in N-Quads are expressed as _: followed by a blank node label which is a series of name characters. The characters in the label are built upon PN_CHARS_BASE, liberalized as follows:
The characters _ and digits may appear anywhere in a blank node label.
The character . may appear anywhere except the first or last character.
The characters -, U+00B7, U+0300 to U+036F and U+203F to U+2040 are permitted anywhere except the first character.
Changing the regex in NQuads.js to (_:(?:[A-Za-z0-9_]+)) should solve the issue.