Embedded sub-process in drools rule flow
by Sanjay Mj
Hi all,
Can anyone please tell me whether it is possible to design nested blocks in
rule flow. I know that using sub-process, we can embed different rule
tasks, but my rule flow file is getting bulkier by the day and I wanted to
know if i can have a few rules in a sub-process, but the rule tasks
executed by the sub-process should not be visible in the uppermost layer.
DOuble clicking on that should take me inside the sub-process and show the
rules executed by it. Also if it is not possible to have such an operation
with the build in blocks in drools rule flow, can anyone tell me how i can
have a custom made block which has that functionality. I have designed
custom blocks having simple properties, but i have no idea how this should
be done. Hope to get an answer here.
Regards sanjay
12 years
Getting started
by vvicky72
I am a newbie to both Drools and Maven. I was asked to research how we can
build brms using drools. This is what I am trying
1) Setup a guided decision table using drools workbench.
This worked without much issues. I deployed the project ( pnd-1.1.pom
<http://drools.46999.n3.nabble.com/file/n4028927/pnd-1.1.pom> )pom.xml
attached.
2) Setup a drools project in ecplise to execute the rule. To do this
a) I installed the Maven plugin in eclipse.
b) I copied the pom.xml create above to my drools project (Not sure if this
was the right thing to do).
c) I then ran Maven install using eclipse. That got the jar file pnd-1.1.jar
(kie wb project created using workbench).
d) I copied the following code to execute the rules
<http://drools.46999.n3.nabble.com/file/n4028927/DroolsTestClient.jpg>
*My first problem was that it would not find the bean (Data Model) that is
in the pnd-1.1.jar.* For the sake of moving forward, I recreated that class
in my drools project on eclipse.
This is how my project looks.
<http://drools.46999.n3.nabble.com/file/n4028927/Droolsproject.jpg>
*Now when I run it I get the error java.lang.RuntimeException: Cannot find
KieModule: com.yrc.ops:pnd:1.1*
I am obviously missing something. But after reading several posts and
tutorials I am still unable to solve it. Please shed some light and help me
out.
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Getting-started-tp4028927.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Not able to detect how to correct ERR 102
by ankit3j
Below is a sample DSLR code I am trying out. Now I am getting error in "when"
block. After hours of trying to search for a solution I have not yet been
able to detect the error.
package com.sample
import com.sample.*;
//expander sample.dsl
rule "hello rule"
when
There is a "$customer" with first name "David" // This is
where the error is
then
Greet Customer
end
[ERR 102] Mismatched input "is" in rule "hello rule"
Any idea whats wrong with this line??
--
View this message in context: http://drools.46999.n3.nabble.com/Not-able-to-detect-how-to-correct-ERR-1...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Performance of rules in Drools
by Seb Geek
Hello,
I have a list of very similar rules executed in Drools and some performance
problems appear ... I want some advices to choose between two "direction"
in order to correct them ...
First the context :
I have to execute always the same check but with different level or
"parameters".
For example,
- in the first demand (rule for our client) i have to count and retrieve
the list all Article that have a family code equals to 'A', 'B' or 'C' and
execute the then clause only if there is 3 elements in the filtered list.
- in the second demand (rule for our client) i have to count and retrieve
the list all Article that have a family code equals to 'B' or 'C' and
execute the then clause only if there is 4 elements in the filtered list
and so on ...
The number of different group of parameter values and the values of theses
parameters will change over time ...
The question is : is it more efficient to implement a lot of different
rules, each with their parameter in the code OR is it more efficient to
implement only one rule with an additional object as a drools fact
containing different parameter's values ?
Thanks for your help
Sébastien
12 years
6.0.1.F How to set Maven repo used by KieScanner?
by SrjTx
I am doing the following, but no rules ever fire. I suspect the maven repo
location is not right -and that no rules are getting loaded - how do I set
it?
I am using /root/.m2/repository
It would be the programmatic equivalent of
-Dorg.guvnor.m2repo.dir=/root/.m2/repository"
Also, how do you list the rules that are in the base? I see there is a
getRule(...), but no getRules.
kieServices = KieServices.Factory.get();
releaseId = kieServices.newReleaseId("com.xyz.policy", "cep",
"LATEST");
kieContainer = kieServices.newKieContainer(releaseId);
kieBase = kieContainer.newKieBase(config);
kieSession = kieBase.newKieSession();
kieSession.addEventListener((RuleRuntimeEventListener) this);
kieScanner = kieServices.newKieScanner(kieContainer);
kieScanner.start(10000L);
--
View this message in context: http://drools.46999.n3.nabble.com/6-0-1-F-How-to-set-Maven-repo-used-by-K...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
NullPointerException with kie-spring 6.0.1 and Spring 4.0
by Andrew Berman
Hello,
I'm trying to play around with Drool 6.0.1 integration with Spring (I'm
using spring-boot which includes spring 4.0). I've looked at the unit
tests written and have copied them pretty much exactly. When I start the
app, I consistently receive:
Caused by: org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class [org.kie.spring.KModuleBeanFactoryPostProcessor]:
Constructor threw exception; nested exception is
java.lang.NullPointerException
at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164)
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1069)
... 22 more
Caused by: java.lang.NullPointerException
at
org.kie.spring.KModuleBeanFactoryPostProcessor.initConfigFilePath(KModuleBeanFactoryPostProcessor.java:79)
at
org.kie.spring.KModuleBeanFactoryPostProcessor.<init>(KModuleBeanFactoryPostProcessor.java:64)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
When debugging the NPE comes from line 79,
getClass().getResource("/").getPath(), because getResource yields null.
Here is my spring context file:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:kie="http://drools.org/schema/kie-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd
">
<kie:kmodule id="kmodule">
<kie:kbase name="kbase1" packages="rules.drools">
<kie:ksession name="ksession">
<kie:consoleLogger/>
</kie:ksession>
</kie:kbase>
</kie:kmodule>
<bean id="kiePostProcessor"
class="org.kie.spring.KModuleBeanFactoryPostProcessor"/>
</beans>
Can someone help out?
Thanks!!
12 years
Rules updating error
by Ioannis Christodoulou
In my java ee application, I use drools 6.1.0.Beta1, deployed on jboss eap
6.2 (I have also deployed Kie Workbench 6.0.1.Final).
In order to get the latest updates on my rules (made on kie wb) I tried to
set kiescanner to "LATEST". This seems to not be working always (I'm not
100% sure about the reason, it seems to happen when I have not re-deployed
the jar with the model classes I use in my rules, or I have not clicked on
build&deploy of the rules project), so I have reverted to using "1.0" as
the version and not changing the version when I update the rules project.
There is an issue with the application not validating, because I have a
guided decision table which uses a global variable and a function, but that
seems to not be an error after all (everything seems to build as it should).
However, while my application is running (and watching for updates through
scanner), if I make an update and deploy the rules project again, the
application retrieves the update and fails with a validation error about
not being able to analyse the expressions regarding the global function and
the global variable.
Any suggestions?
Thank you very much.
12 years
Needs advice to help Drools on a big problem (and avoid GC overhead)
by Raphael
Hi,
In our project, we use Drools to compute forbidden allocations as input for
an allocation problem (for which we do not use Drools BTW).
The constraint of the problem (forbidden operation for given resources) are
expressed as drools rules.
We have about
-200 resources
-700 operations
Those are the Drools facts.
We have about 200 Drools rules describing the forbidden allocations
The problem here is that many rules produce duplicates forbids.
For instance :
Rule 1 may forbid Op1 on Res1 & Res3
Rule 2 may forbid Op1 on Res2 & res3
Currently the RHS of rules just insert forbids into a pure Java Set (no fact
insertion).
The Set takes care of avoiding duplicates, but still, we feel we could help
Drools by giving him a hint that
all rules are actually producing pairs of <Resource, Allocation> and that he
should not try to produce them more than once.
Currently the structure of each rule looks like that :
when
$resource : Resource(<someconditions>)
$operation : Operation(<someconditions>)
then
globalSet.add(Pair<resrouce, operation>)
end
With the size of the problem, we often end up with outOfMem/ GC limit.
When analyzing memory dump, we see about
300.000 drools left tuple object.
I am not sure if we could help drools to reduce the Rete tree here.
I mean, the allocation matrix is already : 200*700 = 140.000 cells.
Drools only uses 2 nodes for each possible forbids, which seems already well
optimized.
We had several idea to improve that though, but we are not enough expert in
the internal of the RETE algorithm to decide if that's a good way to go :
1) Insert forbids as facts in the RHS and check they are not already there
in the LHS :
when
$resource : Resource(<someconditions>)
$operation : Operation(<someconditions>)
not Forbid(res=$resource, op=$operation)
then
insert(Forbid($resource, $operation))
end
2) Merge all rules in one big rule with a single RHS
Is it possible to have something like :
when
// Rule 1
($resource : Resource(<someconditions>)
$operation : Operation(<someconditions>))
or
// Rule 2
($resource : Resource(<someconditions>)
$operation : Operation(<someconditions>))
// Etc ...
then
globalSet.add(Pair<resrouce, operation>)
end
3) Define a common RHS somewhere and tell Drools all rules use this one.
Is there a possibility in Drools to define reusable RHS ? Would it help ?
4) Any other idea ?
Thanks in advance for your help.
Brgds,
Raphael Jolivet
--
View this message in context: http://drools.46999.n3.nabble.com/Needs-advice-to-help-Drools-on-a-big-pr...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years