linkeddata / rdflib.js

Linked Data API for JavaScript
http://linkeddata.github.io/rdflib.js/doc/
Other
562 stars 142 forks source link

Fix for `BlankNode` as `NamedNode` when parsing JSON-LD #555 #558

Closed RinkeHoekstra closed 1 year ago

RinkeHoekstra commented 2 years ago

The JSON-LD parser currently uses the JSON-LD flattening algorithm of jsonld.js. This algorithm assigns @id attributes to blank nodes, but the JSON-LD parser only creates a BlankNode when no @id is present.

This means that currently, the blank nodes in JSON-LD are interpreted as NamedNode, which is incorrect.

This pull request does the following:

This fixes #555

Also raised an issue in rdf-canonize (https://github.com/digitalbazaar/rdf-canonize/issues/45) to flag the problem that blank node identifiers generated by jsonld.js are not unique across loads (this is the cause of issue #405 )

bourgeoa commented 1 year ago

@RinkeHoekstra CI fails. If I only add your first commit https://github.com/linkeddata/rdflib.js/pull/558/commits/e0d332e0cb53207bbb0879626b6dc1f19e4b1b3f it does not fail locally

I think you should only keep this one and make other PR for your last 2 commits that are not directly related so I can merge your PR.

bourgeoa commented 1 year ago

resolved with https://github.com/linkeddata/rdflib.js/pull/589/commits/17052b62209a92112d21a01dd8d2cd2f5fde16a3