Skip to content

Instantly share code, notes, and snippets.

@kasei
Last active January 6, 2020 19:44
Show Gist options
  • Save kasei/c26e10b0defadcc9ab9143782b644087 to your computer and use it in GitHub Desktop.
Save kasei/c26e10b0defadcc9ab9143782b644087 to your computer and use it in GitHub Desktop.
JSON-LD 1.1 issue with test for overriding protected terms in property-scoped context

Test tpr19 includes a property-scoped context that includes a null value:

    "protected2": {
      "@id": "ex:protected2",
      "@context": [
        null,
        {
          "protected1": "ex:protected3"
        }
      ]
    },

When Context Processing is called during expansion of the "protected2" key, why does the first (null) context value here not trigger the error condition in Context Processing step 5.1.1?

5 For each item context in local context:

5.1 If context is null:

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

@kasei
Copy link
Author

kasei commented Jan 3, 2020

This seems to impact tests tpr06, tpr14, tpr15, tpr16, tpr19.

@gkellogg
Copy link

gkellogg commented Jan 3, 2020

The design is that property scoped contexts can null out protected contexts, which was the result of some considerable WG discussions.

This is supported by step 6 of the expansion algorithm passing true for override protected, which allows this behavior.

Issue 90 (w3c/json-ld-api#90) should shed some light on the reasoning.

@kasei
Copy link
Author

kasei commented Jan 3, 2020

@gkellogg – The step 6 you seem to be referring to is in the compaction algorithm. I can't figure out if there is something similar in the expansion algorithm.

@kasei
Copy link
Author

kasei commented Jan 3, 2020

There doesn't seem to by any use of the string "override protected" in the expansion algorithm.

@gkellogg
Copy link

gkellogg commented Jan 3, 2020

Looks like that parameter is missing from step 8 of the expansion algorithm.

@gkellogg
Copy link

gkellogg commented Jan 3, 2020

It should say the following:

If property-scoped context is defined, set active context to the result of the Context Processing algorithm, passing active context property-scoped context as local context, and true for override protected.

@kasei
Copy link
Author

kasei commented Jan 3, 2020

@gkellogg yes, that seems right, and fixes the tests.

@kasei
Copy link
Author

kasei commented Jan 3, 2020

@gkellogg do you want me to file an issue for this?

@gkellogg
Copy link

gkellogg commented Jan 3, 2020

Yes, that will keep the provenance correct. Otherwise, I could update it, but in this case it's better to have an issue to track it to.

@kasei
Copy link
Author

kasei commented Jan 6, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment