Create a new ReeteGraph instance. You should normally not need to create a ReteGraph directly, as it is managed by the Workspace.
ProtectedfindFind a data node in the graph by its key. Data nodes represent top-level facts that rules depend on.
the expression of the data node to find or create.
the data node with the given expression.
ProtectedfindFind a decision node in the graph by its expression. Decision nodes represent expressions that can be evaluated to find related rules.
the expression of the decision node to find or create.
the decision node with the given expression.
ProtectedfindFind or create a suitable node for the given expression.
the expression to find or create a node for.
the suitable node, unless none is necessary (literal expressions).
Add a rule to the graph based on its expression. The rule is represented as a RuleNode, and it is connected to the nodes representing its required decisions and eventually to top-level data nodes.
the rule to be added to the graph.
Find rules relevant to any given node. Data nodes only return relevant rules if they are defined. Decision rules only return relevant rules if they evaluate to a truthy value. Disabled rules are not returned as relevant.
the node to start from.
the working context to use when evaluating.
a set of rules relevant to the given start node.
The ReteGraph class is responsible for providing an efficient way to find rules relevant to a context. It builds a graph similar to a Rete algorithm (with modifications) and uses it to find nodes relevant to context data.
TODO: Currently expressions are evaluated at every level. The nodes do not use parent nodes as already-calculated values since that would require a complete repition of all expression evaluation logic.