drools规则引擎的简单使用

1.单条件
$u:Address(street == “人民大街”)
2.多条件使用and
address : Address(postcode != null, postcode matches “([0-9]{5})”)
3.多条件使用or
Address(postcode==“123”) or Address(postcode == “234”)
4.not 判断
not (Address(postcode==“123”) or Address(postcode == “234”))
5.List 集合
//依次获取工作内存中的所有List集合
l i : L i s t ( s i z e > 0 ) / / li:List(size > 0) // li:List(size>0)//m:Address(postcode == “123”) from $li //获取List中postcode = “123” 的Address对象
$m:Address() from $li
6.多对象判断
$person:Person(name==“张三”)
$address:Address(postcode “123”);
7.exists判断
exists (Address(postcode
"123") or Address(postcode == “234”))
8.forAll判断
WorkMemory中所有facts都需要符合表达式, 可以支持多项匹配
forall(Person(name==“张三”))

你可能感兴趣的:(java)