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.
(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.
(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.
(find-listeners session pred)
Return all listeners on the session matching the predicate.
Return all listeners on the session matching the predicate.
(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.
(get-conditions-and-rule-names node)
Returns a map from conditions to sets of rules.
Returns a map from conditions to sets of rules.
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-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.
(pre-reduce node elements)
(right-activate-reduced node join-bindings reduced memory transport listener)
(alpha-activate node facts memory transport listener)
(alpha-retract node facts memory transport listener)
(description node)
(get-join-keys node)
(left-activate node join-bindings tokens memory transport listener)
(left-retract node join-bindings tokens memory transport listener)
(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.
(right-activate node join-bindings elements memory transport listener)
(right-retract node join-bindings elements memory transport listener)
(components session)
(fire-rules session)
(fire-rules session opts)
(insert session facts)
(query session query params)
(retract session facts)
(retract-elements transport memory listener nodes elements)
(retract-tokens transport memory listener nodes tokens)
(send-elements transport memory listener nodes elements)
(send-tokens transport memory listener nodes tokens)
(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.
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.
(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.
(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.
(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
(retract-facts! facts)
Perform the fact retraction.
Perform the fact retraction.
(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.
(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
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close