-
Notifications
You must be signed in to change notification settings - Fork 8
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
Define anchor usage in yaml-ld #13
Comments
|
One point where I believe YAML anchors can help are the description complex of contexts. E.g.
Notice that the scoped contexts of NB: there are other means to get rid of this redundancy in pure JSON-LD:
but they have their drawbacks that are not always acceptable. |
That's exactly the kind of discussions and examples we need :)
|
Frames specify which nodes to expand, and which nodes to merely refer to by URI. Anchors and Aliases tackle the same problem; intuitively I feel in a more general way. So: what can be the connection between them? |
I am not entirely clear on how anchors would actually affect the LD part of the picture. Having a YAML document with anchors, we're going to convert it to JSON — and in that conversion, the anchors will be resolved. Thus, a JSON-LD processor that we will subsequently use won't know anything about those anchors. This is similar to C preprocessor directives which are resolved before the source file is consumed by the compiler itself. Is that right? If yes, can't we safely ignore these particular YAML features relying upon YAML spec to describe them? |
Of course, JSON-LD does encode a graph in JSON; what used to be called a node reference is of the form The YAML anchor/alias mechanism is similar the the framing keys, and also similar in concept to the For now, I think we need to be cautions on depending on any YAML features beyond JSON re-serialization until we understand the requirements for round-tripping. a YAML-LD extended profile could allow us to move beyond what can easily be represented in JSON-LD, and we need to tread carefully. |
Anchors can be used to define fragment IDs inside YAML instance data, like attributes @ioggstream where was your proposal for such fragments? In addition to anchors, it used JSON Path to address any element in the JSON/YAML structure. Eg if at https://example.com/TheSimpsons.yaml we have: *Bart:
name: Bart Simpsons
gender: male Then the alias would be resolved to The same in plain YAML-LD would look like this: - "@id": Bart
name: Bart Simpsons
gender: male -- @anatoly-scherbakov basically says that anchors/aliases must be resolved by the YAML processor and elided, i.e. anchors can only be used locally inside one file. -- If anchor-based data sharing is necessarily local (limited to one file), then perhaps we can use it at least for blank nodes and avoid copying? Eg valve1:
temperature: *temp100C
value: 100
unit: degC
valve2:
temperature: &temp100C Should result in this turtle <valve1> :temperature _:temp100C.
<valve2> :temperature _:temp100C.
_:temp100C :value 100; :unit <degC>. and NOT this one: <valve1> :temperature [:value 100; :unit <degC>]
<valve2> :temperature [:value 100; :unit <degC>]. |
@VladimirAlexiev let me try to clarify your examples: Syntax tweak. A keyword cannot start with
|
Sharing and Cycles (Frames)Frames are quite key because they define what part of an RDF graph and how to unroll it to a JSON tree.
Agreed, and I don't even know it properly. Of course, we'll use it whole-cloth without modification. But I intuitively feel that anchors may have something to do with Frames because both address (to some degree) the problem "given a graph, how to serialize part of it as a tree".
Modularity/Structuring
JSON Schema has special modularity/structuring facilities, see https://json-schema.org/understanding-json-schema/structuring.html
So the question of YAML fragments and pointers, and how they relate to Schema fragments and JSON Pointers, is key.
Thanks!
Yes, but the alias "nodes" |
This issue was discussed on the Aug 03 meeting. |
As an json-ld editor … WHO
I want to use yaml anchors … WHAT
So that I can easily reuse content … WHY
Note
The specification should define:
example 1
example 2
Using anchor and alias nodes https://gist.github.com/ioggstream/31f3226fa9976b3baf0800f44bc19c98
The text was updated successfully, but these errors were encountered: