Do you know the difference between a URL, a URI, and a urn?

Source: Internet
Author: User

This is a classic technical argument, and many people will ask themselves: URLs, URIs, and probably urns, what the difference is between them. Although, now we simply look at the URN and the URL as URIs, but strictly speaking the URI can be further divided into a URL, URN, or a combination of the two, so understanding the differences between the three will be very interesting and beneficial to people. If you happen to meet these things somewhere, you should at least know what they mean.

I think that, although for the average person, 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 generally, you are working in the IT field, then it is necessary to understand this knowledge.

This article is designed to clearly explain the differences between URLs, URIs, and urns to help you quickly understand these prerequisites. Are you confused about this topic? So let's get started!

Origin

These three acronyms are the Internet standard tracking protocol that Tim Berners-lee defines in a document called RFC 3986:uniform Resource Identifier (URI): Generic syntax.

Citation:

A Uniform Resource Identifier (URI) provides a simple, extensible way to identify resources. The semantics and syntax in the URI specification are derived from the concept of the Global Information initiative introduced by the World Wide Web, which has been used since 1990 and is described as "Uniform resource descriptors in the World Wide Web".

Tim Berners-lee, the inventor of the World Wide Web, is also the head of the World Wide Web Consortium. The photos are provided by Paul Clarke following the CC BY-SA 4.0 protocol.

Difference

First, let's make one thing clear: URLs and urns are a subset of URIs.

In other words, both the URL and the urn are URIs, but the URI is not necessarily a URL or urn. To better understand the concept, look at this picture below.

With the following example (from Wikipedia), we have a good understanding of the difference between a urn and a URL. If it is a person, we will think of his name and address.

A URL is similar to an address, and it tells you a way to look for a goal (in this case, find a person by street address). You know, the above definition is also a URI.

In contrast, we can think of a person's name as a urn, so a urn can be used to uniquely identify an entity. Because there may be a case of the same name (same surname), it is not quite appropriate to say more accurately the example of a person's name. What's more appropriate is the book's ISBN code and the serial number of the product within the system, although it doesn't tell you how or where to find the target, but you have enough information to retrieve it. Quote this article:

All urns Follow the following syntax (the phrase in quotation marks is required):

" urn: " " : " < NSS >

Where Nid is a namespace identifier, NSS is a specific string that identifies the namespace.

An example to understand these three

Let's take a look at how these concepts apply to the Internet that is relevant to us.

Again, citing Wikipedia, these citations are more professional than the example of a person's address:

About URLs:

A URL is a URI that identifies not only the Web resource, but also the operation or Fetch method, as well as the main access mechanism and network location.

About urn:

A urn is a URI that identifies a resource with the name of a particular namespace. Urns can be used to discuss resources without knowing their network locations and access patterns .

Now, if you go to the web and look at it, you'll find many examples that are more confusing than anything else. I'll just show you an example, very simply and clearly tell you the difference between a URI, a URL, and a urn in the internet.

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

Http://bitpoetry.io/posts/hello.html#intro

We begin to analyze

/HTTP

is a way to define how resources are accessed . Other than that

Bitpoetry.io/posts/hello.html

is where the resources are stored , so in this case,

#intro

is a resource.

A URL is a subset of the URI that tells us how to access the network location. in our example, the URL should look like this:

Http://bitpoetry.io/posts/hello.html

A urn is a subset of URIs, including the name (within a given namespace), but does not include access, as follows:

Bitpoetry.io/posts/hello.html#intro

That's it. Now you should be able to tell the difference between a URL and a urn.

If you forget the content of this article, at least one thing to remember: URIs can be divided into URLs, urns, or combinations of both. If you have been using the term URI, there is no mistake.

Do you know the difference between a URL, a URI, and a urn?

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.