Examples of URI, URL and URN

Bren Ginthom picture Bren Ginthom · Mar 1, 2017 · Viewed 12.2k times · Source

I have read many articles about URIs, URLs and URNs, but I don't understand the diff in real examples.

Could you take a few examples of URI and URL?

I think http://stack.com/first/index.html?submit=yes&action=go#second is URI, not URL, yes?

Then http://stack.com/first/index.html is URL, because it's not so specific?

enter image description here

Is this image is correct?

Answer

Varvara Kalinina picture Varvara Kalinina · Jun 11, 2017

Here's a quote from the REST in Practice by J.Webber, S.Parastatidis, I.Robinson, that captures the essence of the differences:

URLs and URN s are special forms of URIs.

A URI that identifies the mechanism by which a resource may be accessed is usually referred to as a URL. HTTP URIs are examples of URLs.

If the URI has urn as its scheme and adheres to the requirements of RFC 2141 and RFC 2611, it is a URN. The goal of URN s is to provide globally unique names for resources.

The ISBN of this book is ISBN-13: 978-0596805821, by the way. If you click on the Amazon.com's link Why is ISBN important, you will see the tooltip saying:

This bar-code number lets you verify that you're getting exactly the right version or edition of a book.

This is an example of the URN (and URI by definition) in the urn:isbn namespace, which does not assume any given mechanism for retrieving this resource, but does identify it.

If you had some link to the book online, for example, in PDF format, that would be a URL (and URI by definition) and look something like this:

https://www.somewebsite.org/books/RestInPractice.pdf