Re: Atom Content Negotiation

Alistair Miles <alimanfoo@googlemail.com> Tue, 17 May 2011 09:11 UTC

Return-Path: <owner-atom-syntax@mail.imc.org>
X-Original-To: ietfarch-atompub-archive@ietfa.amsl.com
Delivered-To: ietfarch-atompub-archive@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 312B5E0656 for <ietfarch-atompub-archive@ietfa.amsl.com>; Tue, 17 May 2011 02:11:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.299
X-Spam-Level:
X-Spam-Status: No, score=-3.299 tagged_above=-999 required=5 tests=[AWL=-0.300, BAYES_00=-2.599, J_CHICKENPOX_44=0.6, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SXO6h4BzvEUY for <ietfarch-atompub-archive@ietfa.amsl.com>; Tue, 17 May 2011 02:11:50 -0700 (PDT)
Received: from hoffman.proper.com (IPv6.Hoffman.Proper.COM [IPv6:2001:4870:a30c:41::81]) by ietfa.amsl.com (Postfix) with ESMTP id DD9C5E0758 for <atompub-archive@ietf.org>; Tue, 17 May 2011 02:11:49 -0700 (PDT)
Received: from hoffman.proper.com (localhost [127.0.0.1]) by hoffman.proper.com (8.14.4/8.14.3) with ESMTP id p4H95lW3078579 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 May 2011 02:05:47 -0700 (MST) (envelope-from owner-atom-syntax@mail.imc.org)
Received: (from majordom@localhost) by hoffman.proper.com (8.14.4/8.13.5/Submit) id p4H95lJU078578; Tue, 17 May 2011 02:05:47 -0700 (MST) (envelope-from owner-atom-syntax@mail.imc.org)
X-Authentication-Warning: hoffman.proper.com: majordom set sender to owner-atom-syntax@mail.imc.org using -f
Received: from mail-fx0-f43.google.com (mail-fx0-f43.google.com [209.85.161.43]) by hoffman.proper.com (8.14.4/8.14.3) with ESMTP id p4H95iIO078570 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for <atom-syntax@imc.org>; Tue, 17 May 2011 02:05:46 -0700 (MST) (envelope-from alimanfoo@googlemail.com)
Received: by fxm3 with SMTP id 3so331257fxm.16 for <atom-syntax@imc.org>; Tue, 17 May 2011 02:05:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=fVzoNGvs9hIvDOoa/7ikcq6m0a7Nb7VQ9MTcNc72+JU=; b=mkaDl53209jsSXu5TG5zRSo/LbsO38yaKRcW8Up6LB+CcZ9Bvel+R7mTU6ybHj7J+E V40sxY6qhOM0IIrH6qKRVofsok3bjSPEeyT8VoICk/5CdyU6AukVXNm+mo9m7iLNS9GJ SOsRyHMPBtgAU8l7WYZB+6JFYXrp7Nq+FmhqI=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=YpC27WOTnFtXiTHEWUBuG7izQUNpq58PyCmfwu0WlrGeKKxxvPH+HIhel6tz+v2EZG 3dkJ7X31NEZXGiXuWwpTOq85BUae3owSZuzgOry5BfmPMkRRFr8Q+OXjxtJEkMW9RIuP aqS7W35s3lMsqyA+tKBX+YFxT7ApQhiCt9OKM=
Received: by 10.223.113.193 with SMTP id b1mr505101faq.47.1305623144376; Tue, 17 May 2011 02:05:44 -0700 (PDT)
Received: from aliman-desktop (dhcp175.well.ox.ac.uk [129.67.45.18]) by mx.google.com with ESMTPS id d16sm119312faa.12.2011.05.17.02.05.42 (version=SSLv3 cipher=OTHER); Tue, 17 May 2011 02:05:43 -0700 (PDT)
Date: Tue, 17 May 2011 10:05:40 +0100
From: Alistair Miles <alimanfoo@googlemail.com>
To: Erik Wilde <dret@berkeley.edu>
Cc: Atom-Syntax <atom-syntax@imc.org>
Subject: Re: Atom Content Negotiation
Message-ID: <20110517090540.GA3329@aliman-desktop>
References: <4DBA06CE.8070304@berkeley.edu> <20110516092225.GD5335@skiathos> <20110516103355.GA8063@skiathos>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <20110516103355.GA8063@skiathos>
User-Agent: Mutt/1.5.21 (2010-09-15)
Sender: owner-atom-syntax@mail.imc.org
Precedence: bulk
List-Archive: <http://www.imc.org/atom-syntax/mail-archive/>
List-Unsubscribe: <mailto:atom-syntax-request@imc.org?body=unsubscribe>
List-ID: <atom-syntax.imc.org>

On Mon, May 16, 2011 at 11:33:55AM +0100, Alistair Miles wrote:
> One thought that does occur, as something you could deploy without having to get 
> into debates about media type parameters, perhaps you could invent a new link 
> relation like "atom-content" as you suggest, and use it in a link template which 
> tells a client how to request a variant representation of a feed with a given 
> inline content type. E.g., something like...
> 
> <link-template rel="alternate-content" 
> href="http://example.org/foo?inlinecontenttype={inlinecontenttype}"/>

On reflection, I don't think the link template idea above is a good solution, 
because the client has no way of finding out what inline content types are 
available.

I wonder if a better solution would be to invent three new pieces of machinery:

* a new @inline-type extension attribute for use on atom:link elements

* a new Accept-Inline HTTP header

* a new <accept-inline> element for use within app:collection elements in Atom 
service documents

So, to satisfy your use case, you could publish an Atom feed with links like...

<feed xmlns="http://www.w3.org/2005/Atom">
  <link rel="alternate" type="application/atom+xml;type=feed" inline-type="text/html" href="..."/>
  <link rel="alternate" type="application/atom+xml;type=feed" inline-type="application/json" href="..."/>
  <link rel="alternate" type="application/atom+xml;type=feed" inline-type="application/rdf+xml" href="..."/>
  ...
</feed>

Also, clients and servers could negotiate about the inline content type when 
making GET requests, e.g, ...

GET /foo
Host: example.org
Accept: application/atom+xml
Accept-Inline: application/rdf+xml

200 OK
Content-Type: application/atom+xml;type=feed
  
<feed xmlns="http://www.w3.org/2005/Atom">
  <link rel="alternate" type="application/atom+xml;type=feed" inline-type="text/html" href="..."/>
  <link rel="alternate" type="application/atom+xml;type=feed" inline-type="application/json" href="..."/>
  <link rel="alternate" type="application/atom+xml;type=feed" inline-type="application/rdf+xml" href="..."/>
  ...
  <entry>
    <content type="application/rdf+xml">
      <rdf:RDF ...>
      </rdf:RDF>
    </content>
    ...
  <entry>
  ...
</feed>

Also, for editable collections, an Atom server could advertise its intention to 
only accept Atom entries with a particular inline content type within the 
service document, e.g.:

<app:service>
  ...
  <app:workspace>
    <app:collection href="http://example.org/foo">
      <app:accept>application/atom+xml;type=entry</app:accept>
      <x:accept-inline>application/rdf+xml</x:accept-inline>
    </app:collection>
  </app:workspace>
</app:service>

Just a thought.

Cheers,

Alistair

> 
> ...just a thought, this has probably occurred to you already.
> 
> Cheers,
> 
> Alistair
> 
> On Mon, May 16, 2011 at 10:22:25AM +0100, Alistair Miles wrote:
> > Hi Erik,
> > 
> > On Thu, Apr 28, 2011 at 05:31:10PM -0700, Erik Wilde wrote:
> > > 
> > > hello.
> > > 
> > > on http://dret.typepad.com/dretblog/2011/04/atom-content-negotiation.html
> > > i have posted some thoughts on whether there should eb a way how to
> > > differentiate between "feed variants", so that publishers could link
> > > the HTML feed to the XML feed. any feedback would be very welcome,
> > > both encouraging and critical. commenting on the blog might be
> > > better visible, and i will take the freedom to link back from the
> > > blog to the mailing archive if there are interesting follow-up
> > > mails, unless you don't want me to do so.
> > 
> > Why not just use <atom:link rel='alternate' href='...'/> at both the feed and 
> > entry levels? 
> > 
> > In our data repository systems (based on AtomPub), both collections and 
> > collection members are content negotiable resources. I.e., you can retrieve an 
> > Atom, HTML or JSON representation, by specifying different preferences in the 
> > Accept request header. In addition to this content negotiation at the collection 
> > or member URI, each variant representation also has a URI, and links are 
> > provided in entry and feed representations to all variant representations via 
> > the 'alternate' link relation.
> > 
> > E.g., 
> > 
> > GET /foo
> > Host: example.org
> > Accept: application/atom+xml
> > 
> > 200 OK
> > Content-Type: application/atom+xml;type=feed
> > Content-Location: http://example.org/foo?format=atom
> > Vary: Accept 
> > 
> > <atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
> >   <atom:link rel="self" href="http://example.org/foo"/>
> >   <atom:link rel="alternate" type="text/html" href="http://example.org/foo?format=html"/>
> >   <atom:link rel="alternate" type="application/json" href="http://example.org/foo?format=json"/>
> >   ...
> >   <atom:entry>
> >     <atom:link rel="edit" href="http://example.org/foo/bar"/>
> >     <atom:link rel="alternate" type="text/html" href="http://example.org/foo/bar?format=html"/>
> >     <atom:link rel="alternate" type="application/json" href="http://example.org/foo/bar?format=json"/>
> >     ...
> >   </atom:entry>
> > </atom:feed>
> > 
> > FWIW, this is implemented using a generic content negotiation plugin for 
> > AtomBeat [1], sorry no documentation as yet.
> > 
> > Cheers,
> > 
> > Alistair
> > 
> > [1] http://code.google.com/p/atombeat/wiki/ReleaseNotes#configurable_conneg_plugin 
> > 
> > > 
> > > thanks and kind regards,
> > > 
> > > dret.
> > > 
> > > -- 
> > > erik wilde | mailto:dret@berkeley.edu  -  tel:+1-510-6432253 |
> > >            | UC Berkeley  -  School of Information (ISchool) |
> > >            | http://dret.net/netdret http://twitter.com/dret |
> > > 
> > 
> > -- 
> > Alistair Miles
> > Head of Epidemiological Informatics
> > Centre for Genomics and Global Health <http://cggh.org>
> > The Wellcome Trust Centre for Human Genetics
> > Roosevelt Drive
> > Oxford
> > OX3 7BN
> > United Kingdom
> > Web: http://purl.org/net/aliman
> > Email: alimanfoo@gmail.com
> > Tel: +44 (0)1865 287669
> 
> -- 
> Alistair Miles
> Head of Epidemiological Informatics
> Centre for Genomics and Global Health <http://cggh.org>
> The Wellcome Trust Centre for Human Genetics
> Roosevelt Drive
> Oxford
> OX3 7BN
> United Kingdom
> Web: http://purl.org/net/aliman
> Email: alimanfoo@gmail.com
> Tel: +44 (0)1865 287669

-- 
Alistair Miles
Head of Epidemiological Informatics
Centre for Genomics and Global Health <http://cggh.org>
The Wellcome Trust Centre for Human Genetics
Roosevelt Drive
Oxford
OX3 7BN
United Kingdom
Web: http://purl.org/net/aliman
Email: alimanfoo@gmail.com
Tel: +44 (0)1865 287669