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. Nothing is interpreted here that assert would not interpret anyway: a rule is just a sentence carrying an implies / set/*Rule / exceptWhen wrapper.

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

kb/CoreContext.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. 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.  Nothing is
interpreted here that `assert` would not interpret anyway: a rule is just a
sentence carrying an `implies` / `set/*Rule` / `exceptWhen` wrapper.

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

    kb/CoreContext.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.  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 <Context>.txt in kb/<dir>/ loads it with no code change — every context is loaded on kb start by default. (File-classpath discovery, so a repl / lein / test tree; a packaged jar would need an explicit manifest.)

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 `<Context>.txt` in `kb/<dir>/` loads it with no code change — every
context is loaded on kb start by default.  (File-classpath discovery, so a repl /
lein / test tree; a packaged jar would need an explicit manifest.)
raw 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.
raw 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.
raw docstring

load-sentencesclj

(load-sentences kb sentences context)

Assert sentences into context, order-insensitively: a sentence refused because content further down the list has not arrived yet is retried rather than fatal. Returns kb.

A KB file's order is its terms', not its dependencies' — blocks run in natural sort order, which is the whole point of grouping term-centrically — so a file cannot also be dependency-ordered. (argPreserving largerThan 1 partOf) sits under largerThan and (transitive partOf) under partOf, and l sorts before p. Several checks read the store (a preservation's transitivity, an argIsa clash, a disjointness), so without this a term-centric file is refused for where its author filed a sentence.

Retry rounds run while each one makes progress; the sentences that survive a round that changed nothing are re-asserted without a catch, so a genuinely ill-formed one still throws — carrying the error it has once everything that could have helped it is stored, which is the error worth reporting. A list that loads clean pays one try per sentence and no second round.

Assert `sentences` into `context`, **order-insensitively**: a sentence refused
because content further down the list has not arrived yet is retried rather than
fatal.  Returns kb.

A KB file's order is its *terms'*, not its dependencies' — blocks run in natural
sort order, which is the whole point of grouping term-centrically — so a file cannot
also be dependency-ordered.  `(argPreserving largerThan 1 partOf)` sits under
`largerThan` and `(transitive partOf)` under `partOf`, and `l` sorts before `p`.
Several checks read the store (a preservation's transitivity, an `argIsa` clash, a
disjointness), so without this a term-centric file is refused for where its author
filed a sentence.

Retry rounds run while each one makes progress; the sentences that survive a round
that changed nothing are re-asserted **without a catch**, so a genuinely ill-formed
one still throws — carrying the error it has once everything that could have helped
it is stored, which is the error worth reporting.  A list that loads clean pays one
`try` per sentence and no second round.
raw 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.
raw 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