json-ld-api icon indicating copy to clipboard operation
json-ld-api copied to clipboard

Possible mistake in Context Processing Algorithm

Open timothee-haudebourg opened this issue 4 years ago • 5 comments

Hi,

Step 5.5.1 of the Context Processing Algorithm says:

If override protected is false and active context contains any protected term definitions, an invalid context nullification has been detected and processing is aborted.

The verification is done on active context (the input context of the algorithm) and not result (the context being built). as far as I understand, this means that the following context, given in compact#tpr01 should be accepted:

{
  "@context": [
    {
      "@vocab": "http://example.com/",
      "@version": 1.1,
      "protected": {"@protected": true}
    },
    null
  ]
}

...but it is not. An invalid context nullification is expected to be returned. So my conclusion is that in Step 5.5.1 of the processing algorithm, result must be used to check the presence of protected term definitions, and not the original active context. Is that correct?

timothee-haudebourg avatar Dec 19 '20 12:12 timothee-haudebourg

(I believe 5.1.1 is the step you meant).

I think 5.1.1 should check result instead of active context, so the paragraph could read as follows:

| If override protected is false and result contains any protected term definitions, an invalid context nullification has been detected and processing is aborted.

cc/ @dlongley @pchampin

gkellogg avatar Dec 19 '20 20:12 gkellogg

@iherman Should this be marked as Editorial, given our general policy about tests winning out over algorithm text?

gkellogg avatar Dec 19 '20 20:12 gkellogg

I imagine the next step (5.1.2) may need to talk about setting result back to an initial active context instead of saying it's being initialized as well. I do think it's clearly a typo/editorial.

dlongley avatar Dec 19 '20 23:12 dlongley

@iherman Should this be marked as Editorial, given our general policy about tests winning out over algorithm text?

I do not think so. If my understanding is correct, the normative description of the algorithm changes, which may, potentially, affect other implementations (even though the change is not far-reaching).

iherman avatar Dec 20 '20 05:12 iherman

Summary:

Update the Context Processing Algorithm steps 5.1.1 and 5.1.2 to look for protected term definitions in result not active context and to initialize result to an initial active context as follows:

5.1.1) If override protected is false and result contains any protected term definitions, an invalid context nullification has been detected and processing is aborted. 5.1.2) Set result as a new initial active context as defined above, and setting both base IRI and original base URL to the value of original base URL in active context, and, if propagate is false, previous context in result to the previous value of result.

gkellogg avatar Oct 16 '22 22:10 gkellogg