w3c / w3c/json-ld-api

A remote context in a property-scoped context can override protected terms

Open
#708 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs discussion
Dominant language
HTML
Stars
106
Forks
40
PR merge metrics
No merged PRs in 30d

Description

I think the JSON-LD Specification and the JSON-LD Processing Algorithms and API have a bad interaction when it comes to property-scoped contexts that contain a remote context.

In the JSON-LD API spec:

4.1.2 Context Processing algorithm, step 5.2.6
Set result to the result of recursively calling this algorithm, passing result for active context, loaded context for local context, the documentUrl of context document for base URL, a copy of remote contexts, and validate scoped context.

The text here does not mention passing through override. The default for override is false, essentially resetting whatever the caller did pass.

However, in the JSON-LD spec, there is this:

4.1.11 Protected Term Definitions
[..] The second exception is that a property-scoped context is not affected by protection, and can therefore override protected terms, either with a new term definition, or by clearing the context with "@context": null.

I believe this statement conflicts with the algorithm in 5.2.6. If a property-scoped context contains a remote context, and as far as I know a property-scoped context is not limited to being a context document, the override option needs to be passed through, and not get reset to false. I believe 5.2.6 should read

[..] a copy of remote contexts, validate scoped context and override.

For a context document, ensuring that a property-scoped context can override protected terms is caught by tpr40 https://github.com/w3c/json-ld-api/blob/ffdb326121ea89b7b8280e76a5caea923834bcef/tests/expand/pr40-in.jsonld#L4-L11.

But it doesn't seem the case of a property-scoped context that contains a remote context is covered.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JSON-LD API specification's Context Processing algorithm, section 4.1.2 step 5.2.6, and compare it with the Protected Term Definitions text. Then inspect tests/expand/pr40-in.jsonld and the surrounding expand tests for coverage of a property-scoped context containing a remote context. Done means the specification and tests consistently cover the reported protected-term override case.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
api, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.