- From: David Janes <davidjanes@davidjanes.com>
- Date: Mon, 8 Jun 2015 19:24:10 -0400
- To: "David I. Lehn" <dil@lehn.org>
- Cc: Linked JSON <public-linked-json@w3.org>
- Message-ID: <CACp1KyMuPF5UadMeTwfxFoL=Jw89Sah47f_mBJx1aQ3FgvidYw@mail.gmail.com>
Ah. I've tried a number of variants with no joy.
I've changed this to Node JS for easier testing. After I add the
definitions to the @context in "iot.jsonld", the issue seems to be with how
@vocab is used.
Just to spell it out, the only difference between the two examples is I
expanded out "model" to "https://iotdb.org/pub/iot#model", which if I
understand this correctly should be happening because of the @vocab
This does not work
var doc = {
"@context": [
"https://iotdb.org/pub/iot",
{
"@vocab": "https://iotdb.org/pub/iot#"
}
],
"@id":
"/api/things/urn:iotdb:thing:REST:20b2c3ca712e8b0031debf3453cc75d1:rest-color-light"
,
"model":
"/api/things/urn:iotdb:thing:REST:20b2c3ca712e8b0031debf3453cc75d1:rest-color-light/model"
}
jsonld = require('jsonld')
jsonld.expand(doc, function(err, expanded) {
console.log(JSON.stringify(expanded, null, 2));
});
This does
var doc = {
"@context": [
"https://iotdb.org/pub/iot",
{
"@vocab": "https://iotdb.org/pub/iot#"
}
],
"@id":
"/api/things/urn:iotdb:thing:REST:20b2c3ca712e8b0031debf3453cc75d1:rest-color-light"
,
"https://iotdb.org/pub/iot#model":
"/api/things/urn:iotdb:thing:REST:20b2c3ca712e8b0031debf3453cc75d1:rest-color-light/model"
}
D.
On Mon, Jun 8, 2015 at 6:31 PM, David I. Lehn <dil@lehn.org> wrote:
> On Mon, Jun 8, 2015 at 6:08 PM, David Janes <davidjanes@davidjanes.com>
> wrote:
> > Yes - live. It's https://iotdb.org/pub/iot#model expanded.
> >
> > D.
> >
> > On Mon, Jun 8, 2015 at 5:42 PM, David I. Lehn <dil@lehn.org> wrote:
> >>
> >> On Mon, Jun 8, 2015 at 4:11 PM, David Janes <davidjanes@davidjanes.com>
> >> wrote:
> >> > ...
> >> > BUT the fact that
> >> >
> >> > "model": { "@type": "@id" }
> >> >
> >> > is _already_ defined in "https://iotdb.org/pub/iot" (go look at
> >> > "https://iotdb.org/pub/iot.jsonld). So my understanding is we
> shouldn't
> >> > have
> >> > to explicitly spell that out here. But when I do:
> >> >
> >>
> >> I don't see "model" in the context at that URL. Is the live site
> >> up-to-date?
> >>
>
> https://iotdb.org/pub/iot.jsonld has this @context:
> {
> "@context": {
> "iot": "https://iotdb.org/pub/iot#",
> "iot-attribute": "https://iotdb.org/pub/iot-attribute#",
> "iot-facet": "https://iotdb.org/pub/iot-facet#",
> "iot-unit": "https://iotdb.org/pub/iot-unit#",
> "iot:cf": {
> "@type": "@id"
> },
> "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
> "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
> "schema": "https://schema.org/",
> "xs": "http://www.w3.org/2001/XMLSchema/#"
> },
> ...
> }
>
> A JSON-LD processor will only look at the @context data not other
> vocabulary data. iot:model is described later in the doc but that
> won't be used during processing. Adding '"model": { "@type": "@id" }'
> (and anything else similar) to the @context should do what you want.
>
> -dave
>
Received on Monday, 8 June 2015 23:24:58 UTC