Liking cljdoc? Tell your friends :D

vaelii.host.spindle

Bring a KB's shipped spindle up to the running engine's.

A KB stores the starter ontology it was built with, and the engine that opens it later ships its own: a strength marked set/monotonic, a vocabulary term added to CxCore, a disjointness the ontology stopped stating. sync-spindle! makes the KB state what this engine ships, context by context, and leaves everything else alone.

What is shipped is what starter/load-into produces, read off a scratch in-memory KB it is loaded into — not the text of the files. The two differ: genlCx edges are stored in CxUniverse whichever file states them, and the closing unary_predicate batch is stated by no file. Each premise is attributed to the file whose load stored it.

Which contexts are synced exactly: CxCore and the kb/upper/ and kb/middle/ contexts. These are the engine's, so a premise there that the engine does not ship is retracted, a strength that differs is restated, and a missing one is asserted. A context an author adds to the spindle — wired between CxCore and CxUniverse, say — is not one of them and is not read.

Which are only added to: the collectors (kb/ root files, CxUniverse today) and any other context a shipped file's content is stored in. A collector gathers what the engine routes there from every context, so what it holds beyond the shipped content is not the engine's to retract.

Only the layers a KB has. A file whose context holds nothing in the KB is not loaded into it, and the collector files and the unary_predicate batch follow the upper layer: a core-only KB stays core-only.

Comparison is by the form a KB file writes (text/premise-entries): a fact or rule under its strength wrapper, an exceptWhen as the wrapper it was asserted as. A strength the engine raised is only an assertion, since assert raises a held premise's strength in place; one it lowered is the form retracted and the weaker one asserted, since nothing lowers a strength in place.

One batch. The sync is one v/edit!: the additions first, then the retractions, one settle. So the belief a retraction would sweep and the addition rebuild keeps its witness through the batch, where retracting first tore the TMS down only to build it back up. What cannot go in that order — a retraction of a record an addition lands on — goes before it (sync-spindle!).

Bring a KB's shipped spindle up to the running engine's.

A KB stores the starter ontology it was built with, and the engine that opens it later
ships its own: a strength marked `set/monotonic`, a vocabulary term added to CxCore, a
disjointness the ontology stopped stating.  `sync-spindle!` makes the KB state what this
engine ships, context by context, and leaves everything else alone.

**What is shipped** is what `starter/load-into` produces, read off a scratch in-memory KB
it is loaded into — not the text of the files.  The two differ: `genlCx` edges are stored
in CxUniverse whichever file states them, and the closing `unary_predicate` batch is
stated by no file.  Each premise is attributed to the file whose load stored it.

**Which contexts are synced exactly**: CxCore and the `kb/upper/` and `kb/middle/`
contexts.  These are the engine's, so a premise there that the engine does not ship is
retracted, a strength that differs is restated, and a missing one is asserted.  A
context an author adds to the spindle — wired between CxCore and CxUniverse, say — is
not one of them and is not read.

**Which are only added to**: the collectors (`kb/` root files, CxUniverse today) and any
other context a shipped file's content is stored in.  A collector gathers what the
engine routes there from every context, so what it holds beyond the shipped content is
not the engine's to retract.

**Only the layers a KB has.**  A file whose context holds nothing in the KB is not
loaded into it, and the collector files and the `unary_predicate` batch follow the upper
layer: a core-only KB stays core-only.

Comparison is by the form a KB file writes (`text/premise-entries`): a fact or rule
under its strength wrapper, an `exceptWhen` as the wrapper it was asserted as.  A
strength the engine **raised** is only an assertion, since `assert` raises a held
premise's strength in place; one it **lowered** is the form retracted and the weaker one
asserted, since nothing lowers a strength in place.

**One batch.**  The sync is one `v/edit!`: the additions first, then the retractions,
one settle.  So the belief a retraction would sweep and the addition rebuild keeps its
witness through the batch, where retracting first tore the TMS down only to build it
back up.  What cannot go in that order — a retraction of a record an addition lands on —
goes before it (`sync-spindle!`).
raw docstring

exact-contextsclj

(exact-contexts)

The contexts sync-spindle! makes state exactly what the engine ships: CxCore and the upper and middle layers' contexts, as discovered on the classpath.

The contexts `sync-spindle!` makes state exactly what the engine ships: CxCore and the
upper and middle layers' contexts, as discovered on the classpath.
sourceraw docstring

planclj

(plan kb)
(plan kb shipped)

What sync-spindle! would change in kb, without changing it:

:add {:context :form} the shipped content kb lacks, in the layers it has, in shipped's order :remove {:context :form :handles} premises in an exact context the engine does not ship

A premise the engine ships at a higher strength is an :add alone: asserting it raises the held one. One it ships at a lower strength is a :remove and an :add.

shipped defaults to a fresh (shipped).

What `sync-spindle!` would change in `kb`, without changing it:

  :add     `{:context :form}` the shipped content `kb` lacks, in the layers it has,
           in `shipped`'s order
  :remove  `{:context :form :handles}` premises in an exact context the engine does not
           ship

A premise the engine ships at a higher strength is an `:add` alone: asserting it raises
the held one.  One it ships at a lower strength is a `:remove` and an `:add`.

`shipped` defaults to a fresh `(shipped)`.
sourceraw docstring

shippedclj

(shipped)

Every premise the starter stores, as {:context c :form f :file ctx}: the form a KB file writes it in, the context it is stored in, and the context of the file whose load stored it — :unary-predicates for the closing batch no file states. In the order the load stored them, which is an order they assert in: the load retried what arrived before its dependencies. Built in a scratch in-memory KB that is cleared before this returns.

Every premise the starter stores, as `{:context c :form f :file ctx}`: the form a KB
file writes it in, the context it is stored in, and the context of the file whose load
stored it — `:unary-predicates` for the closing batch no file states.  In the order the
load stored them, which is an order they assert in: the load retried what arrived
before its dependencies.  Built in a scratch in-memory KB that is cleared before this
returns.
sourceraw docstring

sync-spindle!clj

(sync-spindle! kb)
(sync-spindle! kb ships)

Make kb's shipped spindle state what this engine ships (see the namespace doc), as one v/edit!: the additions, then the retractions, one settle. Returns

{:added n :removed n :refused [{:context :form :type :message} …]}

A retraction goes first only when an addition lands on a record it retracts: a strength the engine lowered, whose weaker form would otherwise be asserted onto the premise and then retracted with it, or an exceptWhen restated around a rule the KB keeps. Those are their own edit! before the batch.

An addition the batch refuses is set aside, the batch rolled back and run without it, so the rest lands in one settle. The ones set aside are asserted after it, retrying while a round makes progress (add!): the batch's refusal can be an order the batch could not fix, or content its own retractions then took away. What still refuses is :refused. Each refusal costs the batch one rollback.

kb must accept writes (v/write-hazards empty). ships is (shipped), passed by a caller that syncs more than one KB or prices the sync apart from the scratch load.

Make `kb`'s shipped spindle state what this engine ships (see the namespace doc), as
one `v/edit!`: the additions, then the retractions, one settle.  Returns

  {:added n :removed n :refused [{:context :form :type :message} …]}

**A retraction goes first** only when an addition lands on a record it retracts: a
strength the engine lowered, whose weaker form would otherwise be asserted onto the
premise and then retracted with it, or an `exceptWhen` restated around a rule the KB
keeps.  Those are their own `edit!` before the batch.

**An addition the batch refuses is set aside**, the batch rolled back and run without
it, so the rest lands in one settle.  The ones set aside are asserted after it,
retrying while a round makes progress (`add!`): the batch's refusal can be an order the
batch could not fix, or content its own retractions then took away.  What still refuses
is `:refused`.  Each refusal costs the batch one rollback.

`kb` must accept writes (`v/write-hazards` empty).  `ships` is `(shipped)`, passed by a
caller that syncs more than one KB or prices the sync apart from the scratch load.
sourceraw 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