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.
3 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
“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.
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:
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.
nice to see rev=”canonical” is getting lots of discussion and is being adopted by the major search engines