4

我正在使用 JBoss Drools 编写一些业务规则。我遇到了“不存在”规则的问题。这是我的代码。

rule "ATL 27R-A12 Subfleet A319-100 Departure configuration list has flap 1"
    salience 20
    no-loop true
    when
        AircraftConfig(aircraftType=="A319-100")
        RunwayInfo(airport3lCode== "ATL", runwayId == "27R-A12" )
        not (exists (DepartureConfiguration( flap == 1 )))
    then
        throw new RuleNotMatchException("The configurations do not match the rule of this runway.");
end

我的事实包含:一个AircraftConfig、一个RunwayInfo和几个DepartureConfigurations。我想在没有DepartureConfigurationwhich时触发规则flap=1。我的意思是,如果有三个DepartureConfigurations,其中一个是flap=1,其他是flap=2or flap=3,那么这个规则就不会触发。我怎样才能使这项工作?

4

2 回答 2

11

检查事实不存在的关键字是not, not not exists。将条件的最后一行更改为:

not DepartureConfiguration( flap == 1 )
于 2012-03-20T12:34:13.403 回答
1

实际上,我的规则有些冲突。我以前认为规则应该从drl文件的顶部运行到末尾。我通过添加规则流解决了我的问题。也感谢给我建议的各位。

于 2012-03-21T08:13:59.093 回答