Fork me on GitHub
#clara
<
2020-07-16
>
sekao21:07:40

is there any way, either with the public API or with private stuff, that i can determine which fact(s) caused a rule to fire? something that i could check in the right hand side of a rule. i tried looking in clara.rules.engine/**rule-context** but the :token inside it seems to contain all matching facts, not just the ones that triggered the rule.

mikerod23:07:16

@sekao if you use a fact level binding you have the fact available as a binding on rhs

mikerod23:07:02

[?fact <- Something] =>

sekao23:07:25

yes but what i'm hoping to figure out is which of the bound facts actually caused the rule to fire. so if i have three facts bound on the lhs, in the rhs i want to know which of the three caused the current execution. i'm guessing this info is not available anywhere?

sekao23:07:20

during the first execution the answer will be "all three caused it to fire", but if i insert a new fact that matches the first binding, for example, the rule will execute a second time, and i want to know that the first binding was what caused that second execution.