The firing of rules can be observed by implementing an org.kie.api.event.rule.AgendaEventListener
and attaching it with KieSession.addEventListener(AgendaEventListener listener)
.
The rule engine is not equipped to explain why some rule has not fired.
It depends on the complexity of the rules you have, but one way is to write rules that evaluate the constraints individually and accumulate a "set of met", after which "all met" can be determined and the complement of an incomplete set is the answer to your question.
Another way is to have rules that fire when one of the patterns or constraints is not met. For instance, in addition to
rule abc when A() B() C() then ... end
you have to write
rule not_a when not A() then ... end
rule a_not_B when A() not B() then ... end
rule ab_not_c when A() B() not C() then ... end
This, however, will not tell you all missing conditions: if not_a
fires, also B
and C
could be mismatched.