Description
It recently came as a surprise to me that, in JSON-LD, you can not use a relative IRI as a property. In this example, the key "./baz"
is ignored (although "./bar"
is correctly interpreted as a value of @id
).
Then I realized that this is probably a feature, not a bug, and I can see the rationale. After digging into the spec, I also realized that it is indeed documented in the Expansion algorithm (it all comes down to document relative defaulting to false
in the IRI Expansion function).
However, I think other people might get confused by it, especially because nothing in the JSON-LD syntax document hints at this. On the contrary, section 5.2 states
In JSON-LD, IRIs may be represented as an absolute IRI or a relative IRI.
And Section 8.2 states:
All keys which are not IRIs, compact IRIs, terms valid in the active context, or one of the following keywords MUST be ignored when processed:
Ironically, in many other places of the spec, absolute IRIS and relative IRIs are both explicitly mentioned as allowed (e.g. as values of @id
or @context
).
The most obvious solution would be to replace "IRIs" by "absolute IRIS", in the sentenced quoted above. I would even argue in favor of a note, drawing the reader's attention to the fact that relatives IRIs as keys are deliberately ignored in JSON-LD.