Skip to content

Escape IRIs #31

Open
Open
@clehner

Description

@clehner

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions