如何检查累积 Drools 中的空值

How to check for null value in accumulate Drools

我是第一次使用 Drools。在 accumulate 函数中,我有一个场景来检查 java 的 (!= null) 特性。但是在 Drools 中,我发现 != 不起作用。

      $addr : String(length > 0) from accumulate(
                  $person : Person(),
                   action(
                         $addresses : $person.getAddresses();
                         // i want to check whether $addresses is not 
                             null.
                         if($addresses !=null) is what i want to achieve

)

非常感谢任何帮助。

按如下方式编辑规则:

Person(adresses !=null) && $addr : String(length > 0) from accumulate(
              $person : Person(),
               action(
                     $addresses : $person.getAddresses();
                     )