The text KB format, read and written: one file per context, one s-expression per
sentence, the format the shipped ontology is authored in (resources/kb/,
vaelii.host.seed). Every form is read with clojure.edn; the file name is the context.
peel-form takes the (set/monotonic S) and (set/inert S) wrappers off a whole form.
Text holds premises and inert sentexes in the author's spelling, with a handle as the
(ist Cx S) reference it resolves from; the export dump (io.export, io.import) holds
every record at its own handle. See docs/kbs.md, "Text you exported yourself".
The text KB format, read and written: one file per context, one s-expression per sentence, the format the shipped ontology is authored in (`resources/kb/`, `vaelii.host.seed`). Every form is read with `clojure.edn`; the file name is the context. `peel-form` takes the `(set/monotonic S)` and `(set/inert S)` wrappers off a whole form. Text holds premises and inert sentexes in the author's spelling, with a handle as the `(ist Cx S)` reference it resolves from; the export dump (`io.export`, `io.import`) holds every record at its own handle. See docs/kbs.md, "Text you exported yourself".
(context-of f)The context a text KB file asserts into: its name without the .txt.
The context a text KB file asserts into: its name without the `.txt`.
(digest-check kb)A check! for load-entries! over kb: throws :canonical-mismatch when the references
entry/references reads in sentence are not as many as digests, or when one resolves
to a sentex whose digest is not the one its writer recorded, naming the reference under
:reference. An (ist Cx S) form is S read in Cx.
A `check!` for `load-entries!` over `kb`: throws `:canonical-mismatch` when the references `entry/references` reads in `sentence` are not as many as `digests`, or when one resolves to a sentex whose digest is not the one its writer recorded, naming the reference under `:reference`. An `(ist Cx S)` form is `S` read in `Cx`.
(entries source)Every [form context] a text KB holds, with the files they came from:
{:files ["CxUniverse.txt" …] :entries [[form context] …] :path "…"}. In a
directory holding a manifest-file, each entry is [form context digests].
source is a directory of Cx….txt files — an export-text! destination, or an
ontology tree an author keeps — or a single such file, the context of a form its file's
name. A directory is read whole for one load-entries! pass, since one context's
content can rest on another's.
Every `[form context]` a text KB holds, with the files they came from:
`{:files ["CxUniverse.txt" …] :entries [[form context] …] :path "…"}`. In a
directory holding a `manifest-file`, each entry is `[form context digests]`.
`source` is a **directory** of `Cx….txt` files — an `export-text!` destination, or an
ontology tree an author keeps — or a single such file, the context of a form its file's
name. A directory is read whole for one `load-entries!` pass, since one context's
content can rest on another's.(form-spans source)Every form in the text KB file source (anything io/reader takes), in file order, as
{:form f :start line :end line}: the 1-based lines the form opens and closes on.
clojure.edn, so comments and blank lines added no work and no code can run. A form
that does not read is refused as :unreadable, carrying :file and the :line it
opens on and never the file's text.
Every form in the text KB file `source` (anything `io/reader` takes), in file order, as
`{:form f :start line :end line}`: the 1-based lines the form opens and closes on.
`clojure.edn`, so comments and blank lines added no work and no code can run. A form
that does not read is refused as `:unreadable`, carrying `:file` and the `:line` it
opens on and never the file's text.(kb-file? f)Is f a context file of a text KB directory — a regular Cx….txt? The prefix is
the discriminant so a directory holding a README or a checksum is read for its KB
files rather than refused for the rest.
Is `f` a context file of a text KB directory — a regular `Cx….txt`? The prefix is the discriminant so a directory holding a README or a checksum is read for its KB files rather than refused for the rest.
(kb-files dir)The context files of the text KB directory dir, in name order.
The context files of the text KB directory `dir`, in name order.
(load-entries! assert! assert-inert! entries)(load-entries! assert! assert-inert! entries refused! check!)Assert every [form context] of entries through assert! ((assert! sentence context opts), or (assert-inert! sentence context) for a form peel-form reads as inert),
order-insensitively: an entry refused because content further down the list has not
arrived is retried. Returns how many entries were read. Both writers are passed in
because this sits under vaelii.core. The context topology and the reference declarations
go first (topology-first). Retry rounds run while each makes progress; the survivors of
a round that changed nothing are re-asserted without a catch, so an ill-formed entry
throws, or with refused! call (refused! entry ex-info) per refusal. With check!,
an entry carrying digests is passed to (check! sentence context digests) first.
Assert every `[form context]` of `entries` through `assert!` (`(assert! sentence context opts)`, or `(assert-inert! sentence context)` for a form `peel-form` reads as inert), order-insensitively: an entry refused because content further down the list has not arrived is retried. Returns how many entries were read. Both writers are passed in because this sits under `vaelii.core`. The context topology and the reference declarations go first (`topology-first`). Retry rounds run while each makes progress; the survivors of a round that changed nothing are re-asserted without a catch, so an ill-formed entry throws, or with `refused!` call `(refused! entry ex-info)` per refusal. With `check!`, an entry carrying digests is passed to `(check! sentence context digests)` first.
The file a delta export writes beside its context files: {file {form-index [digest …]}},
the digest of each reference a form holds, in the order entry/references reads them.
The file a delta export writes beside its context files: `{file {form-index [digest …]}}`,
the digest of each reference a form holds, in the order `entry/references` reads them.(peel-form form)[sentence opts] for one form of a text KB file (sx/form-peel): (set/monotonic S)
is S with {:strength :monotonic}, (set/inert S) is S with {:inert true}, which
tells the caller to write S through assert-inert, and anything else is itself with
nil. Throws sx/form-peel's :shape problem for a malformed wrapper.
`[sentence opts]` for one form of a text KB file (`sx/form-peel`): `(set/monotonic S)`
is `S` with `{:strength :monotonic}`, `(set/inert S)` is `S` with `{:inert true}`, which
tells the caller to write `S` through `assert-inert`, and anything else is itself with
nil. Throws `sx/form-peel`'s `:shape` problem for a malformed wrapper.(premise-entries kb records)[entries skipped] for records of kb, premises and inert sentexes: each as the form a KB
file writes it, {:context c :form f :handles [h …] :digests [d …]}, and the records
there is no text for. :handles are the records the form stands for, so a caller knows
what to retract; :digests are reference-writer's, on a form holding references.
An ordinary fact or rule is authored under its strength wrapper, an inert sentex under
(set/inert …). An exceptWhen meta-sentex is written as the (exceptWhen <query> <rule>)
wrapper (exception-form), and its target rule is not written again unless it is
known-true under a default exception. Anything else naming a handle is written through
reference-writer (names-a-handle?), and skipped and counted when it has no text.
`[entries skipped]` for `records` of `kb`, premises and inert sentexes: each as the form a KB
file writes it, `{:context c :form f :handles [h …] :digests [d …]}`, and the records
there is no text for. `:handles` are the records the form stands for, so a caller knows
what to retract; `:digests` are `reference-writer`'s, on a form holding references.
An ordinary fact or rule is `authored` under its strength wrapper, an inert sentex under
`(set/inert …)`. An exceptWhen meta-sentex is written as the `(exceptWhen <query> <rule>)`
wrapper (`exception-form`), and its target rule is not written again unless it is
known-true under a default exception. Anything else naming a handle is written through
`reference-writer` (`names-a-handle?`), and skipped and counted when it has no text.(read-forms source)Every form in the text KB file source, in file order (form-spans).
Every form in the text KB file `source`, in file order (`form-spans`).
(write-kb! kb dir)(write-kb! kb dir o)(write-kb! kb dir o records)Write kb's premises and inert sentexes into dir as a text KB, one <Context>.txt per
context, and return {:contexts n :sentences n :skipped n :files ["CxUniverse.txt" …] :bytes n :elapsed-ms n :dir "…"}. opts: {:context C} for one context's file,
{:ancestor-set C} for C and every context it sees; neither writes every context with
a premise or an inert sentex. A key this fn does not read is refused (:unknown-option).
records replaces the premises and inert sentexes. dir must be absent or empty. With
:delta?, the manifest-file holds the digests of each form's references.
Write `kb`'s premises and inert sentexes into `dir` as a text KB, one `<Context>.txt` per
context, and return `{:contexts n :sentences n :skipped n :files ["CxUniverse.txt" …]
:bytes n :elapsed-ms n :dir "…"}`. `opts`: `{:context C}` for one context's file,
`{:ancestor-set C}` for `C` and every context it sees; neither writes every context with
a premise or an inert sentex. A key this fn does not read is refused (`:unknown-option`).
`records` replaces the premises and inert sentexes. `dir` must be absent or empty. With
`:delta?`, the `manifest-file` holds the digests of each form's references.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 |