This blog can't be viewed on LiveJournal. Instead see http://www.apparently.me.uk/17794.html.

HTML Social Network in Atom

13th Oct 2008

Some time ago I posted about HTML Social Network, which is essentially just a bunch of link "rel" attribute values to indicate relationships between people and social objects.

One limitation of that approach, though, is that it lacks time information. You can't take the link relationships on an arbitrary HTML page and build an ordered list of (for example) status updates without additional context to give you the date and time of publication.

The obvious existing standard for time-based publishing is Atom, but the problem with Atom is that there's no way to know without out-of-band information that Twitter's Atom feeds are of status updates, and Flickr's Atom feeds are of photos, and (although HSN doesn't have a relationship for this right now) Last.fm's feeds are of tracks a user listened to recently. Action Stream services currently have to hard-code various services in order to present results in the correct context.

With this realisation, the obvious answer is to marry the "rel" attribute of HTML with the time-based publishing of Atom. Rather than publishing merely relationships between URLs, let's instead publish relationships between an Atom feed and its constituent entries, which themselves contain URLs. We can infer (using Atom auto-discovery) that a given Atom feed is a stream of information about a given resource. Here's one possible way to encode this:

<feed xml:lang="en-US"
    xmlns="http://www.w3.org/2005/Atom"
    xmlns:ahsn="http://example.com/xmlns/ahsn">
  <title>Twitter / worstusernameevar</title>
  <id>tag:twitter.com,2007:Status</id>
  <link type="text/html" rel="alternate" href="http://twitter.com/worstusernameevar"/>
  <updated>2008-10-13T19:14:32+00:00</updated>
  <subtitle>Twitter updates from Worst Evar / worstusernameevar.</subtitle>
  <entry ahsn:rel="status-update">
      <title>Reading about HSN in Atom.</title>
      <id>tag:twitter.com,2007:[omitted]</id>
      <published>2008-10-13T15:15:54+00:00</published>
      <updated>2008-10-13T15:15:54+00:00</updated>
      <link type="text/html" rel="alternate"
            href="http://twitter.com/.../statuses/957716495"/>
  </entry>
</feed>

Of course, I'm not wedded to this encoding, just the general principle of putting HTML's rel attribute into Atom. I'm open to suggestions of how to do it better. Though I called it AHSN here, really this can be generalized to all values of rel in HTML.

Obviously for backward compatibility for now Action Stream implementations will have to hard-code some assumptions such as "twitter.com feeds have an implied rel of status-update", but hopefully new services can start to include this extra information so that Action Stream services can start to handle these things intelligently without needing to hard-code every possible publishing service.

As usual, I'm open to suggestions about how this idea can be improved.

Comments

  • rel attributes

    Why not simply use the existing rel attribute on the link?

    http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rel_attribute

    The current set of permissible values can be found here:

    http://www.iana.org/assignments/link-relations.html

    If you don't wish to register a new one (why not?), you can simply provide a full URI.
    By ext_26836 at 07:39 pm on 13th Oct 2008
    • Re: rel attributes

      My understanding was that the rel attribute you refer to gives a relationship between the entry and the link's target URI. I wish to indicate a relationship between the the feed and the entry. The relationship is, of course, implied also for all links with rel="alternate", but there's more information in the entry than just the URLs for alternate representations.

      As a side note, why does Atom have its own pool of rel values, rather than sharing the list with HTML? All of those relationships on that page you linked to would seem to be suitable for HTML representations of entries too.

      By Martin Atkins at 08:32 pm on 13th Oct 2008
  • or atom:category

    For typing an Atom Entry in the context of a feed, I would tend to use an Atom category with the appropriate scheme as a full url:

    category term="status-update" scheme="http://example.com/xmlns/ahsn"

    or to simply type a link, I think simply using the existing rel attribute of the link is the way to go.
    By pkeane at 08:13 pm on 13th Oct 2008