How Do You Link?

July 16th, 2009  |  Published in REST by Ian Robinson  |  7 Comments

Consider these links:

Example 1



Example 2

<link rel="" href=""/>
<link rel="" href=""/>

Functionally equivalent?

There are two separate concerns at play here: finding links, and understanding links. An application’s semantic space – the set of link relations it uses to annotate links – is extensible. Understanding targets an open set. The capability to find links, on the other hand, ought ideally target a closed set.

In Example 1, each element bears the weight of addressing both concerns. The ability to find links is pinned to an open set. In Example 2, by contrast, the link element belongs to a closed set, with the semantic variance broken out and herded into the rel attribute value. Much easier to find links belonging to Example 2 using an application-agnostic function, a LINQ for Links, as it were.

What happens when we extend an application’s semantic space?

Example 3


Example 4

<link rel="" href=""/>
<link rel="" href=""/>
<link rel="" href=""/>

A client of Example 3 will likely only be able to report: “foreign markup found.” A client of Example 4 will be able to recognize the new link, though not necessarily understand the new rel value.

7 Comments  |  Atom   RSS 2.0   Email


  1. Subbu Allamaraju says:

    July 16th, 2009 at 8:01 pm (#)

    In all the four examples, if the media type is application/xml, clients won’t be able to discover links.

    Link discovery requires semantics specified by the media type or some other means. Of course, a human reader may be able to guess the intent, and possibly use it right, but that’s not the case for machine clients.

  2. Solomon says:

    July 16th, 2009 at 8:11 pm (#)

    why not <a href=”″ rel=”” class=”all” />?

  3. iansrobinson says:

    July 16th, 2009 at 8:33 pm (#)

    Hi Subbu

    Thanks for the comment.

    Yep. I wasn’t tackling media types here, but yes, the media type specifies the processing model, and a really good (hyper) media type will tell you how to identify hypermedia controls.

    Kind regards


  4. iansrobinson says:

    July 16th, 2009 at 8:37 pm (#)

    Hi Solomon

    Thanks for the comment. An <a/> tag is, as you point out, just as good – as long as the media type guides the client to identify that as a hypermedia control. I’ve been living with Atom for too long, perhaps. The general point is: closed set (plus media type processing model) is better than open set, if only from a pragmatic point of view.

    Kind regards


  5. Mike Amundsen says:

    July 16th, 2009 at 9:28 pm (#)


    I use elements w/ rels. I some cases, i’ve actually enclosed all the links for the document in a element to make discovery easy, but not often.

    Also, I sometimes add a method attribute with parameters within the link:

    that starts to break down for anything other than simple content-type formats, tho.

    FWIW, I still use ‘unqualified’ rels “proceed”, “next”, “drop”, etc. rather than following the full URI pattern; proly gonna hafta cave on that one.


  6. Andrew says:

    November 23rd, 2009 at 6:17 pm (#)

    This is why I love RDFa as my resource representation of choice. It builds these kind of best practices into the representation…

  7. Using Typed Links to Forms :: says:

    September 2nd, 2010 at 3:22 pm (#)

    […] this is that elements such as <link> separate link syntax from semantic context, as explained here; and this is a good thing, because what a link ought look like – its syntax – changes […]