w3c / w3c/json-ld-api

Compaction of IRIs with "@list" @container for sets of @list

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

Nobody has claimed this yet.

ErratumRaised spec:bug substantive:class 3 test:missing-coverage test:needs tests
Dominant language
HTML
Stars
106
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Compacting this document:

{
  "http://schema.org/prop": [
    {
      "@list": ["foo", "bar"]
    },
    {
      "@list": ["baz", "qux"]
    }
  ]
}

with this context:

{
  "prop": {
    "@id": "http://schema.org/prop",
    "@container": "@list"
  }
}

produces this new document:

{
  "@context": {
    "prop": {
      "@id": "http://schema.org/prop",
      "@container": "@list"
    }
  },
  "prop": [
    "baz",
    "qux"
  ]
}

which is missing the first of the two lists.

(Tested with the JSON-LD playground , PyLD, and the ruby-ld gem)

As far as I can tell, this is caused by step 12.8.7.3 of the compaction algorithm, which sets 'item active property' first to ["foo", "bar"] then to ["baz", "qux"] causing the first value to be overwritten, and lost from the compacted document.

Is this an expected consequence of the algorithm specification?

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

The issue names step 12.8.7.3 of the JSON-LD 1.1 compaction algorithm but no repository files or tests. Start by reproducing the two-list example in the JSON-LD playground, PyLD, and the ruby-ld gem, then compare the algorithm's handling of repeated @list values. Done means the specification's expected behavior and any required conformance coverage are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.