- From: Vladimir Alexiev <vladimir.alexiev@ontotext.com>
- Date: Thu, 26 Aug 2021 17:49:19 +0300
- To: Jindřich Mynarz <mynarzjindrich@gmail.com>
- Cc: public-json-ld@w3.org
- Message-ID: <CAMv+wg7LnoDU_KbQX81WowYzuC86h3s_1HAdkQgLGK3XhLo_ng@mail.gmail.com>
Hi Jindrich!
If you use
"property": {"@type": "@vocab"}
(instead of "@type": "@id")
then you get what you want ("AliasedB").
BTW I posted https://github.com/digitalbazaar/jsonld-cli/issues/18:
a CURIE in @vocab is handled differently by jsonld-cli compared to the
Playground.
On Thu, Aug 26, 2021 at 5:22 PM Jindřich Mynarz <mynarzjindrich@gmail.com>
wrote:
> 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:50:44 UTC