Since the days of my second semester in my engineering when I came to know about URI and URL, I always had this confusion in my mind which took ages to get cleared.
Here is a small post which gives briefs about URI, URI and URN, and what are the differences between them.
Lets check what Wikipedia has to say on all of this.
Here is an example quoted from a related posting on Stackoverflow to make things little clearer
"Due to difficulties to clearly distinguish between URI and URL or may be other reasons as well, W3C seems to lessen the importance of this additional level of hierarchy (i.e. URLs and URNs)."
So who knows, may be after sometime they will officially keep only URI and discard any other UR* terms
Hope this helps in clearing the confusions.
So long,
Sandeep Rajoria
Here is a small post which gives briefs about URI, URI and URN, and what are the differences between them.
Lets check what Wikipedia has to say on all of this.
- Wikipedia on Uniform resource locator(URL)
A uniform resource locator (URL) is a specific character string that constitutes a reference to an Internet resource.
A URL is technically a type of uniform resource identifier (URI) but in many technical documents and verbal discussions URL is often used as a synonym for URI
- Wikipedia on Uniform resource identifier(URI)
A uniform resource identifier (URI) is a string of characters used to identify a name or a resource. Such identification enables interaction with representations of the resource over a network (typically the World Wide Web) using specific protocols.
- Wikipedia on Uniform resource name(URN)
Uniform resource names (URNs) are intended to serve as persistent, location-independent resource identifiers and are designed to.............
And now comes the part where we quote some relations and differences among these
- Wikipedia on their relation/difference
URIs can be classified as locators (URLs), as names (URNs), or as both. A uniform resource name (URN) functions like a person's name, while a uniform resource locator (URL) resembles that person's street address. In other words: the URN defines an item's identity, while the URL provides a method for finding it.
A URL is a URI that, "in addition to identifying a resource, provides a means of locating the resource by describing its primary access mechanism (e.g., its network location)"
- And W3C on the relation/difference [RFC3986]
A URI can be further classified as a locator, a name, or both. The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network "location"). The term "Uniform Resource Name" (URN) has been used historically to refer to both URIs under the "urn" scheme [RFC2141], which are required to remain globally unique and persistent even when the resource ceases to exist or becomes unavailable, and to any other URI with the properties of a name
So we can deduce this out of all the above information.
URIs identify an name or a resource and URLs locate a resource(and of-course also identify) and URNs identify a name. As locations are also identifications, so every URL is also a URI.
Thus URI is a superset of URL and URN.
Here is an example quoted from a related posting on Stackoverflow to make things little clearer
- Roger Pate
This is my name, which is identification. It is like a URI, but cannot be a URL (its probably a URN), as it tells you nothing about my location or how to contact me. In this case it also happens to identify at least 5 other people in the USA alone.
- 4914 West Bay Street, Nassau, Bahamas
This is a location, which is identification for that physical location. It is like both a URL and URI (since all URLs are URIs), and also identifies me indirectly as "resident of..". In this case it uniquely identifies me, but that would change if I get a roommate.
Here is the crux of the discussion
- URL - is a type of URI which
- follow this syntax "scheme://domain:port/path?query_string#fragment_id"
- where the scheme name defines the namespace, purpose, and the syntax of the remaining part of the URL
- have Global scope[RFC1736](are unique in entire world).
- So a few examples can be
- http://example.org:80/index.html(or simply http://example.org:80/)
- http://example.org/absolute/URI/with/absolute/path/to/resource.txt
- ftp://asmith@ftp.example.org
- mailto:bob@example.com
- ../css/style.css is a URL only if the browser(or resource) has an (absolute) URL for its referer document, something like http://example.org:80/index.html. So that the resource understands the absolute locater and then looks for the current resource relative to it.
- URN - is a type of URI which
- follows this syntax "<URN> ::= "urn:" <NID> ":" <NSS>" [RFC2141]
- where <NID> is the Namespace Identifier, and <NSS> is the Namespace Specific String. The leading "urn:" sequence is case-insensitive.
- So a few examples can be
- urn:isbn:0451450523 (The URN for The Last Unicorn 1968 book, identified by its book number.)
- urn:isan:0000-0000-9E59-0000-O-0000-0000-2 (The URN for Spider-Man (2002 film) identified by its audiovisual number.)
- urn:issn:0167-6423 (The URN for the Science of Computer Programming (scientific journal), identified by its serial number.)
- urn:ietf:rfc:2648 (The URN for the IETF's RFC 2648.)
- urn:mpeg:mpeg7:schema:2001 (Default Namespace Rules for MPEG-7 video metadata.)
- urn:www.agxml.org:schemas:all:2:0 (A non-standard URN representing a namespace for Schema "Agricultural Markup Language 2.0 for Grain and Oilseed Business".)
- urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C (A non-standard URN representing a specific MP3 file of the I have a dream speech by Martin Luther King by its SHA-1 hash Base32 encoded.)
- URI - is a URL, a URN or both [RFC3986] Or, all URLs and URNs are URIs
- So a few examples
- ftp://ftp.is.co.za/rfc/rfc1808.txt (an FTP scheme/protocol URL)
- http://www.ietf.org/rfc/rfc2396.txt (a simple HTTP scheme/protocol URL )
- ldap://[2001:db8::7]/c=GB?objectClass?one (LDAP scheme/protocol URL)
- mailto:John.Doe@example.com (email scheme/protocol URL )
- news:comp.infosystems.www.servers.unix (also a URL)
- tel:+1-816-555-1212 (also a URL)
- telnet://192.0.2.16:80/ (also a URL)
- urn:oasis:names:specification:docbook:dtd:xml:4.1.2 (also a URN)
"Due to difficulties to clearly distinguish between URI and URL or may be other reasons as well, W3C seems to lessen the importance of this additional level of hierarchy (i.e. URLs and URNs)."
So who knows, may be after sometime they will officially keep only URI and discard any other UR* terms
Hope this helps in clearing the confusions.
So long,
Sandeep Rajoria
Comments