json-ld-api
json-ld-api copied to clipboard
Possible mistake in Context Processing Algorithm
Hi,
Step 5.5.1 of the Context Processing Algorithm says:
If
override protectedis false andactive contextcontains any protected term definitions, aninvalid context nullificationhas 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?
(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
@iherman Should this be marked as Editorial, given our general policy about tests winning out over algorithm text?
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.
@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).
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
falseand 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 isfalse, previous context in result to the previous value of result.