jsonld.js icon indicating copy to clipboard operation
jsonld.js copied to clipboard

Compaction of language maps with @value aliased not as expected

Open letmaik opened this issue 9 years ago • 1 comments

(from https://github.com/json-ld/json-ld.org/issues/420)

{
  "@context": {
    "id": "@id",
    "type": "@type",
    "value": "@value",
    "skos": "http://www.w3.org/2004/02/skos/core#",
    "label": { "@id": "skos:prefLabel", "@container": "@language" },
    "qudt": "http://qudt.org/schema/qudt#",
    "symbol": "qudt:symbol",
    "UCUM": "http://www.opengis.net/def/uom/UCUM/"
  },
  "id": "qudt:DegreeCelsius",
  "label": {"en": "Degrees Celsius"},
  "symbol": {
    "type": "UCUM",
    "value": "Cel"
  }
}

When I compact that with the same context I get:

{
  "@context": {
    "id": "@id",
    "type": "@type",
    "value": "@value",
    "skos": "http://www.w3.org/2004/02/skos/core#",
    "label": {
      "@id": "skos:prefLabel",
      "@container": "@language"
    },
    "qudt": "http://qudt.org/schema/qudt#",
    "symbol": "qudt:symbol",
    "UCUM": "http://www.opengis.net/def/uom/UCUM/"
  },
  "id": "qudt:DegreeCelsius",
  "symbol": {
    "type": "UCUM",
    "value": "Cel"
  },
  "label": {
    "en": {
      "@language": "en",
      "value": "Degrees Celsius"
    }
  }
}

Why does the compaction algorithm care about how I aliased @value when trying to compact the language maps? Shouldn't it still go back to the original simple language map?

The playground at http://www.markus-lanthaler.com/jsonld/playground/ seems to handle it correctly.

letmaik avatar May 28 '16 20:05 letmaik

I found this issue now as well. Using latest release. Really confused by how the playgrounds handles this fine.

tarjelavik avatar Nov 24 '22 18:11 tarjelavik