URL, URI & URN.. cakewalk? Not for me atleast..

Prologue

I have always been confused on the difference between the 3 most popular acronyms in web based computing – URL, URI and URN. The concept always seemed to evade me..

This post is more of a ‘talking to myself’ thing. I can almost imagine me reading this months from now, and feeling grateful that I finally wrote this down.

The Journey

I started off with a good old Google search and I should say, the initial results were truly disheartening. The first results that came up was this one by damnhandy.com. Even though the intentions are true, this blog is very much misleading as it is pretty clear from the comments. The blog was followed by this and again by this and it gets pretty clear if you read all three. (A trilogy on Uniform Resources)

You could always visit the official w3c documentation. Unless you think in binary and have bytestreams for breakfast, you won’t understand much. You are better off reading couple of interesting posts in StackOverflow.

The Real Deal

So here is what I learned from the journey…

Let me talk about URI and URL first. Expanding them would be URI – Uniform Resource Identifier and URL – Uniform Resource Locator.

Both of them are used to provide details about resources ( a file, a server, a port.. ). URI is an identifier. As the name says, it identifies a resource. Let me make myself clear with some examples.

  1. http://thisisrinda.files.wordpress.com/2011/10/mojojojo.jpg
  2. buttercup.jpg
  3. Room 1738

See the first example, it identifies a resource ( a jpeg image with the name mojojojo ). The second example does the same, it identifies a resource. The difference between example #1 and #2, the first one gives more detail ( the location… ). But we don’t need that, all we need to do is identify the resource. A real world example would be #3, a hotel room number. There can be trizillions of Room 1738s in the planet. But all we need is an identification and that’s exactly what an URI does – an Identifier.

Moving to URL, it’s the locator. With URI, you identify the resource, and with URL, you locate the resource. In the example #1 above, we have the complete location of the resource, and that makes example #1 an URL. So, the first example is an URI and an URL – you can identify and locate the resource. But examples #2 and #3 are not URLs, they won’t help you locate the image or the hotel room. However, both these are URIs.

  1. D:/images/buttercup.jpg
  2. Room 1738, Queen Elizabeth Hotel, Montreal, Canada

Hope you get the bigger picture. One is just an identifier, while the other one is a locator.

All URLs are URIs but all URIs are not URLs..

What then are URNs ?

The wiki page says :

A uniform resource name (URN) is the historical name for a uniform resource identifier (URI) that uses the urn: scheme.

It’s an URI.. just that it uses the urn: scheme.. What and how an urn: scheme is implemented is totally out of scope here.. you can read on that here..

example of URN

  1. urn:isbn:9781402531996
  2. urn:isan:0000-0000-9E59-0000-O-0000-0000-2

The first example identified Umberto Eco’s ‘Baudolino’ and the second example identifies a very popular movie. It’s just the same as an URI, the only difference is that it uses the urn: scheme.

Epilogue

So, that does it. Do let me know if you think what i just said is nonsense or if you want me to elaborate on any point.

Advertisements

2 thoughts on “URL, URI & URN.. cakewalk? Not for me atleast..

  1. A couple of points:
    While true that a URI is an identifier, it also supposed to be a universally unique identifier. Thus, the examples of “buttercup.jpg” and “Room 1738” are not valid URIs, both syntactically and logically as there is now way to disambiguate them from files or rooms in different locations.

    Technically speaking neither of your other examples of URIs are not URIs either:
    * D:/images/buttercup.jpg
    * Room 1738, Queen Elizabeth Hotel, Montreal, Canada
    For these to be valid, they need to conform to the to RFC3986.

    In my view, it’s the duality of identity and location that throws people off. RDF is probably a great example of this since RDF uses URIs to identify everything. The tricky bit comes in when a well known URL is no longer accessible. Take for example the following URI:

    http://futurewave.com/splash

    At one point in time, this identified the early version of Flash. It’s still a valid URI, but as a URL, it gives you something other than expected. However, in RDF land, it’s still reasonable to use as an identifier even though as a URL, it doesn’t return what you might expect.

    • Agreed.. You can’t call my examples URIs. Thanks a lot for the feedback..

      Instead of URIs, It would be correct to call them Resource Identifiers (RI) as the term URI is the property of RFC3986 and should follow the specific norms.. feedback is much appriciated

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s