Skip to content
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

Remove Natural Language Value #46

Closed
jasnell opened this issue Nov 3, 2014 · 3 comments
Closed

Remove Natural Language Value #46

jasnell opened this issue Nov 3, 2014 · 3 comments

Comments

@jasnell
Copy link
Collaborator

jasnell commented Nov 3, 2014

See: http://lists.w3.org/Archives/Public/public-socialweb/2014Nov/0010.html

"The "Natural Language Value" construct in AS2 was originally added
before the serialization of AS2 was formally based on JSON-LD. The
mechanism is intended to provide a default language context for the
document, but it's not entirely compatible with the JSON-LD mechanisms
and requires a pre-processing step to be implemented before successful
JSON-LD processing... At this point, I think it makes sense to simply remove the Natural
Language Value construct and rely specifically on the JSON-LD
mechanisms to eliminate the additional pre-processing step. Doing so
makes things a bit more reliant on JSON-LD but simplifies things
overall."

@jasnell
Copy link
Collaborator Author

jasnell commented Nov 3, 2014

Related to #21

@jasnell
Copy link
Collaborator Author

jasnell commented Nov 5, 2014

Due to the way @language works within JSON-LD, there are a couple of gotchas in the way AS 2.0 is currently defined. The original goal was to make it so that a single "language sensitive" property like "displayName" could be either a literal string or a language-map... e.g.

{
  "displayName": "Foo"
}

or

{
  "displayName": {
    "en": "Foo",
    "fr": "Bar"
  }
}

This has advantages and disadvantages. One key disadvantage is that it simply does not work properly in JSON-LD without additional processing. The correct JSON-LD approach would be to map distinct terms in the JSON-LD @context, e.g.

{
  "@context": {
    ...,
    "displayName": "as:displayName",
    "displayNameMap": {
      "@id": "as:displayName",
      "@container": "@language"
    },
    "title": "as:title",
    "titleMap": {
      "@id": "as:title",
      "@container": "@language"
    },
    ...
  }
}

When run through the JSON-LD algorithms, things just work as expected. In the serialized compacted JSON-LD... the choices become:

{
  "displayName": "Foo"
}

and

{
  "displayNameMap": {
    "en": "Foo",
    "fr": "Bar"
  }
}

The advantage here is that "displayName" is always just a literal string, whereas "displayNameMap" is always a Language Map. It requires us to track one additional term for each language-sensitive field, but the advantage is greater consistency and less weirdness. Which is always good

@jasnell
Copy link
Collaborator Author

jasnell commented Dec 4, 2014

Covered by current Editor's draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants