Open In App

Difference Between URI and URN in Java

Improve
Improve
Like Article
Like
Save
Share
Report

URI stands for Uniform Resource Identifier. It identifies the resource either by name, or by location, or by both. It allows uniform identification of the resources. Here the resource can be anything like documents, images, files, web pages, etc. that can be part of the web architecture. The identifier in the name URI refers to the prominence of the resources, despite the technique used. 

When you are browsing on the internet, you are actually looking up a bundle of web resources. We use the Uniform resource identifiers to define the location of a resource. A URI consists of two things: URL and URN.

URN stands for Uniform Resource Name. It identifies the resources by name in a given name-space. A name-space refers to a group of names or identifiers. It is a subset of URI. URN does not include any protocol. A URN is required to exist globally unique and features global scopes. A URN is an unambiguous way to identify a resource.

Difference Between URI and URN

 URI

URN

It is the superset of URL and URN. It is the subset of URI.
It identifies the recourse by name, location, or both. It identifies the resource by names.
URI is used to distinguish one resource from others regardless of the method used. URN is used to distinguish one resource from others by the globally unique names.

Example:  

https://www.website.com/html/#posts

The above example line completely is referred to as URI whereas the part “www.website.com/html/#posts” of the above example is referred to as a URN.


Last Updated : 28 Jan, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads