-
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
Spec progress #78
Spec progress #78
Conversation
* Flesh out more conversion operations. * Describe conversion relative to the YAML Representation Graph. * Stub a definition of the YAML-LD JSON profile. * Describe the YAML-LD extended profile. * Stub updated descriptions to the JSOn-LD API
Note that some references depend on broken ReSpec xrefs as discussed in https://github.com/w3c/respec/issues/4243. Apologies for a dump of changes, as I expect my time to become more limited once the RCH and RDF-star working groups get underway. PR is in progress, but early reviews and change requests to this PR are welcome. |
Suggestions from @TallTed, who never tires in his errors to make technical specifications more readable. Co-authored-by: Ted Thibodeau Jr <[email protected]>
… representation. Of course, this section requires further expansion.
…nes of how it is introduced in the JSON-LD Syntax document.
It's difficult to track the changes in the last commit, |
Well, this is a work in progress. Given the amount that's being touched, it's impractical to break it up into multiple PRs, which would all then need to be re-based against each other, and would significantly affect that amount of work that can be done. Probably best to wait until the status changes from "work in progress". Still, it does touch a lot of the document, and I apologize for that. Changes for things like |
I'm afraid that waiting until this already giant PR (GitHub won't tell me how many lines are touched, though I can easily see that ~550 lines have been added) becomes even bigger means "review the entire document" rather than "review the changes", and that's going to be a big time sink when we get there. That said, I'm (generally) OK with large PRs (though smaller remain preferable). In this case, doing the None of which is to say, stop what you're doing. More to ask that maybe this omnibus PR be merged, and another (smaller, hopefully) omnibus begun, sooner than later. I do understand the pain of addressing near-inevitable conflicts and rebasing PRs that have impacted one another. But it's better than building these docs in a wiki, as we used to do... |
Again, apologies for touching so much of the document, but I think it is now useful for developers to start implementing something. I've completed the work I intended for this PR. |
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.
Minor stuff...
@@ -943,6 +943,15 @@ <h3>Converting a <a>YAML scalar</a></h3> | |||
the conversion result is a <a>language-tagged string</a> | |||
with value taken from |n|, | |||
ane a <a>language tag</a> taken from the suffix of |t|. | |||
<div class="note"> | |||
<a>Node tags</a> including an underscore (`"_"`), |
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.
<a>Node tags</a> including an underscore (`"_"`), | |
<a>Node tags</a> including an underscore ("`_`"), |
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.
I went back and forth on this. The JSON-LD specs use "_"
instead of "_
" for equivalent quoted characters (e.g., in https://www.w3.org/TR/json-ld11/#the-i18n-namespace) That may make it more readable, if not be as accurate. If we do make the change, it needs to be done comprehensively, so I'll leave this out of this batch.
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.
Fair enough. There may be some W3-ish style guide or examples that provides guidance, or others in the WG with opinions. I can live with the "_"
style if there's general agreement that it's better, though it's not to my taste.
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.
There were about four points in the document that use this style for "_", "#", and "%23". To my mind it's easier to see these as it exists easily, given how the spec styles code blocks.
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.
I sympathize with @TallTed's argument that discussing on big PRs is not ideal, so I am in favour of merging it, and then discussing more specific points, using more targetted PRs.
In particular, I am still uncomfortable with extending the internal representation, but this can be discussed later, on the basis of the changes proposed here.
spec/index.html
Outdated
the document SHOULD use the `%YAML` directive with | ||
version set to at least `1.2` | ||
and a `%TAG` directive appropriate for each | ||
`RDF literal`. |
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.
this should not be "for each RDF literal", but "for each namespace of datatype(s) used in RDF literals of the input RDF graph", although this phrasing is not very clear either.
Also: how are implementation chose the name of such tags?
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.
this should not be "for each RDF literal", but "for each namespace of datatype(s) used in RDF literals of the input RDF graph", although this phrasing is not very clear either.
Well, in terms of iteration, it is for each "RDF literal" with the description of specifically looking at the "datatype IRIs" of those literals left unsaid.
Also: how are implementation chose the name of such tags?
As with most other RDF serialization formats, the choice of namespace prefix to use is up to a given implementation and not something that should be specified. It's perfectly legitimate to not use any %TAG
prefixes and have the node tags be full IRIs. I don't think we can say more than this.
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.
Well, in terms of iteration, it is for each "RDF literal"
Ok, now that you explain it, I understand what you meant. It is however very easy to misread the current phrasing as "there should be 1 TAG declaration per RDF literal". Furthermore...
It's perfectly legitimate to not use any %TAG prefixes and have the node tags be full IRIs.
agreed, and that's why a SHOULD seems to strong for me.
I don't think we can say more than this.
I think we should even say less 😉 i.e. and replace the SHOULD by a MAY. E.g. replacing the end of the sentence with "and MAY use %TAG
directives to make the serialization of some RDF literals more concise."
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.
I updated language and added an example in 53837c8. See if that helps.
spec/index.html
Outdated
<li> | ||
All other literals a transformed to a native <a>string</a>. | ||
</li> | ||
</ul> | ||
|
||
<p class="ednote"> | ||
An alternative would be to transform such literals to | ||
JSON-LD <a>value objects</a>, |
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.
I reallyy don't see the benefit of losing information at this stage, while the (standard) internal representation is capable of representing RDF literals through value objects...
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.
My concern was for round-tripping: how do you distinguish from something specified using a value object (or through context coercion) from something expressed natively? How would you know to express a value object using node tags? Easiest to not do that at all, and allow direct representation within the (expanded) internal representation. At least, this was the conclusion I came to when thinking about it over time.
Being able to represent more native values in the internal representation (also potentially IRIs and blank nodes) better supports the greater expressivity of alternative formats such as YAML and CBOR. And, it's largely transparent to the JSON-LD processing algorithms, other than the to/from RDF bits, so it seems a natural solution.
This was discussed in #17 (comment) on #17, and should be the topic of further discussion.
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.
Another problem is that the serialization phase comes after compaction and framing, so trying to interpret what nodes represent value objects and are eligible for being serialized using node tags could require recursively processing the internal definition of the graph as it is done in expansion in order to identify which keys represent @value
, @type
, and @language
, so the process of finding those, and replacing them with a scalar with node tag becomes much more difficult.
Consider the following:
{
"@context": {
"@vocab": "http://example.org/",
"prop": {
"@context": {
"xsd": "http://www.w3.org/2001/XMLSchema#",
"val": "@value",
"dt": "@type"
}
}
},
"prop": {
"val": "2022-08-27",
"dt": "xsd:date"
}
}
The use of an expanded internal representation retains the nature of the literal values so that they are more easily resolved into scalars with node tags.
Of course, when serialized to JSON, or using the YAML-LD JSON schema, these get flattened. The text in this PR simply turns them into strings (or numbers of boolean), but we could decide to turn them into value objects as well, which is also a reasonable direction. At that point, re-compacting might be necessary to get an expression suiting the in-scope context.
Co-authored-by: Pierre-Antoine Champin <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Ted Thibodeau Jr <[email protected]>
…or another `<p>`.
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.
Just a couple of minor tweaks above...
Co-authored-by: Ted Thibodeau Jr <[email protected]>
…ich apparently is the right way to modify a term defined in another spec.
This was discussed on today's meeting. Not ready to merge yet. @niklasl suggested an alternative to using RDF literals as part of an extended internal representation would be to simply use YAML node tags on scalars to encode value objects. This could only really work where value objects (containing {
"property": {
"@value": "2022-08-31",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
} could be serialized as: ---
property: !<http://www.w3.org/2001/XMLSchema%23date> "2022-08-31" If we allow some examination of the context, we could also probably handle: {
"@context": {
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"property": {
"@value": "2022-08-31",
"@type": "xsd:date"
}
} That could be considered as an alternative to the suggested algorithms for Converting a YAML scalar (still requiring some |
spec/index.html
Outdated
Although allowed within the YAML Grammar, some current YAML parsers | ||
do not allow the use of `"#"` within a tag URI — substituting | ||
the `"%23"` escape is a workaround for this problem, that will | ||
hopefully become unnecessary as implementations are updated. |
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.
@gkellogg I suggest to collect all these notes under "interoperability consideration", so that implementers can find them all in the same place.
<p class="issue" data-number="63"> | ||
The current text does not support this, and only supports | ||
a single <a>YAML document</a>. | ||
This is inconsistent with the processing description in <a href="#convert-stream" class="sectionRef"></a>. |
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.
@gkellogg I suggest to say that:
- ld+yaml can contain multiple documents even in the basic profile;
- they should be processed in isolation. For further details see https://github.com/ietf-wg-httpapi/mediatypes/blob/main/draft-ietf-httpapi-yaml-mediatypes.md#yaml-streams-int-yaml-streams
This is because aggregating multiple docs in a single stream is a common practice and a useful native YAML feature addressed by editors and libraries.
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.
I'm not sure what the implications for the API would be, as it doesn't really provide for separate documents.
I think this is something we come back to later.
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.
@gkellogg positive feelings provided that the comments are addressed.
On YAML -> Internal representation processing I just trust you, but I think that we will have time for tuning after releasing of a draft version.
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Discussed at today's Face to Face and resolved to merge. Resolution: https://json-ld.org/minutes/2022-09-12/#resolution-1 |
For #75.
Preview | Diff