Group a list of objects in Drools
by Amila Silva
hi all,
I have requirement to group the list of objects in drl file.
I have list of events objects and i want group then by no of occurrences and
filter them that no of occurrences.
thanks
Amila
15 years, 5 months
Debug drl file is not working eclipse
by balachandra maddina
Hi There,
I tried debug a drl file in eclipse(3.4) but its not working not sure what
is required to get the debug enabled here. any help would be appreciated.
Thank you,
bala.
15 years, 5 months
RuleContext and insertLogical()
by Michal Bali
Hi,
The org.drools.runtime.rule.RuleContext doesn't support insertLogical() as
did the deprecated KnowledgeHelper. Is it planned to support this method in
the next release of Drools?
Thanking you in advance.
Best regards,
Michal
15 years, 5 months
unable to resolve method using strict-mode
by Chris Richmond
I cannot seem to call a static method on one of my classes and keep getting
this error:
[Error: Failed to compile: 1 compilation error(s):
- (1,44) unable to resolve method using strict-mode:
com.aps.syslog.logging.manager.LoggingManager.runLoggingTest(java.lang.Strin
g, com.aps.syslog.logging.Transaction)]
[Near : {... Unknown ....}]
When I call the static method:
LoggingManager.runLoggingTest ("23223", transaction);
Where the first argument can be any string and the second is a custom class
that I isntatiated earlier in the RHS with no problems.
Is the problem strict-mode? Or something else? LogginManager.runLoggingTest
is a static method but do I perhaps have to do something like:
$lm : LoggingManager()
Then call the static method using:
$lm.runLoggingTest ("23223", transaction);
Or something along these lines (I did try this but it failed as well).
Thanks,
Chris
15 years, 5 months
Class Cast Exception in Drools 4 Generated Accumulate Method
by Steve Ronderos
Hi Rules Users,
I'm experiencing an issue with a Drools 4.0.7 rule.
Here is a clip of the exception that is thrown:
Caused by: org.mvel.CompileException: cannot invoke method
at
org.mvel.optimizers.impl.refl.MethodAccessor.getValue(MethodAccessor.java:54)
at
org.mvel.optimizers.impl.refl.VariableAccessor.getValue(VariableAccessor.java:39)
at
org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
at
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
at
org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at
org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
... 80 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor412.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.mvel.optimizers.impl.refl.MethodAccessor.getValue(MethodAccessor.java:46)
... 88 more
Caused by: org.drools.RuntimeDroolsException:
java.lang.ClassCastException: com.demo.Rule_My_Rule_0$Accumulate0
at org.drools.rule.Accumulate.accumulate(Accumulate.java:131)
at
org.drools.reteoo.AccumulateNode.modifyTuple(AccumulateNode.java:352)
at
org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:248)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
at
org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:67)
at
org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:61)
... 92 more
Caused by: java.lang.ClassCastException:
com.demo.Rule_My_Rule_0$Accumulate0
at
com.demo.Rule_My_Rule_0Accumulate0Invoker.accumulate(Rule_My_Rule_0Accumulate0Invoker.java:43)
at org.drools.rule.Accumulate.accumulate(Accumulate.java:123)
... 103 more
The actually rule name and package are a lot longer, I changed them here
for brevity and because I don't believe the names themselves are relevant.
This exception is being thrown intermittently when this rule, which
contains an accumulate function is called. I say intermittently because
it does not happen every time the rule is run. As far as I can tell the
ClassCastExceptions only happens when the computer that the rules are
running on is under load.
A few more details before I post the rule itself. The rule base that I am
building consists of 2 drl files. Both of the files have the same package
declaration at the top. The 2 packages are built separately using
PackageBuilder then combined using RuleBase.addPackage() on both packages.
Also, I'm not sure if this is relevant, but this scenario takes place in
a web application where the two package objects are only built once (for
performance) but each user session creates a new RuleBase and adds the
packages. The individual sessions then create stateful sessions from the
rule base.
This is the rule that I believe is causing the issue.
rule "My Rule"
salience 50
dialect "java"
no-loop true
when
$module : Module( selected == false, required > 1, $size :
required )
$list : ArrayList( )
from accumulate( PotentialMatch( module == $module, $slot
: slot ),
init( List result = new ArrayList(); ),
action( result.add($slot); ),
reverse( result.remove((Integer)$slot ); ),
result( result ) )
eval( countThem($list, $size) != $module.setMatchCount() )
then
modify( $module ) { setMatchCount(countThem($list, $size)) };
end
As I'm typing this I realize that there is another way to write this rule
using collect. I'm not sure why it was written this way, but since I have
already come this far, has anyone had any experience with the Drools 4
generated code throwing ClassCastExceptions?
Thanks,
Steve Ronderos
15 years, 5 months
forEach node Clarification
by rajakanthan
Hey guys,
I'm doing a POC using drools and drools flow.I have inserted a image here
after modifying some of ruleflow groups. There are more ruleflow groups. The
rules belong to each ruleset in a composite node is perfectly working.Ok.
fine. the problem is, when it comes to 'child service', a list of
ChildService Object will be returned by POJO(let me say, ). For each object,
the rules belong to Service 1,2 and 3 has to executed before coming out of
this composite node 'Level Child'.
I dont have any clue on this. what i have to be given in
CollectionExpression and variableName property in forEach node? How to work
on this forEach?
http://www.nabble.com/file/p24150374/ServiceForEach.jpg
--
View this message in context: http://www.nabble.com/forEach-node-Clarification-tp24150374p24150374.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
process order example not working fully
by Aziz Boxwala
I am trying to execute a ruleflow and use rules to assign tasks within the ruleflow in Drools 5.0.1. I have a drl file included in my knowledge base that tries to assign a task to a user when a new human task is created. This is based on the example in org.drools.example.process.order. I can't get my code to work. I don't the rules in the example are working either (dslr for the task assignment or the drl for dynamic logging). After some attempts, I found that this condition
WorkItemNodeInstance()
does not evaluate to true ever.
Do I have to do anything special to make the WorkItemNodeInstance appear in working memory?
Thanks for any help.
--Aziz
15 years, 5 months
workflow rules in process order example
by gryf@hippogrif.dk
Hi,
looking at the process order example in Drools 5.0 I wonder what workflow_rules.drl is doing? It relies on implementation details but seems not to be used on execution.
thanks,
gryf
15 years, 5 months