drools-flow

Generate drools drl file by using java

安稳与你 提交于 2021-02-11 12:49:47
问题 I m trying to create the drools drl file using java programmatically by following method. I can able to create the below simple rules by simple rule by java program. rule "Demo_testing" when $employee : EmployeeModel( department contains "Accounts" ) then // And this in one working fine for me, but i need get the employee information from list. Like $employee : EmployeeModel( department contains "Accounts", role = "manager" ) from $employeeList I found the list on descriptor available in

Drools rule fire only for inserted event

点点圈 提交于 2020-01-25 08:59:08
问题 I have a multiple uses with each a sensor that sends pedometer data. I have a rule file that based on the macAddress, fires the rule: declare Steps @role(event) end declare User @role(fact) end rule "MAC" when User( $mac: macAddress ) from entry-point "entrySteps" then end rule "ACC STEPS RULE" extends "MAC" when accumulate( Steps( $s : steps , macAddress == $mac ) over window:time( 1h ) from entry-point "entrySteps"; $fst: min( $s ), $lst: max( $s ); $lst - $fst < 50 ) then System.out

How to deploy Drools Flow and rules by my web application

一世执手 提交于 2019-12-21 02:59:09
问题 I've just now started my new project. My project manager said that Drools is the new technology and we will include drools flow and rules and will integrate our web application with it. How does one integrate Drools flows and rules to within a web-application? 回答1: It depends on what technologies you use. If, for example, you use Java+Maven+Spring, you first need to include Drools dependencies: <dependency> <groupId>org.drools</groupId> <artifactId>drools-core</artifactId> <version>${drools

Drools testing with junit

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 07:53:35
问题 What is the best practice to test drools rules with junit? Until now we used junit with dbunit to test rules. We had sample data that was put to hsqldb. We had couple of rule packages and by the end of the project it is very hard to make a good test input to test certain rules and not fire others. So the exact question is that how can I limit tests in junit to one or more certain rule(s) for testing? 回答1: Personally I use unit tests to test isolated rules. I don't think there is anything too

drools rule get value from a map

自闭症网瘾萝莉.ら 提交于 2019-12-11 22:44:26
问题 How to get the perticular value in the drools when block. I am looking for something like this but its not working: I have inserted Hashmap into Working memory and trying to retrieve it in When $expiry_date:HashMap(get("CREDIT_CARD_EXPIRATION_DATE")); eval(ageInDays($expiry_date)>10) ; I get below error [42,37]: [ERR 101] Line 42:37 no viable alternative at input '"CREDIT_CARD_EXPIRATION_DATE"' in rule "Rule1" in pattern HashMap 回答1: For maps/lists/arrays, you can use [] syntax to access

Stop Rules on update facts drools

我怕爱的太早我们不能终老 提交于 2019-12-11 16:16:48
问题 I have a scenario in Drools. I have some set of rules. For Example : In Rule 1: I am setting ProductName in the fact pojo that comes from session after some condition. In Rule 2: I am calculating grade value i.e. X1,X2,X3,X4. So for each grade I have single rule to calculate. The Fact pojo that is coming from User may ask to calculate any grade value. However, say user asked for X4, then all the grade value from X1 to X3 should also be calculated. What I did is that whenever any rule is

How to define constant in jboss drools?

我是研究僧i 提交于 2019-12-10 20:39:39
问题 All I want to know that how to define contant variable in jboss drools rule. So, Admin has to change only one place to modify the configurable value. Thanks. 回答1: You´re able to define global variables within a rule. This variable can be filled via Java like this: public void init() { StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession(); String string = "foo"; // setGlobal 'string' as 'var' in rule ksession.setGlobal("var", string); } In the rule, this global can be

Decision trees and rule engines (Drools)

大憨熊 提交于 2019-12-03 17:39:27
问题 In the application that I'm working on right now, I need to periodically check eligibility of tens of thousands of objects for some kind of a service. The decision diagram itself is in the following form, just way larger: In each of the end nodes (circles), I need to run an action (change an object's field, log information etc). I tried using Drool Expert framework, but in that case I'd need to write a long rule for every path in the diagram leading to an end node. Drools Flow doesn't seem to

Drools testing with junit

大兔子大兔子 提交于 2019-12-03 12:06:01
What is the best practice to test drools rules with junit? Until now we used junit with dbunit to test rules. We had sample data that was put to hsqldb. We had couple of rule packages and by the end of the project it is very hard to make a good test input to test certain rules and not fire others. So the exact question is that how can I limit tests in junit to one or more certain rule(s) for testing? Personally I use unit tests to test isolated rules. I don't think there is anything too wrong with it, as long as you don't fall into a false sense of security that your knowledge base is working

Decision trees and rule engines (Drools)

不羁的心 提交于 2019-12-03 06:24:49
In the application that I'm working on right now, I need to periodically check eligibility of tens of thousands of objects for some kind of a service. The decision diagram itself is in the following form, just way larger: In each of the end nodes (circles), I need to run an action (change an object's field, log information etc). I tried using Drool Expert framework, but in that case I'd need to write a long rule for every path in the diagram leading to an end node. Drools Flow doesn't seem to be built for such a use case either - I take an object and then, depending on the decisions along the