- From: Niklas Lindström <lindstream@gmail.com>
- Date: Fri, 29 Mar 2013 18:33:22 +0100
- To: public-linked-json@w3.org
Hi all, I'd like to verify that `@vocab`, when used in compaction, takes precedence over any prefix with the same value. For instance, I'd expect that this data: { "@type": "http://schema.org/Document", "http://schema.org/name": "Something" } when compacted with this context: { "@context": { "schema": "http://schema.org/", "@vocab": "http://schema.org/" } } 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. But in both the official and Markus' playground, the results uses "schema:Document" and "schema:name". .. 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.) 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. Cheers, Niklas [1]: http://json-ld.org/spec/latest/json-ld-api/#iri-compaction
Received on Friday, 29 March 2013 17:34:19 UTC