- From: Niklas Lindström <lindstream@gmail.com>
- Date: Tue, 3 Jun 2014 22:13:20 +0200
- To: "john.walker" <john.walker@semaku.com>
- Cc: "public-linked-json@w3.org" <public-linked-json@w3.org>
- Message-ID: <CADjV5jcoPumt-TxjsVqiezAhd1_N2GD6y8wY_YCbrP6KkO42EQ@mail.gmail.com>
Hi John,
To resolve values as context keys (or against @vocab), you need to use
@type: @vocab, e.g.:
"property1": {
"@id": "http://example.com/vocab#foo",
"@type": "@vocab"
}
The difference between this and @type: @id is that @id coercion resolves
values against the document URI (or @base, or by expanding prefixes). It
thus treats your values as relative paths. (This ensures that relative
paths don't collide with terms.) Using @type: @vocab instead looks in
"vocabulary space" first.
Cheers,
Niklas
On Tue, Jun 3, 2014 at 9:53 PM, john.walker <john.walker@semaku.com> wrote:
> I'm looking for some help/guidance with context usage.
>
> Say I have an existing JSON document:
>
> {
> "property1": "value1",
> "property2": "value2"
> }
>
> I'm struggling with mapping this to existing URIs.
> Say:
> property1 => http://example.com/vocab#foo
> property2 => http://example.com/vocab#bar
> value1 => http://example.com/vocab#baz
> value2 => http://example.com/vocab#qux
>
> So the triples I'm looking to derive are:
>
> _:b0 <http://example.com/vocab#bar> <http://example.com/vocab#baz> .
> _:b0 <http://example.com/vocab#foo> <http://example.com/vocab#qux> .
>
> I tried with this context:
>
> {
> "@context": {
> "property1": {
> "@id": "http://example.com/vocab#foo",
> "@type": "@id"
> },
> "property2": {
> "@id": "http://example.com/vocab#bar",
> "@type": "@id"
> },
> "value1": "http://example.com/vocab#baz",
> "value2": "http://example.com/vocab#qux"
> }
> }
>
> But this does not do the desired mappings for the values, instead the
> values are
> just interpreted relative to the base/current URI.
>
> It feels like I'm missing something obvious...
>
> Cheers,
> John
>
>
>
>
Received on Tuesday, 3 June 2014 20:14:17 UTC