Skip to content


link and self; rel=”canonical” and rev=”canonical”

This is based on a cross post from http://www.innoq.com/blog/st/2009/01/link_and_self.html.

Subbu and <Stefan Tilkov have been discussing URI Equivalence, linking to self and Resource Identities, so here is my view.

Subbu's last remark asks the question

>>>
On January 18, 2009 4:32 AM, Subbu Allamaraju said:
Here is a longer response that is longer than a comment <img src='http://brettdargan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />

http://www.subbu.org/blog/2009/01/uris-vs-identifiers-take-two

IMHO URI non-equivalence does not imply resource non-equivalence. And if that is really important to your application there SHOULD be ways to handle it.

I agree with Stefan on providing a canonical resource.

You can argue both ways that person and person with address book are either two representations of a person resource, or two different resources, that is the great thing about the Web.

For this case in the atom self link what about using the <b>rev tag</b> to identify the canonical resource that makes sense for your application.

Since rev also accepts space separated list of link-types you could mark it with both the type and the uri of the canonical resource.

<link href="http://www.example.org/person/abc?include=addressBook" rel="self" rev="canonical http://www.example.org/person/abc"/>

As to whether or not two different entities that returned from different URI are based on the same version of the canonical resource or not:

I would use an EntityTag that encoded some value of resource state and some value of the representation. Eg. template for xhtml representation may change without resource state and the ETag must change in order to reflect that.

To KISS.

If you had an ETag consisted of something like "resourceVersion=20,reprVersion={date}" Then your application could extract out the self links with identical rev tags and extract from the ETag the resourceVersion.

Post to Twitter Tweet This Post

Posted in RESTful, Web, design. Tagged with , , .

3 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. “You can argue both ways that person and person with address book are either two representations of a person resource, or two different resources, that is the great thing about the Web.”

    Actually, as far as HTTP (and hence the client) is concerned, those are two different resources. That is the reason behind my remark that there are no canonical resources.

  2. admin said

    I wasn’t approaching this from an identity type of perspective, merely as a challenge to see how we could refer to another resource with self links.

    There is no dispute, from a HTTP (RFC2616) point of view they are different requests.

    But, those requests return data representations and some of those may be the same for different URI, or some responses may be different, yet still be based on the same logical resource.

    Looking at RFC3986, it clearly states that:

    • “Because URIs exist to identify resources, presumably they should be considered equivalent when they identify the same resource. However, this definition of equivalence is not of much practical use, as there is no way for an implementation to compare two resources unless it has full knowledge or control of them.”
    • “Our use of the terms “identify” and “identifying” refer to this purpose of distinguishing one resource from all other resources, regardless of how that purpose is accomplished (e.g., by name, address, or context). These terms should not be mistaken as an assumption that an identifier defines or embodies the identity of what is referenced, though that may be the case for some identifiers.”

    My point is if you did have full knowledge and control over the URI and it were useful to identify non equivalent URI as being based on the same logical resource (and maybe representation), then you could find a way to link it to a canonical resource.

    Granted, not many apps may find that useful, I just mention that there are ways.

  3. admin said

    nice to see rev=”canonical” is getting lots of discussion and is being adopted by the major search engines

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.


Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.