Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
具有列表值和多个条件的事实的drools规则_Drools - Fatal编程技术网

具有列表值和多个条件的事实的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
你可以稍微简化一下语法,但我想说得更清楚一些

希望有帮助