-
Notifications
You must be signed in to change notification settings - Fork 157
Add specifying @language to expanded form #159
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
Sorry Manu, but I fear your proposal wouldn't work in this form. We will run into problems with The other problem I see is that if we allow completely arbitrary values in language maps, one could even include a language-tagged string which is tagged with another language than the one defined by the language-map and consequently round-tripping would break. The only possible solution I see right now is to add a Nitpick: In the example above, after expansion, the value of "label" should be language-tagged strings. |
I actually think it can probably work. It involves allowing @language to be used within node definitions. When expanding, string values would be expanded to include the included @language, such as:
As long as expanding leads to expanded values (which it does), this should allow compacting by adding rules for a local @language, and keeping that when compacting recursive objects. Adding a '@context" can't be done when expanding, obviously. Otherwise, I think it can probably work, or I'm not completely understanding @lanthaler's concerns. |
I was concerned about documents like this: {
"lang-map": {
"en": [
{ "@id": "http://example.com/tags/foo", "label": "Foo.en" },
1,
"Foo.en",
{ "@value": "Foo" },
{ "@value": "Foo.type", "@type": "someType" }
],
"de": [
{ "@id": "http://example.com/tags/bar", "label": "Bar.de" },
2,
"Bar.de",
{ "@value": "Bar" },
{ "@value": "Bar.type", "@type": "someType" }
]
}
} After expansion this would become:
|
Current options under consideration by the group:
|
ACTION: Gregg to write up language-map spec text for the JSON-LD API. |
There are two proposals for supporting round-tripping of language maps in JSON-LD. Language map syntax is supported using @container: @language in a context document as specified in issue #133. This issue relates to defining expansion for language map in the case where the value is not a simple string. In the first proposal, expanded values (included typed values), node definitions and node references are given an "@language" key/value pair:
This expands to a single property, but all values have @language added, even node definitions and typed values. This allows compaction to reverse the operation and properly allocate values to language tags.
A complication is that typed values (which may also include @type) now may also contain @language. This creates some complexity when selecting the term to apply to a typed value (i.e., one may also exist which is coerced to the datatype of the value), but as this is a corner-case which is an anti-pattern, it seems acceptable. The alternative algorithm would use @langmap instead of @language for both node definitions and typed values:
This removes the ambiguity, but adds a separate keyword principally to support anti-patterns. The proposal is to implement the first solution. PROPOSAL: When expanding language maps, add @language to all expanded values, even for data-typed values. PROPOSAL: When compacting, allocate values to language map terms (if they exist) when they contain an @language key even if a term with datatype coercion matches the datatype of a value. |
I'm fine with the proposals except the expanded/typed values corner-case, so this:
Should expand to
This is completely in-line with how we treat values in expanded object form with normal properties. Name below won't be expanded to a language-tagged string:
To be consistent, we should then also language-tag booleans and numbers for simple language-tagged properties. PROPOSAL: When expanding language maps, add |
Not adding @language to already expanded values is consistent with how we process things now, but it does mean that we can't round-trip this use. We need to carefully consider if we should continue this, and risk creating a round-tripping issue. |
The same is true for simple language-tagged properties, values in expanded object form don't round-trip, and that's a feature™ :-)
Otherwise there wouldn't be a way to express a plain literal in a language-tagged property. You would have to define another property or use the full IRI instead. @linclark is it a requirement for Drupal that also things like
(this is compact form, not expanded form) round-trip cleanly? |
I'm trying to figure out where we are with this issue. We agreed that we want the simpler form of language maps in JSON-LD 1.0 - so, basically, we support only this form of language map in JSON-LD 1.0: With this context: { and this compact form: { would expand to: { PROPOSAL 4: JSON-LD 1.0 will support simple language maps. When using a language map and expanding, if the term's language key's value is not a simple string, the rule for using the language map does not apply (all language-map values get dropped). When compacting, if all statements in the list are not simple @value/@language objects, then the term that defines the language map does not match (the statements are kept in expanded form). |
Yes, this is basically what we came up with for #133:
I would suggest we close this issue by simply referencing #133. |
PROPOSAL 5: Close by referencing #133: no further actions required. |
+1 to PROPOSAL 5. |
PROPOSAL 5: +1 (as long as we move the language over that I wrote above, it makes what we're doing clearer) |
PROPOSAL 5: +1 |
2 similar comments
PROPOSAL 5: +1 |
PROPOSAL 5: +1 |
RESOLVED: Close ISSUE-159 by referencing ISSUE-133: no further actions required. |
In order to fully support language-map round-tripping, we need to be able to express that a particular piece of markup in expanded form was specified using a language map. So, in order to round-trip this language map:
We need to support this in expanded form:
To get back to this in compacted form:
The text was updated successfully, but these errors were encountered: