Unveiling URI, URL, and URN(blog.logto.io)
90 points by thunderbong 10 days ago | 13 comments
golly_ned 9 days ago
This isn't correct. One example is that URIs don't necessarily provide the means of locating a resource. Another example is that the author says there are no URIs which are URNs.

This is wrong according to the URI RFC, which the author cites: https://datatracker.ietf.org/doc/html/rfc3986#section-1.1.1

   The following example URIs illustrate several URI schemes and
   variations in their common syntax components:

      ftp://ftp.is.co.za/rfc/rfc1808.txt

      http://www.ietf.org/rfc/rfc2396.txt

      ldap://[2001:db8::7]/c=GB?objectClass?one

      mailto:John.Doe@example.com

      news:comp.infosystems.www.servers.unix

      tel:+1-816-555-1212

      telnet://192.0.2.16:80/

      urn:oasis:names:specification:docbook:dtd:xml:4.1.2
CognitiveLens 9 days ago
I might be reading a different version of the article than you did, but the article agrees with you - URIs are a superset of URNs and URLs. I didn't see where the author says there are no URIs which are URNs - the article specifically says 'a URN is a type of URI with the scheme "urn"'
Macha 9 days ago
To add to the mess, the WHATWG now maintains a "URL" spec that covers URIs and declares URIs an outdated term for URLs: https://url.spec.whatwg.org/

So now we have a URL spec from WHATWG that says URI is an old term for URLs, and a URI spec from the IETF that says that URL is just a term for a certain subset of URIs.

Retr0id 9 days ago
> the IETF that says that URL is just a term for a certain subset of URIs

This is the more broadly accepted definition, right?

immibis 8 days ago
That may be true within their bounded context. WhatWG is the web/HTML working group, and a URL is something you can type in the address bar, and this tells the browser how to find it, although the browser's configuration may be used implicitly in the process. URIs the browser can't use to locate something are useless in the context of the web. For example news:comp.lang.c may be considered a URN, but when the browser is configured with a news server, it can also locate it, so for web purposes it's a URL.
JimDabell 8 days ago
> URIs the browser can't use to locate something are useless in the context of the web.

The obvious counterexample to this is the mailto: URI scheme. It has no location but it is still a useful thing to link to on the web.

immibis 8 days ago
It locates and opens your email program. Sometimes it even locates and opens another web page (Gmail/O365).
JimDabell 7 days ago
It doesn’t locate my email program. It contains zero information about that.
amyjess 9 days ago
> declares URIs an outdated term for URLs

The term I would use is "a distinction without a difference", but they're not entirely wrong.

paulddraper 9 days ago
> URI and IRI are just confusing.

WhatWG wasn't wrong.....

CaliforniaKarl 9 days ago
UR_:

I: Identifier, is an identifier. "Oh, that's a [a thing, or a location]."

N: Name, tells what the thing is. "Oh, that's the Sears Tower."

L: Locator, tells how to get to something. "Oh, that's at 233 S. Wacker Drive Chicago, Illinois 60606"

That was the second example to come into my head (the first was the Bank of America building in San Francisco), and I think it speaks to things that both* examples have changed their names! The Sears Tower is now the "Willia Tower", and the "Bank of America Center" is now "555 California Street".

And even place names don't stay the same! In 2019, Stanford University renamed "Serra Mall" to "Jane Stanford Way": addresses changed; building names did not.

Just goes to show why it's so important to implement redirects, and (in HTTP at least) why the "301 Moved Permanently" response code exists.

tolerance 9 days ago
> That was the second example to come into my head (the first was the Bank of America building in San Francisco), and I think it speaks to things that both* examples have changed their names! The Sears Tower is now the "Willia Tower", and the "Bank of America Center" is now "555 California Street".

I was under the impression that a URN is an identifier that is not tied to a specific location, in fact it could apply to a resource that exists at many different ones. Is the "Sears Tower" example (or anything that could reasonably be associated with a single location) really the best in this case?

skissane 9 days ago
Here is a real URN which is also a good example of what you’d use a URN for - urn:isbn:9780133488838 - that’s one of the volumes of Knuth’s TAOCP
gorgoiler 9 days ago
It’s hard to imagine URNs without a DNS based namespace to back up the universality part of it.

  urn:catalogue.isbn.org:1234
You could use a URL for information about the book as the URN for the book itself? Or is that “bad” because in 25 years we might not use either https or DNS?

  https://isbn.org/catalogue/1234
If the URN is a kind of type prefix for an otherwise meaningless number, are we supposed to use these inline / Hungarian notation types everywhere the number is used?:

  https://amazon.com/books/urn:isbn:1234/purchase
immibis 8 days ago
This is how XML namespaces work. They're URLs, but they identify resources rather than locating them. Often, conventionally, some information about the identified thing also happens to exist at the URL.
tolerance 9 days ago
Thank you. Most examples of URNs that I've found use ISBNs to convey their use. I just wish that there was more information out there about use cases. This post's article does make a good reference to one that I found interesting though.
jdougan 9 days ago
The RFC for a URN scheme for federated content: https://www.rfc-editor.org/rfc/rfc4198

I ended up using this for XML namespaces.

sham1 9 days ago
Also somewhat relatedly, XMPP tends to use URNs for the XML namespaces af the various stanzas, which in turn define the various parts of the IM message or what have you.
Pxtl 9 days ago
So how many tools out there use the term "uri" to sound smart but would fall over on their faces of you passed anything but a web URL to their "uri" parameter?
paulddraper 9 days ago
Plenty of tools have inputs for "numbers" that don't accept all real numbers (which is impossible).

Even if the nomenclature was "URL" they still wouldn't necessarily accept all URLs.

stavros 9 days ago
file:///etc/passwd
PeeMcGee 9 days ago
The author does a poor job explaining anything about URI or URN, and says very little about URL beyond naming the components of a hypothetical URL on their website. It is frankly confusing why they published this at all (other than to achieve some SEO goal that concludes with "please try our service").
surfingdino 8 days ago
pyuser583 8 days ago
I was taught never to confuse these three things. Then I started working as a developer, and realized it's a bit like correcting people's grammar. Don't do it.
9 days ago
jinnko 10 days ago
> All URLs or URNs are URIs, but not all URIs are URLs or URNs.
yuchi 9 days ago
And only very malformed URNs may be actually valid URLs
jwilk 9 days ago
RFC 3986 ("Uniform Resource Identifier (URI): Generic Syntax") has a wider definition of URNs, according to which URLs and URNs are not disjoint.

https://www.rfc-editor.org/rfc/rfc3986.html#section-1.1.3

lohfu 9 days ago
It pains me greatly that the host name part is in lack of a better name unimportance to significance in domain names, but significance to unimportance in URL paths
tejtm 9 days ago
And don't forget IRIs for when you have really dirty data and can't be bothered to clean it up.

https://en.wikipedia.org/wiki/Internationalized_Resource_Ide...

seabass-labrax 9 days ago
That's a very misleading statement. IRIs are for the majority of people in the world whose language isn't written exclusively with the Latin script - more specifically, the ASCII version of the Latin script, which doesn't even include diacritical marks. The IRI https://example.com/menu/pâtés is a lot better than the best equivalent URI: https://example.com/menu/p%C3%A2t%C3%A9s
tejtm 9 days ago
Granted.

My only exposure was folks using it to gloss over what could have been expressed in 7 bit clean ascii if you knew the codepage it had been encoded with.

I apologize for the mischaracterization of legitimate use.

lohfu 9 days ago
[flagged]
lohfu 9 days ago
[flagged]