drools

Using Drools drl file with common functions in 2 separate kbase/ksessions

廉价感情. 提交于 2021-02-10 20:47:51
问题 using Drools 6.2.0.Final we have a rules project with 2 separate kbases and ksessions configured like this in the kmodule.xml: <kbase name="kbase1" packages="foo.bar.package1"> <ksession name="ksession1" type="stateless" /> </kbase> <kbase name="kbase2" packages="foo.bar.package2"> <ksession name="ksession2" type="stateless" /> </kbase> In each of these packages we have a number of .drl files that contain some business rules. In addition to those each package contains a .drl containing

drools - Unable to Analyse Expression

我只是一个虾纸丫 提交于 2021-02-08 10:56:40
问题 I have defined some rules in DRL file, and its my first program of creating a drl file. I am getting the error " unable to analyse expression ".Here is my code: package rules import com.sample.Applicant.appli; rule "Is of valid age" when $a : appli ( age < 18 ) // appli is my class name // age is a variable in that class then $a.setValid( false ); // setValid is a method of appli end and getting the error: Unable to Analyse Expression age < 18: [Error: unable to resolve method using strict

drools - Unable to Analyse Expression

不想你离开。 提交于 2021-02-08 10:55:54
问题 I have defined some rules in DRL file, and its my first program of creating a drl file. I am getting the error " unable to analyse expression ".Here is my code: package rules import com.sample.Applicant.appli; rule "Is of valid age" when $a : appli ( age < 18 ) // appli is my class name // age is a variable in that class then $a.setValid( false ); // setValid is a method of appli end and getting the error: Unable to Analyse Expression age < 18: [Error: unable to resolve method using strict

Drools - same KieSession for multiple requests

耗尽温柔 提交于 2021-02-08 10:13:04
问题 I use drools 6.3.0 in my projects. I have around 3 thousands rules with 2 categories. Say, category1 with 1500 rules and category2 with 1500 rules. There are 20k orders with different data. Each order will have set of different attributes. Now, creating kiesession for each request is taking time and it is really slow. So, planning to use the same kiesession for executing all the orders and orders will be processed using multi threading. Below is my current approach. KieBase kieBase = null;

PackageBuilder.java not available in Drools 6.1.0.final

自闭症网瘾萝莉.ら 提交于 2021-02-08 03:36:39
问题 I am new to drools and we are currently using Drools 5.4.0 in our project. Currently we are using RuleCompiler.java and PackageBuilder.java classes of Drools 5.4.0 to compile the .xls files and create ruleSetObject. The code snippet is as given below String drlFromFile = null; if (Pattern.matches(regexPattern, file.getName())) { if (file.getName().contains("csv") || file.getName().contains("CSV")) { drlFromFile = RuleCompiler.compileCSV(file); } else { drlFromFile = RuleCompiler

PackageBuilder.java not available in Drools 6.1.0.final

你说的曾经没有我的故事 提交于 2021-02-08 03:36:30
问题 I am new to drools and we are currently using Drools 5.4.0 in our project. Currently we are using RuleCompiler.java and PackageBuilder.java classes of Drools 5.4.0 to compile the .xls files and create ruleSetObject. The code snippet is as given below String drlFromFile = null; if (Pattern.matches(regexPattern, file.getName())) { if (file.getName().contains("csv") || file.getName().contains("CSV")) { drlFromFile = RuleCompiler.compileCSV(file); } else { drlFromFile = RuleCompiler

How to return the value from Cosequence of drl file to java

谁说胖子不能爱 提交于 2021-02-05 07:54:08
问题 If rule matches then i am executing the java function in consequence of drl and i want that result of function in consequence to be returned back to the function which calls to execute the drl. 回答1: You need to make sure that the side effect of the rule is passed back to the caller. How you do this depends on your particular rule set and the objects you pass into it. One solution, for example, might be to change a value on an object you have in working memory. rule "Example rule changing a

RuleBaseLoader loadFromInputStream drools 2.5 compilation error on Java8 and weblogic12c

时光毁灭记忆、已成空白 提交于 2021-02-04 08:36:06
问题 We are facing compilation error while compiling Rule Base from DB on server using drools-io-2.5.jar. RuleBaseLoader.loadFromInputStream(stream); stream is XML input stream picked from database. This code is working with JAVA6 and weblogic 11g but we start getting error when we deployed on weblogic 12c on JAVA8. Can someone please give a direction, how to resolve this. Error: <09-09-2020 18:12:47.235> <DEBUG> <ejbframework> <system> <RulesHelper> <subscriber-type-rules Checking rule base:

Drools 7 - load rules from DB

六眼飞鱼酱① 提交于 2021-02-04 08:23:08
问题 I'm using Drools 7 as rule engine. Initially I loaded rules from classpath with the following code to build a StatelessKieSession: KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); StatelessKieSession statelessKieSession = kContainer.newStatelessKieSession(); then I decided to load rules from DB, here's the code: KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); SqlRowSet sqlRowSet = new JdbcTemplate(ds)

Problem with DSL and Business Rules creation in Drools

孤街醉人 提交于 2021-01-29 21:20:27
问题 I am using Eclipse with the Drools plugin to create rules. I want to create business rules and main aim is to try and provide the user a set of options which he can use to create rules. For eg:If an Apple can have only 3 colors: I want to provide an option like a drop down so that the user can know before hand which are the options he can use in his rules. Is it possible? I am creating a dsl but unable to still provide the above functionality for a business rule. I am having an error