First and foremost it needs to be clear that world of internet or any network for that matter is made up of different 'resources' which we need to 'access'. To make it clearer following are few examples of these two concepts.
RESOURCES : Any meaningful entity that is available in a network e.g. webpages of websites, images hosted on flicker, this blog post etc
ACCESS: Any meaningful action taken on the resources e.g viewing the webpage, adding a new image on the flicker , deleting the post. These are nothing but different ways to access the resource.
Enough background ; getting down to actual topic (Q and A style)
Q : What do we need to access the resource ?
A : Obviously, we first need to identify the resource in the network. then we need to be able obtain the resource somehow
Now next natural question is that how do we identify the resource ? We all know that in the network each resource has a name which is unique in that network context (also called as namespace) and a distinct location in the network (aka address). So what we mean here is that a resource can be identified by its name or location (or in some cases by both at the same time as we will see below)
So there we have it. All the things we need to know are in above 4 lines.
Enough sidewalking...Getting down to the thick of it.
URI : URI is as it says Uniform Resource Identifier. It is a string that identifies any resource in the network. As we talked about it above, we can do this either by the name of the resource or the location of the resource. It doesn't matter how we do it, it is still a URI since either ways it identifies the resource.
URN : Uniform Resource Names : This is a TYPE of URI that identifies a resource by its name in the network
URL: Uniform Resource Locator : This is a TYPE of URI that identifies a resource by its location in the network. Now one special note here ! Sometimes the location of the resource is its name so URL can be both ; name as well as location. It stiill doesn't matter. It is still a URI for sure.
So for those of us familiar with UML, we can say that URI is an abstract class which can be realized by either a URN or a URL. Till this date, these are the only two ways to realize a URI. Following diagram represents this relation.
Time for some examples:
So as we discussed above, we can specify URI by specifying either a URL or a URN so following examples represent both these schemes.
URN examples
- urn:isbn:143424254 -- This identifies a resource (a book) by its ISBN number.
- www.yahoo.com -- This identifies a yahoo website
- ldap://some.resource.here -- Identifies an ldap resource (person may be)
URL examples
- http://www.yahoo.com -- This identifies the yahoo website based on its address
- ftp://ftp.is.co.za/rfc/rfc1808.txt -- Identifies a particular text file by its location on the website
Difference between URL and URN :
- URL gives the road to visit the resource (access mechanism) and possibly the name of the resource (in some cases)
- URN gives out just the name but keeps mum about the access mechanism
(Not exactly correct to point out differences between parent and child but still this topic seems to be quite a hot one in general):
- URL is a TYPE of URI : meaning every URL is a URI but converse is not true
- URL is expected to point out the access mechanism of the resource but for URI it is not mandatory as long as it uniquely identifies the resource.
Related mis-conceptions
- It is wrong to assume that URL is tied to http protocol. URL can be of any protocol that sticks with the specified syntax. Examples are ftp urls
- It is wrong to assume that if we have the URN, we can access the resource. It is perfectly valid to have the name of the resource but it is not accessible. URNs do not talk anything about availability of the resource.
- The term 'URL' is now deprecated. So if we are writing any technical documentation, best thing would be to drop the word URL and use URI instead.




0 comments:
Post a Comment