RE: Multiple contexts (ISSUE-32)

> Yes, each object can have it's own context.

OK.. We should mention this in the spec. I will prepare something.


> I also suggested using an
> array notation to allow a give object to have multiple contexts, which
> could allow a remote context and an in-line. For example, the in-line
> could be used to specify @language.

Right, you proposed the following form:

{
  "@context": [
    "/api/context.json",
    { "@language": "en" }
  ],
  "@subject": ...
}

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.

Thus, the approach suggested by Niklas:

{
  "@context": {
    "@import": "/api/context.json",
    "@language": "en",
    "@base": "http://example.org/"
  }
  "@subject": ...
}

or Ivan:

{
  "@importcontext": "http:...",
  "@context": {
    ...
  }
}

might be easier to understand.

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" }
  }
}

But this might go too far...



--
Markus Lanthaler
@markuslanthaler

Received on Thursday, 29 September 2011 09:01:36 UTC