Drools:如何在 not 表达式中实现 and ( && ) 条件?

Drools: how to implement and ( && ) condition inside not expression?

我有以下规则:

rule " data value > 50 for 10 seconds "
dialect "java"
when
    data: MyData(name.contains("double") && getValue()> 50) from entry-point "dataEntryPoint"   
    not(
        myData(this.name==dataName,
        getValue() < 50 ,
        this after[0,10s] data ) from entry-point "dataEntryPoint" )
    
then
    doSmthg();
end

数据类型包含在名称中,我只想在双精度值上编写此规则。 但是,似乎在第二个表达式中(在 not 内部),即使 this.name != 也会调用 getValue() dataName 导致错误,因为值为字符串。

基本上,我希望它仅在第一个条件为真 ( && ) 时评估 getValue()。

我只有在添加 not() 条件时才会遇到这个问题。

当我删除它时,getValue() > 50 仅在第一个条件为真时才被评估。

rule " data value > 50 for 10 seconds "
dialect "java"
when
    data: MyData(name.contains("double") && getValue()> 50) from entry-point "dataEntryPoint"   
    
then
    doSmthg();
end

有趣的是,它仅在 && 运算符的两个部分都是同一变量的约束时才有效。

rule "data value > 50 for 10 seconds"
dialect "java"
when
    data: MyData(name contains "double" && value > 50) from entry-point "dataEntryPoint"   
    not(
        MyData(name == data.name, 
        value instanceof Number && value < 50,
        this after[0,10s] data) from entry-point "dataEntryPoint")
then
    System.out.println("alert");
end