- From: Jindřich Mynarz <mynarzjindrich@gmail.com>
- Date: Thu, 26 Aug 2021 18:11:01 +0200
- To: Vladimir Alexiev <vladimir.alexiev@ontotext.com>
- Cc: public-json-ld@w3.org
- Message-ID: <CAE=8Bu_iXhY8SvDFgN6-6AcStLwjywQscQrwBorPiEZgHH5pJA@mail.gmail.com>
Hi Vladimir, thanks for the practical answer! I see that "@type": "@vocab" makes values to be resolved relative to the vocabulary of a JSON-LD context instead of being resolved relative to the JSON-LD document ( https://www.w3.org/TR/json-ld11/#shortening-iris and the example https://www.w3.org/TR/json-ld11/#example-65-term-expansion-for-values-not-identifiers). However, when in my example "@type": "@vocab" is not used, the value of "@id" is still resolved relative to the vocabulary of the JSON-LD context, but only relative to the vocabulary prefixes. Is that expected? - Jindrich On Thu, 26 Aug 2021 at 16:49, Vladimir Alexiev < vladimir.alexiev@ontotext.com> wrote: > 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 16:11:25 UTC