On this page:
prefix-string?
prefix-name-string?
prefix
string->prefix
empty-prefix
prefix-empty?
prefix->string
prefix+  name->nsname
prefix+  name->url

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?)
Returns a new prefix if the value of str is a valid prefix-string?.

constructor

(empty-prefix)  prefix?

Returns an empty prefix name.

predicate

(prefix-empty? v)  boolean?

  v : any/c

procedure

(prefix->string nsprefix)  string?

  nsprefix : prefix?

Examples:

procedure

(prefix+name->nsname prefix name map)  nsname?

  prefix : namespace-prefix?
  name : local-name-string?
  map : nsmap?
Returns a new nsname if the prefix is in map, else #f.

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?
Returns a new url if prefix is in map, else #f.

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"