w3c / w3c/json-ld-api

Recursively nested properties and compaction

Open
#391 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

defer-future-version
Dominant language
HTML
Stars
106
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Following the discussion in #380, I have a question:

Consider the following data:

{
  "@context": {
    "foo": "http://example.org/foo",
    "bar": "http://example.org/bar",
    "baz": "http://example.org/baz",
    "n1": "@nest",
    "n2": "@nest"
  },
  "foo": "FOO",
  "n1": {
    "bar": "BAR",
    "n2": {
      "baz": "BAZ"
    }
  }
}

Can I expand it and compact it back to the same shape (including the doubly-nested property baz)?

I gave it a try there but with no luck.

If this is indeed impossible, I'm not suggesting we should fix it now. But I'm trying to decide how bad it is if we introduce an asymmetry between expansion and compaction wrt nested properties in #388. If it appears that the asymetry is already there (in the example above), that would help be byte the bullet.

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 discussion in #380 and the proposed asymmetry in #388, then reproduce the supplied example in the linked JSON-LD Playground. Compare expansion and compaction for the doubly nested @nest properties; done means documenting whether the original shape can be round-tripped and what that implies for the proposed change.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
api, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.