Drools 版本:6.3.0.Final
波乔:
public class Person {
private Integer age;
private Integer childrens;
private String name;
private String address;
(...)
}
DSL 文件:
[condition][]and=&&
[condition][]or=||
[condition][]is less than or equal to=<=
[condition][]is less than=<
[condition][]is greater than or equal to=>=
[condition][]is greater than=>
[condition][]is equal to===
[condition][]There is a [Pp]erson with=$person:Person()
[condition][].{field:\w*} {operator} {value:\d*}={field} {operator} {value}
(...)
DSRL 文件:
package <package>;
import <import class>.*
global org.slf4j.Logger logger;
expander <class>.dsl;
rule "R1"
when
There is a person with
.age is greater than 10 or .chidldrens is less than 2 and .name is equal to "<name>"
then
(...)
end
rule "R2"
when
There is a person with
(.age is greater than 10 or .childrens is less than 2) and .name is equal to "<name>"
then
(...)
end
DRL(来自 R1):
(...)
rule "R1"
when
$person:Person(age > 10 || childrens < 2 && name = "<name>")
then
(...)
end
(...)
DRL(来自 R2):不生成规则。
如果我删除括号它正在工作,但带有括号的 DRL 文件没有正确生成。所以只有 R2 规则有效,但我的目标是 R1 规则。
任何想法?