w3c / w3c/json-ld-api

Lists, sets, and multisets

Open
#473 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi it's me again,

I am confused about the use of the term "set" to describe @set objects. In the section Lists and Sets it is said that

A set represents an unordered set of values

Section 4.3.2 it is said that

While @list is used to describe ordered lists, the @set keyword is used to describe unordered sets.

So I thought to be correct assuming that I could optimize @set objects by removing duplicate values (using a set data structure internally), since it is described as an unordered set, a opposed to @list objects defined as an ordered list.

Now trying to pass the expansion tests, I cannot pass test 27 as it is indicated that "Duplicate values in @list and @set are not merged" which is not mentioned in the specification sections associated to @list and @set, and also means that a @set object is, in fact, not a set, but a multiset.

Note that I understand that @set is just syntactic sugar, associating multiple values to a subject property. Forcing an implementation to keep duplicate values in @set objects implies that duplicate RDF triples would have some kind of meaning, which they have not since a RDF graph is a set of triples, not a multiset.

Am I correct in my conclusion or is there something wrong with the expansion test 27? Or did I miss the explanation in the spec? Or is it just to avoid further complications (like, what should we do if there is a duplicate occurrence of the same node object, with the same id but not the same properties, etc.)

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 by comparing the JSON-LD 1.1 sections on Lists and Sets and section 4.3.2 on sets with expansion test 27 at tests/expand/0027-in.jsonld. Review the linked specification wording and test expectation together. Done means the duplicate-value behavior is unambiguous and any needed specification or test clarification is agreed upon.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.