14.7 Vocabulary Tool🔗ℹ

This package also includes a command-line tool mkns that will generate a module in the same style as those above from a set of command-line parameters.

❯ mkns -h

usage: mkns [ <option> ... ] <uri> <prefix>

 

  Create a new Racket module for an RDF vocabulary.

 

<option> is one of

 

  -n <name>, --name <name>

     This vocabulary's name

  -d <text>, --description <text>

     A description of this vocabulary

  -s <uri>, --spec-uri <uri>

     A Specification URI describing this vocabulary

  -p <date>, --spec-published <date>

     The publication date of the vocabulary specification

  -w <width>, --width <width>

     The width of the output written (default: 100)

/ -o <racket-file>, --output-file <racket-file>

|    The name of a file to write output to (default: stdout)

| -r <module>, --output-racket-module <module>

|    The name of a module to write output to

| -u, --use-prefix-name

\    Use the namespace prefix to determine the module name

* -m <member-names>, --member <member-names>

     The name of a member, or list of members, within this vocabulary

  --help, -h

     Show this help

  --

     Do not treat any remaining argument as a switch (at this level)

 

 *   Asterisks indicate options allowed multiple times.

 /|\ Brackets indicate mutually exclusive options.

 

 Multiple single-letter switches can be combined after

 one `-`. For example, `-h-` is the same as `-h --`.

The only required properties are the URI and prefix for the namespace, which generates a very bare-bones module, as shown below.

❯ mkns http://example.org/schema/example# ex

#lang racket/base

;;

;; Status: not set

;;

 

(require (only-in rdf/core/namespace

                  make-namespace

                  make-name))

 

(provide (all-defined-out))

 

;; ==============================================================

;; Namespace definition

;; ==============================================================

 

(define ex:

  (make-namespace "http://example.org/schema/example#"

                  "ex"))

 

;; ==============================================================

;; Name Definitions

;; ==============================================================

A more complete example specifies a name, description, a specification URI and date, as well as two member names to be added to the namespace.

❯ mkns -n "An example namespace" \

       -d "Using the IETF example domain name, example.org, …" \

       -s https://www.rfc-editor.org/rfc/rfc2606.html \

       -p 1999-06 \

       -m ExampleClass \

       -m exampleProperty \

       -w 65 \

       http://example.org/schema/example# ex

#lang racket/base

;;

;; Name: An example namespace

;;

;; Using the IETF example domain name, example.org, this adds a

;; simple path which can be used to document RDF tools.

;;

;; Specification URI: https://www.rfc-editor.org/rfc/rfc2606.html

;;

;; Specification Date: 1999-06

;;

;; Status: not set

;;

 

(require (only-in rdf/core/namespace

                  make-namespace

                  make-name))

 

(provide (all-defined-out))

 

;; ==============================================================

;; Namespace definition

;; ==============================================================

 

(define ex:

  (make-namespace "http://example.org/schema/example#"

                  "ex"))

 

;; ==============================================================

;; Name Definitions

;; ==============================================================

 

(define ex:exampleProperty (make-name ex: "exampleProperty"))

(define ex:ExampleClass (make-name ex: "ExampleClass"))