Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape IRIs #31

Open
clehner opened this issue Sep 28, 2020 · 0 comments
Open

Escape IRIs #31

clehner opened this issue Sep 28, 2020 · 0 comments

Comments

@clehner
Copy link

clehner commented Sep 28, 2020

In lib/NQuads.js, string literals are escaped. But IRIs are not.

RDF 1.1 N-Quads includes this production:

[10] IRIREF::='<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>'

Here is a test showing a statement with a IRI that does not match the IRIREF production, which is parsed without error and serialized without escaping.

const assert = require('assert');
const canonize = require('.');
const NQuads = require('./lib/NQuads');

function assertIsCanonical(line) {
  var stmt = NQuads.parse(line)[0]
  var out = NQuads.serializeQuad(stmt);
  assert.equal(line, out);
}

// this should fail, but it currently passes:
assertIsCanonical('<urn:ex:s"{}\t|^`\\> <urn:ex:016> "asdf" .\n')

I also opened an issue about this on the test suite:
w3c-ccg/rdf-dataset-canonicalization#15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant