w3c / json-ld-framing

JSON-LD 1.1 Framing Specification
https://w3c.github.io/json-ld-framing/
Other
24 stars 20 forks source link

Language map with global context #126

Open Murloc6 opened 2 years ago

Murloc6 commented 2 years ago

We are trying to round trip json-ld with framing.

Our input json-ld document is:

{
  "@context": [
    {
      "@language": "en"
    },
    {
      "title": {
        "@id": "dct:title"
      },
      "titles": {
        "@id": "dct:title",
        "@container": "@language"
      }
    }
  ],
  "title": "myTitle"
}

We obtain the following triple:

_:b0 <dct:title> "myTitle"@en .

When we try to frame the data back, with round tripping, we get this result :

{
  "@context": [
    {
      "@language": "en"
    },
    {
      "title": {
        "@id": "dct:title"
      },
      "titles": {
        "@id": "dct:title",
        "@container": "@language"
      }
    }
  ],
  "titles": {
    "en": "myTitle"
  }
}

You can observe that title is transformed into titles since the input triple contain a language tag. Even though the context contains a global @language. We would expect the output to be the same as the input. It means that if there is a global @language defined in the context, the value should be defined with title and not a language map.

jsonld playground

gkellogg commented 1 year ago

This isn't a framing issue, rather it's a compaction issue. The issue should probably be moved to https://github.com/w3c/json-ld-api/issues for future tracking, but would constitute a normative change that would have to be deferred to a future version.