RE: Context Negotiation

Hi Robert,

On Friday, January 24, 2014 9:16 PM, Robert Sanderson wrote:
> Dear all,
> 
> A quick question driven by discussions in the Open Annotation
> Community Group.
> 
> If two communities decide that they want to use different context
> descriptions for the same basic ontologies, is there a recommended way
> to allow a system to serve both formulations?
> 
[...]
> 
> The two methods that immediately come to mind are:
> 
> 1.  Content Negotiation Use a header on the HTTP request to ask for a
> particular context by its full URI. For example:   X-JSONLD-Context:
> http://www.openannotation.org/spec/core/context.json

A variation of that would be my preferred approach. JSON-LD's media type [1]
features a profile parameter that you can use for such purposes. Just define
a profile and give it a unique URL identifying it. Then you simply use
HTTP's 

  Accept: application/ld+json;
     profile="http://www.openannotation.org/profile/default"

You should consider registering that profile. There's an IETF Internet Draft
of mine [2] establishing a registry for such profiles. I expect it to become
an RFC shortly.


> 2.  URI patterns. Have patterns in the URIs (somehow) that reflect
> which context is desired.  This isn't as extensible, but doesn't
> require minting new HTTP headers. For example:
> http://example.org/annotations/defaultContext/annotation1.json vs:
> http://example.org/annotations/otherContext/annotation1.json

I would discourage you to do something like that. It's very brittle and not
without good reason considered an anti pattern.


> Or as a query param with the full URI:   http://example.org/annotation
> s/annotation1.json?context=http://www.openannotation.org/spec/core/con
> text.json

A bit better but also difficult to standardize.


HTH,
Markus


[1] http://www.w3.org/TR/json-ld/#iana-considerations
[2] http://tools.ietf.org/html/draft-lanthaler-profile-registry


--
Markus Lanthaler
@markuslanthaler

Received on Friday, 24 January 2014 20:31:40 UTC