rightsstatements / rights-app

Web application to serve the rightsstatements.org vocabulary
http://rightsstatements.org/vocab/1.0/
European Union Public License 1.1
1 stars 3 forks source link

Recovery guidance #33

Closed literarymachine closed 8 years ago

literarymachine commented 8 years ago

On dev, see e.g.

$ curl -v "http://h2481931.stratoserver.net:9001/vocab/InC-OW-EU/1.0/?relatedURL=http://example.org/"
> GET /vocab/InC-OW-EU/1.0/?relatedURL=http://example.org/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: h2481931.stratoserver.net:9001
> Accept: */*
> 
< HTTP/1.1 406 Not Acceptable
< Alternates: {"/page/InC-OW-EU/1.0/?relatedURL=http://example.org/" 0.9 {text/html}},{"/data/InC-OW-EU/1.0/" 0.9 {text/turtle}}
< Date: Fri, 11 Dec 2015 13:14:01 GMT
< Content-Length: 0

for a parameter that is valid for the statement and

$ curl -v "http://h2481931.stratoserver.net:9001/vocab/InC/1.0/?relatedURL=http://example.org/"
> GET /vocab/InC/1.0/?relatedURL=http://example.org/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: h2481931.stratoserver.net:9001
> Accept: */*
> 
< HTTP/1.1 406 Not Acceptable
< Date: Fri, 11 Dec 2015 13:14:55 GMT
< Content-Length: 0

for a parameter that is not valid for the statement.

Fixes #10.

acka47 commented 8 years ago

Looks good mostly. As we decided in #32 to serve JSON-LD as default on a /data URI, we have to replace in the Alternates header document format text/turtle by application/ld+json.

I am not quite sure, though, whether pointing to the /data URI in the Alternates header actually is the desired behaviour as there is one image on page 23 of the technical white paper that suggests rather pointing to the /vocab URI without indicating a document format. The other two images (here and here) suggest like we do now, though (i.e. pointing to /data indicating a document format). I will open a separate question issue to sort this out.

acka47 commented 8 years ago

Just saw that this also works with a /data URI which makes sense, IMO:

$ curl -v "http://h2481931.stratoserver.net:9001/data/InC-OW-EU/1.0/?relatedURL=http://example.org/"
* Hostname was NOT found in DNS cache
*   Trying 85.214.19.235...
* Connected to h2481931.stratoserver.net (85.214.19.235) port 9001 (#0)
> GET /data/InC-OW-EU/1.0/?relatedURL=http://example.org/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: h2481931.stratoserver.net:9001
> Accept: */*
> 
< HTTP/1.1 406 Not Acceptable
< Alternates: {"/page/InC-OW-EU/1.0/?relatedURL=http://example.org/" 0.9 {text/html}},{"/data/InC-OW-EU/1.0/" 0.9 {text/turtle}}
< Date: Sun, 13 Dec 2015 19:38:29 GMT
< Content-Length: 0
< 
* Connection #0 to host h2481931.stratoserver.net left intact
acka47 commented 8 years ago

It is not taken into account yet that the relatedURL parameter (which is the only one that is currently used) is only allowed on a subset of statements, see this table from p.6 of the technical white paper:

parameter-table

Consequently, e.g. also $ curl -v "http://h2481931.stratoserver.net:9001/page/InC/1.0/?relatedURL=http://example.org/" should result in a 406 with recovery guidance.

literarymachine commented 8 years ago

It is not taken into account yet that the relatedURL parameter (which is the only one that is currently used) is only allowed on a subset of statements

Yes, it is. But currently only for /data and vocab URIs, as @no-reply commented in https://github.com/rightsstatements/rights-app/issues/11#issuecomment-156560354:

The short version is that parameters are 406 Not Acceptable for all but the page URIs for the applicable statements. Requests to the vocab or data URI for statements that can accept a parameter use Alternates: headers to direct the client toward the relevant page (retaining the parameter) or vocab (omitting it) resource.

The question is whether /page URLs should also check for invalid parameters or if a more relaxed strategy (i.e.: ignore any unknown parameters) would suffice here.

acka47 commented 8 years ago

The question is whether /page URLs should also check for invalid parameters or if a more relaxed strategy (i.e.: ignore any unknown parameters) would suffice here.

As discussed in the Tuesday meeting we will keep to discarding invalid parameters for /page.

acka47 commented 8 years ago

Please adjust the implementation according to @anarchivist's example in https://github.com/rightsstatements/rights-app/issues/34#issuecomment-164848784.

literarymachine commented 8 years ago

Please adjust the implementation according to @anarchivist's example in #34 (comment).

On dev, see e.g.

$ curl -v "http://h2481931.stratoserver.net:9001/vocab/InC-OW-EU/1.0/?relatedURL=http://example.org/"
> GET /vocab/InC-OW-EU/1.0/?relatedURL=http://example.org/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: h2481931.stratoserver.net:9001
> Accept: */*
> 
< HTTP/1.1 406 Not Acceptable
< Alternates: {"/vocab/InC-OW-EU/1.0/" 0.9},{"/page/InC-OW-EU/1.0/?relatedURL=http://example.org/" 0.9 {text/html}},{"/data/InC-OW-EU/1.0/" 0.9 {application/ld+json}},{"/data/InC-OW-EU/1.0/" 0.9 {application/json}},{"/data/InC-OW-EU/1.0/" 0.9 {text/turtle}}
< Date: Thu, 17 Dec 2015 16:34:06 GMT
< Content-Length: 0
< 
acka47 commented 8 years ago

+1 for a /vocab-URL with parameter. But I am not sure whether the /vocab URL should appear in the Alternates header when a parameter is passed with a /data URL, e.g.:

$  curl -v "http://h2481931.stratoserver.net:9001/data/InC-OW-EU/1.0/?relatedURL=http://example.org/"
* Hostname was NOT found in DNS cache
*   Trying 85.214.19.235...
* Connected to h2481931.stratoserver.net (85.214.19.235) port 9001 (#0)
> GET /data/InC-OW-EU/1.0/?relatedURL=http://example.org/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: h2481931.stratoserver.net:9001
> Accept: */*
> 
< HTTP/1.1 406 Not Acceptable
< Alternates: {"/vocab/InC-OW-EU/1.0/" 0.9},{"/page/InC-OW-EU/1.0/?relatedURL=http://example.org/" 0.9 {text/html}},{"/data/InC-OW-EU/1.0/" 0.9 {application/ld+json}},{"/data/InC-OW-EU/1.0/" 0.9 {application/json}},{"/data/InC-OW-EU/1.0/" 0.9 {text/turtle}}
< Date: Thu, 17 Dec 2015 20:41:15 GMT
< Content-Length: 0
< 
* Connection #0 to host h2481931.stratoserver.net left intact

I'd rather expect Alternates: {"/page/InC-OW-EU/1.0/?relatedURL=http://example.org/" 0.9 {text/html}},{"/data/InC-OW-EU/1.0/" 0.9 {application/ld+json}},{"/data/InC-OW-EU/1.0/" 0.9 {application/json}},{"/data/InC-OW-EU/1.0/" 0.9 {text/turtle}}.

anarchivist commented 8 years ago

@acka47 I think that sounds fine - thanks.

literarymachine commented 8 years ago

On dev, see e.g.

$ curl -v "http://h2481931.stratoserver.net:9001/data/InC-OW-EU/1.0/?relatedURL=http://example.org/"
> GET /data/InC-OW-EU/1.0/?relatedURL=http://example.org/ HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: h2481931.stratoserver.net:9001
> Accept: */*
> 
< HTTP/1.1 406 Not Acceptable
< Alternates: {"/page/InC-OW-EU/1.0/?relatedURL=http://example.org/" 0.9 {text/html}},{"/data/InC-OW-EU/1.0/" 0.9 {application/ld+json}},{"/data/InC-OW-EU/1.0/" 0.9 {application/json}},{"/data/InC-OW-EU/1.0/" 0.9 {text/turtle}}
< Date: Wed, 23 Dec 2015 14:52:26 GMT
< Content-Length: 0
< 
acka47 commented 8 years ago

+1