drools

Optaplanner: extending the vrp example to tackle multi trip case

天大地大妈咪最大 提交于 2020-01-04 05:26:17
问题 At my company we are currently using optaplanner to solve a vehicle routing problem with great results, we built a web app to manage vehicles, clientes, locations, depots and to show a graphic representation of the solution (including showing the locations in a map). We wrapped the solver in a spring java app with a rest interface to receive request and solve the problem. We are using Google maps to get distance-time data. Now we need to implement multirip.... To tackle the multitrip part I

Integrating Drool 6 work bench with Java Application

两盒软妹~` 提交于 2020-01-03 04:32:15
问题 I have a drool 6 work bench. I am trying to read the rules from work bench and execute them in stand alone java application. Is there any way to download the drl file using URL from the workbench. Please write the code as well as I am new to drools 回答1: First create Java application, include all drools 6 based binary dependencies. For that you can create Maven driven java application. include following dependencies in POM.xml file.. it will download all dependencies in your local maven

Error installing Drools plugin for Eclipse

血红的双手。 提交于 2020-01-02 02:59:07
问题 Does anyone know how to fix this issue ? Cannot complete the install because one or more required items could not be found. Software being installed: JBoss Runtime Drools Detector 6.3.0.Final (org.jboss.tools.runtime.drools.detector.feature.feature.group 6.3.0.Final) Missing requirement: JBoss Runtime Drools Detector 6.3.0.Final (org.jboss.tools.runtime.drools.detector.feature.feature.group 6.3.0.Final) requires 'org.jboss.tools.runtime.core.feature.feature.group 0.0.0' but it could not be

Multiple boolean conditions in a rule in drools?

 ̄綄美尐妖づ 提交于 2020-01-01 19:01:31
问题 I have created a rule whose "when" condition is as follows :- when $map: Map(this["key1"].equals("value1")) and Map(this["key2"].equals("value2")) then ... The above condition is working fine. Now how do I add multiple boolean conditions in a rule? For eg. The above rule could be summarized as : a and b so if I want to create a rule : (a and b) or c then what would be actual drl syntax for it. I am new to drools so kindly help me with the syntax of the rule (a and b) or c. I did create a

scala drools and map

无人久伴 提交于 2020-01-01 00:09:11
需求,安全检查,例如Linux系统,用户安全检查,配置项检查等,这些检查的规则在Drools里面去实现,数据传送过来即可, 问题:如何定义数据结构,不同的检查项会有不同的数据结构,如何规范呢? 思路: 使用map嵌套的思路,检查的数据输出过来是json的格式发送到kafka,然后spark streaming程序直接读取json,然后转为map进行处理。 遇到的问题,一开始代码是使用scala.util.parsing.json.JSON.parseFull(string),这样返回的可能是map[String,Any] 但在drools的rule文件中直接的语言是java,所以需要引入scala.collection.javaconversion._来隐式转换。 但这里的问题是,转换只会完成一层,但json会嵌套,会返回嵌套的map,这样这种方法就不好用了。 折腾了半天,暂时是两层,只是强制转换完成了,这里提一下,java中的object对应scala里面的AnyRef. val jsonstr = scala.io.Source.fromFile(new File("""C:\git\ccms-analyzer\target\classes\test\jsondemo.txt""")).mkString("") //use gson to parse json to map

disable strict mode in drools

假如想象 提交于 2019-12-31 04:05:49
问题 I'm getting error like Error: unable to resolve method using strict-mode: ... I've added system property drools.dialect.mvel.strict=false I can see system property was applied to my app in jvisualvm But I'm getting the same error with 'using strict-mode'. How could I disable strict mode in drools? 回答1: This is how it can be done from Java: KnowledgeBuilderConfiguration kbConfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(); kbConfig.setProperty("drools.dialect.mvel.strict",

Creating new Scala object in Drools right hand side

醉酒当歌 提交于 2019-12-31 04:03:11
问题 Since I'm working with Scala immutable objects within Drools, in order to update a fact I would need to create a new object to replace it. I've written a Scala method for the rule to call which returns just such an object. My query is, what's the syntax for defining a new Scala case class object in the "then" section of a Drools rule? I've tried syntax similar to the following which I saw somewhere but it doesn't seem to be doing the trick either...(even for standard types like Strings) then

java code to access drools guvnor

Deadly 提交于 2019-12-30 11:14:29
问题 We have a project requirement to access the guvnor through a web application .Can any one let me know how to access guvnor through java code ? 回答1: The mortgage-example already has some example code. And the Drools Expert manual probably explains it in detail. Here's the code: private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeAgent kagent = KnowledgeAgentFactory .newKnowledgeAgent( "MortgageAgent" ); kagent.applyChangeSet( ResourceFactory .newClassPathResource(

How does update function works in drools?

烈酒焚心 提交于 2019-12-30 10:45:19
问题 How does update function works in drools? Does it cause the same rules fire again automatically? 回答1: I think you need to read the manual: http://docs.jboss.org/drools/release/5.4.0.Final/drools-expert-docs/html_single/ Using update makes the rules engine aware that a fact has been modified. Therefore rules which depend upon that fact must be re-evaluated. This does have the effect that a rule may fire in an endless cycle. For instance, given the following DRL, you will see that the "Infinite

Drools Change Set

别来无恙 提交于 2019-12-30 10:02:23
问题 I have change set file <change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'> <add> <resource source='http://172.16.13.33:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Eligibility/Eligibility' type='PKG' /> <resource source='http://172.16.13.33:8080/drools-guvnor