Re: Multiple contexts (ISSUE-32)

On Thu, Sep 29, 2011 at 5:01 AM, Markus Lanthaler
<markus.lanthaler@gmx.net> wrote:
> ...
> I think that's quite a nice approach.. I see only one issue with it. People
> could start doing something like:
>
> {
>  "@context": [
>    "/api/context.json",
>    { "xy": "..a..", "@language": "en" },
>    { "xy": "..b..", "@language": "de" }
>  ],
>  "@subject": ...
> }
>
> As we generally say that arrays are unordered in JSON-LD we have no way to
> resolve this conflict. Saying that in this case the order of the elements
> matters wouldn't be a very elegant solution.
>

Treating arrays as unordered is for the data, but meta-data like
@context is a bit different.  I think it's fine, and perhaps required,
to have @context be ordered so you can control processing and allow
overriding of rules.  Your example above will work fine, it just does
some extra processing work.  I don't think we need to add complexity
to avoid that just as most programming languages don't go out of their
way to avoid you from assigning values to a variable twice (ex: x = 1;
x = 2).


> ...
> We might even generalize Niklas' approach and say that @import can be used
> to import both context and instance documents. Then we could have something
> like
>
>
> {
>  "@import": "my-big-context.jsonld",
>  "@context": { "@language": "en" },
>  "name": "Markus Lanthaler",
>  "knows": [
>    { "name": Gregg Kellog", "@import": "/details/gregg.jsonld" }
>  }
> }
>

I seem to recall tossing around some ideas about general inclusion
mechanisms a long time ago.  Something to keep in mind but we'd have
to deal with @import and @context ordering and precedence issues and
probably other details.  What are the use cases of this that are not
solved with just loading two docs at the application level?

-dave

Received on Thursday, 29 September 2011 18:56:10 UTC