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/s

source

*pending-external-retractions*clj/s

source

*rule-context*clj/s

source

AccumulateNodeclj/s

source

AccumulateWithJoinFilterNodeclj/s

source

Accumulatorclj/s

source

Activationclj/s

source

AlphaNodeclj/s

source

assembleclj/s

(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

conj-rulebasesclj/s

(conj-rulebases base1 base2)

DEPRECATED. Simply concat sequences of rules and queries.

Conjoin two rulebases, returning a new one with the same rules.

DEPRECATED. Simply concat sequences of rules and queries.

Conjoin two rulebases, returning a new one with the same rules.
sourceraw docstring

Elementclj/s

source

empty-tokenclj/s

source

ExpressionJoinNodeclj/s

source

find-listenersclj/s

(find-listeners session pred)

Return all listeners on the session matching the predicate.

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

fire-rules*clj/s

(fire-rules* rulebase
             nodes
             transient-memory
             transport
             listener
             get-alphas-fn
             update-cache)

Fire rules for the given nodes.

Fire rules for the given nodes.
sourceraw docstring

get-conditions-and-rule-namesclj/s

(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/s

(get-terminal-node-types node)
source

HashJoinNodeclj/s

source

IAccumInspectclj/sprotocol

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/s

(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

IAccumRightActivateclj/sprotocol

pre-reduceclj/s

(pre-reduce node elements)

right-activate-reducedclj/s

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

IAlphaActivateclj/sprotocol

alpha-activateclj/s

(alpha-activate node facts memory transport listener)

alpha-retractclj/s

(alpha-retract node facts memory transport listener)
source

IConditionNodeclj/sprotocol

get-condition-descriptionclj/s

(get-condition-description this)
source

ILeftActivateclj/sprotocol

descriptionclj/s

(description node)

get-join-keysclj/s

(get-join-keys node)

left-activateclj/s

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

left-retractclj/s

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

insert-facts!clj/s

(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

IRightActivateclj/sprotocol

right-activateclj/s

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

right-retractclj/s

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

ISessionclj/sprotocol

componentsclj/s

(components session)

fire-rulesclj/s

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

insertclj/s

(insert session facts)

queryclj/s

(query session query params)

retractclj/s

(retract session facts)
source

ITerminalNodeclj/sprotocol

terminal-node-typeclj/s

(terminal-node-type this)
source

ITransportclj/sprotocol

retract-elementsclj/s

(retract-elements transport memory listener nodes elements)

retract-tokensclj/s

(retract-tokens transport memory listener nodes tokens)

send-elementsclj/s

(send-elements transport memory listener nodes elements)

send-tokensclj/s

(send-tokens transport memory listener nodes tokens)
source

local-memoryclj/s

(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

LocalSessioncljs

source

LocalTransportcljs

source

NegationNodeclj/s

source

NegationResultclj/s

source (clj)source (cljs)

NegationWithJoinFilterNodeclj/s

source

node-rule-namesclj/s

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

node-type->abbreviated-typeclj/s

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/s

(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/s

(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

ProductionNodeclj/s

source

QueryNodeclj/s

source

remove-listenersclj/s

(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/s

(retract-facts! facts)

Perform the fact retraction.

Perform the fact retraction.
sourceraw docstring

rhs-retract-facts!clj/s

(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

RootJoinNodeclj/s

source

TestNodeclj/s

source

Tokenclj/s

source

variables-as-keywordsclj/s

(variables-as-keywords expression)

Returns symbols in the given s-expression that start with '?' as keywords

Returns symbols in the given s-expression that start with '?' as keywords
sourceraw docstring

with-listenerclj/s

(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