drools

Evaluating XPath expressions in JBoss Drools

…衆ロ難τιáo~ 提交于 2019-12-07 17:33:56
问题 I am working within a enterprise architecture that is processing a large amount of XML messages. We have recently been given the requirement to perform some calculations on data contained in those XML messages and add some results to the message header before passing the message out of the enterprise to an external consumer. Our architecture is based on the JBoss SOA-P and I am currently evaluating JBoss Drools 5.2.0 for performing these message operations. I know that I can simply hydrate a

在智能交通系统中基于 Drools BRMS 实现业务规则动态管理

核能气质少年 提交于 2019-12-07 16:32:42
引言 业务规则管理系统(BRMS)在电信,银行和政府等各行业中广泛使用,用来支持业务规则的编辑,管 理和部署,以适应业务的快速变化。Drools 是一款基于 Java 的开源产品,包括业务规则执行引擎和业务规则管理系统。本文首先介绍了业务规则引擎和业务规则管理系统的基本概念和体系结构,然后介绍一个智能交通系统中 的典型业务场景,最后展现如何通过使用 Drools BRMS 来实现这个业务场景,并根据不同的业务需要灵活配置这些业务规则。 回页首 基本概念介绍 智能交通系统中的业务规则简介 智 能交通系统中的道路收费系统的基本业务场景是:载有特定装置(通常是电子标签装置或者是有全球卫星定位功能的装置)的车辆进入收费区后,收费区的信号探测 器发出扫描信号,检测并获取该车的有关信息,譬如信号探测系统能够获取并记录诸如车辆的几何尺寸、车重、车型等数据。对于没有安装这种装置的车辆来说,系 统可以通过摄像机拍摄记录获得车型、车牌号等信息。然后根据不同的收费业务规则,针对不同的车辆采取不同的收费标准。 目前主要的道路收费业务规则有基于特殊道路使用收费、基于区域收费和基于距离 / 时间收费等。 基于特殊道路使用收费:这种收费模式通常是针对特殊的道路,如某条高速公路。这种收费的业务规则比较简单,当车辆通过一次收费检测点就收取一次费用。基于特殊道路的使用收费模式还广泛应用在城市拥堵费收取中

动手撸一个规则引擎(二):方案解析

天大地大妈咪最大 提交于 2019-12-07 16:32:28
写在前面 规则引擎可以搞啥?一般使用场景,是通过可视化节目进行拖拉或者简单的操作指定流程和规则,将规则输入得到目标输出。 交易系统中的规则引擎 规则编排的过程是各种条件的组合,类似于搭积木,指定逻辑规则,细化逻辑因子,比如指定选人规则,一个用户id进来之后根据指定的不同逻辑规则得到该用户可以发的券集合。同样可以用来筛选商品,筛选营销规则等。 在交易系统中主要是和用户和营销策略相关,比如根据历史订单,是否会员信息,是否门店新老客等规则因子,组合规则因子,也就是指定决策逻辑。动态的去响应不同用户的不同策略。 规则引擎的难点 规则引擎的难点在于:规则的易变和定制化。 规则往往处于热更新的状态,在产品决策过程中因为ABTest等原因,可能随时调整规则。同时一套营销规则可能因为用户画像不同导致千人前面的策略,有一定的定制特点。 在没有规则引擎之前,系统实现规则引擎一般采用硬编码,if/else登方式。哪怕是将规则相关逻辑单独抽离到规则模块,代码规则实现存在硬编码难以热更新的问题依然存在。 但是硬编码并非一无是处,较粗粒度的规则还是需要固化到系统中,这样可以达到更好封装和抽象的目的,降低一定的迭代成本。 规则引擎系统 规则引擎被定义为系统中的一组规则组件,可以将业务逻辑和决策逻辑进行拆分,抽离出来。 规则引擎的关键词: 实事:用户的输入信息为实事 规则:定制化的业务规则逻辑 结果

1、常用规则引擎、java规则引擎的标准。

故事扮演 提交于 2019-12-07 16:31:14
一、概述。JSR94标准 在本文中,我们将介绍一些最流行的Java规则引擎。 在应用程序中,业务规则很复杂(比如:优惠券的使用规则)。如果用源代码实现这些规则,很繁琐。通过规则引擎将业务逻辑与源代码分离,可以简化开发和维护。 在Java世界中,大多数规则引擎库都实现了称为 Java Rule API Engine 的 JSR94标准。 二、常用的规则引擎。 1、Drools Drools的官网: https://www.drools.org/ Drools是业务规则管理系统(BRMS)解决方案。Drools可以与jBPM集成,jBPM是一个业务流程管理工具,用于流程,事件活动,任务等的标准化。 如果你想阅读更多内容,可以 在这里 找到Drools的介绍,以及一篇关于 与Spring集成 的文章。 2、OpenL Tablets 官网: http://openl-tablets.org/ OpenL Tablets是一个业务规则管理系统和一个基于Excel决策表的业务规则引擎。由于此框架使用的表格格式对业务用户来说很熟悉,因此它弥合了业务用户和开发人员之间的差距。 3. Easy Rules 官网: http://www.jeasy.org/ Easy Rules是一个简单的Java规则引擎,提供轻量级和基于POJO的框架来定义业务。它可以通过使用复合模式从原始规则创建复杂规则。

Drools Expert output object in Scala

…衆ロ難τιáo~ 提交于 2019-12-07 15:41:27
问题 I'm a novice in both Scala and Drools Expert, and need some help getting information out of a Drools session. I've successfully set up some Scala classes that get manipulated by Drools rules. Now I want to create an object to store a set of output facts for processing outside of Drools. Here's what I've got. I've got a simple object that stores a numeric result (generated in the RHS of a rule), along with a comment string: class TestResults { val results = new MutableList[(Float, String)]()

Convert Java POJO to Drools DRL and vice versa

家住魔仙堡 提交于 2019-12-07 15:28:53
问题 I have rule configuration on UI which builds to Java POJO. How could I generate Drools DRL (to be passed to other component which will match facts, etc and returns true or false if rule matches). Also I receive DRL file from database and in order to show rule on UI, I need to convert back to Java POJO. Basiclly is there any tool or script that could convert between Java POJO and Drools DRL file? If not, what is the best way available? Thanks much! 回答1: I am not sure what are your Java POJOs?

unable to resolve method using strict-mode

吃可爱长大的小学妹 提交于 2019-12-07 12:30:41
问题 I'm newbie with java and drools and I have to build a java RESTful Web Services / rules engine. We already have Genesys Rule Authoring (GRAT) and Genesys Rule Engine (GRE) (version 8.1.2) who run drools version 5.2. We have the need to take the source of GRAT packages and use them in a "lite rule engine" for our development environments. For my POC, I have install drools 5.2 and create a project who can digest my package and fire rules just like I want. But for some package I have this kind

Possible causes for “StreamCorruptedException: invalid stream header”

故事扮演 提交于 2019-12-07 00:52:25
问题 I (try to) use drools to process my pricing rules. But when I try to execute the rules the following exception is thrown: java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:418) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:120) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:109)

what is the difference between no-loop and lock-on-active in drools

大城市里の小女人 提交于 2019-12-06 23:06:51
问题 Here is an example of a rule that uses "no-loop": rule "Even Number Rule" dialect "java" no-loop when n : Number( number !=0 && (number%2)==0 , value : number) then modify(n){setNumber(8)}; end 回答1: Long story short: no-loop: avoid the re-activation of a rule caused by the RHS of that SAME rule. lock-on-active: avoid the re-activation of a rule NO MATTER what the cause is. Long story: http://ilesteban.wordpress.com/2012/11/16/about-drools-and-infinite-execution-loops/ Hope it helps, 来源: https

KIE Workbench Integration Responds with 401

China☆狼群 提交于 2019-12-06 20:47:43
I'm trying to integrate my KIE Workbench 6.1.FINAL deployment with a simple application using Drools 6.1.FINAL. I use the following code: String url = "http://localhost:8088/workbench/maven2/com/sep/test/myProject/1.0/myProject-1.0.jar"; KieServices ks = KieServices.Factory.get(); UrlResource urlResource = (UrlResource) ks.getResources().newUrlResource(url); urlResource.setBasicAuthentication("enabled"); urlResource.setUsername("admin"); urlResource.setPassword("admin"); try { InputStream is = urlResource.getInputStream(); KieModule kModule = ks.getRepository().addKieModule(ks.getResources()