W3C home > Mailing lists > Public > public-linked-json@w3.org > January 2017

Re: Scoped Contexts

From: Robert Sanderson <azaroth42@gmail.com>
Date: Wed, 4 Jan 2017 06:14:42 +1300
Message-ID: <CABevsUH-0R-+WB2OKt8NNBRp0uZrDWKdUOV1+2wE=y4RcUCt1Q@mail.gmail.com>
To: Gregg Kellogg <gregg@greggkellogg.net>
Cc: Linked JSON <public-linked-json@w3.org>
+1 from me!

Rob

On Mon, Jan 2, 2017 at 3:23 PM, Gregg Kellogg <gregg@greggkellogg.net>
wrote:

> I added specification text to JSON-LD and JSON-LD-API to support scoped
> contexts [1]. This ended up being a fairly minor change to context,
> compaction and expansion algorithms. Basically, the desire is to be able to
> define a term with a local context such that for values of that term, the
> context associated with the term is used in just the same way as if the
> context had been specified within the source. This allows, for example,
> values to be included that use a different namespace for properties. For
> example:
>
>
> {
>    "@context":
>   {
>     "name": "http://schema.org/name",
>     "interest": {
>       "@id":"http://xmlns.com/foaf/0.1/interest",
>       "@context": {"@vocab": "http://xmlns.com/foaf/0.1/"}
>     }
>   },
>   "name": "Manu Sporny",
>   "interest": {
>     "@id": "https://www.w3.org/TR/json-ld/",
>     "name": "JSON-LD",
>     "topic": "Linking Data"
>   }
> }
>
> Defines “interest” with a local context which uses the default vocabulary
> for FOAF. The node object value of “interest” then has otherwise undefined
> property terms expanded using the context definition contained within the
> “interest” term. The resulting expanded value looks like the following:
>
>
> [{
>   "http://schema.org/name": [{"@value": "Manu Sporny"}],
>   "http://xmlns.com/foaf/0.1/interest": [{
>     "@id": "https://www.w3.org/TR/json-ld/",
>     "http://schema.org/name": [{"@value": "JSON-LD"}],
>     "http://xmlns.com/foaf/0.1/topic": [{"@value": "Linking Data"}]
>   }]
> }]
>
> Expansion is modified to look up a term context when it is encountered and
> use that instead of the otherwise active context when expanding values.
>
> Compaction is modified to see if the input property parameter has a local
> context associated with it in active context, and to update active context
> accordingly.
>
> I don’t think this should be too controversial, so I’ll give this a week
> for feedback before merging the pull request.
>
> Gregg Kellogg
> gregg@greggkellogg.net
>
> [1] https://github.com/json-ld/json-ld.org/pull/445
>



-- 
Rob Sanderson
Semantic Architect
The Getty Trust
Los Angeles, CA 90049
Received on Tuesday, 3 January 2017 17:15:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 3 January 2017 17:15:15 UTC