- From: Markus Lanthaler <markus.lanthaler@gmx.net>
- Date: Fri, 29 Mar 2013 19:05:44 +0100
- To: <public-linked-json@w3.org>
Hi Niklas,
> results in:
>
> {
> "@type": "Document",
> "name": "Something"
> }
>
> I believe that compaction is specified like this, according to in "8.3
> IRI Compaction" [1]:
>
> > we first try to find a term that the IRI or keyword can be compacted
> to if it is relative to active context's vocabulary mapping.
You are citing the non-normative overview here. "Document" is neither a term
(there's no "Document" entry in the context) nor a keyword. So this step
will fail. If you read on, the text says:
"If no term was found that could be used to compact the IRI, then an attempt
is made to find a compact IRI to use."
And that's exactly what happens here. It will be compacted to
schema:Document. I think the assumption was always that if you specify a
term or prefix in the context, than it should always be preferred to a
@vocab mapping.
> .. Of course, in the above example, just removing the "schema" term
> would do the trick. But in practice, it is often useful to both set a
> default vocabulary and also have a prefix for the same IRI, in order
> to e.g. rename certain terms (and relying on prefixes to shorten the
> context size). E.g. to make plural forms of terms with a `@container`
> of `@set` or `@list, like:
>
> "contributors": {"@id": "schema:contributor", "@container":
> "@set"},
> ...
>
> (Or for specific datatyped values, or terms with predefined language,
> etc.)
You don't need to define a prefix in this case as @vocab is used here as
well. So you could simply write
"contributors": {"@id": "contributor", "@container": "@set"},
Instead.
> Moreover, sometimes you want to have a list of contexts, the first
> defining common prefixes and the latter declaring your specific
> context needs. While you can end by setting a `@vocab` and then
> setting any prefix with that same value to `null`, that can be brittle
> and cumbersome.
That might be true.. but since there's only one vocab mapping, there number
of prefixes you would have to reset is usually *very* small.
--
Markus Lanthaler
@markuslanthaler
Received on Friday, 29 March 2013 18:06:19 UTC