-
Notifications
You must be signed in to change notification settings - Fork 152
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
Expanded form - expand all native types to @value form? #115
Comments
For the record, here's the full IRC protocol:
|
There are often multiple ways to describe the same value in JSON-LD; the original purpose of "expanded form" was to represent all values in the "longest" or most "expanded" way. There were no optimizations in this form, as these were left to compaction, where the specific optimizations used were specified by the context. By removing @value in expanded form, we've introduced an optimization because it's more "compact" -- and this is counter-intuitive to the purpose of expanded form and somewhat conflates the two forms. I would support always using @value in expanded form for this reason and because I believe it results in a more regular output. |
I agree that the expanded output should be very predictable and regular, but going as far as putting every scalar in an object is the wrong direction in my opinion. I don't think it will make client code any easier and would also have the disadvantage of increased memory usage due to the plethora of objects that have to be instantiated. E.g., is it easier to deal with prop1 or prop2 in the example below?
I would argue dealing with prop2 is easier.. Instead of having to check
a simple Please note that my argumentation here implies that all objects have to be "compacted" to the most basic representation during expansion - but the code doesn't get much more complex due to that since we already support that. So there should definitely be a unique representation for every value in expanded output. I argue it should be the simplest one and not the most verbose one. The reasoning behind this is that I expect that a lot of developers will probably never use a language/type and if they do, they will know the consequences. |
On a related note, something like
should probably be converted to
during expansion. |
RESOLVED: In general, for expansion, ensure that all property values are expressed in expanded value form (e.g. PROPOSAL: In expanded form, |
The question I ask myself now is why we treat As we already opened the door, we could as well allow what @niklasl wanted to have some time ago:
|
In a discussion of issue #114 between @gkellogg, @dlongley, and myself it was also discussed to change the shape of expanded documents to always use the expanded object form. The means, that instead of using just a native datatype as the value of a property, the value of every property (except
@id
and perhaps@type
) would be in expanded object form. So, e.g., the following documentwould be expanded to
I wouldn't particularly like this as it bloats the document up quite a bit without much (any?) advantages. I believe the overhead (due to the number of necessary object instantiations) would be considerable and don't really see the uniformity that Gregg and Dave see.
The text was updated successfully, but these errors were encountered: