-
Notifications
You must be signed in to change notification settings - Fork 157
This adds a @nest
member to term definitions used for _transparent properties_
#453
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
Conversation
@@ -4058,6 +4112,7 @@ | |||
"invalid language mapping", | |||
"invalid language-tagged string", | |||
"invalid language-tagged value", | |||
"invalid @nest value", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move up sorted with other @ values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, the @
was added later. Should be good now.
@@ -4134,6 +4189,8 @@ | |||
associated language tag was detected.</dd> | |||
<dt><dfn>invalid local context</dfn></dt> | |||
<dd>In invalid <a>local context</a> was detected.</dd> | |||
<dt class="changed"><dfn>invalid @nest value</dfn></dt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move up sorted with other @ values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth considering a different keyword, instead of @nest, in case the ability to handle semantically significant nested properties is eventually added to JSON-LD, such as distinguishing the different uses of the "location" property below (vehicle.location versus file.location):
{
"@context": ...
vehicle: {
make: "Honda",
location: "123 Main Street, Cambridge MA"
},
file: {
type: "text/html",
location: "/tmp/foo.html"
}
};
It seems like the functionality in this PR is more akin to 'flatten'. Not sure what other keywords might chosen instead.
@dbooth-boston Flattening is an entirely different concept, which takes nested node definitions and flattens them so that nodes only reference other nodes, rather than include them. @dlongley suggested However, the use case you may be looking for could be handled using scoped contexts, there interpretation of "location" is different for "file" vs "vehicle". This was the subject of a recently merged change. But, that does imply that both "file" and "vehicle" refer to different entities, rather than are each properties of the containing node, which is more consistent with what I think you want. As for a |
I was thinking of _.flatten from http://underscorejs.org/#flatten -- not the JSON-LD concept of flattening. I should not have used that word. Sorry for the confusion! Yes, the use case I was mentioning would be the ability to distinguish between properties (of the same name) by their object ancestors, as illustrated above. This came up a couple of years ago when we were originally trying to see if FHIR/JSON could be adapted to be JSON-LD. We concluded that it could not without either changing the existing property names or inserting additional @contexts into the instance data -- neither of which would be palatable to the vanilla FHIR/JSON folks. |
# Conflicts: # spec/latest/json-ld-api/index.html # spec/latest/json-ld/index.html # test-suite/tests/compact-manifest.jsonld # test-suite/tests/error-manifest.jsonld # test-suite/tests/expand-manifest.jsonld
This introduces the
@nest
keyword, used for folding contained properties to the enclosing node object, and allows for@nest
in a term definition, to introduce such nesting when compacting.Fixes #246. This also is an alternative to PR #451 and is (mostly) independent of #449).
In contrast to #451, having a parallel
@nest
term definition property allows this to be used in conjunction with@container
(but not for@reverse
compaction).There are several new expand, compact and error tests for this feature.
Formatted HTML versions are available for JSON-LD, and JSON-LD-API on my personal fork.