Liking cljdoc? Tell your friends :D

vaelii.impl.cli

A command-line driver for a KB — the shell dual of the in-process API, launched with lein run -m vaelii.impl.cli <cmd> <args…>. It runs the engine in-process (no daemon); to talk to a running daemon use vaelii.impl.client instead.

lein run -m vaelii.impl.cli assert '(dog Fido)' NaturalWorldContext --dir /tmp/kb lein run -m vaelii.impl.cli query '(dog ?x)' NaturalWorldContext --dir /tmp/kb lein run -m vaelii.impl.cli why 3 --dir /tmp/kb lein run -m vaelii.impl.cli export /tmp/dump --dir /tmp/kb lein run -m vaelii.impl.cli repl --starter # interactive, starter schema

Backend. --dir <path> uses the durable :disk backend (recovered on open, so a fact asserted in one invocation is there in the next); with no --dir the KB is in-memory and lives only for the process — useful for repl or a single compound session, pointless across one-shot commands. --starter loads the shipped schema (types, contexts, relation rules) so you can explore the ontology. --strength monotonic marks an assert known-true. export takes --variant records|records+index and --compression gzip|xz|none.

One writer. A --dir KB takes the single-writer file lock (docs/storage.md), so the CLI and a daemon cannot own the same directory at once — by design.

A command-line driver for a KB — the shell dual of the in-process API, launched with
`lein run -m vaelii.impl.cli <cmd> <args…>`.  It runs the engine in-process (no
daemon); to talk to a running daemon use `vaelii.impl.client` instead.

  lein run -m vaelii.impl.cli assert  '(dog Fido)'  NaturalWorldContext --dir /tmp/kb
  lein run -m vaelii.impl.cli query   '(dog ?x)'    NaturalWorldContext --dir /tmp/kb
  lein run -m vaelii.impl.cli why     3                                 --dir /tmp/kb
  lein run -m vaelii.impl.cli export  /tmp/dump                         --dir /tmp/kb
  lein run -m vaelii.impl.cli repl --starter          # interactive, starter schema

**Backend.**  `--dir <path>` uses the durable `:disk` backend (recovered on open, so
a fact asserted in one invocation is there in the next); with no `--dir` the KB is
in-memory and lives only for the process — useful for `repl` or a single compound
session, pointless across one-shot commands.  `--starter` loads the shipped schema
(types, contexts, relation rules) so you can explore the ontology.  `--strength
monotonic` marks an `assert` known-true.  `export` takes `--variant
records|records+index` and `--compression gzip|xz|none`.

**One writer.**  A `--dir` KB takes the single-writer file lock (docs/storage.md), so
the CLI and a daemon cannot own the same directory at once — by design.
raw docstring

-mainclj

(-main & argv)

Parse argv, open the KB, run the command, and print the result. With repl (or no command) it drops into the interactive loop.

Parse argv, open the KB, run the command, and print the result.  With `repl` (or no
command) it drops into the interactive loop.
raw docstring

commandsclj

The command words dispatch knows, for the usage message and unknown command.

The command words `dispatch` knows, for the usage message and `unknown command`.
raw docstring

dispatchclj

(dispatch kb cmd args opts)

Run one command against kb and return its result (a handle, a seq of sentences / solutions, a proof tree, …). args are data; opts is the parsed option map.

Run one command against `kb` and return its result (a handle, a seq of sentences /
solutions, a proof tree, …).  `args` are data; `opts` is the parsed option map.
raw docstring

open-kb-fromclj

(open-kb-from {:keys [dir starter] :as _opts})

Build the KB a run operates on from the parsed opts: :dir → durable disk (recovered), else in-memory. :starter loads the shipped schema.

Build the KB a run operates on from the parsed `opts`: `:dir` → durable disk
(recovered), else in-memory.  `:starter` loads the shipped schema.
raw docstring

parse-optsclj

(parse-opts args)

Split raw args into [positionals opts]. --k v becomes {:k v}, a bare --flag becomes {:flag true}; everything else is a positional, in order.

Split raw args into `[positionals opts]`.  `--k v` becomes `{:k v}`, a bare `--flag`
becomes `{:flag true}`; everything else is a positional, in order.
raw docstring

read-argclj

(read-arg s)

One argv string as data: the EDN it reads as — a sentence, a context symbol, a handle — and the raw string when it reads as none.

That last case is what a filesystem path is. /var/lib/vaelii is not a symbol (two slashes), so a command taking a path (export, load) would otherwise fail in the reader, before the command it belongs to had been looked at.

One argv string as data: the EDN it reads as — a sentence, a context symbol, a handle
— and the **raw string** when it reads as none.

That last case is what a filesystem path is.  `/var/lib/vaelii` is not a symbol (two
slashes), so a command taking a path (`export`, `load`) would otherwise fail in the
reader, before the command it belongs to had been looked at.
raw docstring

read-formsclj

(read-forms s)

Every EDN form in s, in order — how a REPL line's args ((dog ?x) MyContext) are parsed into data.

Every EDN form in `s`, in order — how a REPL line's args (`(dog ?x) MyContext`) are
parsed into data.
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