4 ms·
Unveiling URI, URL, and URN
- jinnko 2y ago> All URLs or URNs are URIs, but not all URIs are URLs or URNs.
- yuchi 2y agoAnd only very malformed URNs may be actually valid URLs
- jwilk 2y agoRFC 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 https://www.rfc-editor.org/rfc/rfc3986.html#section-1.1.3
- CaliforniaKarl 2y agoUR_: 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 2y 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 2y agoHere 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
- tolerance 2y agoThank 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 2y agoThe RFC for a URN scheme for federated content: https://www.rfc-editor.org/rfc/rfc4198 https://www.rfc-editor.org/rfc/rfc4198 I ended up using this for XML namespaces.
- sham1 2y agoAlso 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.
- gorgoiler 2y agoIt’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 2y agoThis 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.
- Pxtl 2y agoSo 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?
- stavros 2y agofile:///etc/passwd
- paulddraper 2y agoPlenty 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.
- lohfu 2y agoIt 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
- lohfu 2y ago[flagged]
- lohfu 2y ago[flagged]
- tejtm 2y agoAnd 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_Identifier https://en.wikipedia.org/wiki/Internationalized_Resource_Ide...
- seabass-labrax 2y agoThat'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 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 https://example.com/menu/p%C3%A2t%C3%A9s
- tejtm 2y agoGranted. 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.
- golly_ned 2y agoThis 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 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 2y agoI 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 2y agoTo 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/ 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.
- paulddraper 2y ago> URI and IRI are just confusing. WhatWG wasn't wrong.....
- Retr0id 2y 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?
- amyjess 2y 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.
- immibis 2y agoThat 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 2y 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.
- PeeMcGee 2y agoThe 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").
- deleted 2y ago[deleted]
- surfingdino 2y agoThe author omitted IRI https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier https://en.wikipedia.org/wiki/Internationalized_Resource_Ide... in his article.
- pyuser583 2y agoI 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.