Do you know the difference between URL, URI, and URN?

Source: Internet
Author: User

Do you know the difference between URL, URI, and URN?

This is a classic technical debate. Many people may ask themselves: URL, URI, and URN. What is the difference between them. Although we simply regard both URN and URL as Uris, URI can be further divided into URL, URN, or a combination of the two, so understanding the differences between the three will be very interesting and beneficial. If you happen to encounter these things somewhere, you should at least know their meaning.

In my opinion, although for average people, it is not a problem to understand the technical differences between the three acronyms and their respective meanings. However, if you are a computer scientist, a Web Developer, a system administrator, or more broadly speaking, you are working in the IT field, IT is necessary to understand this knowledge.

This article aims to clearly explain the differences between URLs, Uris, and urns and help you quickly understand these essential knowledge. Are you confused about this topic? Let's get started!

 

Origin

The three acronyms are the Internet standard tracing protocol defined by Tim Berners-Lee in an article titled RFC 3986: Uniform Resource Identifier (URI): Generic Syntax.

Citation:

Uniform Resource Identifier (URI) provides a simple and scalable resource identification method. The semantics and syntax in the URI specification are derived from the concept of active introduction of World Wide Web information. Since 1990, the World Wide Web used this identifier data and described it as "unified resource descriptor in the World Wide Web ".

 

Differences

First, we need to figure out one thing: the URL and URN are both a subset of the URI.

In other words, the URL and URN are both Uris, but the URI is not necessarily a URL or URN. For a better understanding of this concept, see the following picture.

Through the example below (derived from Wikipedia), we can understand the difference between URN and URL. If you are a person, we will think of his name and address.

A URL is similar to an address, which tells you a way to find a target (in this example, a person is found through a street address ). The preceding definition is also a URI.

In contrast, we can regard a person's name as URN, so we can use URN to uniquely identify an object. Because there may be the same name (the same surname), it is not very appropriate to say that the name of a person is more accurate. What's more appropriate is the ISBN code of the book and the serial number of the product in the system, even though it doesn't tell you how or where to find the target, but you have enough information to retrieve it. Introduced from this article:

All urns follow the following syntax (the quotation mark phrase is required ):

  1. <URN>::="urn:"<NID>":"<NSS>

The NID is the namespace identifier, and the NSS is the specific string that identifies the namespace.

 

An example of understanding the three

Let's take a look at how the above concepts are applied to the Internet that is closely related to us.

Again, Wikipedia, which provides a more professional explanation than the above example:

URL:

A URL is a type of URI. It not only identifies Web resources, but also specifies the operation or retrieval method. It also points out the main access mechanism and network location.

About URN:

URN is a type of URI that identifies a resource with the name of a specified namespace. You can use URN to discuss resources without knowing the network location and access method.

Now, if you look at the Web, you will find many examples, which is more confusing than other things. I will show you only one example. It is very simple and clear to tell you the difference between URI, URL, and URN on the Internet.

Let's take a look at the fictitious example below. This is a URI:

  1. http://bitpoetry.io/posts/hello.html#intro

Let's start the analysis.http://Is to define how to access resources. In additionbitpoetry.io/posts/hello.htmlIs the location where resources are stored. In this example,#introIs a resource.

A URL is a subset of a URI, which tells us how to access the network location. In our example, the URL should be as follows:

  1. http://bitpoetry.io/posts/hello.html

URN is a subset of URIs, including names (within a given namespace), but does not include access methods, as shown below:

  1. bitpoetry.io/posts/hello.html#intro

That's it. Now you should be able to identify the difference between URL and URN.

If you forget the content of this article, remember at least one thing: URI can be divided into URL, URN, or a combination of the two. If you keep using the term URI, there will be no errors.

This article has been updated to correct some errors. If you find new errors, either technically or syntactically, please do not hesitate to tell us!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.