[rules-users] Performance gain by upgrading Drools Expert from 5.1 to 5.3

2012-03-21 Thread womuji
We recently upgrade our Drools Expert from 5.1 to 5.3, expecting big
performance gain. But from the tests we done so far, the result is mixed at
best. Is this common or there is sth we can fine-tune the system?


http://drools.46999.n3.nabble.com/file/n3846747/PerformanceResult.png 

All time is in milliseconds.

Thanks

--
View this message in context: 
http://drools.46999.n3.nabble.com/Performance-gain-by-upgrading-Drools-Expert-from-5-1-to-5-3-tp3846747p3846747.html
Sent from the Drools: User forum mailing list archive at Nabble.com.___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] how to invoke java method with variable arguments from drl file

2012-03-08 Thread womuji
Thanks for your reply. We do use mvel. 

I found out that we have to change our signature in JAVA from
methodA(String...) to methodA(String[])

and call it in rule like this:

bjA.methodA(new String[]{string1});

then it worked.

--
View this message in context: 
http://drools.46999.n3.nabble.com/how-to-invoke-java-method-with-variable-arguments-from-drl-file-tp3807314p3810520.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] load precompiled rule/ruleflow file in 5.3.0

2012-03-08 Thread womuji
We are upgrading from Drools 5.1 to 5.3.0.Final, and running into issues with
loading precompiled rule/ruleflow files.

Previously, we precompiled our drl files using ant task
org.drools.contrib.DroolsCompilerAntTask, e.g. rule1.drl to
rule1.drl.rules. We did the similar thing for ruleflow files, i.e.
precompiled all of our rf files to a single ruleflow.flow file. In our java
code, in 5.1, we load them as following:

   DroolsObjectInputStream ruleFlowStream = null;
try
{
ruleFlowStream = new DroolsObjectInputStream(
new BufferedInputStream(
resourceLoader.getResource(
classpath:ruleflow.flow
).getInputStream()
)
);
org.drools.rule.Package ruleFlow =
(org.drools.rule.Package)ruleFlowStream.readObject();
ruleBase.addPackage(ruleFlow);
}
...

Same thing for the rule files.

My question is:
How do we load the precompiled file in 5.3 (we switch to the KnowledgeBase
API ) so that we can save the compiling time when loading?

Thanks.

--
View this message in context: 
http://drools.46999.n3.nabble.com/load-precompiled-rule-ruleflow-file-in-5-3-0-tp3810622p3810622.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] how to invoke java method with variable arguments from drl file

2012-03-07 Thread womuji
We are upgrading Drools from 5.1 to 5.3, and running into some issue when
invoking a Java method with 
String variable arguments:

methodA(String... params)

how do we invoke this in a drl file? We used to call it in 5.1 as:

objA.methodA({string1});

and it works fine. Now in 5.3, it complains that 

unable to resolve method using strict-mode:
objA.methodA([Ljava.lang.Object;)]

If we tried objA.methodA(new String[]{string1});
it complains that 
unable to resolve method using strict-mode:
objA.methodA([Ljava.lang.String;)]

It passes the rule loading if we change to :

objA.methodA(string1);

but when actually running the rule, we are getting error saying
 unable to resolve method methodA(java.lang.String)


--
View this message in context: 
http://drools.46999.n3.nabble.com/how-to-invoke-java-method-with-variable-arguments-from-drl-file-tp3807314p3807314.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] MVEL Expression causing NPE in MVEL optimizer

2012-02-22 Thread womuji
I found the issue: I have to set all the globals before inserting any facts:

cmds.add(CommandFactory.newSetGlobal( addressManager, addressManager,
true)); 
...
cmds.add(CommandFactory.newInsert(event));



--
View this message in context: 
http://drools.46999.n3.nabble.com/MVEL-Expression-causing-NPE-in-MVEL-optimizer-tp3733427p3766434.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] MVEL Expression causing NPE in MVEL optimizer

2012-02-18 Thread womuji
The NPE was caused by the call:
cmds.add(CommandFactory.newSetGlobal( addressManager, addressManager,
true));
cmds.add(CommandFactory.newSetGlobal(fieldOperations, new HashMapString,
AbstractField(), true));

the addressManager is not available via this call, but if I switched all
Global setting via non-command API as

session.setGlobal( addressManager, addressManager);   
session.setGlobal(fieldOperations, new HashMapString, AbstractField());

although they are available during rules' firing, they are not available as
part of ExecutionResults when I call

sessionResult.getValue(fieldOperations)

From the API doc, it says:
StatelessKnowledgeSessions support globals, scoped in a number of ways.
I'll cover the non-command way first, as commands are scoped to a specific
execution call. Globals can be resolved in three ways.

It seems either way should work, what I'm missing here?

Thanks.




--
View this message in context: 
http://drools.46999.n3.nabble.com/MVEL-Expression-causing-NPE-in-MVEL-optimizer-tp3733427p3756295.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] MVEL strict-mode vs. performance

2012-02-13 Thread womuji
Hi,

We are upgrading from Drools 5.1 to 5.3 to improve the performance, but we
are hoping to keep our drl files intact. We were trying to use the old drl
files by setting drools.dialect.mvel.strict=false, but somehow with this
setting we still got  unable to resolve method using strict-mode .. error
from time to time. 

I'm wondering if there is any correlation between this strict-mode and the
performance gain, if in order to achieve the performance gain, we have to
set the strict-mode to true, then we will make changes to our drl files,
instead of spending time to figure out why the effect of
drools.dialect.mvel.strict=false is sporadic.

Thanks.  

--
View this message in context: 
http://drools.46999.n3.nabble.com/MVEL-strict-mode-vs-performance-tp3741814p3741814.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] MVEL Expression causing NPE in MVEL optimizer

2012-02-11 Thread womuji
 The global (?) addressManager is initialized *before* inserting the fact. As
for findFirstAddressByTypeByPerson(), the exception is thrown before it's
invoked: the NPE is thrown as part of the MVEL optimizers.

--
View this message in context: 
http://drools.46999.n3.nabble.com/MVEL-Expression-causing-NPE-in-MVEL-optimizer-tp3733427p3736063.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to the setdrools.dialect.mvel.strictusingDrools+Spring?

2012-02-10 Thread womuji
Hi,

I need to upgrade from Drools 5.1 to 5.3, but keep the original drl files
intact. So I have to disable the strict mode. I tried all the 3 solutions:
1. -Ddrools.dialect.mvel.strict=false
2. set the property in Spring
3. directly set in Java code

But still getting the error:
[Error: unable to resolve method using strict-mode:
java.lang.Integer.parseInt(java.lang.Object)]
[Near : {... ctualDate),Integer.parseInt(leaVariables[Var5]) }]

Where my rule is :

rule my rule
ruleflow-group myGroup
no-loop true
when
$student : Student()
$eventGroup : EventGroup()
$event : Event()
ArrayList( size = 1 ) from collect(Event( eventType.id == xyz)
from $eventGroup.events)
then

Event event1 = new Event(new EventType(xyz));
refEvent = $event ;
   
ValidationFunctions.insertEvents(futureEventGroups,calendarManager.getDateOffset(null,$student,ValidationFunctions.nullSafeGet(refEvent,eventGroup.actualDate),Integer.parseInt(leaVariables[Var5])
+ 0 , false, 0)
,{event1});
end

Where leaVariables is type java.util.Map

I'm using Drools 5.3.0.Final and 

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-How-to-the-set-drools-dialect-mvel-strict-using-Drools-Spring-tp3064468p3733264.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] MVEL Expression causing NPE in MVEL optimizer

2012-02-10 Thread womuji
Hi,

I kept getting NPE for the following MVEL express in Drools rule:
---
rule my Rule
ruleflow-group myGroup
no-loop true
when
not Field(id==meetingNotes)
$student : Student()
$homeAddress : Address() from
addressManager.findFirstAddressByTypeByPerson( new ReferenceCode(xyz),
$student )
then
eventFields.put(meetingNotes,new
Field(meetingNotes,AbstractFieldConverter.formatFullAddress($homeAddress)));
end
---
the stack trace is:
---
[Error: null pointer: addressManager.findFirstAddressByTypeByPerson( new
ReferenceCode(xyz), $student )]
[Near : {... addressManager.findFirstAddres }]
 ^
[Line: 1, Column: 1]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:434)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:141)
at org.mvel2.ast.ASTNode.optimize(ASTNode.java:157)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:113)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:87)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:122)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:115)
at org.mvel2.MVEL.executeExpression(MVEL.java:942)
at
org.drools.base.dataproviders.MVELDataProvider.getResults(MVELDataProvider.java:111)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:140)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:197)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:72)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:161)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:458)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:386)
at 
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:215)
at 
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:244)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:330)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:291)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:845)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
at
org.drools.command.runtime.rule.InsertObjectCommand.execute(InsertObjectCommand.java:84)
at
org.drools.command.runtime.rule.InsertObjectCommand.execute(InsertObjectCommand.java:38)
at
org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:155)
at
org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:76)
at
org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:264)
---

I'm using Drools5.3.0.Final, which in turn depends on MVEL2.1.0

Anything wrong with my MVEL expression?

Thanks in advance.


--
View this message in context: 
http://drools.46999.n3.nabble.com/MVEL-Expression-causing-NPE-in-MVEL-optimizer-tp3733427p3733427.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] ruleflow and bpmn files issues with drools and guvnor 5.2 final

2012-02-02 Thread womuji
We are upgrading from 5.1 to 5.3 and we had some rule flow files with .rf
extension, but the new jBPM in 5.2 and after is creating bpmn files instead
for process. 

 Can we still use the old rf file? or we have to recreate them as bpmn file?

Thanks.

--
View this message in context: 
http://drools.46999.n3.nabble.com/ruleflow-and-bpmn-files-issues-with-drools-and-guvnor-5-2-final-tp3103475p3710293.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] ruleflow and bpmn files issues with drools and guvnor 5.2 final

2012-02-02 Thread womuji
Also, as part of our build process, we used
org.drools.contrib.DroolsCompilerAntTask in our maven file to compiled all
.rf file into a single ruleflow.flow file , which in turn was added to our
RuleBase in the following fashion:

  DroolsObjectInputStream ruleFlowStream = new
DroolsObjectInputStream(
new BufferedInputStream(
resourceLoader.getResource(
classpath:ruleflow.flow
).getInputStream()
)
);
org.drools.rule.Package ruleFlow =
(org.drools.rule.Package)ruleFlowStream.readObject();
ruleBase.addPackage(ruleFlow);

How do we add it to KnowledgeBase in the new 5.3 API? Do we need to make any
changes for our Maven task?

--
View this message in context: 
http://drools.46999.n3.nabble.com/ruleflow-and-bpmn-files-issues-with-drools-and-guvnor-5-2-final-tp3103475p3710360.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Difference between Rule Base and Knowledge Base

2012-02-01 Thread womuji
We are upgrading Drools Core from 5.1.1 to 5.3.1 and stilling using the old
RuleBase API, but we got Null Pointer Exception when running rules: 
-
Caused by: [Error: wm.startProcess($phase.id): null]
[Near : {... WorkingMemory wm = drools.getW }]
...
Caused by: java.lang.NullPointerException
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1073)
-

where our DRL file has content:
-
rule Set ruleflow
salience 10
when
$phase : Phase()
then
WorkingMemory wm = drools.getWorkingMemory();
wm.startProcess($phase.id);
end
-
Do we have to switch to KnlowledgeBase API or sth wrong with our rule? ( it
worked fine with 5.1.1)

--
View this message in context: 
http://drools.46999.n3.nabble.com/Difference-between-Rule-Base-and-Knowledge-Base-tp1263675p3706866.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Difference between Rule Base and Knowledge Base

2012-02-01 Thread womuji
Mark, thanks for your answer.

I just added the following dependency:

  dependency
groupIdorg.jbpm/groupId
artifactIdjbpm-flow/artifactId
version5.2.0.Final/version
  /dependency
but still getting the same error, where the processRuntime is null. Am I
missing sth else here?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Difference-between-Rule-Base-and-Knowledge-Base-tp1263675p3707839.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Upgrade Drools from 5.1 to 5.3

2012-01-19 Thread womuji
Hi,

We have a legacy Drools application using 5.1 and we are planning to upgrade
to 5.3. I have several questions:
1. Are org.drools.StatelessSession and RuleBase deprecated? and instead we
should use KnowledgeBase and StatelessKnowledgeSession?

2. In 5.1.1, we extend WorkingMemoryLogger(final WorkingMemoryEventManager
workingMemoryEventManager) , but it's changed to WorkingMemoryLogger(final
WorkingMemory workingMemory)  in 5.3, how do we change accordingly?

Thanks in advance.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Upgrade-Drools-from-5-1-to-5-3-tp3672875p3672875.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users