- From: David Janes <davidjanes@davidjanes.com>
- Date: Wed, 10 Jun 2015 15:13:37 -0400
- To: "David I. Lehn" <dil@lehn.org>
- Cc: Linked JSON <public-linked-json@w3.org>
- Message-ID: <CACp1KyPu4mKfoyQuj-ft_eHSC=yHQ4R-X-nqBxJMGgt0FvxUPA@mail.gmail.com>
Three part response:
(1)
Thank you for going through all this trouble to figure this out. I do
appreciate the effort
(2)
I've tightened it up to this:
{
"@context": "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"
}
and made a revised https://iotdb.org/pub/iot.jsonld with e.g.
"model": {
"@id": "https://iotdb.org/pub/iot#model",
"@type": "@id"
},
And I get exactly what I expect:
</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>
.
(3)
Bonus curiosity! In my model if I don't have the "@id": "...." I get an
error that terms in @context must define an @id. Cool.
But why does schema.org's @context not get this error message?? All their
terms look like
"artMedium": { "@type": "@id" },
D.
On Wed, Jun 10, 2015 at 2:38 PM, David I. Lehn <dil@lehn.org> wrote:
> On Mon, Jun 8, 2015 at 7:24 PM, David Janes <davidjanes@davidjanes.com>
> wrote:
> > 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
> > ...
> > "model":
> >
> "/api/things/urn:iotdb:thing:REST:20b2c3ca712e8b0031debf3453cc75d1:rest-color-light/model"
> > ...
> >
> > This does
> > ...
> > "https://iotdb.org/pub/iot#model":
> >
> "/api/things/urn:iotdb:thing:REST:20b2c3ca712e8b0031debf3453cc75d1:rest-color-light/model"
> > ...
>
> This managed to confuse me too. If someone else would like to explain
> this with the proper terminology, please do. I'll give it a try. The
> issue is that during expansion the processor is looks up the original
> term in the context, not what the term is expanded into. The first
> one fails since it does not find "model" in the context and defaults
> to a string. However, expansion will use @vocab to expand the term to
> the full URL. It doesn't have a second pass to re-lookup that value.
> The second one works since your context has the full URL defined. The
> way you probably want to structure this is that in your context you
> will map the short aliases to the full URL and type:
>
> "@context": {
> "model": {
> "@id": "https://iotdb.org/pub/iot#model",
> "@type": "id"
> },
> ... similar for other terms ...
> }
>
> Since you define the "iot" prefix you can shorten that a bit:
>
> "@context": {
> "model": {
> "@id": "iot:model",
> "@type": "id"
> },
> ... similar for other terms ...
> }
>
> If you want to also use "iot:model" or
> "https://iotdb.org/pub/iot#model" you will need to duplicate the
> definitions in the context for those. If you do this for all the
> terms you use then you can also remove the use of @vocab since it
> wouldn't be needed. I think one reason for this design is so that you
> can have different term names that map to the same property URL but
> with different types. Another is simplicity to avoid multiple lookup
> passes during expansion.
>
> -dave
>
Received on Wednesday, 10 June 2015 19:14:25 UTC