W3C home > Mailing lists > Public > public-linked-json@w3.org > May 2016

Re: use of @base

From: Gregg Kellogg <gregg@greggkellogg.net>
Date: Tue, 17 May 2016 21:13:38 +0300
Cc: public-linked-json@w3.org
Message-Id: <E38B9A2A-A24F-469E-9BC5-7F21912058AF@greggkellogg.net>
To: Jim Balhoff <balhoff@gmail.com>
On May 16, 2016, at 17:57, Jim Balhoff <balhoff@gmail.com> wrote:
> 
> Hi,
> 
> I am trying to understand how @base works. I’m running into a possible discrepancy between the JSON-LD playground and Java API and the documentation. I would like to use relative IRIs within my document, and specify the base IRI within the document for resolving these. I also have a remote context I would like to reference. This is working in the JSON-LD playground in this example:
> 
> http://tinyurl.com/htvmc7d
> 
> When I have @base in the embedded context, it is used for interpreting the relative IRIs. (“1234” is expanded to "http://example.org/person/1234”). If I remove @base from the embedded context, the @base in the remote context is used.
> 
> However, I found that when using the jsonld-java API, any @base is ignored whenever I include any remote context. I assumed this was a bug at first, but the docs seem to suggest this is intended:
> 
> "Please note that the @base will be ignored if used in external contexts."
> http://www.w3.org/TR/json-ld/#base-iri

Yes, that's correct, as it doesn't make sense for a single external context to resolve relative IRIs for every document using it.

> And an older version of that document says: "JSON-LD has no equivalent for the Turtle @base declaration”
> http://www.w3.org/TR/2012/WD-json-ld-syntax-20120712/#prefix-definitions
> 
> Is the JSON-LD playground behavior in error?

No, your interpretation that a local context defining @base overrides a previous definition and the actual document load location.

Note, however, that properties and @type are "vocabulary relative", and may make use of @vocab, but this doesn't seem to be what you're running into.

You can also try my distiller at http://rdf.greggkellogg.net/distiller,as,a,different data point.

If this is ambiguous, it might call for an additional expansion test, but I'm not in a place to check right now?

Gregg

> Thank you,
> Jim Balhoff
> 
> 
Received on Tuesday, 17 May 2016 18:14:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:47 UTC