Skip to content

Add tests for type-scoped contexts defined by embedded contexts - #720

Open
skydudie wants to merge 1 commit into
w3c:mainfrom
skydudie:test/embedded-and-isolated-type-scoped-contexts
Open

skydudie wants to merge 1 commit into
w3c:mainfrom
skydudie:test/embedded-and-isolated-type-scoped-contexts

Conversation

@skydudie

Copy link
Copy Markdown

Closes #719.

Adds two tests as expand + toRdf twins (byte-identical inputs):

  • c039 — Type-scoped context defined in an embedded context. A type defined only by the node object's own embedded @context activates its type-scoped context: expansion step 11.2 resolves types against the active context after step 9, not the initial document context.
  • c040 — Outer type-scoped context does not survive a property-scoped context null reset. After a property-scoped @context: null reset, a type-scoped context defined in the outer document context must not activate; the node's own embedded definition of the same type applies. Similar to the verifiableCredential isolation pattern in the VC Data Model 2.0 context.

Expected outputs verified byte-identical across jsonld.js 8.3.3, PyLD 3.3.0, Ruby json-ld 3.3.2, Titanium JSON-LD 1.4.1 and PHP-JSON-LD. Manifest entries added to expand-manifest.jsonld and toRdf-manifest.jsonld in series order, matching neighboring entry format; inputs use absolute IRIs only.

Contributed under the W3C Patent Policy and Software and Document License.

Expansion step 11 resolves a node's types against the type-scoped
context (the active context after the node's embedded context is
processed, step 9). No existing fixture exercises the two consequences
of that wording:

- tc039: a type defined only by the node object's own embedded context
  activates its type-scoped context. Every current scoped-context
  fixture defines the type in the initial document context, where an
  implementation that wrongly resolves types against the initial
  context is indistinguishable from a conformant one.
- tc040: after a property-scoped "@context": null reset, a type-scoped
  context defined in the outer document context must not activate; the
  node's own embedded definition of the same type applies instead.
  This is the JSON-LD shape underlying VC 2.0's verifiableCredential
  credential isolation.

An implementation that resolves types against the initial document
context passes the current suite while silently dropping the terms of
any type-scoped context introduced by an embedded context. The pattern
is common in VC-shaped documents, where the divergence reaches expanded
output, N-Quads, and RDFC-1.0 hashes.

Expected outputs verified identical across jsonld.js 8.3.3, PyLD 3.3.0,
Ruby json-ld 3.3.2, and Titanium JSON-LD 1.4.1 (expand and toRdf).

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: No status

Development

Successfully merging this pull request may close these issues.

No test exercises a type-scoped context defined by an embedded context (expansion step 11.2)

2 participants