Fork me on GitHub

Hi. Im having a play around with Clara and seeing if it’ll fit our use case. One of which is to know which Rule(s) failed. I can see the inspect function gives loads of nice info for all the activations; what could I do if i wanted to know which Rules were not triggered and why?


@mbragg I think that will be a bit of a challenge with a forward-chaining approach to rules


if you have more specific questions - you can model that as rules and queries


but just to find out something like “what was missing that you would have needed to reach certain goals/conclusions” is more of a backwards chaining strength (ie goal-driven) I’d say


• clara is based around the rete algo which is a forward-chaining (ie data-driven) approach Good references for further reading: 1) 2) (section 8.2 Rule-Based Expert Systems)


you can make some progress of course with inspection - you can see what did happen, and subtract that from all the rules you know exists to find which were left out


you can also make more rules in some cases, perhaps even systematically (and programmatically) that try to capture the “negative” cases


eg. if I have a rule rule a => insert b, then also make a rule rule not(a) => insert z


of course it can be more difficult than that with mult-condition joins, negation, and accumulators involved


Many thanks @mikerod That all makes sense. diffing the activated vs non-activated rules & using inspection does feel a little hacky, It seems like I should either re-think the problem and model it in a forward-chaining manner, or maybe not use clara and implement some sort of backward-chaining model. Thanks again!


@mbragg at my previous gig, we found that doing what @mikerod mentioned was sufficient for our observability purposes. (Namely, we generated negative cases for certain types of rules, and created targeted queries to aid in observability.)


Thanks @devn yeah I’m having a think about that too