Differences in IRI compaction of "@id" and "@type"

Hi,

I'm wondering about the differences in JSON-LD API's IRI compaction (
https://www.w3.org/TR/json-ld-api/#iri-compaction) of "@id" and "@type".
When I compact the following data:

{
  "@type": "http://example.com/A",
  "http://example.com/property": {"@id": "http://example.com/B"}
}

With the following JSON-LD context:

{
  "@vocab": "http://example.com/",
  "ex": "http://example.com/",
  "AliasedA": "A",
  "AliasedB": "B",
  "property": {"@type": "@id"}
}

The JSON-LD Playground (https://json-ld.org/playground, running jsonld.js
compliant with JSON-LD 1.1) returns the following compacted data:

{
  "@context": {
    "@vocab": "http://example.com/",
    "ex": "http://example.com/",
    "AliasedA": "A",
    "AliasedB": "B",
    "property": {
      "@type": "@id"
    }
  },
  "@type": "AliasedA",
  "property": "ex:B"
}

While the value of "@type" is compacted to its alias term, the value of
"@id" is only compacted using a prefix definition, not its alias term.

Link into JSON-LD Playground: https://tinyurl.com/yfrzckbr

I'm guessing values of "@type" are treated differently by IRI compaction,
but I cannot find support for that in the JSON-LD API specification. Can
you help?

Best regards,

Jindrich

-- 
Jindrich Mynarz
https://mynarz.net/#jindrich

Received on Thursday, 26 August 2021 14:21:38 UTC