Drools规则"不存在"

Nig*_* Wu 3 drools business-rules

我正在使用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
Run Code Online (Sandbox Code Playgroud)

我的事实包括:An AircraftConfig,an RunwayInfo和几个DepartureConfigurations.我想在没有DepartureConfiguration它的情况下解雇规则flap=1.我的意思是,如果有三个DepartureConfigurations,其中一个有flap=1,其他的是flap=2flap=3,那么这个规则就不会发射.我怎么能做这个工作?

小智 9

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

not DepartureConfiguration( flap == 1 )
Run Code Online (Sandbox Code Playgroud)