A Strawman Instance of an Echo Feed
The inital application driving the Echo Project is weblog syndication. We could invest a huge amount of time wrestling with abstractions and generalities as regards Containers and so on; I think it might be helpful to start by trying to do a good job of helping the client that's standing at the front of the queue.
The EchoFeed knows it contains an Entry but the Entry has no clue that it's in a EchoFeed. With Related the Entry is allowed to know what feeds it is in.
Related is a typed peer-to-peer relation between Entry and any other object. EchoFeed implements a hard-coded relation on an ad hoc basis.
Do the simplest thing doesn't mean avoiding abstraction, nor jumping to a hasty solution based on an earlier approach. That client is best served by thoughtful design.
Come to think of it. Why make EchoFeed at all if it's an RSS work-a-like. Just put the new Entry in an RSS feed. See EchoRssExample.
Fortunately, we have plenty of prior art to help us, most obviously RSS 2.0. Without further ado:
<feed xmlns="uri/of/echo/namespace#"> <title>Bob Boggington's Blog</title> <link>http://bob.blog/</link> <description>Bob looks at life</description> <!-- I would also take the following optional elements from RSS 2.0: copyright, managingEditor, webMaster, lastBuildDate, image --> <entry> ... </entry> <entry> ... </entry> </feed>
[TimBray] Hmm, yep. Thinking systematically, what is this thing? It's a feed, in Echo terms. So by default the root element should be feed (but in the Echo namespace). You're right about entries. I have recast it accordingly.
[LachlanCannon] The id looks redundant here. Why not make it default to the permalink when not present?
[JamesSnell] Here's how I had imagined it:
[TimBray] Why 'echo' as the root?
[TimothyAppnel] Isn't the point of this effort to develop a shared syntax? Having the same root like echo makes a lot of sense to me.
[TimBray] I think the root element of any XML document should say what the document is. In this case, it's a feed. But we're into fine-tuning territory.
[ChrisWilper] +1 Or the term echo could be defined as a synonym for feed.
[BruceLoebrich] Why have 'feed' at all, why not just let entries contain other entries?
<echo xmlns="..."> <source> <name>snellspace.com</name> <permalink>http://www.snellspace.com/blog</permalink> <description>re-al-i-ty: a leaky abstraction of the surreal</description> </source> <entry id="...">...</entry> <entry id="...">...</entry> <entry id="...">...</entry> </echo>
[DonPark] I recommend 'EchoFeed' as the root. This would ease naming of future 'echo' formats. Also, I recommend CamelCase be used for tag names where structure elements start with uppercase and value elements start with lowercase. In my experience, this approach has the extra benefit of working well with language binding generators. Also, I recommend that 'id' and 'href' be used consistently. To do this, it is best if they are attributes.
[DuncanWilcox] I haven't seen any reference to bandwidth issues. For static content I suppose ETags and gzip/deflate are the only choice, but a smart aggregator might ask a smart server to only produce entries changed since some date, and a feed might be synthetized on the fly. Server load vs. bandwidth? Is an API needed for the feed?
That could be a variant of the 'search' API.
GET /atomfeed.xml HTTP/1.1 Range: entries 42- HTTP/1.1 206 Partial content Content-Range: entries 42-84 ...
or if there's no news:
GET /atomfeed.xml HTTP/1.1 Range: entries 42- HTTP/1.1 416 Requested range not satisfiable ...
<site xmlns="..."> : : <feed> <title>My Category</title> <entry identifier="/EntryA" location="/My%20Category/EntryA"/> <entry identifier="/EntryB" location="/My%20Category/EntryB"/> </feed> <feed> <title>Different Category</title> <entry identifier="/EntryB" location="/Different%20Category/EntryB"/> <entry identifier="/EntryC" location="/Different%20Category/EntryC"/> </feed> <entry> <identifier>/EntryA</identifier> ... </entry> <entry> <identifier>/EntryB</identifier> ... </entry> <entry> <identifier>/EntryC</identifier> ... </entry> </site>
<site xmlns="..."> <entry> : : <identifier>/EntryA</identifier> <also-at>/My%20Category/EntryA</also-at> <subject>My Category</subject> </entry> <entry> : : <identifier>/Entryb</identifier> <also-at>/My%20Category/EntryB</also-at> <also-at>/Different%20Category/EntryB</also-at> <subject>My Category</subject> <subject>Different Category</subject> </entry> <entry> : : <identifier>/EntryC</identifier> <also-at>/Different%20Category/EntryC</also-at> <subject>Different Category</subject> </entry> </site>
AggregateFeeds - feeds which partially or entirely consist of the contents of one or more other feeds)
Tristan Louis I've tried it and have a few questions (follow the link)