具有列表值和多个条件的事实的drools规则
我正在尝试编写一个规则,将事实列表值与多条件规则进行比较具有列表值和多个条件的事实的drools规则,drools,Drools,我正在尝试编写一个规则,将事实列表值与多条件规则进行比较 rule: only valid legislations when fact:Fact (legislationList == ('L1' && 'L2') OR 'L3') then fact.printMessage(); end ie. if fact.legislationList={'L1', 'L2') then fire if fact.legislationList={'L1', 'L4')
rule: only valid legislations
when
fact:Fact (legislationList == ('L1' && 'L2') OR 'L3')
then
fact.printMessage();
end
ie. if fact.legislationList={'L1', 'L2') then fire
if fact.legislationList={'L1', 'L4') then dont fire
我看了“from”条款,但不清楚这将如何解决我的问题
有什么巫术方法/解决方案可以帮助我吗
谢谢
-lp假设LegicationList是一个列表,则可以使用Drools“”contains“”运算符:
rule: only valid legislations
when
fact:Fact ((legislationList contains "L1" && legislationList contains "L2") || legislationList contains "L3" )
then
fact.printMessage();
end
你可以稍微简化一下语法,但我想说得更清楚一些
希望有帮助