Well, if you want to know if that ‘something’ is URI or URL or URN, you should always mark it as a URI because all URLs and URNs are URIs. Below are the differences:
Point of Distinction | URI | URL | URN |
---|---|---|---|
Stands For | Uniform Resource Identifier | Uniform Resource Locator | Uniform Resource Name |
Subset / Superset | All URLs are not URI. | Subset of URI. All URLs are URI. | URN is also the subset of URI |
Real World Example | Your name could be a URI because it identifies you, but it couldn't be a URL because it doesn't help anyone find your location. | On the other hand, your address is both a URI and a URL because it both identifies you and it provides a location for you. | One of the best examples of URN is ISBN number which is used to uniquely identify a book. URN is completely different than URL as it doesn't include any protocol. |
Resource | The URI is the identifier of the specific resource. Like a page, or book, or a document. | URL is the locator of a resource. | Name of the resource |
Syntax |
scheme:[//authority]path[?query][#fragment] where authority = [userinfo@]host[:port] |
[protocol]://www.[domain_name]:[port 80]/[path or exaction resource location]?[query]#[fragment] |
<URN> ::= "urn:" <NID> ":" <NSS> where <NID> is the Namespace Identifier, and <NSS> is the Namespace |
Schema | The scheme can be anything – protocol, name or specification, etc... | The scheme is always a protocol like HTTP, https, ftp, LDAP etc... | Namespace identifier or namespace specific String. |
Purpose | The main purpose of URI is to identify a resource and distinguish it from other resources using either location or name | The main purpose is to get the address or location of a resource | Uniquely identify Books and Journals |
Example | contact: +91 9999075499, urn:isbn:1234567890 |
https://www.programsbuzz.com |
urn:ISBN:1-23-432536-5 urn:ISSN:0167-6423 |
Use | Used in HTML, XML and tag library files like XSLT and jstl to identify resources and binaries. | URL is used to find only web pages | Find Books and Journals or any other resource with name |
Tue, 09/01/2020 - 02:32
Tarun Goswami is a highly experienced professional, currently serving as Technical Lead at a well-established IT services company. With over 12 years of experience across multiple domains, he demonstrates his expertise and passion for the industry through his engaging and informative blog writing in his spare time.
Comments