Subject: Question about sorting in Atom

From: Peter Keane <[email-masked]>
Date: Sat, 7 Feb 2009 18:26:45 -0600

I have just finished building a small web application (for accepting
grant proposals) on top of an Atom/AtomPub server (instead of an
RDBMS).  There are just a few entities: person, proposal, budget item,
submitting department.  Everything is represented as Atom documents
and many-to-one relationships (e.g. proposal has many budget items)
are represented w/ atom:link (w/ locally minted rels).
POSTS/PUT/DELETES are relationship link aware and do the right thing.

I hit an unanticipated snag with sorting.  A submitting department
gets to "rank" proposals, so the proposal document has a "departmental
rank" attribute. As it stands, to resort a set of proposals (and to
present a netflix-queue-like interface for sorting) is incredibly
expensive.  I ended up doing much of it in javascript, but I still end
up PUT-ing each document with it's new rank order. Sorting 10
proposals requires a minimum of 10 requests (and all of the
authentication, updating, re-indexing, etc. that entails).  Seems like
I've hit on two pain points of Atom & REST -- the difficulty of doing
partial updates and batch updates.

I wonder if anyone has any advice on this.  One thought is to have a
"feed-view" type of atom:entry that simply lists links to the entries
in the preferred order.  Updating the rank order would entail PUT-ing
just that one entry.  It's extrinsic rather than instrinsic sort
ordering.  But that means I'd have to expose a new URI for the feed
that was "aware" of the sort order asserted by the view.

I am aware this all could be considered a misuse of Atom/AtomPub (I
realize there are MUCH easier ways to build such an app), but it is
something of a research project, so any advice on this particular pain
point would be appreciated.

--peter keane

---

From: "Sylvain Hellegouarch" <[email-masked]>
Date: Tue, 10 Feb 2009 13:52:35 +0100 (CET)

Hi Peter,

> point would be appreciated.

To be honest I don't quite see how this is a misuse of Atom let alone
AtomPub. AtomPub defines a collection feed but nothing stops you from
creating various "views" of that feed, organised the way it makes sense to
your application. You probably need a distinct URL indeed considering that
AtomPub tells us that the collection feed should be ordered by app:edited.
In that case the "view" at that URL isn't to be considered as the
collection feed but as a public feed probably.

- Sylvain

-- 
Sylvain Hellegouarch
http://www.defuze.org