Description
JSON-LD separates handling of IRI conversions for document- and vocabulary-relative IRIs. At times, it is useful to have more vocabulary items be considered in the document space. A change was made to allow the empty string ("") as a value for @vocab
, but this may not be adequate.
Issue #56 somewhat complains about this, as does #37.
Currently, the Syntax document describes this in §4.1.2.1 Using the Document Base as the Default Vocabulary, but the use of a term "#breweats"
is not a natural JSON property. If @vocab
could be set to "#"
, this would allow a more natural expression.
The API document has a carve-out for the empty string, but otherwise require @vocab
to resolve to an absolute IRI:
Otherwise, if value is an absolute IRI or blank node identifier, the vocabulary mapping of result is set to value. If it is not an absolute IRI, or a blank node identifier, an
invalid vocab mapping
error has been detected and processing is aborted.
The proposal would be to treat things that are not absolute IRIs as IRIs relative to the document base as does the current empty-string carveout:
Otherwise, if value the empty string (""), the effective value is the current base IRI.
Resolving vocabulary-relative IRIs is done with simply concatenation, so the proposal would be to concatenate any non-absolute IRI value of @vocab
to base IRI by concatenating the value of @vocab
to base IRI; if the result is not then a valid absolute IRI we would continue to generate an invalid vocab mapping
error. Note that this sill not invalidate any 1.0 documents, but will allow things which were previously not valid.