Your JSON is not my JSON

A case for more fine-grained content negotiation

Ruben Verborgh, Ghent Universityimec

Smart Descriptions & Smarter Vocabularies (SDSVoc), 1 December 2016

Read the accompanying article.

Your JSON is not my JSON

A case for more fine-grained content negotiation

Ruben Verborgh

Ghent University – imec

What is the location of SDSVoc?

What is the location of SDSVoc
by public transport?

What is the location of SDSVoc
by car?

What is the location of SDSVoc
on foot?

Independently of my preferences,
SDSVoc is located at the same address.

Science Park 123
1098 XG Amsterdam
Netherlands

Why not always use
the same address?

Exactly.

Content negotiation is not an academic exercise,
but rather a necessity for sustainable publication.

How can a single address
give access to data
my client understands?

Your JSON is not my JSON

Your JSON is not my JSON

As an example, we will use a dataset
of local governmental decisions.

This involves resources such as:

The challenge is to expose this dataset
in a sustainable way.

Domain resources are identified
by specific URLs.

This URL identifies a local council decision:

Each representation of a resource
can also be identified with a specific URL.

Minting only representations-specific URLs
leads to several problems.

Each resource should always have
a representation-independent URL.

Using HTTP content negotiation,
clients send representation preferences.

request

GET /decisions/3147.json HTTP/1.1
Host: council.my
Accept: application/ld+json;q=1.0,text/turtle;q=0.8
Accept-Language: en
…

Using HTTP content negotiation,
servers send a matching representation.

response

HTTP/1.1 200 OK
Content-Type: application/ld+json
Content-Language: en
…

Content negotiation allows for
sustainable data publication.

Your JSON is not my JSON

MIME types are an underspecification
of the interpretation clients need.

MIME types underspecify on:

A MIME type does not indicate
the most specific syntax.

3147.json is all of these:

A MIME type does not indicate
the structure within the syntax.

A MIME type does not indicate
how a representation is modeled.

Should we simply introduce
more specific MIME types then?

A council decision could have MIME type application/vnd.council.my.decision+json

Especially with RDF syntaxes,
specific MIME types become problematic.

text/vnd.council.my.decision+turtle

application/vnd.council.my.decision+ld+json

application/vnd.foaf.person+ld+json

application/vnd.council.my.decision.foaf.person+ld+json

Since RDF is self-descriptive,
can representations use multiple models?

Your JSON is not my JSON

HTTP Content negotiation is extensible
in multiple dimensions.

Since MIME types are limited,
we should negotiate in more dimensions.

profile can be defined as:

additional semantics that can be used to process a resource representation, such as constraints, conventions, extensions, or any other aspects that do not alter the basic media type semantics…

RFC 6906

Servers indicate what profiles
a representation uses.

Clients indicate what profiles
they support or prefer.

Activity Streams are an example
of a MIME-type/profile combination.

Your JSON is not my JSON

I'm not suggesting that
we all must negotiate
over multiple dimensions.

am suggesting that,
if you decide to publish multiple dimensions,
you should provide
content negotiation.

HTTP content negotiation
is the extensible path
towards sustainable content interoperability.

Your JSON is not my JSON

A case for more fine-grained content negotiation

@RubenVerborgh

Ghent University – imec