An http Header for Metadata Schema Negotiation

12
An http Header for Metadata Schema Negotiation Lars G. Svensson | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016 1

Transcript of An http Header for Metadata Schema Negotiation

Page 1: An http Header for Metadata Schema Negotiation

An http Header for Metadata Schema Negotiation

Lars G. Svensson

| 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 20161

Page 2: An http Header for Metadata Schema Negotiation

2

Why is Profile Negotiation Necessary?

| 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

Phot

o by

Eric

Kilb

y (C

C BY

-SA)

: http

s://fl

ic.kr

/p/6

qrXw

3

Phot

o by

mar

io (C

C BY

): ht

tps:

//flic.

kr/p

/ceS

RwU

The profile you expected The profile you got

Page 3: An http Header for Metadata Schema Negotiation

3 | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

– Profile in Accept-/Content-Type-headers (RFC 7231)– Link-header with rel=“profile” (RFC 6906)– Link-header with profile-parameter (RFC 5988)– Prefer-/Preference-Applied-headers (RFC 7240)– Accept-Schema-/Schema-headers (yet to be specified)

I have looked at five options

Page 4: An http Header for Metadata Schema Negotiation

4 | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

GET /some/resource HTTP/1.1Accept: text/turtle;q=0.9;profile=”urn:example:profile-1”,

text/turtle;q=0.7;profile=”urn:example:profile-2” HTTP/1.1 200 OKContent-Type: text/turtle; profile=”urn:example:profile-2”

Profile in Accept-/Content-Type-headers (RFC 7231)

Page 5: An http Header for Metadata Schema Negotiation

5 | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

HEAD /some/other/resource HTTP/1.1Accept: text/turtle;q=0.9,application/rdf+xml;q=0.5Link: <http://example.com/profile-1>; rel=”profile” HTTP/1.1 200 OKContent-type: text/turtleLink: <http://example.com/profile-1>; rel=”profile”

Link-header with rel=“profile” (RFC 6906)

Page 6: An http Header for Metadata Schema Negotiation

| 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

GET /another/thing HTTP/1.1Accept: application/xmlLink: <urn:example:profiles:schema-2>; rel=”profile” HTTP/1.1 200 OKLink: <http://example.org/another/thing>;

rel=”self”;type=”application/xml”profile=”urn:example:profiles:schema-2”

Link-header (RFC 5988 with new parameter “profile”)

6

Page 7: An http Header for Metadata Schema Negotiation

7 | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

HEAD /this/or/that HTTP/1.1Accept: application/xmlPrefer: profile=<urn:example:some:schema> HTTP/1.1 200 OKContent-Type: application/xmlPreference-Applied: profile=<urn:example:some:schema>

Prefer- and Preference-Applied-headers

Page 8: An http Header for Metadata Schema Negotiation

8 | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

GET /final/resourceAccept: application/rdf+xml; q=0.9, text/turtle; q=0.5Accept-Schema: <http://example.org/shacl/shape-1>; q=0.9,

<http://example.org/shacl/shape-2>; q=0.5 HTTP/1.1 200 OKContent-Type: application/rdf+xmlSchema: <http://example.org/shacl/shape-2>

Accept-Schema- and Schema-headers

Page 9: An http Header for Metadata Schema Negotiation

9 | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

  Pro Con

Accept/Content-Type + Profile

No header registration necessary

Requires registration of profile parameter for each content-type

q-value only available for each combination of content-type and profile

Link: rel=”profile” (RFC 6906)

No header, parameter or relation type registration necessary

q-values not supported

does not support multiple combinations of namespace+profile

Link: profile=”…” (RFC 5988)

No header registration necessary

q-values not supported

different use in request and response

does not support multiple combinations of namespace+profile in request

Now we can look at the consequences

Page 10: An http Header for Metadata Schema Negotiation

10 | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

  Pro Con

Prefer/Preference-Applied

No header registration necessary

Supports combination of multiple namespace+profile-combinations

q-values not supported

not clear if absence of “Preference-Applied” was because server does not understand “Prefer” or because it did not honour the preference stated

requires registration of “profile” preference

Accept-Schema/Schema

Supports q-values fits nicely into content

negotiation framework supports combination

of multiple namespace+profile-combinations

 

Requires registration of new http-headers

… and more consequences

Page 11: An http Header for Metadata Schema Negotiation

11 | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

– None of the options is perfect (features vs work)– In order to perform proper content negotiation, we need q-

values– In any case we need to figure out, how to deal with multiple

profiles and with combinations of namespaces and schemas

My recommendation is a new header

Page 12: An http Header for Metadata Schema Negotiation

12 | 12 | An http Header for Metadata Schema Negotiation | Dcember 01, 2016

And now I look forward to the discussion!

Phot

o by

ste

ven

sim (C

C BY

-SA)

: http

s://fl

ic.kr

/p/8

AnKh

p