jsonld.js icon indicating copy to clipboard operation
jsonld.js copied to clipboard

Normalization options differ from pyld

Open lemoustachiste opened this issue 3 years ago • 0 comments

Hi,

I was facing another normalization issue today and I have found that with javascript we use jsonld.normalize with expandContext https://github.com/digitalbazaar/jsonld.js/blob/main/lib/jsonld.js#L536, while pyld does not offer the same option https://github.com/digitalbazaar/pyld/blob/master/lib/pyld/jsonld.py#L247.

We use pyld on the issuing side and jsonld.js on the verification side, so having different options for normalize yields a different result.

Given this context:

[
    "https://www.w3.org/2018/credentials/v1",
    {
      "Blockcerts": {
        "@id": "bc:Blockcerts",
        "@type": "@id"
      }
    },
    "https://w3id.org/blockcerts/v3"
],

With JS, I have this output:

<urn:uuid:41015b98-fc99-447c-b211-ef6782147fb3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/blockcerts#Blockcerts> .

While with PY, I have this one:

<urn:uuid:41015b98-fc99-447c-b211-ef6782147fb3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <bc:Blockcerts> .

So I can stop passing the expandContext option, but I'd like to understand the implication of doing so. And also, why this option is not available in Python?

lemoustachiste avatar Apr 05 '22 19:04 lemoustachiste