What is URL, URN and URI?
When accessing resources on the Internet, or simply data, files, audio and other media, three key concepts are the URL, URN and URI.
All these 3 acronyms are related to the Internet and the World Wide Web.
But what is the purpose of them? Why do we need URL, URN and URI?
What is an URI?
URI stands for Uniform Resource Identifier. This actually gives us a hint on why we need an URI.
We need URI’s to identify resources, either by name or location, or both.
In practice, an URI is used to is used to provide an address to a resource. This resource can be located on any system, i.e. the Internet or your own personal computer.
The form (or “syntax”, if you will) of an URI is as follows:
An URI starts with the protocol used to access the resources, followed by the actual address of the resource. An URI might also contain constraint parameters for the particular resource.
Before we dive into the subject of URL and URN, let’s clearify this with an example.
Whenever you browse the web through your web browser, you’re actually accessing web resources.
These web resources are defined by their location / name, known as the URI.
The fact that the URI can be identified by both location and name, tells us that the URI has two specializations: the URL and the URI.
What is an URL?
URL is an abbreviation of Uniform Resource Locator.
The URL is one of two specializations of URI. An URL defines the network location of a specific resource.
The URL defines how a specific resource can be accessed.
If this sounds kind of cryptic to you, don’t worry. I can almost guarantee that you make use of URLs on a daily basis!
Actually, an URL is what may be called a link in layman terms.
The most widely used form of an URL is as follows (using this blog article as an example):
This URL tells us that we want to access the resource “what-us-url-urn-and-uri” on the host modestprogrammer.com located on the World Wide Web, using the protocol https.
The general form of an URL is like this:
The “key=value” part is the parameters we mentioned earlier in this article. They are not mandatory, but is a way to provide additional information to the resource you are accessing.
Note that the protocol don’t have to be either http or https!
What is an URN?
URN stands for Uniform Resource Name.
The URN is also, as URL, a specialization of the URI. An URN defines the name of a particular resource in a given namespace.
Since URN is not as widely used as the URL, we describe the URN with a real life example.
Assuming that you want to look up someone in a physical address book. You have both their first and last name.
You can’t start off by searching for the person by his/hers first name.
The obvious thing to do would be to start looking up the last name – thus, the last name is used as the name space.
When you’ve scoured through enough pages, you finally find their last name. But there are multiple people with the same last name!
Now you can utilize the first name. You’ll use the first name as the identifier, in the name space (which is the last name).
Well.. There might be more than one person with that particular name? You are exactly right, and this is where our example breaks.
URNs are intended to be unique.
To sum up the discussion of the URN:
An URN identifies a resource by name in a given namespace but does not define how the resource may be obtained.
So why would we ever want to use a URN? It sure seems as it is quite useless?
Assume you have information about books stored in a database. Books are identified by their ISBN number. Using URN, we can define this:
This URN tells us that the namespace is isbn and the identifier is 06857733, which is the ISBN number of a particular book.
|Uniform Resource Identifier||Uniform Resource Locator||Uniform Resource Name|
|A combination of URL and URN used to access any resources.||Specialization of URI.||Specialization of URI.|
|URI is the physical or logical address to the resource which also includes protocol related information with it.||URL is the address of the resource with the protocol and resource specific information included.||URN contains the resource specific information.|
|URI may change over time.||URL may change over time.||URN never changes for a resource.|
|Every URI in not URL or URN.||Every URL is a URI.||Every URN is a URI.|