drools

How to control rule evaluation (or rule execution) stages in Drools?

丶灬走出姿态 提交于 2019-12-13 03:55:33
问题 I know that "salience" in Drools provides control under rule execution sequence. But above is an example of the problem when "saliences" cannot help anymore that I've faced with. Here I have three rules being executed one after another: rule "Rule 1" salience 30 when then Resource resource1 = new Resource(); resource1.setName("Resource 1"); resource1.setAmount("5"); insert(resource1); System.out.println("First"); end rule "Rule 2" salience 20 //no-loop (interesting, it doesn't lead to a loop)

Migration of JBPM Processes from v5.5 to 6 and finally to 7

强颜欢笑 提交于 2019-12-13 03:54:25
问题 I need to migrate my project with drools and JBPM 5.5 to 6 and finally to 7.15. I tried importing my workflow bpmn file (bpmn2 behavior) and it could not work properly. I am using eclipse BPMN plugin. We have made extensive use of Signal events using BPMN process editor. Looking at the xml, they are configured as intermediateCatchEvent. However the same dont work in JBPM6 or later versions where the signal events need to be Start event with type as Signal. So, when I manually deleted the node

How can i match on multiple objects of the same kind in Drools 5?

孤街醉人 提交于 2019-12-13 02:51:22
问题 Given a collection of BMSContract objects in memory of two or more, I need to match specific patterns using the BMSContract.status field. My rule should resolve to Success if in such collection exactly ONE and ONLY ONE BMSContract has a status of ACTIVE. Any other combination of objects and status codes should resolve to Fail. Again this rule is for a collection of 2 or more objects only and there could be any number of them: 2, 5, 10, 15 or more. There is a slightly different set of rules

Incremental informations about Drools match

天大地大妈咪最大 提交于 2019-12-13 02:49:12
问题 I am trying to use Drools as an rule engine to a synchronizer. The synchronizer does some changes in the system based on some conditions which will be checked using Drools. fireAllRules() and the matches Suppose there can be 'matches'** m0, m1, m2 and m3 against my rules. In the image above I have shown what are the matches for two fireAllRules(). When running fireAllRules() first time, 'I get'*** matches m0, m1 and m2. Then my synchronizer does some changes in the system. On second run of

Drools flow persistence - No active JTA transaction on joinTransaction call

 ̄綄美尐妖づ 提交于 2019-12-13 02:28:20
问题 I've been trying to configure persistence to work with drools flow on JBOSS 6.0.0.Final by following the documentation Drools-Flow-Persistence but I keep getting a exception as below (although hibernate DOES create the database schema): java.lang.RuntimeException: Could not commit session 2011-04-14 23:16:53,716 ERROR [STDERR] (http-0.0.0.0-8000-1) at org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:292) 2011-04-14 23:16:53,716 ERROR [STDERR]

How to get max min item from a list in Drools

╄→гoц情女王★ 提交于 2019-12-13 01:35:09
问题 I have a class class Person { public Date dateOfBirth; public List<Person> children; } I would like to create a Drools rule that gets me the oldest child. For example: rule "Oldest Child" when $person: Person() $oldestChild: Person() from $person.children then insert($oldestChild) end As written, $oldestChild is a list but I'd really like to be an actual oldest child (single object instead of a list). I played around with accumulate a bit but couldn't get it to work. Any ideas? 回答1: An

Drools imports java static method

丶灬走出姿态 提交于 2019-12-13 00:33:41
问题 The static java class and method code is: public class DroolsStringUtils { public static boolean isEmpty(String param) { if (param == null || "".equals(param)) { return true; } return false; } } and the drl code is : package com.rules import com.secbro.drools.utils.DroolsStringUtils.isEmpty; rule CheckIsEmpty when isEmpty(""); then System.out.println("the param is not empty"); end But the IDEA hints "cannot relove" on the method 'isEmpty("")'.I just want to import a static method from java

How To Quiet Drools Resource Scanner Logging?

落花浮王杯 提交于 2019-12-13 00:16:04
问题 I am using Drool's resource scanner like so: ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration(); sconf.setProperty("drools.resource.scanner.interval", "5"); ResourceFactory.getResourceChangeScannerService().configure(sconf); ResourceFactory.getResourceChangeScannerService().start(); ResourceFactory.getResourceChangeNotifierService().start(); Which works well, but the problem is that is logs to the console way

Nested JSON iterations using drools Fluent API

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 23:05:18
问题 For below JSON, later mention drl syntax should suffice (Although haven't tested running drl but correction would be welcome) { "category": [ { "nlp": [ { "mainCategory": "General" } ], "crawler": { "isNLP": true, "mainCategory": "General" } } ], "uniqueId": "5695d7dae4b047806242cfbc0" } Drl Rule for testing "category.nlp.mainCategory" as "General" below: When $basePojo: BasePojo($categoryList:category) $catgory : Category($nlpList: nlp) from $categoryList $nlp : Nlp(mainCategory=="General")

How to know Optaplanner solving has ended?

心已入冬 提交于 2019-12-12 22:27:19
问题 I have initialized and started a solver, I have registered a listener for the best solution change but I would also like to know when solving has ended. I have configured the logger and it correctly shows when the solver has stopped solving (when the termination condition is met or when it is terminated early). I would like to know when the solver has finished, whichever way it ended. Here's my current code for listening for best solution changes solver.addEventListener(new