在哪里可以查看规则失败的模式? [英] Where can I see if a pattern failed in rule?

查看:90
本文介绍了在哪里可以查看规则失败的模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行的规则包含一些模式,我想知道哪个模式失败:

I run a rule that contains a few patterns, I want to know which pattern failed:

我尝试调试代码(drools 7.18.0) ,并且没有找到相关的地方。

I've tried to debug the code (drools 7.18.0), and didn't found the relevant place.

规则示例:

rule "Trigger"
agenda-group "Trigger"
salience 100
    when
        $pcase : PCaseMgr()

        D1($id: id, type != null, type == "AAA")
        D2(aId == $id)

    then
        $pcase.printAnalyticsRuleLog(">>>>>>>>>>>>>>>>>>> In Trigger");
end

,我在(drools 7.18.0的)代码中哪里可以查看模式是否失败?

in the example above, if D1 pattern is passed, and D2 pattern is failed, where in the code (of drools 7.18.0) can i see if the pattern was failed?

推荐答案

。由于Drools在内部使用了算法,因此模式被分解为节点,并且节点可以在知识库中的多个规则之间共享。如果您真的需要知道为什么某个规则不被执行,则可以创建其他规则来告诉您。在您的示例中,您可以创建以下内容:

You can't. Because of the algorithm Drools uses internally, patterns are decomposed into nodes and nodes can be shared among multiple rules in your knowledge base. If you really need to know why a rule was not fire, then you can create other rules that will tell you that. In your example, you could create something like this:

rule "No Trigger because of No D2"
agenda-group "Trigger"
salience 100
    when
        $pcase : PCaseMgr()

        D1($id: id, type != null, type == "AAA")
        not D2(aId == $id)

    then
        $pcase.printAnalyticsRuleLog(">>>>>>>>>>>>>>>>>>> No Trigger because no D2");
end

希望有帮助,

这篇关于在哪里可以查看规则失败的模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆