Skip to content

expand: certain keywords are dropped - #705

Open
daenney wants to merge 1 commit into
w3c:mainfrom
daenney:drop-keyword-expanded-property
Open

daenney wants to merge 1 commit into
w3c:mainfrom
daenney:drop-keyword-expanded-property

Conversation

@daenney

@daenney daenney commented Aug 5, 2026

Copy link
Copy Markdown

Step 13.4 of the expansion algorithm handles the case where a key, after IRI expansion, matches a JSON-LD keyword. It enumerates a number of keywords that are specifically handled, and ends with 13.4.17:

Continue with the next key from element.

From my understanding of it, that should mean that any key which expanded into a keyword we did not just explicitly handle is not added to the expanded document, and therefor its value is never expanded either so can't be present in the expanded document. In effect, we're dropping that key.

One interesting tidbit, this fails in the JSON-LD playground. I think my reading of the spec is correct, so I believe this is an oversight in jsonld.js. But I'm not entirely sure. The expanded result on the playground is:

[
  {
    "@base": [
      "base"
    ],
    "@container": [
      "@language"
    ],
    "@json": [
      {}
    ],
    "@none": [
      "none"
    ],
    "@prefix": [
      "prefix"
    ],
    "@preserve": [
      "preserve"
    ],
    "@version": [
      "1.1"
    ],
    "@vocab": [
      "hello"
    ]
  }
]

@daenney

daenney commented Aug 5, 2026 •

Copy link
Copy Markdown
Author

Assuming my reading is correct, should the various frame expansion keywords be added to this test as well?

@anatoly-scherbakov anatoly-scherbakov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand the point correctly then the keywords in the test should be ignored specifically for the reason that they aren't keywords in the document-root context.

Here's a classification of these.

Keyword Classification Valid JSON-LD 1.1 use
@base Context keyword Context definition
@container Term-definition keyword Expanded term definition
@import Context keyword Context definition
@json Type keyword Value of @type
@none Map index sentinel Index, id, language, or type map
@prefix Term-definition keyword Expanded term definition
@propagate Context keyword Context definition
@version Context keyword Context definition
@vocab Context/type keyword Context definition or term-definition @type
@any Algorithm sentinel Inverse-context processing
@null Algorithm sentinel Inverse-context processing
@preserve Framing-processing keyword Framing/compaction processing

Could you please also regenerate and commit tests/expand-manifest.html:

cd tests
bundle exec rake expand-manifest.html

This is the generated-file rule in tests/Rakefile.

Non-blocking: adding @protected would complete the coverage of context/term-definition-only keywords.

@w3cbot

w3cbot commented Aug 16, 2026

Copy link
Copy Markdown

anatoly-scherbakov marked as non substantive for IPR from ash-nazg.

In step 13.4 of the expansion algorithm,
https://www.w3.org/TR/json-ld11-api/#algorithm-5, a number of keywords
are listed as needing specific handling. Any keywords that do not match
in 13.4 should be dropped in 13.4.17.
@daenney
daenney force-pushed the drop-keyword-expanded-property branch from df7bd67 to 5088e31 Compare August 18, 2026 10:41
@daenney

daenney commented Aug 18, 2026 •

Copy link
Copy Markdown
Author

@anatoly-scherbakov all done I think. I added propagate protected for good measure.

@daenney

daenney commented Aug 19, 2026

Copy link
Copy Markdown
Author

Sorry, I confugred propagate and protected there. Propagate was already there, I added protected as suggested.

Something I did just notice, propagate, regardless of its value, is dropped by the JSON-LD playground. Protected is kept though no matter the value.

@niklasl niklasl moved this to Discuss-Call in JSON-LD Management Sep 16, 2026

This branch has not been deployed

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

Labels

None yet

Projects

Status: Discuss-Call

Development

Successfully merging this pull request may close these issues.

5 participants