Re: an idea: @context in coercion rules ?

On Wed, Jul 11, 2012 at 9:06 AM, Pierre-Antoine Champin <
pierre-antoine.champin@liris.cnrs.fr> wrote:

> Hi,
>
> an idea that came to me while reading the JSON-LD syntax document is one
> could put a @context inside a coercion rule,
> in order to change the meaning of a property depending on where it appears.
>
> For example,
>
> {
>   "@context": {
>     "name": "http://xmlns.com/foaf/0.1/name",
>     "homepage": {
>       "@id": "http://xmlns.com/foaf/0.1/homepage",
>       "@type": "@id",
>       "@context": {
>         "name": "http://purl.org/dc/terms/title"
>       }
>     }
>   },
>   "name": "Manu Sporny",
>   "homepage": {
>        "@id": "http://manu.sporny.org/",
>        "name": "Manu's homepage"
>   }
> }
>
> would give the following triples
>
> _:t0 <http://xmlns.com/foaf/0.1/name> "Manu Sporny" .
> _:t0 <http://xmlns.com/foaf/0.1/homepage> <http://manu.sporny.org/> .
> <http://manu.sporny.org/> <http://purl.org/dc/terms/title> "Manu's
> homepage" .
>
> where property name means foaf:name or dc:title depending on where it
> appears.
>


Interestingly I was thinking along the same line last night. My use case
was a nested object where the same key happens to appear at different
levels of nesting, much like Pierre-Antoine's example. In other words, this
would allow overriding the context inside a nested element of a JSON
object. A good example is for the example a key 'item' which might appear
at several levels of nesting, and that might qualify for a different
mapping depending on what level it's at.

Steph.

Received on Wednesday, 11 July 2012 14:17:54 UTC