Drools

Drools中常用但易混淆的概念

KIE/Drools/jBPM

官方的一句话解释了比较到位:
The process of researching an integration knowledge solution for Drools and jBPM has simply used the “droolsjbpm” group name. This name permeates GitHub accounts and Maven POMs. As scopes broadened and new projects were spun KIE, an acronym for Knowledge Is Everything, was chosen as the new group name. The KIE name is also used for the shared aspects of the system; such as the unified build, deploy and utilization.
kie

KieServices/KieRepository/KieProject/KieContainer/KieModule/KieBase/KieSession区别,部分转自Drools入门系列(六)——KIE之基础API详解

Drools之使用注意点

1.DRL中不要使用单引号,对于字符串一定使用双引号.

2.如果集成了Spring,一定不能调用kieSession.dispose();

3.stateful和stateless区别

Drools之宏对象的常用方法

insert、update、retract

方法名称用法格式含义
getWorkingMemory()drools.getWorkingMemory()获取当前的WorkingMemory对象
halt()drools.halt()在当前规则执行完成后,不再执行其它未执行的规则。
getRule()drools.getRule()得到当前的规则对象
insert(new Object)drools.insert(new Object)向当前的WorkingMemory当中插入指定的对象,功能与宏函数insert相同。
update(new Object)drools.update(new Object)更新当前的WorkingMemory中指定的对象,功能与宏函数update相同。
update(FactHandle Object)drools.update(FactHandle Object)更新当前的WorkingMemory中指定的对象,功能与宏函数update相同。
retract(new Object)drools.retract(new Object)从当前的WorkingMemory中删除指定的对象,功能与宏函数retract相同。

Drools之LHS和RHS

LHS

约束连接

对于对象内部的多个约束的连接,可以采用“&&”(and)、“||”(or)和“,”(and)来实现,表面上看“,”与“&&”具有相同的含义,但是有一点需要注意,“,”与“&&”和“||” 不能混合使用

比较操作符

操作符包括:>、>=、<、<=、= =、!=、contains、not contains、memberof、not memberof、matches、not matches

GenScript 规则引擎项目

使用开源组件

Drools/Kie Workbench

使用Workbench中的规则文件类型

DRL

主要对运费、用户积分点数使用了该类型

Decision Table

主要对服务价格、周期计算使用了该类型

搭建文档