Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of lists? #428

Open
puckipedia opened this issue Feb 17, 2024 · 3 comments
Open

List of lists? #428

puckipedia opened this issue Feb 17, 2024 · 3 comments

Comments

@puckipedia
Copy link

Section 4.3.1 of the JSON-LD 1.1 spec suggests that lists of lists are "fully supported", and this is also what the API implements. However, this section is non-normative, and what I believe to be the normative text for list objects and set objects suggests that it is, in fact, not possible to nest lists or sets in other lists or sets. What's going on here?

@VladimirAlexiev
Copy link

@puckipedia

  • (It's better to read https://w3c.github.io/json-ld-syntax/#lists-and-sets, though in this case I think there's no difference).
  • Can you elaborate "suggests that it is, in fact, not possible to nest"?
    The last bullet says "an array of zero or more of the above possibilities", so I think this allows nested lists?

@puckipedia
Copy link
Author

puckipedia commented Mar 27, 2024

No, it doesn't; as that bullet ("an array of zero or more of the above possibilities") allows the JSON-LD to contain both, say:

{
    "@list": "foo"
}

and

{
    "@list": ["bar", "baz"]
}

but, note the conspicuous lack of list objects and set objects that may be contained inside list and set objects. (and no, list and set objects aren't subsets of value ar node objects, I checked.) This also doesn't allow for arrays of arrays of e.g. value objects, as it says "of the above possibilities", which excludes itself.

@Peeja
Copy link

Peeja commented Aug 23, 2024

I think @puckipedia is right. A list within a list looks like:

{
  "http://example.com/list-of-lists": {
    "@list": [
      { "@list": ["foo", "bar"] },
      { "@list": ["baz", "quux"] }
    ]
  }
}

The playground accepts this as one would expect from intuition and the non-normative text. But as @puckipedia says, the normative text doesn't appear to account for it. It says a list of set can contain:

A list or a set is neither a node object nor a value object. The last bullet supports actually putting more than one thing in the (top-level) list or set, not nesting them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants