Skip to content

Support recursive @list usage #36

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

Closed
gkellogg opened this issue Jul 25, 2018 · 5 comments
Closed

Support recursive @list usage #36

gkellogg opened this issue Jul 25, 2018 · 5 comments
Assignees
Labels
satisfied Requirement Satisfied spec:enhancement

Comments

@gkellogg
Copy link
Member

From Should we support lists of lists?

We did not support recursive RDF lists in 1.0 due to perceived complexity and lack of a use case. Since then there are numerous use cases that can make use of recursive lists in JSON-LD, and it goes further towards full idiomatic support of RDF 1.1 in JSON-LD.

Changes to the syntax document are minimal, there are substantial API implications.

@gkellogg gkellogg self-assigned this Jul 25, 2018
@gkellogg
Copy link
Member Author

I'm actively working on tests and algorithms to support this now; compaction and expansion are reasonably easy. A review of Flattening shows some errors in that algorithm, and potentially missing tests. Biggest changes will be to the FromRDF algorithm, as the list support there is complicated already.

gkellogg added a commit to w3c/json-ld-api that referenced this issue Aug 3, 2018
…tion, flattening and to/from RDF conversion. Also adds tests.

For w3c/json-ld-syntax#36.
@gkellogg
Copy link
Member Author

gkellogg commented Aug 3, 2018

There are numerous tests in the API PR w3c/json-ld-api#16 that show how this looks.

Compacted list containing embedded lists, simply continues to expand embedded arrays:

{
  "@context": {"foo": {"@id": "http://example.com/foo", "@container": "@list"}},
  "foo": [["baz"]]
}

expands to

[{
  "http://example.com/foo": [{"@list": [{"@list": [{"@value": "baz"}]}]}]
}]

which is equivalent to the following Turtle

[<http://example.com/foo> (("baz"))] .

Algorithms support arbitrary depth and mixed elements.

@iherman
Copy link
Member

iherman commented Aug 4, 2018

I do not have any problem having this but I think the syntax document should include some explicit statements and examples for the case of lists of lists. It is not clear from the text in the syntax document whether the syntax above is permitted or not...

@gkellogg
Copy link
Member Author

gkellogg commented Aug 4, 2018

I started with the API, to make sure I had a solution that worked. I still need to update the syntax document for grammar, explanation and examples, which I’ll do presently.

@azaroth42
Copy link
Contributor

Given this issue is syntax, and we agreed to include it in the syntax, flagging as editorial and removing needs discussion.

@ghost ghost removed the spec:editorial label Aug 11, 2018
gkellogg added a commit to w3c/json-ld-api that referenced this issue Aug 11, 2018
…tion, flattening and to/from RDF conversion. Also adds tests.

For w3c/json-ld-syntax#36.
@azaroth42 azaroth42 added the satisfied Requirement Satisfied label Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
satisfied Requirement Satisfied spec:enhancement
Projects
None yet
Development

No branches or pull requests

3 participants