On this page:
resource-absolute?
resource-maybe-namespace?
resource-maybe-nsname?
resource-name-only?
resource-empty?
resource<?

3.2 Resource Predicates🔗ℹ

predicate

(resource-absolute? val)  boolean?

  val : any/c
Returns #t if val is a resource? and is an absolute URI. An absolute URI is defined as having a scheme, FQDN for the host, and an absolute path.

Examples:
> (require racket/function racket/list rdf/core/resource)
> (filter
    (compose resource-absolute? string->resource)
    '("http://example.com"
      "http://example.com/"
      "http://example.com/name"
      "http://example.com/name#other"
      "http://example.com/name#"
      "example.com:80"
      "/name"
      "#other"
      "name"
      "other"
      ""))

'("http://example.com"

  "http://example.com/"

  "http://example.com/name"

  "http://example.com/name#other"

  "http://example.com/name#")

predicate

(resource-maybe-namespace? val)  boolean?

  val : any/c
Returns #t if val is a resource? and would be a valid namespace URI. A namespace URI is resource-absolute?, has an empty path, a path that ends in "/", or the empty fragment "#".

Examples:
> (require racket/function racket/list rdf/core/resource)
> (filter
    (compose resource-maybe-namespace? string->resource)
    '("http://example.com"
      "http://example.com/"
      "http://example.com/name"
      "http://example.com/name#other"
      "http://example.com/name#"
      "example.com:80"
      "/name"
      "#other"
      "name"
      "other"
      ""))

'("http://example.com/" "http://example.com/name#")

predicate

(resource-maybe-nsname? val)  boolean?

  val : any/c
Returns #t if val is a resource? and would be a valid namespaced-name. A namespaced-name is a resource-absolute?, and either has a path ending in a local-name-string? value or a fragment that is a local-name-string?.

Examples:
> (require racket/function racket/list rdf/core/resource)
> (filter
    (compose resource-maybe-nsname? string->resource)
    '("http://example.com"
      "http://example.com/"
      "http://example.com/name"
      "http://example.com/name#other"
      "http://example.com/name#"
      "example.com:80"
      "/name"
      "#other"
      "name"
      "other"
      ""))

'("http://example.com/name"

  "http://example.com/name#other"

  "example.com:80"

  "/name"

  "#other"

  "name"

  "other")

predicate

(resource-name-only? val)  boolean?

  val : any/c
Returns #t if val is a resource? and either has only a path with a single local-name-string? component, or only a local-name-string? fragment.

Examples:
> (require racket/function racket/list rdf/core/resource)
> (filter
    (compose resource-name-only? string->resource)
    '("http://example.com"
      "http://example.com/"
      "http://example.com/name"
      "http://example.com/name#other"
      "http://example.com/name#"
      "example.com:80"
      "/name"
      "#other"
      "name"
      "other"
      ""))

'("/name" "#other" "name" "other")

predicate

(resource-empty? val)  boolean?

  val : any/c
Returns #t if val is a resource? and has no content whatsoever.

Examples:
> (require racket/function racket/list rdf/core/resource)
> (filter
    (compose resource-empty? string->resource)
    '("http://example.com"
      "http://example.com/"
      "http://example.com/name"
      "http://example.com/name#other"
      "http://example.com/name#"
      "example.com:80"
      "/name"
      "#other"
      "name"
      "other"
      ""))

'("")

predicate

(resource<? v1 v2)  boolean?

  v1 : resource?
  v2 : resource?
Returns #t if v1 and v2 are resource? values, and v1 is lexigraphically less than v2. This is equivalent to the following:

(string<?
  (resource->string val1)
  (resource->string val2))