Drools

  1. kie maven plugin 用来验证和预编译artificat reousrce file;

  2. KieServices工厂中的战斗机,可以访问Kie构建和运行时的各种信息;

  3. KieRepository是一个单例,存储所有可用的KieModule;

  4. Kie Project就是一个Maven Project或者Maven Module,拥有groupId,artifactId,and version;pom.xml中定义的groupId,artifactId,and version用来生成ReleaseId对象;ReleaseId这个就是对应一个Kie Project,这个Kie;一个Kie Project的学名叫做KieModule,一个Kie Project包含一个kmodule.xml,这个kmodule=KieModule; 最终被加到KieRepository的是KieModule对象;

  5. 一个KieModule项目中包含一个kmodule.xml文件, 用来选择kiebase里的资源的描述符,他还用来配置kiebase和kiesession;一个kiemoudle.xml对应一个KieContainer对象,提供管理KieBase和KieSession的API

  6. KieBase是一个应用中所有的knowledge定义的仓库,knowledge包括rules,processes,functions和type model;

  7. KieBase没有运行时数据;KieSession存储和执行运行时数据;KieSession可以通过KieBase和KieContainer来创建,KieContainer提供了更强大的创建KieSession的API;区别在于,KieBase的API更底层,他可以创建kiemodule.xml中没有定义的KieSession,KieContainer是运行时模块的接口,是个运行时概念,他只能创建kiemodule.xml中定义好的KieSession,文档上这么说的,看接口定义好像差不多,有空在研究!

  8. KieContainer:一个KieModule包含一个kmodule.xml文件,kmodule.xml文件中定义了多个kbase,一个KieContainer对象,对应一个KieModule,是一个KieModule中所有KieBase的容器;

  9. KieSession是整个Kie runtime模块对外的API,其整合了kie runtime模块的各个子模块的运行时接口,比如针对Rule的StatefulRuleSession和针对jbpm的StatefulProcessSession

  10. KieSession(StatefulKieSession)和StatelessKieSession的唯一区别是最后是不是会自动调用FireAllRules Command;StatefulKieSession不会自动调用;StatefulKieSession两次fireALlReles可以延续状态;里面的fact可以被增删改;

  11. FactHandle,Fact被插入到KieSession中之后,返回的举兵,随后可使此举兵对其对应的fact进行增删修查询;

  12. deployment unit = kie container

  13. Kie Execution Server:KIE Server is a modular, standalone server component that can be used to instantiate and execute rules and processes. It exposes this functionality via REST, JMS and Java interfaces to client application. It also provides seamless integration with the Business Central.
    With the KIE Server REST API, you can perform the following actions:

    1. Deploy or dispose KIE containers

    2. Retrieve and update KIE container information

    3. Return KIE Server status and basic information

    4. Retrieve and update business asset information

Execute business assets (such as rules and processes)

The KIE Server REST API base URL is http://SERVER:PORT/kie-server/services/rest/


  org.kie.server
  kie-server-client
  ${drools.version}

  1. drools controller:Drools provides a Drools controller REST API that you can use to interact with your KIE Server templates (configurations), KIE Server instances (remote servers), and associated KIE containers (deployment units) in Drools without using the Business Central user interface. This API support enables you to maintain your Drools servers and resources more efficiently and optimize your integration and development with Drools.

http://localhost:8080/business-central/docs
The Drools controller REST API base URL is http://SERVER:PORT/CONTROLLER/rest/
Swagger UI for the Drools controller REST API at http://SERVER:PORT/CONTROLLER/docs

With the Drools controller Java client API, you can perform the following actions also supported by the Drools controller REST API:

Retrieve information about KIE Server templates, instances, and associated KIE containers

Update, start, or stop KIE containers associated with KIE Server templates and instances

Create, update, or delete KIE Server templates

Create, update, or delete KIE Server instances

    
      org.kie.server
      kie-server-controller-client
      ${drools.version}
    
    
    
    
      org.jboss.resteasy
      resteasy-client
      ${resteasy.version}
    
    
    
    
      io.undertow
      undertow-websockets-jsr
      ${undertow.version}
    

Knowledge Store REST API for Business Central spaces and projects

With the Knowledge Store REST API, you can perform the following actions:
1. Retrieve information about all projects and spaces
2. Create, update, or delete projects and spaces
3. Build, deploy, and test projects
4. Retrieve information about previous Knowledge Store REST API requests, or jobs

这里有两个client包,kie-server-client和kie-server-controller-client,kie-server-client是Kie Execution Server的java client,kie-server-controller-client是kie Server的 controller ,也就是business central的管理Kie Execution Server的模块的Java client;

Activation:数据被 assert 进 WorkingMemory 后,和 RuleBase 中的 rule 进行匹配(确切的说应该是 rule 的 LHS ),如果匹配成功这条 rule 连同和它匹配的数据(此时就叫做 Activation )一起被放入 Agenda ,等待 Agenda 来负责安排激发 Activation (其实就是执行 rule 的 RHS ),下图中的菱形部分就是在 Agenda 中来执行的, Agenda 就会根据冲突解决策略来安排 Activation 的执行顺序。
Drools_第1张图片
RuleUnit:Rule units represent a purely declarative approach to partition a rules set into smaller units,binding different data sources to those units and orchestrate the execution of the individual unit.A rule unit is an aggregate of data sources, global variables and rules.

Pattern:An object type constraint plus its zero or more field constraints is referred to as a pattern
Pattern Matching:The process of matching patterns against the inserted data is, not surprisingly, often referred to as pattern matching.

The data is matched during the insertion stage ;Meanwhile, the rule plus its matched data is placed on the Agenda and referred to as an RuIe Match or Rule Instance.

Consequence:when then 里then的部分;

StatelessKieSession and Since Stateful KIE session is the most commonly used session type it is just named KieSession in the KIE API.

Stateless Sessions typically do not use inference, Inference can also be turned off explicitly by using the sequential mode.

KieSession#insert 之后 Drools engine has done all of its matching, but no rules have fired yet. Calling ksession.fireAllRules() allows the matched rules to fire;

Cross Products: the result of a join.

Agenda Groups + Salience + activation-group + ruleflow-group

With logical assertions, the fact that was asserted will be automatically retracted when the conditions that asserted it in the first place are no longer true.

A “insertLogical” is part of the Drools Truth Maintenance System (TMS).

参考
Drools Fusion(CEP)独家解读

你可能感兴趣的:(Drools)