w3c / w3c/json-ld-syntax

Expected interaction between nested properties and contexts?

Open
#469 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
139
Forks
23
PR merge metrics
No merged PRs in 30d

Description

We're encountering a situation where we want a nested property to have a different vocabulary than the parent. The spec states that such properties are "semantically transparent."

A nested property is used to gather properties of a node object in a separate map, or array of maps which are not value objects. It is semantically transparent and is removed during the process of expansion. Property nesting is recursive, and collections of nested properties may contain further nesting.

Semantically, nesting is treated as if the properties and values were declared directly within the containing node object.

(https://www.w3.org/TR/json-ld/#property-nesting)

What we want to do is have a top level vocabulary within which Dublin Core Terms may be nested. There are a handful of name collisions between our vocabulary and Dublin Core (description, identifier, and title). Our proposed solution is to put the Dublin Core properties under a nested dublinCore property with the appropriate @vocab and scoped redefinitions of the properties with colliding names.

Some implementations (we've tested the playground and https://github.com/digitalbazaar/jsonld.js) seem to interpret "semantically transparent" as meaning any @context defined for a nested property is ignored during expansion. Properties with matching names are included, but with the base namespace; other properties are discarded. At least one implementation (https://github.com/filip26/titanium-json-ld) does what I'd regard as the right thing and takes the sub-@context into account. You can see a test file at https://gist.github.com/hcayless/ba8b7d0ea16a00c4f355540f7f03632b and the diff between the ld-cli (Titanium) and jsonld-cli (DigitalBazaar) parsing of that file into n-quads at https://gist.github.com/hcayless/5852f25d57b4f11446808c0363dc5110/revisions.

Does "semantically transparent" mean that the nested property gets bypassed during expansion while its child properties retain any context defined for it? Or does it mean that nested properties are treated as though they didn't exist at all and can supply no further context? Is this an ambiguity in the spec?

cc: @PonteIneptique

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 linked test file and compare the expansion and N-Quads outputs from the JSON-LD playground, jsonld.js, and Titanium JSON-LD implementations. Review the JSON-LD property-nesting and expansion specifications; done means the nested-context behavior is clarified and the expected interpretation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.