- From: john.walker <john.walker@semaku.com>
- Date: Wed, 4 Jun 2014 14:36:10 +0200 (CEST)
- To: "Niklas Lindström" <lindstream@gmail.com>
- Cc: "public-linked-json@w3.org" <public-linked-json@w3.org>
- Message-ID: <370563298.60852.1401885370281.open-xchange@oxweb05.eigbox.net>
Hi Niklas, Thanks, works like a charm. So that can also be used the other direction to map from a URI in object position of a triple in JSON-LD to some label required by an application that consumes 'regular' JSON. John > On June 3, 2014 at 10:13 PM Niklas Lindström <lindstream@gmail.com> wrote: > > 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 > <mailto: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 Wednesday, 4 June 2014 12:36:40 UTC