Anatomy of an URI

Valid URIs are composed of an optional scheme name and an optional scheme-specific part.

Scheme name and scheme-specific part

At the highest level, a URI is composed of two distinct character sequences separated by a colon (":") delimiter: the scheme name and the scheme-specific part.

scheme name
describes the nature of the URI itself. It may be related to a given protocol (e.g. http, ftp, mailto). In any case, it describes how the remaining part of the URI (i.e. the scheme-specific part) should be processed.

scheme-specific part
may contain hierarchical information. When this is not the case, the URI is said to be opaque and considered a URN.

Components of a hierarchical URI

Detailing each part of a hierarchical URI is not relevant to this document, but here are the basics:

URI validity

Most components of the URI are optional. Hence these are valid URIs:

Even the scheme name is not mandatory. Anyway, handling some URI that has no scheme name requires a default context or default scheme (usually file).

The same way, even a single, relative path is considered a valid URI, although it is of no use without a proper context or base URI.