business-rules

How to share data between Drools rules in a map?

自古美人都是妖i 提交于 2019-12-11 16:17:30
问题 I have a rule which accepts Map() as a fact and then sets lots of elements to this map. I want to be able to use this map somewhere else when executing other rules. I read about globals in Drools but seems like they should not be used for this purpose. Right now I keep this map as private property in Java class, so that it can keep all data in web application context, but this increases my memory footprint. I know it might sound bizarre but is there any analogy in Drools rules to Java static

What would possibly be wrong with the following decision table?

你。 提交于 2019-12-11 13:27:05
问题 public class TestDecisionTable { public static void main(String[] args) { try{ KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession("ksession-dtables"); Screens s1 = new Screens(); s1.setDeliveryChannel("Y"); s1.setUsePointsAppl("Y"); s1.setContactDetails("Y"); s1.setRiskScore("Y"); s1.setReasonCode(100); s1.setCurrentScreen(303); kSession.insert(s1); Screens s2 = new Screens(); s2

Custom ANTLR grammar not working for every input

戏子无情 提交于 2019-12-11 04:56:52
问题 I am trying to write a grammar for our custom rule engine which uses ANTLR (for parsing) and Pentaho Kettle (for executing the rules) Valid inputs for the parser would be of the type: (<Attribute_name> <Relational_Operator> <Value>) AND/OR (<Attribute_name> <Relational_Operator> <Value>) i.e. PERSON_PHONE = 123456789 Here is my grammar: grammar RuleGrammar; options{ language=Java; } prog : condition; condition : LHSOPERAND RELATIONOPERATOR RHSOPERAND ; LHSOPERAND : STRINGVALUE ; RHSOPERAND :

How can be controled / coordinated algorithm

穿精又带淫゛_ 提交于 2019-12-11 04:46:38
问题 Below picture is a simple part of complex algorithm. I try to prepare some classes in accordance with algorithm. abstract class Person { public string HasXRecords { get; set; } public int PersonAnotherFeature { get; set; } public List<X> Xs { get; set; } = new List<X>(); } abstract class X { //There will more than 1000 type subX classes } interface IAdder { void AddXToList(); } interface IRemover { void RemoveXFromList(); } class XAdderFactory { private Person _person; public bool

Guvnor rules encoding

时间秒杀一切 提交于 2019-12-11 00:43:30
问题 I have a Drools decision table in Excel, and some of the strings used in rules have "Á" characters. When I build rules package in Guvnor from this decision table, I get wrong characters in rules source. For instance, in spreadsheet -> Área de Lazer|POR, in built drl file -> �rea de Lazer|POR Is there any way Guvnor can be tuned to support UTF-8 in this case? Had anyone faced similar issue? Thanks @Geoffrey De Smet Hi, I have added following code to ExcelParser.java: WorkbookSettings ws = new

Drools Queries. How are they evaluated and executed?

喜欢而已 提交于 2019-12-10 22:08:14
问题 I am evaluating Drools 6 in a proof of concept application. I am either misunderstanding how the queries in Drools work or I have not implemented something properly. Could someone explain this behavior to me: I have a rule that is supposed to act on validated records like this: rule "Patient Intake: Valid new Patients without a Medical History require a Review" ruleflow-group "Patient Intake" when $patient : Patient( status == PatientStatus.NEW ) not Invalid( value == $patient ) then modify(

Using collect in drools to get similar objects

你。 提交于 2019-12-08 07:45:08
问题 I am trying to collect some objects in Drools, but I want to only collect objects which have the same attribute. To wit, imagine a TestData class: public class TestData { int number; String name; //Getters, setters, rest of class } I want to use collect to get all TestDatas which have the same name. For the following data set, I want a rule which can collect the first two (both having the name 'Test1') and the second two ('Test2') as separate collections. custom.package.TestData< number: 1,

Method or pattern to implement a Business Rules Engine in a solution?

假如想象 提交于 2019-12-06 02:49:59
I am working in a young banking company. Our solution (.NET) has an important technical debt, so we refactor it following DDD principles. We are planning to use (a) Business Rules Engine(s). Business rules deal with accounting purposes, marketing purposes, risk purposes, legal stuff... we are planning to POC the BRE to be sponsored by the business. I am looking for some feedback by people who succeded in adopting a BRE, or, a combination of BREs? Are there tools to manage the BR repository? Is there any pattern that might help to separate processes and BR ? Do you know some authors who wrote

Drools JBOSS rule Nested IF's

此生再无相见时 提交于 2019-12-04 19:09:53
I am a newbie with Jboss Rule. I have gone through the documentation but I fail to find the approach to begin writing rule for following code sample. For each User code in the list { If User code = ‘11’ { If User code ‘17’ present in the group { Add letter id 1 } Else If User code ‘18’ present in the group { Add letter id 2 } } Else { Add letter id 3 which is the letter need to be sent for code 11 } } I would really appreciate if anyone can give me a hint/idea how to go about it? EDIT: Hi, So far this is what i can develop for the user case discussed above. I am inserting (List of UserDetailVo

Biztalk - possible to create rule/policy programmatically?

走远了吗. 提交于 2019-12-04 14:08:37
It seems that Biztalk only supports making rules via the Business Rules Composer, a design-time tool. Everywhere I see "programmatic" referring to Biztalk's Business Rules Engine (BRE), I only see that you can execute the rules in .NET, but not actually create them. I have found the Microsoft.RuleEngine namespace, but the documentation is abysmal, with zero examples and I can't even tell if you can use it to create a rule, or just retrieve the rules (one example I found). Is anyone aware of whether this API exists and/or blogs/references/docs that might be helpful. I think I found a partial