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 two non-sentence spellings live ((set/monotonic S) and (set/inert S))
and what vaelii.core/export-text! writes. Which files a layer holds is
vaelii.impl.io.shipped's; what is here is reading and loading them.
The files live under resources/kb/, in two layers:
kb/upper/<name>.txt the upper ontology, every file loaded into CxUniverse
(see vaelii.host.core-context)
kb/middle/<C>.txt theory contexts, each seeing CxUniverse
An upper file is named for its domain (core.txt is the vocabulary, interface-rules.txt
the args→argAndRest twin rule); a middle file's name is its context. 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.host.core-context,
vaelii.host.starter) is the order the layers load in.
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 two non-sentence spellings live (`(set/monotonic S)` and `(set/inert S)`)
and what `vaelii.core/export-text!` writes. Which files a layer holds is
`vaelii.impl.io.shipped`'s; what is here is reading and loading them.
The files live under `resources/kb/`, in two layers:
kb/upper/<name>.txt the upper ontology, every file loaded into CxUniverse
(see vaelii.host.core-context)
kb/middle/<C>.txt theory contexts, each seeing CxUniverse
An upper file is named for its domain (`core.txt` is the vocabulary, `interface-rules.txt`
the `args`→`argAndRest` twin rule); a middle file's *name* is its context. 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.host.core-context,
vaelii.host.starter) is the *order* the layers load in.
Sentences read with `clojure.edn`, so a KB file is data and can never run code.(compose-renames maps)The renames files maps, oldest first, as one map of the four vocabulary keys: each
:renames and :context-merges chain followed to its last spelling, the :re-meanings
notes joined and the :retired sets unioned. :api, which a caller's code takes, is
left out.
The renames files `maps`, oldest first, as one map of the four vocabulary keys: each `:renames` and `:context-merges` chain followed to its last spelling, the `:re-meanings` notes joined and the `:retired` sets unioned. `:api`, which a caller's code takes, is left out.
(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.
(load-sentences kb sentences context)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.
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.
(read-sentences file)(read-sentences file dir)Read every sentence from KB file file — the context a middle file is named for, or
an upper file's name — 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 KB file `file` — the context a middle file is named for, or
an upper file's name — 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.(release-renames)Every renames/<version>.edn on the classpath, composed (compose-renames). Every
file is read, since a store records no release: lein lint's E22 keeps each renamed or
retired symbol out of the shipped KB, so a rename finds a premise to rewrite only in a
store written before it.
Every `renames/<version>.edn` on the classpath, composed (`compose-renames`). Every file is read, since a store records no release: `lein lint`'s E22 keeps each renamed or retired symbol out of the shipped KB, so a rename finds a premise to rewrite only in a store written before it.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |