Liking cljdoc? Tell your friends :D

vaelii.impl.seed

Ontology KB files: declarative content held as plain text on the classpath rather than as code.

A KB file is a list of ordinary vaelii sentences — one s-expression each, with ;; line comments and blank lines allowed — named for the context its sentences assert into, and grouped term-centrically: every sentence about a vocabulary term sits together, and the terms run in natural sort order. A rule is just a sentence carrying an implies / set/*Rule / exceptWhen wrapper.

The format itself — reader and writer both — is vaelii.impl.io.text, which is where its one non-sentence spelling lives ((set/monotonic S), the known-true class) and what vaelii.core/export-text! writes. What is here is the classpath side: the shallow tree under resources/kb/ and how a layer's files are discovered in it.

The files live under resources/kb/, in a shallow tree that mirrors the context spindle:

kb/CxCore.txt        the vocabulary head (see vaelii.impl.core-context)
kb/upper/<C>.txt          definitional layers, between Core and Universe
kb/middle/<C>.txt         theory layers, between Universe and Well

The file name is the context; the sub-directory is the layer. Only the layer a caller names is discovered, so a sibling directory under kb/ that names no layer here is not loaded: kb/koinii/ is one, an application's own context files, which that application loads for itself. What stays in code (vaelii.impl.starter) is the order the files load in and the handful of genuinely computed assertions. Sentences read with clojure.edn, so a KB file is data and can never run code.

Ontology KB files: declarative content held as **plain text on the classpath**
rather than as code.

A KB file is a list of ordinary vaelii sentences — one s-expression each, with
`;;` line comments and blank lines allowed — named for the context its sentences
assert into, and grouped **term-centrically**: every sentence about a vocabulary
term sits together, and the terms run in natural sort order.  A rule is just a
sentence carrying an `implies` / `set/*Rule` / `exceptWhen` wrapper.

**The format itself — reader and writer both — is `vaelii.impl.io.text`**, which is
where its one non-sentence spelling lives (`(set/monotonic S)`, the known-true class)
and what `vaelii.core/export-text!` writes.  What is here is the *classpath* side: the
shallow tree under `resources/kb/` and how a layer's files are discovered in it.

The files live under `resources/kb/`, in a shallow tree that mirrors the context
spindle:

    kb/CxCore.txt        the vocabulary head (see vaelii.impl.core-context)
    kb/upper/<C>.txt          definitional layers, between Core and Universe
    kb/middle/<C>.txt         theory layers, between Universe and Well

The file *name* is the context; the sub-directory is the layer.  Only the layer a
caller names is discovered, so a sibling directory under `kb/` that names no layer here
is not loaded: `kb/koinii/` is one, an application's own context files, which that
application loads for itself.  What stays in
**code** (vaelii.impl.starter) is the *order* the files load in and the handful of
genuinely computed assertions.  Sentences read with `clojure.edn`, so a KB file is
data and can never run code.
raw docstring

layer-contextsclj

(layer-contexts dir)

The context symbols whose KB files live in the layer sub-directory dir ("upper" / "middle"), sorted for determinism. Discovered from the classpath, so dropping a new Cx<Name>.txt in kb/<dir>/ loads it with no code change — every context is loaded on kb start by default, from a filesystem tree and from a packaged jar alike (layer-files).

The context symbols whose KB files live in the layer sub-directory `dir`
("upper" / "middle"), sorted for determinism.  Discovered from the classpath, so
dropping a new `Cx<Name>.txt` in `kb/<dir>/` loads it with no code change — every
context is loaded on kb start by default, from a filesystem tree and from a
packaged jar alike (`layer-files`).
sourceraw docstring

load-contextclj

(load-context kb context)
(load-context kb context dir)

Assert every sentence of the KB file for context into that context, through load-sentences — so the file's term order is not also asked to be a dependency order. dir names the layer sub-directory, nil for the kb/ root. Returns kb.

Assert every sentence of the KB file for `context` into that context, through
`load-sentences` — so the file's term order is not also asked to be a dependency
order.  `dir` names the layer sub-directory, nil for the `kb/` root.  Returns kb.
sourceraw docstring

load-layerclj

(load-layer kb dir contexts)

Load several context files from one layer sub-directory, in the order given. Returns kb.

Load several context files from one layer sub-directory, in the order given.
Returns kb.
sourceraw docstring

load-sentencesclj

(load-sentences kb sentences context)

Assert sentences into context, order-insensitivelytext/load-entries!, which is the loader for this format wherever it is read from (vaelii.core/load-text! reads a file tree through the same one). Returns kb.

A KB file's order is its terms', not its dependencies', so a sentence refused because content further down the list has not arrived yet is retried rather than fatal; text/load-entries! says why, and what a clean list pays.

Assert `sentences` into `context`, **order-insensitively** — `text/load-entries!`,
which is the loader for this format wherever it is read from (`vaelii.core/load-text!`
reads a file tree through the same one).  Returns kb.

A KB file's order is its *terms'*, not its dependencies', so a sentence refused
because content further down the list has not arrived yet is retried rather than
fatal; `text/load-entries!` says why, and what a clean list pays.
sourceraw docstring

read-sentencesclj

(read-sentences context)
(read-sentences context dir)

Read every sentence from the KB file for context (a symbol or string), in file order. dir names the layer sub-directory ("upper" / "middle"), nil for a file at the kb/ root. Throws if the resource is missing: a silently empty ontology is worse than a failure to start.

Read every sentence from the KB file for `context` (a symbol or string), in file
order.  `dir` names the layer sub-directory ("upper" / "middle"), nil for a file
at the `kb/` root.  Throws if the resource is missing: a silently empty ontology is
worse than a failure to start.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close