rdfjs / N3.js

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

BlankNode prefix missing in value #336

Closed MarcusElevait closed 1 year ago

MarcusElevait commented 1 year ago

Is there a reason, why the prefix of a BlankNode id is cut of in the value of the BlankNode? image

We're currently try to convert the parsed output to jsonld with the jsonld library and lists are not converted properly and from what i have seen during my research is that this missing prefix could be the problem.

jeswr commented 1 year ago

It is the same reason that Literals don't contain starting and ending quotes " in their value and NamedNodes don't include angular brackets in their value. The value is not meant to assist with serialization, that is the job of the serializer to do it correctly.

You will find that other libraries like rdf-data-factory will have exactly the same behavior.

In the case of the jsonld library it has never been properly RDF/JS compatible - and the issue you point out is a problem on their end. You can see here that the Inrupt libraries are doing a conversion when the jsonld parser is used https://github.com/inrupt/solid-client-js/blob/cf381af7eb0ca77853d90aa2ef49013986837eed/src/formats/jsonLd.ts#L120-L121. We are migrating to use jsonld-streaming-parser at the moment which doesn't have this issue https://github.com/inrupt/solid-client-js/pull/1914/files.

MarcusElevait commented 1 year ago

Ah okay, thanks for pointing this out. This is really bad news, because as long as the jsonld library is not compliant with the specification, we can't trust our process when using multiple libraries for multiple conversion steps. I will close this issue then :-)