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

use of @base

From: Jim Balhoff <balhoff@gmail.com>
Date: Mon, 16 May 2016 10:57:58 -0400
Message-Id: <575C5CE0-B8EC-4C9B-869F-1E6445D99E2E@gmail.com>
To: public-linked-json@w3.org
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

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?

Thank you,
Jim Balhoff
Received on Monday, 16 May 2016 14:58:29 UTC

This archive was generated by hypermail 2.3.1 : Monday, 16 May 2016 14:58:29 UTC