Re: quick advice on content negotiation

Mark Baker wrote:
> On Tue, Dec 8, 2009 at 11:43 AM, Nathan <nathan@webr3.org> wrote:
>   
>> in addition adding the extension .n3 / .rdf to the uri causes content
>> RDF to be returned instead.
>>     
>
> How is that information communicated to the world?  Is it documented
> somewhere, or expressed in-band?  If not the latter, then I'd say
> that's not passable because, from a REST POV it's not respecting the
> hypermedia constraint.  I'd suggest returning a Link header using the
> "alternate" relation type, e.g.
>
> GET /user/23 HTTP/1.1
> Host: example.org
> Accept: application/rdf+xml
>
> -->
>
> HTTP/1.1 200 Ok
> Content-Type: application/rdf+xml
> Link: <http://example.org/user/23.n3>; rel="alternate"; type="text/n3"
> Link: <http://example.org/user/23.html>; rel="alternate"; type="text/html"
> ...
>
> Mark.
>
>   
Mark,

Yep!

Nathan: see URIBurner or DBpedia responses which also include LINK 
response headers :-)

Sequence example via cURL:

kidehen$ curl -I -H "Accept: text/html" http://dbpedia.org/resource/London
HTTP/1.1 303 See Other
Server: Virtuoso/06.00.3124 (Solaris) x86_64-sun-solaris2.10-64  VDB
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Date: Tue, 08 Dec 2009 17:31:21 GMT
Accept-Ranges: bytes
Location: http://dbpedia.org/page/London
Content-Length: 0

kidehen$ curl -I -H "Accept: text/html" http://dbpedia.org/page/London
HTTP/1.1 200 OK
Server: Virtuoso/06.00.3124 (Solaris) x86_64-sun-solaris2.10-64  VDB
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Date: Tue, 08 Dec 2009 17:31:37 GMT
Accept-Ranges: bytes
Expires: Tue, 15 Dec 2009 17:31:35 GMT
Link: <http://dbpedia.org/data/London.rdf>;
 rel="alternate"; title="Metadata in RDF/XML format",
 <http://dbpedia.org/data/London.n3>;
 rel="alternate"; title="Metadata in N3/Turtle format",
 <http://dbpedia.org/data/London.json>;
 rel="alternate"; title="Metadata in JSON+RDF format"
Content-Length: 2095119



-- 


Regards,

Kingsley Idehen	      Weblog: http://www.openlinksw.com/blog/~kidehen
President & CEO 
OpenLink Software     Web: http://www.openlinksw.com

Received on Tuesday, 8 December 2009 17:36:00 UTC