-
Notifications
You must be signed in to change notification settings - Fork 157
Clarify sets and lists #170
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
Comments
Arrays of sets are allowed as a way of providing meaning to legal JSON constructs. It's not called out explicitly within the syntax document. When converted to RDF, the arrays are effectively flattened, making them all objects of the same subject and predicate. Lists of lists is specifically not supported, and there's an API exception LISTS_OF_LISTS_DETECTED when this is encountered through various API methods. There are also tests which test for this, although we probably need more coverage. We should probably describe the interpretation within the syntax document, and explicitly defer to the API for interpretation. We might consider flattening arrays of arrays interpreted as @set during expansion, which matches the RDF data model. |
It may make sense to rename |
-1 to renaming |
Spoke with Ivan about this - he thinks we should remove @set - I agree, it's unnecessary. |
Entirely? That would remove the ability to make predictable compact JSON, so -1. Unless compaction always put values in arrays. |
There may be other ways do declare how to compact single values though. Perhaps I would actually value the ability to use that directly in the context (i.e. outside of term definitions), to set the default behavior. I've come across both kinds of situations: certain contexts are full of multiple values for the majority of the terms (e.g. bibliographical data), whereas others have been almost void of such. Most of them have at least a couple of "functional properties" though, which are never repeated. But I don't think there's a general way to determine which is the more common. What I do know is that the consumption of JSON where you don't know if the value for a specific term will be an array or not is very costly, both in JS in general (given that |
We have a compactArrays flag but that works globally, i.e., it affects all values. That being said, I share Niklas' concerns and am -1 on this for the same reasons. |
Ah, I forgot about this technical use case for @set - so, removing it comes at a cost. /cc @iherman PROPOSAL 1: Clarify why the @set keyword exists in the JSON-LD Syntax specification. Namely, it exists if developers want to selectively ensure that a term's values will always be compacted to an array in compacted form. PROPOSAL 2: Remove the @set keyword, as we have a compactArrays flag that allows the developer to specify that they always want property values to be placed into arrays. |
PROPOSAL 1: +0.5 |
PROPOSAL 1: +1 |
PROPOSAL 1: +1 |
PROPOSAL 1: +1 |
PROPOSAL 1: +1 |
1 similar comment
PROPOSAL 1: +1 |
RESOLVED: Clarify why the |
From Peter Patel-Schneider:
The text was updated successfully, but these errors were encountered: