4.1 Prefixes
A prefix is the string mapped to a namespace in a namespace map. This prefix can be used in place of the complete namespace URI.
predicate
(prefix-string? v) → boolean?
v : any/c
Returns #t if v is a string and the string conforms to the SPARQL production PNAME_NS.
predicate
(prefix-name-string? v) → boolean?
v : any/c
Returns #t if v is a string and the string conforms to the SPARQL production PN_PREFIX.
struct
(struct prefix ())
This structure provides a safe and efficient way to wrap either a string that conforms to the predicate
prefix-string? or the empty value. This ensures that the name cannot be mutated, and the predicate
prefix-name? is more efficient than parsing the string.
constructor
(string->prefix str) → prefix?
str : (or/c prefix-string? prefix-name-string?)
constructor
(empty-prefix) → prefix?
Returns an empty prefix name.
predicate
(prefix-empty? v) → boolean?
v : any/c
Examples:
> (prefix-empty? (string->prefix "rdf:")) #f
> (prefix-empty? (string->prefix ":")) #t
> (prefix-empty? (empty-prefix)) #t
procedure
(prefix->string nsprefix) → string?
nsprefix : prefix?
Examples:
> (prefix->string (string->prefix "rdf:")) "rdf:"
> (prefix->string (string->prefix ":")) ":"
> (prefix->string (empty-prefix)) ":"
procedure
(prefix+name->nsname prefix name map) → nsname?
prefix : namespace-prefix? name : local-name-string? map : nsmap?
Example:
> (let ((map (make-common-nsmap))) (url->string (nsname->url (prefix+name->nsname (string->prefix "dcterms:") (string->local-name "description") map)))) "http://purl.org/dc/terms/description"
procedure
(prefix+name->url prefix name map) → url-absolute?
prefix : namespace-prefix? name : local-name-string? map : nsmap?
Example:
> (let ((map (make-common-nsmap))) (url->string (prefix+name->url (string->prefix "dcterms:") (string->local-name "description") map))) "http://purl.org/dc/terms/description"