rdfjs / N3.js

Lightning fast, spec-compatible, streaming RDF for JavaScript
http://rdf.js.org/N3.js/
Other
714 stars 130 forks source link

Bug: `termFromId` errors on deeply nested quads #304

Closed jeswr closed 2 months ago

jeswr commented 2 years ago

This test https://github.com/rdfjs/N3.js/blob/a8cd43609e0d83edcd1f2b64d164760e68eaebb0/test/Term-test.js#L211-L213 fails as termFromId does not handle nested quads. This is because this regex (https://github.com/rdfjs/N3.js/blob/e531951ac7f3ec085fb7faab8f1d746a0f8c2fef/src/N3DataFactory.js#L13) cannot handle one of the terms being a quad.

Trying to look into a fix but am struggling to get the regex for it right.

RubenVerborgh commented 2 years ago

am struggling to get the regex for it right

If the nesting is arbitrarily deep, no regex can capture it, so we'd need to actually parse.

jeswr commented 2 months ago

Resolved in https://github.com/rdfjs/N3.js/commit/e1cc8dd41f6fe407ac224121cd85c94307e33dae