Monday, February 15, 2010

URI

Today i was working on a program manipulating the queries that appear in an URL. I read up on the URL, it described many terms as in query, fragment, scheme. What the heck!!

I, then, googled URL. It told something about URI. Now i had heard of URL but URI.Further research concluded that URI is infact superset of URL and URN.

The standard description provided at many place about URI was "URI (uniform resource identifier) is a string of characters used to identify a name or a resource on the internet."

In simpler terms, URN functions like a person's name and URL functions like a person's street address. Or in other words, URN defines an item's identity while URL provides a method for finding it.

A URI consist of 4 parts:
"(scheme):(hierarchical part)[?(query)][#(fragment)]"
The part in [] is optional.

Now lets see the individual parts:
scheme name is the protocol used. An exmaple of it is http. It is followed by a colon(:). Ex. http:
hierarchical part usually begins with '//', followed by 'authority' part and an optional 'path'. Authority part consist of (optional user information@hostname) or (domain name or IP), and an optional port number preceded by a colon(:). Ex
www.google.com, this is the domain name.
192.168.193.203:8080, '192.168.193.203' part is the IP followed by a colon and then the port number 8080.
query is an optional part separated by '?'. You must have noticed that when you search anything on google, in the URI there is a '?'. The part after this '?' is the query part. Commonly it is a sequence of key= value pairs seperated by either a semicolon(;) or ampersand(&).
<fragment is an optional part separated by the rest by a hash(#). It holds additional information that provides direction to a secondary resource, eg a section heading in an article.

Well thats for now. It is getting a bit too technical now.