Re: Distinguishing a context document from an instance document

On Oct 2, 2011, at 1:59 PM, Manu Sporny wrote:

> On 10/01/2011 05:51 PM, Ivan Herman wrote:
>> We should be careful of recursion issues, though. If context document
>> may refer to other context documents, that can play some nasty
>> tricks.
>> 
>> We may declare that when a context document is imported, json-ld
>> processors to do not follow further context imports, ie, it stops at
>> one level.
> 
> Very good point, Ivan.
> 
> If we adopt the suggestion that a "JSON-LD Context Document" is just a 
> regular JSON-LD document, we could prevent recursion issues by stating 
> that any context that is not embedded in the "JSON-LD Context Document" 
> file MUST NOT be processed. So, for example, processing this "JSON-LD 
> Context Document":
> 
> {
>    "@context":
>    {
>       "foo": "http://example.com/foo#"
>    }
> }
> 
> ... would load "foo" into the set of known prefixes. However, processing 
> this "JSON-LD Context Document":
> 
> {
>    "@context":
>    [
>       "http://example.com/bar.jsonld",
>       {"foo": "http://example.com/foo#"}
>    }
> }
> 
> .. would load "foo" into the set of known prefixes, but would not load 
> http://example.com/bar.jsonld.

Just to clarify, this would be valid in a normal JSON-LD document, and would load bar.jsonld as well as creating the "foo" term mapping, but if the document were loaded because it was the target of a @context in a JSON-LD document, the processing rules would indicate that bar.jsonld not be loaded. In fact, this document should be considered to be invalid.

> -- manu
> 
> -- 
> Manu Sporny (skype: msporny, twitter: manusporny)
> Founder/CEO - Digital Bazaar, Inc.
> blog: Standardizing Payment Links - Why Online Tipping has Failed
> http://manu.sporny.org/2011/payment-links/
> 

Received on Sunday, 2 October 2011 22:17:38 UTC