[rules-users] Anyway to get Failed Reason for Failed Rule?

Davide Sottara dsotty at gmail.com
Thu Aug 9 15:32:17 EDT 2012


What do you mean by "failed rule"? It has several possible interpretations...
just to hint to some: a rule that throws an exception during its execution,
possibly through chaining? For that, you can attach custom error handlers.

Or, more likely, are you interested in the reason why a rule didn't fire?
That is trickier: if you take the LHS of a rule as a boolean condition, the
reason why it does not fire is because there are not enough facts matching
ALL the conditions at the same time. The negation here is a potentially very
complicated disjunction of possible cases. I.e. same as putting a "not" in
front of the whole LHS.

I don't think it's possible to monitor the RETE nodes directly to the point
where you can see partial matches, which would rule out (no pun intended)
sub-parts of the LHS and help you explain a missed activation..
justification is currently supported only for positive activations, through
the associated Tuple
and its LogicalDependencies.
The closest approximation you can get is to attach workingmemory and agenda
event listeners, and see which facts are asserted/retracted and which
activations created/cancelled. The latter, in particular, might help you
understand which rules were good candidates to fire but got "preempted"
before they could be executed. 

I hope I didn't confuse you too much, but it would be appreciated if you
could specify your question better :)
Thanks,
Davide



--
View this message in context: http://drools.46999.n3.nabble.com/Anyway-to-get-Failed-Reason-for-Failed-Rule-tp4019070p4019076.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list