Open about-code opened 4 years ago
Might be a duplicate of https://github.com/digitalbazaar/jsonld.js/issues/305
Appendix A of the URN spec tells how URL resolvers are supposed to handle URNs. From a layman's perspective I tend to think the appendix shouldn't be of relevance to jsonld.js, yet I could be wrong and wonder whether this might be part of the reasoning behind the current implementation.
https://tools.ietf.org/html/rfc2141.html#appendix-A
Appendix A. Handling of URNs by URL resolvers/browsers.
The URN syntax has been defined so that URNs can be used in places where URLs are expected. A resolver that conforms to the current URL syntax specification [3] will extract a scheme value of
"urn:"
rather than a scheme value of"urn:<nid>"
.An URN MUST be considered an opaque URL by URL resolvers and passed (with the "urn:" tag) to an URN resolver for resolution. The URN resolver can either be an external resolver that the URL resolver knows of, or it can be functionality built-in to the URL resolver.
To avoid confusion of users, an URL browser SHOULD display the complete URN (including the "urn:" tag) to ensure that there is no confusion between URN namespace identifiers and URL scheme identifiers.
RFC 2141 specifies the URN syntax as
where NID is the namespace identifier and NSS is the namespace string. RFC 4122 specifies a URN for UUIDs where NID for UUIDs is
uuid
. So a Universal Resource Name for uuids looks likeThe following example in json-ld Playground should produce above UUID URN as the subject URN. Yet it only produces a URN missing the namespace identifier:
urn:f81d4fae-7dec-11d0-a765-00a0c91e6bf6