What is a Uniform Resource Indicator (URI)?
URI is a string of characters that identifies a resource. It can identify all objects, including people, places, concepts, information, web pages, and books. The resources may or may not be connected to the internet.
The most commonly used form of Uniform Resource Identifier is the Uniform Resource Locator (URL). URLs are used to identify and locate websites across the internet.
Uniform resource indicator syntax
Every URI starts with a scheme. URI syntax is a united and extensible naming convention where each scheme’s specification restricts the syntax of other parts of the URI. The superset of all URI scheme syntax is URI generic syntax.
A generic URI syntax is made of five components:
URI = scheme:[//authority] path[?query][#fragment]
Further, the authority part is divided into three subparts:
Authority = [userinfo@]host[:port]
The generic form of a URI syntax is represented as below:
![Graphical representation of URI Syntax](https://cms-media.bartleby.com/wp-content/uploads/sites/2/2021/10/21053836/URI_syntax_diagram-1024x96.png)
A generic syntax of URI comprises the following elements.
Scheme
The first component of a URI is the scheme. Schemes are case-insensitive components. They are distinguished from other characters of the URI using a colon. Schemes have a string of characters starting with a letter followed by a combination of letters, digits, plus symbol, period symbol, or a hyphen. Commonly used URI schemes are HyperText Transfer Protocol (HTTP), HyperText Transfer Protocol Secure (HTTPS), File Transfer Protocol (FTP), MailTo, file, and data.
URI scheme names need to be registered with the Internet Assigned Numbers Authority (IANA). However, the use of non-registered schemes is also permitted. An example of a URI scheme is:
telnet://192.0.2.121:83, here telnet is a URI scheme.
Authority
The authority portion of the Uniform Resource Indicator consists of several parts. It is preceded by double slashes (//).
- Userinfo: This sub-component represents the user name and optional password preceded by a colon. It is followed by an @ symbol.
- Host: The host indicates the registered name or internet protocol address (IP address). After the hostname, a colon is added to the URI to distinguish it from other characters. The IPv4 addresses must have the dot-decimal notation and should be enclosed in brackets. They are usually in hexadecimal format.
- Port: Port is an optional subcomponent preceded by a colon.
Path
Path in a URI contains a segment sequence distinguished by a slash. It is always defined for a URI, but it can be zero in length (empty). If a segment is empty, it will consist of two consecutive slashes in the path. If an authority component is present, then the path must be empty or start with a slash. Otherwise, the path cannot begin with two slashes. The last part of the path is called a slug.
Query
The query part in the component is optional and preceded by a question mark (?). It contains a query string of non-hierarchical data. According to its convention, a query is a sequence of attribute-value pairs separated by ampersand (&) or semicolon. It resembles an operation applied to a query-able object by the URI. For instance, in the following URI:
foo://techtalks.org:8042/over/there?name=eagle#beak
The query part in the above link is given by name=eagle
Fragment
The fragment component is also an optional part of the URI. It is preceded by a hash (#). It consists of a fragment identifier that directs to a secondary resource like a section heading in a post defined by the rest of the URI. If the primary resource is a HyperText Markup Language (HTML) article or document, the fragment will be an id attribute of a specific element. In such a case, the web browsers will scroll to that element when the link is clicked. Alternatively, if fragment ID is empty, it represents that URI is a whole object. In such cases, the hash sign will be omitted.
Example of URI
Consider the following URI:
https://paul.mark@www.myhome.com:123/forum/questions/?tag=networking&order=popular#bottom
Here, the parts of the URI will be as follows:
- https is the scheme of the URI.
- paul.mark is the userinfo.
- www.myhome.com is the hostname.
- 123 is the port.
- /forum/questions is the path.
- tag=networking&order=popular is the query.
- bottom is the fragment.
Purpose of URI
URI gives a simple method to recognize internet resources. It uses different resource identifiers to separate resources of the same context. Resources such as electronic documents, web pages, graphics, and other informative content can be identified using a URI. The indicators can even be applied to resources of different contexts.
Types of URI
There are two types of uniform resource identifiers:
- Uniform resource locator (URL)
- Uniform resource names (URN)
Uniform Resource Locator
URL is a useful yet informal type of URI used to classify and locate web pages on the internet. It includes the primary access mechanism and location. A uniform resource locator identifies a resource. It also specifies points on how to access the resource and in which location it is available. It consists of components such as protocol, domain name, and subdomain name, along with URI components.
For instance, the URL http://myhome.com/wiki/Main_Page will refer to the resource /wiki/Main_Page having a representation in the HTML form, and related code can be found using the HTTP: from a network host having domain name (myhome.com).
URLs are subsets of URI. That means every URL is a URI. However, vice versa is not true. A few points to note about URLs are:
- If the resource is a web page, its URL will start with the protocol HTTP or HTTPS.
- If the resource is a file, its URL will start with FTP scheme.
- The URL for an email address will begin with the protocol mailto.
- When the location of the resource changes, the corresponding URL will also change. That is because URL is location-dependent.
Examples of URLs are:
- https://www.cordcuttersnews.com/category/news/covering-the-world-of-free-legal-streaming-services/
- https://corporate.pluto.tv/thanks-for-watching/
- https://www.hypr.com/asymmetric-encryption/
Uniform Resource Name
A Uniform Resource Name is a uniform resource identifier that classifies the resource using its name in a specific namespace. It can be used to refer to a resource without mentioning the location or how to access it. However, a URN is location-independent. It continues to exist even when the resource no longer exists or is unavailable.
Further, unlike URLs, URNs do not state the protocol they use. A URN has three parts: the label urn, a colon, and a character sequence as the identifier.
URL Vs. URN
URL | URN |
It identifies web pages. | It identifies resources. |
It is location-dependent. | It is location-independent. |
It mentions the protocol used to locate or access the web page. | It does not mention the protocol used to locate the resource. |
When the web page of the location is changed or becomes unavailable the URL changes. | A URN exists even when the resource becomes unavailable or its location changes. |
Context and Applications
Uniform resource identifier is a widely-used concept in the basics of internet and web development. It is included in undergraduate and postgraduate courses like:
- Bachelors in Computer Applications
- Bachelor in Engineering (Computer Science)
- Certifications in Web designing and Web development
- Masters in Computer Applications
- Master in Engineering (Computer Science)
Practice Problems
1. Which is a valid form of URL from the below options?
- http://www.abc.org/sigmod
- www.google.com
- www.xyz.in
- http:/www.abc.org/sigmod/
Answer: Option a
Explanation: A uniform resource locator is a unique identifier name for every document on the web. From the above options, only http://www.abc.org/sigmod meets the requirements of a URL.
2. In the URL - http://www.google.com/search?q=silberschatz, which argument is used to process the URL?
- Google.com
- percent-encoding
- q=silberschatz
Answer: Option d
Explanation: Argument or query in a URL is preceded by the? symbol. Consequently, the argument will be q=silberschatz.
3. What is the use of a uniform resource identifier in HTML?
- To customize image from the web page using URI references
- To locate namespace or numbers like +1-816-555-1212
- Identify name or resource on the internet
- To find the base URI references
Answer: Option c
Explanation: The URI assists in identifying a name or resource across the internet.
4. What is the location address of HTML documents called?
- Uniform resource locator
- Base URI reference protocol
- Relative reference webserver
- File percent-encoding
Answer: Option a
Explanation: A URL is used to locate the address of HTML documents.
5. Which of the following is a location-independent uniform resource identifier?
- Uniform resource locator
- Uniform resource name
- Relative reference protocol
- Namespace relative reference
Answer: Option b
Explanation: A URN is a location-independent URI. It locates the resource regardless of its location and existence.
Common Mistakes
Although the terms URIs and URLs are often interchanged, they both have different meanings and refer to different topics. It is mandatory to remember that URLs are types of URIs.
Related Concepts
- Uniform naming convention
- List of URI schemes
- Extensible markup language (XML) namespaces
- Namespace
Want more help with your computer science homework?
*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Search. Solve. Succeed!
Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.
Uniform resource indicator Homework Questions from Fellow Students
Browse our recently answered Uniform resource indicator homework questions.
Search. Solve. Succeed!
Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.