Liking cljdoc? Tell your friends :D

vaelii.impl.examples

Worked examples of the reasoning the shipped ontology actually does — the data, and the one function that runs one.

Nothing here is a story about the engine. Each example names the sentexes it rests on, and those are looked up in the live KB before anything is claimed: an example whose rests-on sentences are not stored is reported unavailable rather than answered, so switching to another corpus greys the examples out instead of silently showing a verdict computed from vocabulary that is not there. The verdict itself is an ordinary ask / escalate / check, and the proof is why.

Two kinds, and the split is about what the KB ships rather than about presentation:

read-only — no premises. The shipped schema is types, taxonomy, metadata and rules, so everything asked of kinds is answerable with no write at all, and the page computes it on render. This is where the taxonomy, argPreserving, disjointness and the predicate meta-ontology live.

sandboxed — premises naming individuals. The starter ships no cast (the fables and their casts live in the test-world), so an example about defaults, joins or refusals has to bring its own, and it writes them into the reader's own sandbox microtheory. Nothing shipped can see in, and the sandbox reset takes the whole thing away.

:expect is what the ontology is supposed to answer, and examples_test asserts every one of them — so the page cannot drift away from the KB it describes.

Worked examples of the reasoning the shipped ontology actually does — the data, and
the one function that runs one.

**Nothing here is a story about the engine.**  Each example names the sentexes it
rests on, and those are looked up in the live KB before anything is claimed: an
example whose `rests-on` sentences are not stored is reported *unavailable* rather
than answered, so switching to another corpus greys the examples out instead of
silently showing a verdict computed from vocabulary that is not there.  The verdict
itself is an ordinary `ask` / `escalate` / `check`, and the proof is `why`.

Two kinds, and the split is about what the KB ships rather than about presentation:

  **read-only** — no premises.  The shipped schema is types, taxonomy, metadata and
  rules, so everything asked *of kinds* is answerable with no write at all, and the
  page computes it on render.  This is where the taxonomy, `argPreserving`,
  disjointness and the predicate meta-ontology live.

  **sandboxed** — premises naming individuals.  The starter ships no cast (the
  fables and their casts live in the test-world), so an example about defaults,
  joins or refusals has to bring its own, and it writes them into the reader's own
  sandbox microtheory.  Nothing shipped can see in, and the sandbox reset takes the
  whole thing away.

`:expect` is what the ontology is supposed to answer, and `examples_test` asserts
every one of them — so the page cannot drift away from the KB it describes.
raw docstring

available?clj

(available? kb {:keys [rests-on]})

Is every sentex this example rests on actually stored? One handle-of per dependency — indexed, and find-without-create, so asking costs nothing and writes nothing. A KB that does not hold them cannot be asked the example's question.

Is every sentex this example rests on actually stored?  One `handle-of` per
dependency — indexed, and find-*without*-create, so asking costs nothing and writes
nothing.  A KB that does not hold them cannot be asked the example's question.
raw docstring

by-idclj

(by-id id)

dependenciesclj

(dependencies kb {:keys [rests-on]})

The [sentence context handle] triples the example rests on, so a page can link each to the record it names and show which are missing.

The `[sentence context handle]` triples the example rests on, so a page can link
each to the record it names and show which are missing.
raw docstring

establish!clj

(establish! kb {:keys [premises]} context)

Write an example's premises into context — one edit, so the whole batch settles once. Idempotent: a premise already stored is found rather than duplicated, so re-running an example is not re-asserting it.

Returns the handles the batch added.

Write an example's premises into `context` — one `edit`, so the whole batch settles
once.  Idempotent: a premise already stored is found rather than duplicated, so
re-running an example is not re-asserting it.

Returns the handles the batch added.
raw docstring

established?clj

(established? kb {:keys [premises]} context)

Are this example's premises already written into context? One handle-of per premise, so a page asking of every example pays a handful of indexed lookups and writes nothing. An example with no premises is never established — it needs nothing.

Are this example's premises already written into `context`?  One `handle-of` per
premise, so a page asking of every example pays a handful of indexed lookups and
writes nothing.  An example with no premises is never established — it needs nothing.
raw docstring

examplesclj

Every worked example, in the order the page shows them. :rests-on is [sentence context] pairs — real stored sentexes, linked on the page and looked up to decide availability. :premises are sentences written into the sandbox, types first so the argIsa checks bind.

Every worked example, in the order the page shows them.  `:rests-on` is
`[sentence context]` pairs — real stored sentexes, linked on the page and looked up
to decide availability.  `:premises` are sentences written into the sandbox, types
first so the `argIsa` checks bind.
raw docstring

groupsclj

The example groups, in page order.

The example groups, in page order.
raw docstring

runclj

(run kb {:keys [kind] :as example} context)

Run one example against kb and answer what it did. context is where the question is asked: the reader's sandbox for an example with premises, and any context seeing the whole ontology for one without.

Writes nothing. Establishing an example's premises is establish!, which the page does on an explicit click — so rendering the gallery is a read however many examples it holds.

Run one example against `kb` and answer what it did.  `context` is where the
question is asked: the reader's sandbox for an example with premises, and any context
seeing the whole ontology for one without.

Writes nothing.  Establishing an example's premises is `establish!`, which the page
does on an explicit click — so rendering the gallery is a read however many examples
it holds.
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