您的位置:首页 > 其它

URI, URL, URN的概念和区分

2015-06-01 15:14 375 查看

URI, URL, URN的概念和区分

定义

A URI can be further classified as a locator, a name, or both. The term “Uniform Resource Locator” (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network “location”). The term “Uniform Resource Name” (URN) has been used historically to refer to both URIs under the “urn” scheme [RFC2141], which are required to remain globally unique and persistent even when the resource ceases to exist or becomes unavailable, and to any other URI with the properties of a name. [1]

So all URLs are URIs (actually not quite - see below), and all URNs are URIs - but URNs and URLs are different, so you can’t say that all URIs are URLs.

Examples[1]

URL & URI

Roger Pate

This is my name, which is an identifier. It is like a URI, but cannot be a URL, as it tells you nothing about my location or how to contact me. In this case it also happens to identify at least 5 other people in the USA alone.

4914 West Bay Street, Nassau, Bahamas

This is a locator, which is an identifier for that physical location. It is like both a URL and URI (since all URLs are URIs), and also identifies me indirectly as “resident of..”. In this case it uniquely identifies me, but that would change if I get a roommate.

I say “like” because these examples do not follow the required syntax.

URN

My name, Roger Pate, could be like a URN (Uniform Resource Name), except those are much more regulated and intended to be unique across both space and time.

Because I currently share this name with other people, it’s not globally unique and would not be appropriate as a URN. However, even if no other family used this name, I’m named after my paternal grandfather, so it still wouldn’t be unique across time. And even if that wasn’t the case, the possibility of naming my descendants after me make this unsuitable as a URN.

URNs are different from URLs in this rigid uniqueness constraint, even though they both share the syntax of URIs.

References

[1]http://stackoverflow.com/questions/176264/what-is-the-difference-between-a-uri-a-url-and-a-urn
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  url uri urn