Skip to content

Add '@language' container type #133

Closed
@lanthaler

Description

@lanthaler

The idea of this issue is to set @container of a property to @language to allow L10n of JSON property values as shown in the following example:

{
  "@context": {
    "label": {
      "@id": "http://example.com/label",
      "@container": "@language"
    }
  },
  "@id": "http://buckingham.uk/queenie",
  "label": {
    "en": "The Queen",
    "de": "Die Koenigin"
  }
}

When expanded, this should result in:

[
  {
    "@id": "http://buckingham.uk/queenie",
    "http://example.com/label": [
      { "@value": "The Queen", "@language": "en" },
      { "@value": "Die Königin", "@language": "de" }
    ]
  }
]

Compaction might be a bit trickier if there are other properties that are not language tagged for the same property. They either have to stay under the full IRI in that case or contain at least one keyword to be distinguishable from language maps, something like:

{
  "@context": {
    "label": {
      "@id": "http://example.com/label",
      "@container": "@language"
    }
  },
  "@id": "http://buckingham.uk/queenie",
  "label": [
    {
      "en": "The Queen",
      "de": "Die Koenigin"
    },
    "No language",
    5,
    true,
    {
      "@id": "_:b1",   <-- a keyword MUST be present to distinguish an object from a language map
      "prop": value"
    }
  ]
}

Something similar was discussed before under the term "language map" (#29) and came up again in a discussion Gregg had with @vrandezo. There has also been some discussion on the mailing list:


Gregg originally proposed to use something he called "folding" for this and #134:

{
  "@context": {
    "en": {"@id": null", "@language": "en", "@fold": true},
    "de": {"@id": null", "@language": "de", "@fold": true},
    "queenie": {"@id": null", "@fold": true}
  },
  "queenie": {
    "@id": "http://buckingham.uk/queenie",
    "label": {
      "en": { "@value": "The Queen" },
      "de": { "@value": "Die Königin"}
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions