Liking cljdoc? Tell your friends :D

clara.rules.engine

This namespace is for internal use and may move in the future. Most users should use only the clara.rules namespace.

This namespace is for internal use and may move in the future. Most users should use only the clara.rules namespace.
raw docstring

*current-session*clj

source

*pending-external-retractions*clj

source

*rule-context*clj

source

->LocalSessionclj

(->LocalSession rulebase
                memory
                transport
                listener
                get-alphas-fn
                pending-operations)
source

assembleclj

(assemble {:keys [rulebase memory transport listeners get-alphas-fn]})

Assembles a session from the given components, which must be a map containing the following:

:rulebase A recorec matching the clara.rules.compiler/Rulebase structure. :memory An implementation of the clara.rules.memory/IMemoryReader protocol :transport An implementation of the clara.rules.engine/ITransport protocol :listeners A vector of listeners implementing the clara.rules.listener/IPersistentListener protocol :get-alphas-fn The function used to return the alpha nodes for a fact of the given type.

Assembles a session from the given components, which must be a map
containing the following:

:rulebase A recorec matching the clara.rules.compiler/Rulebase structure.
:memory An implementation of the clara.rules.memory/IMemoryReader protocol
:transport An implementation of the clara.rules.engine/ITransport protocol
:listeners A vector of listeners implementing the clara.rules.listener/IPersistentListener protocol
:get-alphas-fn The function used to return the alpha nodes for a fact of the given type.
sourceraw docstring

empty-tokenclj

source

find-listenersclj

(find-listeners session pred)

Return all listeners on the session matching the predicate.

Return all listeners on the session matching the predicate.
sourceraw docstring

get-conditions-and-rule-namesclj

(get-conditions-and-rule-names node)

Returns a map from conditions to sets of rules.

Returns a map from conditions to sets of rules.
sourceraw docstring

get-terminal-node-typesclj

(get-terminal-node-types node)
source

IAccumInspectcljprotocol

This protocol is expected to be implemented on accumulator nodes in the rules network. It is not expected that users will implement this protocol, and most likely will not call the protocol function directly.

This protocol is expected to be implemented on accumulator nodes in the rules network.
It is not expected that users will implement this protocol, and most likely will not call
the protocol function directly.

token->matching-elementsclj

(token->matching-elements node memory token)

Takes a token that was previously propagated from the node, or a token that is a descendant of such a token, and returns the facts in elements matching the token propagated from the node. During rules firing accumulators only propagate bindings created and the result binding downstream rather than all facts that were accumulated over, but there are use-cases in session inspection where we want to retrieve the individual facts.

Example: [?min-temp <- (acc/min :temperature) :from [Temperature (= temperature ?loc)]] [?windspeed <- [WindSpeed (= location ?loc)]]

Given a token propagated from the node for the WindSpeed condition we could retrieve the Temperature facts from the matching location.

Takes a token that was previously propagated from the node, 
or a token that is a descendant of such a token, and returns the facts in elements 
matching the token propagated from the node.  During rules firing
accumulators only propagate bindings created and the result binding
downstream rather than all facts that were accumulated over, but there
are use-cases in session inspection where we want to retrieve the individual facts.

Example: [?min-temp <- (acc/min :temperature) :from [Temperature (= temperature ?loc)]]
         [?windspeed <- [WindSpeed (= location ?loc)]]

Given a token propagated from the node for the WindSpeed condition 
we could retrieve the Temperature facts from the matching location.
sourceraw docstring

IAccumRightActivatecljprotocol

pre-reduceclj

(pre-reduce node elements)

right-activate-reducedclj

(right-activate-reduced node join-bindings reduced memory transport listener)
source

IAlphaActivatecljprotocol

alpha-activateclj

(alpha-activate node facts memory transport listener)

alpha-retractclj

(alpha-retract node facts memory transport listener)
source

IConditionNodecljprotocol

get-condition-descriptionclj

(get-condition-description this)
source

ILeftActivatecljprotocol

descriptionclj

(description node)

get-join-keysclj

(get-join-keys node)

left-activateclj

(left-activate node join-bindings tokens memory transport listener)

left-retractclj

(left-retract node join-bindings tokens memory transport listener)
source

insert-facts!clj

(insert-facts! facts unconditional)

Place facts in a stateful cache to be inserted into the session immediately after the RHS of a rule fires.

Place facts in a stateful cache to be inserted into the session
immediately after the RHS of a rule fires.
sourceraw docstring

IRightActivatecljprotocol

right-activateclj

(right-activate node join-bindings elements memory transport listener)

right-retractclj

(right-retract node join-bindings elements memory transport listener)
source

ISessioncljprotocol

componentsclj

(components session)

fire-rulesclj

(fire-rules session)
(fire-rules session opts)

fire-rules-asyncclj

(fire-rules-async session)
(fire-rules-async session opts)

insertclj

(insert session facts)

queryclj

(query session query params)

retractclj

(retract session facts)
source

ITerminalNodecljprotocol

terminal-node-typeclj

(terminal-node-type this)
source

ITransportcljprotocol

retract-elementsclj

(retract-elements transport memory listener nodes elements)

retract-tokensclj

(retract-tokens transport memory listener nodes tokens)

send-elementsclj

(send-elements transport memory listener nodes elements)

send-tokensclj

(send-tokens transport memory listener nodes tokens)
source

local-memoryclj

(local-memory rulebase
              transport
              activation-group-sort-fn
              activation-group-fn
              alphas-fn)

Returns a local, in-process working memory.

Returns a local, in-process working memory.
sourceraw docstring

node-rule-namesclj

(node-rule-names child-type node)
source

node-type->abbreviated-typeclj

To minimize function name length and attempt to prevent issues with filename length we can use these abbreviations to shorten the node types. Used during compilation of the rules network.

To minimize function name length and attempt to prevent issues with filename length we can use these abbreviations to
shorten the node types. Used during compilation of the rules network.
sourceraw docstring

options->activation-group-fnclj

(options->activation-group-fn options)

Given a map of options for a session, construct a function that takes a production and returns the activation group to which it belongs, considering both user-provided and internal salience. Under normal circumstances this function should only be called by Clara itself.

Given a map of options for a session, construct a function that takes a production
and returns the activation group to which it belongs, considering both user-provided
and internal salience.  Under normal circumstances this function should only be called by
Clara itself.
sourceraw docstring

options->activation-group-sort-fnclj

(options->activation-group-sort-fn options)

Given the map of options for a session, construct an activation group sorting function that takes into account the user-provided salience and internal salience. User-provided salience is considered first. Under normal circumstances this function should only be called by Clara itself.

Given the map of options for a session, construct an activation group sorting
function that takes into account the user-provided salience and internal salience.
User-provided salience is considered first.  Under normal circumstances this function should
only be called by Clara itself.
sourceraw docstring

remove-listenersclj

(remove-listeners session pred)

Return a new session with all listeners matching the predicate removed

Return a new session with all listeners matching the predicate removed
sourceraw docstring

retract-facts!clj

(retract-facts! facts)

Perform the fact retraction.

Perform the fact retraction.
sourceraw docstring

rhs-retract-facts!clj

(rhs-retract-facts! facts)

Place all facts retracted in the RHS in a buffer to be retracted after the eval'ed RHS function completes.

Place all facts retracted in the RHS in a buffer to be retracted after
the eval'ed RHS function completes.
sourceraw docstring

with-listenerclj

(with-listener session listener)

Return a new session with the listener added to the provided session, in addition to all listeners previously on the session.

Return a new session with the listener added to the provided session,
in addition to all listeners previously on the session.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close