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 ):
<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:
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.html
Is the location where resources are stored. In this example,#intro
Is 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:
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:
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!