3.1 Namespaces
predicate
(url-absolute? val) → boolean?
val : any/c
Predicate to check that the value val is a url?, and is an absolute URI, not relative.
Examples:
> (require net/url-string) > (url-absolute? (string->url "http://example.com/some/path")) #t
> (url-absolute? (string->url "/some/other/path")) #f
predicate
(namespace-url? val) → boolean?
val : any/c
Predicate to check that the value val is a url-absolute?, and either ends in a path separator
"/" or an empty fragment identifier "#".
Examples:
> (require net/url-string) > (namespace-url? (string->url "/some/other/path")) #f
> (namespace-url? (string->url "http://example.com/some/path")) #f
> (namespace-url? (string->url "http://example.org/schema/nspace#")) #t
> (namespace-url? (string->url "http://example.org/schema/nspace/")) #t
> (namespace-url? (string->url "http://example.org/")) #t
struct
(struct namespace () #:constructor-name url->namespace)
This structure provides a safe and efficient way to wrap a url? that conforms to the predicate
namespace-url?. This ensures that the namespace cannot be mutated, and the predicate namespace? is
more efficient than parsing the URI (see local-name? for a comparison).
constructor
(string->namespace url) → namespace?
url : string?
Returns a new namespace? structure by parsing the provided url string.
procedure
(namespace->url ns) → namespace-url?
ns : namespace?
Returns the namespace URI as a url? structure.
procedure
(namespace->string ns) → string?
ns : namespace?
Returns a string representation of the namespace ns URI.
procedure
(namespace+name->url ns name) → url-absolute?
ns : namespace? name : (or/c local-name-string? local-name?)
Returns a new URI by appending the value of name to the URI value of ns.
Examples:
> (require net/url-string)
> (url->string (namespace+name->url (string->namespace "http://example.com/schema/things#") "ThingOne")) "http://example.com/schema/things#ThingOne"