URI, short for Uniform Resource Identifier, is an Internet protocol element. It was codified by the IETF as RFC 2396, based on earlier proposals from Tim-Berners Lee.

A URI is a short string of characterss that conform to a certain syntax. The string indicates a name or address that can be used to refer to an abstract or physical resource.

The URI syntax is essentially a URI scheme name like "http", "ftp", "mailto", "urn", etc., followed by a colon character, and then a scheme-specific part. The semantics of the scheme-specific part are determined by the specifications that govern the schemes, although the URI syntax does force all schemes to reserve certain characters for special purposes, without always saying what those purposes are.

Table of contents
1 URI Reference
2 URI Resolution
3 URL and URN

URI Reference

A URI reference is another type of string that represents a URI, and, in turn, the resource identified by that URI. The distinction between a URI and a URI reference is not often maintained in informal usage, but protocol documents should not allow for ambiguity.

A URI reference may take the form of a full URI, or just the scheme-specific portion of one, or even some trailing component thereof -- even the empty string. Appended to the end of a URI reference may be an optional fragment identifier, preceded by "#". The part of the reference before the "#" indirectly identifies a resource, and the fragment identifier identifies some portion of that resource.

In order to derive a URI from a URI reference, the trailing "#" and fragment identifier, if any, must be removed because, strictly speaking, it is not part of the URI; it can be used later, if needed. The remainder of the reference, even if it is an empty string, is then resolved to 'absolute' form, unless it is a complete URI already.

URI references are very commonly used in web document markup languages, in places where there is a need to point to other resources, such as external documents or specific portions of the same document, in terms relative to the URI identifying the document that contains the URI reference (or relative to some other established base URI).

Example Absolute URIs

  • http://somehost/absolute/URI/with/absolute/path/to/resource.txt
  • ftp://somehost/resource.txt
  • urn:a-rose-by-any-other-name (hmm... unregistered URN namespace)

Example URI references

  • http://example/resource.txt#frag01
  • http://somehost/absolute/URI/with/absolute/path/to/resource.txt
  • /relative/URI/with/absolute/path/to/resource.txt
  • relative/path/to/resource.txt
  • ../../../resource.txt
  • resource.txt
  • /resource.txt#frag01
  • #frag01
  • [empty string]

URI Resolution

To "resolve" a URI means either to convert a relative URI reference to absolute form, or to dereference a URI or URI reference by attempting to obtain a representation of the resource that it identifies. The "resolver" component in document processing software generally provides both services.

If a URI reference, when resolved to absolute form, is determined to be equivalent to the URI of the document containing the reference, then the document processing software is supposed to use its current representation of the document to satisfy the resolution; a new representation is not to be fetched.

URL and URN

A URL, Uniform Resource Locator, is a URI that is acting as a locator, i.e. it implies a mechanism for retrieval of a resource (as opposed to just referring to it). Note that this depends on the context of use. For example, when a http: URI refers to an XML namespace, it is not being used as a URL, even though it may be possible to use the same string of characters as a URL by typing it into a web browser (hopefully, resulting in documentation for the namespace).

URN, Uniform Resource Name, is a URI that use the "urn" scheme, and does not connote availability of the identified resource.

see also internet, History of the Internet, website