w3c / w3c/json-ld-api

Test compact#t0080 is wrong

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

Nobody has claimed this yet.

spec:bug substantive:class 3
Dominant language
HTML
Stars
106
Forks
40
PR merge metrics
No merged PRs in 30d

Description

The test compact#t0080 is wrong, IMO.
The input (which is in expanded form) corresponds to the following dataset:

_:b0 <http://example.org/input> <http://example.org/gid> .
_:b1 <http://example.org/value> "x" <http://example.org/gid> .

however, the expected compacted result expands to the following dataset:

_:b0 <http://example.org/input> _:b1 .
_:b2 <http://example.org/value> "x" <http://example.org/gid> .

(and the JSON-LD expanded form has an extra level of @graph compared to the original input).

As noted by @gkellogg in a comment on a related issue:

the value of input (...) is not an anonymous named graph. (...) Arguably, the input term should not be chosen, as it doesn't match.

Given the discrepancy between the input and the output, I would argue that the input term MUST not be chosen. The output of compact#t0080 should be:

{
  "@context": {
    "@vocab": "http://example.org/",
    "input": {
      "@container": "@graph"
    }
  },
  "http://example.org/input": {
    "@graph": {
      "value": "x"
    },
    "@id": "http://example.org/gid"
  }
}

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 compact#t0080 entry in the compact manifest and compare its input and expected output with the discussion in issue 512, especially the linked comment. Resolve whether the input term may be selected under the JSON-LD compaction rules, then update the test expectation only if the standard requires it and verify the expanded datasets match.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
data, testing-qa
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.