- From: Gregg Kellogg <gregg@greggkellogg.net>
- Date: Tue, 17 May 2016 21:13:38 +0300
- To: Jim Balhoff <balhoff@gmail.com>
- Cc: public-linked-json@w3.org
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