Re: [rules-users] rule limit

2011-10-05 Thread Mark Proctor
On 06/10/2011 00:09, Davide Sottara wrote:
> As far as I know, the parser does not check the number of rules in a DRL
> Maybe you could do something like this:
>
> (i) use a KnowledgeBuilder to load the DRL resource;
> (ii) before you add the packages to the knowledgeBase, iterate over
> kBuilder.getKnowledgePackages() to find the package generated from your DRL;
> (iii) use getRules().size() on the package to check if the number of rules
> exceeds your desired threshold
Maybe someone can design a Rube Goldberg machine to address this?

Mark
>
> D.
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/rules-users-rule-limit-tp3394660p3398277.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] rule limit

2011-10-05 Thread Davide Sottara
As far as I know, the parser does not check the number of rules in a DRL
Maybe you could do something like this:

(i) use a KnowledgeBuilder to load the DRL resource;
(ii) before you add the packages to the knowledgeBase, iterate over
kBuilder.getKnowledgePackages() to find the package generated from your DRL;
(iii) use getRules().size() on the package to check if the number of rules
exceeds your desired threshold

D.


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-rule-limit-tp3394660p3398277.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] rule limit

2011-10-05 Thread Ansgar Konermann
Hi Slyfox,

nice to read you.

Am 05.10.2011 23:49, schrieb slyfox:
> is this something I missed in the doc
As you are talking about "the doc", it seems you have a particular part
of the solution already in mind (the product/tool you'd like to use to
enforce the size limit). Up to now, you did not describe these ideas
anywhere. If you really expect anyone to help you, please let us know
your actual use case and what you have thought up so far.

It is simply not possible to find a "quality" answer in reasonable time
without this knowledge -- finding the "correct" answer would involve a
lot of guessing what you *really* want to know and then answering the
guessed question(s).

When asking a very broad question like "can it be done", the best you
can expect to get is a very broad answer ("Yes, it can be done" in this
case).

>  or would you mind pointing me in the
> direction of how to accomplish this?
If you give more details on what you're trying to *achieve*, I promise
to give it a try.

If not, oh well, ehm, let me put it like this: as you're certainly
storing the file on some media like a hard disk which cannot be
unlimited in capacity, the file it holds is also implicitly "limited" in
the number of rules in that file.

Of course, this is absolutely not the answer you were looking for, but
hey, how can one know better with that little information you gave first
hand?

It's all good, and I'd really like to help you, but please please please
allow me and the fellow list members to get a clue what problem you're
actually trying to solve. Describe what you're trying to build, how the
problem you're experiencing surfaced, maybe what you already tried to
solve it, how you think a rule number limit could solve your problem,
these sorts of things.

Best regards

Ansgar
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] rule limit

2011-10-05 Thread slyfox
is this something I missed in the doc or would you mind pointing me in the
direction of how to accomplish this?

thanks
Bobby

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-rule-limit-tp3394660p3398077.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] 5.3.0 CR1 has broken existing rules/flows

2011-10-05 Thread Jamie
I've attached a simple stand-alone example to the ticket.

--
View this message in context: 
http://drools.46999.n3.nabble.com/5-3-0-CR1-has-broken-existing-rules-flows-tp3390922p3398007.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] 5.3.0 CR1 has broken existing rules/flows

2011-10-05 Thread Jamie
I created  https://issues.jboss.org/browse/JBRULES-3234 JBRULES-3234 .  I
haven't yet been able to create a stand-alone example, but I'll keep trying. 
I did attach the three rules in question to the ticket.

--
View this message in context: 
http://drools.46999.n3.nabble.com/5-3-0-CR1-has-broken-existing-rules-flows-tp3390922p3397703.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] Memory leak in 5.2/5.3

2011-10-05 Thread Jamie
Thanks, Mark.  That's what I figured.  Not sure why it worked for Alejandro,
but I won't pursue that avenue anymore.  As I mentioned earlier, I did try
to upgrade to 5.3.0.CR1, but there's a new bug in that version that makes it
unusable for me.  (You've been involved in that thread as well).  I'm
planning to open a Jira ticket for the bug this afternoon.  Hopefully the
next CR for 5.3.0 fixes that bug.

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397595.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] Memory leak in 5.2/5.3

2011-10-05 Thread Mark Proctor
On 05/10/2011 19:11, Jamie wrote:
> Thanks for the reply, Alejandro.
>
> I'm currently using these jars:
>
>   knowledge-api-5.2.0.Final.jar
>   drools-core-5.2.0.Final.jar
>   drools-compiler-5.2.0.Final.jar
>   jbpm-flow-5.1.0.Final.jar
>   jbpm-flow-builder-5.1.0.Final.jar
>   jbpm-bpmn2-5.1.0.Final.jar
you need to be using drools 5.3.CR1 with jbpm 5.1.1.final

Mark
>
> I tried changing the three jbpm jars to 5.1.1 and I got a
> NoClassDefFoundError on org.drools.time.impl.TimerJobFactoryManager.  I only
> see that class in drools-core-5.3.0.CR1.jar, so I think this is a dead-end
> for me unless I'm missing something.
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397401.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread Jamie
Thanks for the reply, Alejandro.  

I'm currently using these jars:

 knowledge-api-5.2.0.Final.jar 
 drools-core-5.2.0.Final.jar 
 drools-compiler-5.2.0.Final.jar 
 jbpm-flow-5.1.0.Final.jar 
 jbpm-flow-builder-5.1.0.Final.jar 
 jbpm-bpmn2-5.1.0.Final.jar 

I tried changing the three jbpm jars to 5.1.1 and I got a
NoClassDefFoundError on org.drools.time.impl.TimerJobFactoryManager.  I only
see that class in drools-core-5.3.0.CR1.jar, so I think this is a dead-end
for me unless I'm missing something.


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397401.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] Memory leak in 5.2/5.3

2011-10-05 Thread alopez
Yes, I got the same exception, you can't remove all listeners from the
outside (at least in 5.2.0.Final), that's why I patched the
AbstractWorkingMemory class to hardcode the listeners removal inside Drools.

But now that I found JBPM 5.1.1.Final that seems to solve the problem in a
better way, the memory leak doesn't appear in my tests using that version of
jbpm in combination with Drools.

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397279.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] Memory leak in 5.2/5.3

2011-10-05 Thread Jamie
I'm trying to remove the listeners myself as Edson suggests, but I can't
figure out how to make it work.  I added this to my code just to see how
many listeners there were (I expected to see three - one for each of my
flows - based on what I see in the heap dump):

Collection listeners = session.getAgendaEventListeners();
LOGGER.debug("Agenda event listeners: " + listeners.size());

I was planning to then iterate over the collection and call
session.removeEventListener(),

However, when I run it, get this exception:

java.lang.ClassCastException: org.jbpm.process.instance.ProcessRuntimeImpl$3
incompatible with org.drools.event.rule.AgendaEventListener
at
org.drools.impl.StatefulKnowledgeSessionImpl.getAgendaEventListeners(StatefulKnowledgeSessionImpl.java:182)

Any ideas?


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397001.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] Problem with Java enums in Guvnor "multiple field constraints"?

2011-10-05 Thread Michael Anstis
This was fixed recently for 5.3.0.Final

You can use either "multiple field constraints" or "Add more options to this
fields values" (the icon at the end of a field constraint).

On 5 October 2011 16:43, enkidu  wrote:

> I've been playing with Drools and Guvnor and think I've encountered a
> problem
> with Java enums in Guvnor. I've searched for previous enum bugs and seen
> that a lot have been fixed, but I've tried Guvnor 5.2.0 and 5.3.0.CR1 and
> it
> happens in both.
>
> The problem seems to happen when you use enums in a "multiple field
> constraint" on a fact, eg:
>
>  There is a Person with:
>any of the following:
>  role equal to Role.TEACHER
>  role equal to Role.PARENT
>
> Then using "view source" to see the generated DRL, the enum values are
> enclosed in double quotes, ie:
>
>  rule "test"
>  dialect "mvel"
>  when
>  Person( role == "Role.TEACHER" || role == "Role.PARENT" )
>  then
>  end
>
> If I just do a single field constraint then it comes out fine, eg. Person(
> role == Role.TEACHER )
>
> Is this a bug or am I doing something stupid? I've seen posts recommending
> the use of string constants rather than enums - is this the workaround?
>
> Below is my simple Java model for completeness:
>
> public enum Role {
>TEACHER,
>STUDENT,
>PARENT
> }
>
> public class Person {
>
>private String name;
>private Role role;
>
>public Person( String name, Role role ) {
>this.name = name;
>this.role = role;
>}
>
>public String getName() { return name; }
>
>public Role getRole() { return role; }
> }
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Problem-with-Java-enums-in-Guvnor-multiple-field-constraints-tp3396901p3396901.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Problem with Java enums in Guvnor "multiple field constraints"?

2011-10-05 Thread enkidu
I've been playing with Drools and Guvnor and think I've encountered a problem
with Java enums in Guvnor. I've searched for previous enum bugs and seen
that a lot have been fixed, but I've tried Guvnor 5.2.0 and 5.3.0.CR1 and it
happens in both.

The problem seems to happen when you use enums in a "multiple field
constraint" on a fact, eg:

  There is a Person with:
any of the following:
  role equal to Role.TEACHER
  role equal to Role.PARENT

Then using "view source" to see the generated DRL, the enum values are
enclosed in double quotes, ie:

  rule "test"
  dialect "mvel"
  when
  Person( role == "Role.TEACHER" || role == "Role.PARENT" )
  then
  end

If I just do a single field constraint then it comes out fine, eg. Person(
role == Role.TEACHER )

Is this a bug or am I doing something stupid? I've seen posts recommending
the use of string constants rather than enums - is this the workaround?

Below is my simple Java model for completeness:

public enum Role {
TEACHER,
STUDENT,
PARENT
}

public class Person {

private String name;
private Role role;

public Person( String name, Role role ) {
this.name = name;
this.role = role;
}

public String getName() { return name; }

public Role getRole() { return role; }
}


--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-with-Java-enums-in-Guvnor-multiple-field-constraints-tp3396901p3396901.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] Compilation errors with 5.3.0.CR1

2011-10-05 Thread Edson Tirelli
   I will check these out today. If you can provide an isolated test case,
it helps, otherwise I will try to reproduce from your info in these e-mails.

   Edson

2011/10/5 Wacław Borowiec 

> Thanks for the hint Wolfgang, here are the results:
>
> this == ($constr.getRestrictions () [0])
>
> gives
>
> [Error: unexpected end of statement]
> [Near : {... ($constr.getRestrictions () [0]) }]
>  ^
> [Line: 1, Column: 33]
> at
> org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1146)
>  at
> org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128)
> at
> org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
>  at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
> at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
> at
> org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:854)
> at
> org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:595)
> at
>
> org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:397)
>  at
> org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:309)
> at
> org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:132)
> at
>
> org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:65)
>  at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
> at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2241)
> at
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:802)
> at
>
> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:388)
> at
>
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:566)
> at
>
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:35)
> Caused by: java.lang.StringIndexOutOfBoundsException: String index out
> of range: -1
> at java.lang.String.(String.java:207)
> at
> org.mvel2.optimizers.AbstractOptimizer.capture(AbstractOptimizer.java:222)
> at
> org.mvel2.compiler.PropertyVerifier.analyze(PropertyVerifier.java:123)
> at
> org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:377)
> at
> org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:273)
> at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:2136)
> at org.mvel2.ast.Substatement.(Substatement.java:37)
> at
> org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1006)
> ... 46 more
>
> I tried also without external brackets, but the result is pretty much
> the same.
>
>
> On 10/05/2011 02:45 PM, Wolfgang Laun wrote:
> > Correction:
> > EmNumberRestriction(this == ($constr.getRestrictions () [0] ),...
> >
> > On 5 October 2011 14:44, Wolfgang Laun  wrote:
> >> Write this like so:
> >>EmNumberRestriction(this == ($constr.getRestrictions[0]),...
> >> -W
> >>> part from last line of LHS. Again, it worked well in 5.1.1.
> >>>
> >>> On 10/05/2011 12:14 PM, Swindells, Thomas wrote:
> >>>
> >>> Why do you need the and in the rule?
> >>> Have you tried
> >>>
> >>> rule "enabled paramId: 1, id: 0"
> >>> salience 50
> >>> when
> >>>
> >>>def0: EmParamDefinition(paramName == "p2", listIndex == -1)
> >>>EmParamValue(paramDefinitionId == def0, requiredValue == 1)
> >>>$param : EmParamValue(id == 1, enabled == false)
> >>>not ParentDisabled(id == 1)
> >>>   then
> >>>$param.setEnabled(true);
> >>>update($param);
> >>>   end
> >>>
> >>> Thomas
> >>>
> >>> -Original Message-
> >>> From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
> >>> boun...@lists.jboss.org] On Behalf Of Waclaw Borowiec
> >>> Sent: 05 October 2011 10:55
> >>> To: rules-users@lists.jboss.org
> >>> Subject: [rules-users] Compilation errors with 5.3.0.CR1
> >>>
> >>> Hello
> >>>
> >>> I'm sending the message once again due to problems with code samples
> >>> visibility in the previous one.
> >>>
> >>> I've got following rule:
> >>>
> >>> rule "enabled paramId: 1, id: 0"
> >>> salience 50
> >>> when
> >>>   (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
> >>> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
> >>>   $param : EmParamValue(id == 1, enabled == false)
> >>>   not ParentDisabled(id == 1)
> >>> then
> >>>   $param.setEnabled(true);
> >>>   update($param);
> >>> end>
> >>>
> >>> It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I
> get
> >>> following exception:
> >>>
> >>> [Error: unexpected end of statement]
> >>> [Near : {... def }]
> >>>   ^
> >>> [Line: 1, Column: 4]
> >>>   at
> >>>
> org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1470)
> >>>   at
> >>>
> org.mvel2.compiler.AbstractParser.captureCodeBlock(AbstractParser.java:14
> >>> 46)
> >>>   at
> org.mvel2.compiler.AbstractParser.nextToken(Abstract

Re: [rules-users] Compilation errors with 5.3.0.CR1

2011-10-05 Thread Wacław Borowiec
Thanks for the hint Wolfgang, here are the results:

this == ($constr.getRestrictions () [0])

gives

[Error: unexpected end of statement]
[Near : {... ($constr.getRestrictions () [0]) }]
  ^
[Line: 1, Column: 33]
 at 
org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1146)
 at 
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128)
 at 
org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
 at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
 at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
 at 
org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:854)
 at 
org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:595)
 at 
org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:397)
 at 
org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:309)
 at 
org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:132)
 at 
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:65)
 at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
 at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2241)
 at 
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:802)
 at 
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:388)
 at 
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:566)
 at 
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:35)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out 
of range: -1
 at java.lang.String.(String.java:207)
 at 
org.mvel2.optimizers.AbstractOptimizer.capture(AbstractOptimizer.java:222)
 at 
org.mvel2.compiler.PropertyVerifier.analyze(PropertyVerifier.java:123)
 at 
org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:377)
 at 
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:273)
 at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:2136)
 at org.mvel2.ast.Substatement.(Substatement.java:37)
 at 
org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1006)
 ... 46 more

I tried also without external brackets, but the result is pretty much 
the same.


On 10/05/2011 02:45 PM, Wolfgang Laun wrote:
> Correction:
> EmNumberRestriction(this == ($constr.getRestrictions () [0] ),...
>
> On 5 October 2011 14:44, Wolfgang Laun  wrote:
>> Write this like so:
>>EmNumberRestriction(this == ($constr.getRestrictions[0]),...
>> -W
>>> part from last line of LHS. Again, it worked well in 5.1.1.
>>>
>>> On 10/05/2011 12:14 PM, Swindells, Thomas wrote:
>>>
>>> Why do you need the and in the rule?
>>> Have you tried
>>>
>>> rule "enabled paramId: 1, id: 0"
>>> salience 50
>>> when
>>>
>>>def0: EmParamDefinition(paramName == "p2", listIndex == -1)
>>>EmParamValue(paramDefinitionId == def0, requiredValue == 1)
>>>$param : EmParamValue(id == 1, enabled == false)
>>>not ParentDisabled(id == 1)
>>>   then
>>>$param.setEnabled(true);
>>>update($param);
>>>   end
>>>
>>> Thomas
>>>
>>> -Original Message-
>>> From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
>>> boun...@lists.jboss.org] On Behalf Of Waclaw Borowiec
>>> Sent: 05 October 2011 10:55
>>> To: rules-users@lists.jboss.org
>>> Subject: [rules-users] Compilation errors with 5.3.0.CR1
>>>
>>> Hello
>>>
>>> I'm sending the message once again due to problems with code samples
>>> visibility in the previous one.
>>>
>>> I've got following rule:
>>>
>>> rule "enabled paramId: 1, id: 0"
>>> salience 50
>>> when
>>>   (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
>>> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
>>>   $param : EmParamValue(id == 1, enabled == false)
>>>   not ParentDisabled(id == 1)
>>> then
>>>   $param.setEnabled(true);
>>>   update($param);
>>> end>
>>>
>>> It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I get
>>> following exception:
>>>
>>> [Error: unexpected end of statement]
>>> [Near : {... def }]
>>>   ^
>>> [Line: 1, Column: 4]
>>>   at
>>> org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1470)
>>>   at
>>> org.mvel2.compiler.AbstractParser.captureCodeBlock(AbstractParser.java:14
>>> 46)
>>>   at 
>>> org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:421)
>>>   at
>>> org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:1
>>> 28)
>>>   at
>>> org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62
>>> )
>>>   at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
>>>   at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
>>>   at
>>> org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:

Re: [rules-users] Compilation errors with 5.3.0.CR1

2011-10-05 Thread Wolfgang Laun
Correction:
EmNumberRestriction(this == ($constr.getRestrictions () [0] ),...

On 5 October 2011 14:44, Wolfgang Laun  wrote:
> Write this like so:
>   EmNumberRestriction(this == ($constr.getRestrictions[0]),...
> -W

>> part from last line of LHS. Again, it worked well in 5.1.1.
>>
>> On 10/05/2011 12:14 PM, Swindells, Thomas wrote:
>>
>> Why do you need the and in the rule?
>> Have you tried
>>
>> rule "enabled paramId: 1, id: 0"
>> salience 50
>> when
>>
>>       def0: EmParamDefinition(paramName == "p2", listIndex == -1)
>>       EmParamValue(paramDefinitionId == def0, requiredValue == 1)
>>       $param : EmParamValue(id == 1, enabled == false)
>>       not ParentDisabled(id == 1)
>>  then
>>       $param.setEnabled(true);
>>       update($param);
>>  end
>>
>> Thomas
>>
>> -Original Message-
>> From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
>> boun...@lists.jboss.org] On Behalf Of Waclaw Borowiec
>> Sent: 05 October 2011 10:55
>> To: rules-users@lists.jboss.org
>> Subject: [rules-users] Compilation errors with 5.3.0.CR1
>>
>> Hello
>>
>> I'm sending the message once again due to problems with code samples
>> visibility in the previous one.
>>
>> I've got following rule:
>>
>> rule "enabled paramId: 1, id: 0"
>> salience 50
>> when
>>      (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
>> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
>>      $param : EmParamValue(id == 1, enabled == false)
>>      not ParentDisabled(id == 1)
>> then
>>      $param.setEnabled(true);
>>      update($param);
>> end>
>>
>> It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I get
>> following exception:
>>
>> [Error: unexpected end of statement]
>> [Near : {... def }]
>>                  ^
>> [Line: 1, Column: 4]
>>      at
>> org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1470)
>>      at
>> org.mvel2.compiler.AbstractParser.captureCodeBlock(AbstractParser.java:14
>> 46)
>>      at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:421)
>>      at
>> org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:1
>> 28)
>>      at
>> org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62
>> )
>>      at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
>>      at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
>>      at
>> org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:854)
>>      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:595)
>>      at
>> org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternB
>> uilder.java:397)
>>      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:309)
>>      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:132)
>>      at
>> org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.jav
>> a:65)
>>      at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
>>      at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2241)
>>      at
>> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:802)
>>      at
>> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java
>> :388)
>>      at
>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder
>> .java:566)
>>      at
>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
>> va:35)
>>      at
>> com.proximetry.elmgr.services.DependenciesBean$Expander.addDrl(Depen
>> denciesBean.java:110)
>>
>>
>> It is
>>
>> (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
>> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
>>
>>
>> line that causes the problem - the exeption disappears after removing it.
>> What's interesting, when I add '$' sign to binding variable name, and the 
>> line
>> looks like:
>>
>> ($def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
>> EmParamValue(paramDefinitionId == $def0, requiredValue == 1))
>>
>>
>> instead of the exception I get DRL error:
>>
>> [DialectError message='Unable to wire compiled classes, probably related to
>> compilation failures:sun.reflect.generics.reflectiveObjects.WildcardTypeImpl
>> cannot be cast to java.lang.Class']
>>
>>
>> For completness, this is how I add DRL resources:
>>
>> public void addDrl(Reader rdr) {
>>               KnowledgeBuilder kBuilder =
>> KnowledgeBuilderFactory.newKnowledgeBuilder();
>>
>>               kBuilder.add( ResourceFactory.newReaderResource(rdr),
>> ResourceType.DRL);
>>               if( kBuilder.hasErrors() ){
>>                   for( KnowledgeBuilderError err: kBuilder.getErrors() ){
>>                       StackTrace.error(this, err);
>>                   }
>>                   throw new IllegalStateException( "DRL errors" );
>>               }
>>               knowledgeBase.addKnowledgePackages(
>> kBuilder.getKnowledgePackages() );
>>               }
>>
>>
>> I would be grateful if someone has

Re: [rules-users] Compilation errors with 5.3.0.CR1

2011-10-05 Thread Wolfgang Laun
Write this like so:
   EmNumberRestriction(this == ($constr.getRestrictions[0]),...
-W

2011/10/5 Wacław Borowiec 
>
> Thanks for your answer Thomas. It showed that this construct works fine 
> either way with 5.3.0.CR1, but it's other rule that causes the error:
>
> rule "restriction number paramId: 1, id: 0"
> when
>
>     $param : EmParamValue(id == 1, enabled == true)
>     $def : EmParamDefinition(this == $param.paramDefinitionId)
>     $cust : EmCustomParamDefinition(this == $param.customParamDef)
>     $constr: EmNumberConstraint(this == $cust.constraints)
>     $restr: EmNumberRestriction(this == $constr.restrictions[0], min <= 
> $param.requiredValue, max >= $param.requiredValue)
> then
>     EmRulesUtils.logRuleExecution(kcontext);
>     result.addValidParam($param);
> end
>
> and DRL error:
>
> [DialectError message='Unable to wire compiled classes, probably related to 
> compilation failures:sun.reflect.generics.reflectiveObjects.WildcardTypeImpl 
> cannot be cast to java.lang.Class']
>
> It compiles successfully when I remove
>
> this == $constr.restrictions[0]
>
> part from last line of LHS. Again, it worked well in 5.1.1.
>
> On 10/05/2011 12:14 PM, Swindells, Thomas wrote:
>
> Why do you need the and in the rule?
> Have you tried
>
> rule "enabled paramId: 1, id: 0"
> salience 50
> when
>
>   def0: EmParamDefinition(paramName == "p2", listIndex == -1)
>   EmParamValue(paramDefinitionId == def0, requiredValue == 1)
>   $param : EmParamValue(id == 1, enabled == false)
>   not ParentDisabled(id == 1)
>  then
>   $param.setEnabled(true);
>   update($param);
>  end
>
> Thomas
>
> -Original Message-
> From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
> boun...@lists.jboss.org] On Behalf Of Waclaw Borowiec
> Sent: 05 October 2011 10:55
> To: rules-users@lists.jboss.org
> Subject: [rules-users] Compilation errors with 5.3.0.CR1
>
> Hello
>
> I'm sending the message once again due to problems with code samples
> visibility in the previous one.
>
> I've got following rule:
>
> rule "enabled paramId: 1, id: 0"
> salience 50
> when
>  (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
>  $param : EmParamValue(id == 1, enabled == false)
>  not ParentDisabled(id == 1)
> then
>  $param.setEnabled(true);
>  update($param);
> end>
>
> It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I get
> following exception:
>
> [Error: unexpected end of statement]
> [Near : {... def }]
>  ^
> [Line: 1, Column: 4]
>  at
> org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1470)
>  at
> org.mvel2.compiler.AbstractParser.captureCodeBlock(AbstractParser.java:14
> 46)
>  at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:421)
>  at
> org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:1
> 28)
>  at
> org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62
> )
>  at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
>  at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
>  at
> org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:854)
>  at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:595)
>  at
> org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternB
> uilder.java:397)
>  at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:309)
>  at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:132)
>  at
> org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.jav
> a:65)
>  at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
>  at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2241)
>  at
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:802)
>  at
> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java
> :388)
>  at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder
> .java:566)
>  at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
> va:35)
>  at
> com.proximetry.elmgr.services.DependenciesBean$Expander.addDrl(Depen
> denciesBean.java:110)
>
>
> It is
>
> (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
>
>
> line that causes the problem - the exeption disappears after removing it.
> What's interesting, when I add '$' sign to binding variable name, and the line
> looks like:
>
> ($def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
> EmParamValue(paramDefinitionId == $def0, requiredValue == 1))
>
>
> instead of the exception I get DRL error:
>
> [DialectError message='Unable to wire compiled classes, probably related to
> compilation failures:sun.reflect.generics.reflectiveObjects.WildcardTypeImpl
> cannot be cas

Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread alopez
Hi Marc, Mario,

I'm using the same test case on this thread, and oing more tests I now
realized what is the problem, this leak appears only if the pom file has the
dependency to jbpm-bpmn2 5.1.0.Final along with Drools 5.2.x or 5.3.x.

Re-reading Jamie's post earlier I was puzzled by his reference to jbpm-bpmn2
5.1.1.Final, because is not listed as a version on
http://www.jboss.org/jbpm, but looking at the public maven repo I saw it
really exists, using that version of JBPM resolved the problem, even for
5.2.0.Final.

So in summary Drools 5.2.x and forward do not work properly with JBPM
5.1.0.Final, it would probably be helpful to add some reference to this in
the release notes. And also maybe provide a link to JBPM 5.1.1.Final that I
only saw in the maven repo, no documentation or download link is available
in JBPM site.

Thanks for your help

Alejandro


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3396355.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] Compilation errors with 5.3.0.CR1

2011-10-05 Thread Wacław Borowiec
Thanks for your answer Thomas. It showed that this construct works fine 
either way with 5.3.0.CR1, but it's other rule that causes the error:


rule "restriction number paramId: 1, id: 0"
when

$param : EmParamValue(id == 1, enabled == true)
$def : EmParamDefinition(this == $param.paramDefinitionId)
$cust : EmCustomParamDefinition(this == $param.customParamDef)
$constr: EmNumberConstraint(this == $cust.constraints)
$restr: EmNumberRestriction(this == $constr.restrictions[0], min <= 
$param.requiredValue, max >= $param.requiredValue)

then
EmRulesUtils.logRuleExecution(kcontext);
result.addValidParam($param);
end

and DRL error:


[DialectError message='Unable to wire compiled classes, probably related 
to compilation 
failures:sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot 
be cast to java.lang.Class']


It compiles successfully when I remove

this == $constr.restrictions[0]

part from last line of LHS.Again, it worked well in 5.1.1.

On 10/05/2011 12:14 PM, Swindells, Thomas wrote:

Why do you need the and in the rule?
Have you tried


rule "enabled paramId: 1, id: 0"
salience 50
when

   def0: EmParamDefinition(paramName == "p2", listIndex == -1)
   EmParamValue(paramDefinitionId == def0, requiredValue == 1)
   $param : EmParamValue(id == 1, enabled == false)
   not ParentDisabled(id == 1)
  then
   $param.setEnabled(true);
   update($param);
  end

Thomas


-Original Message-
From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
boun...@lists.jboss.org] On Behalf Of Waclaw Borowiec
Sent: 05 October 2011 10:55
To: rules-users@lists.jboss.org
Subject: [rules-users] Compilation errors with 5.3.0.CR1

Hello

I'm sending the message once again due to problems with code samples
visibility in the previous one.

I've got following rule:

rule "enabled paramId: 1, id: 0"
salience 50
when
  (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
EmParamValue(paramDefinitionId == def0, requiredValue == 1))
  $param : EmParamValue(id == 1, enabled == false)
  not ParentDisabled(id == 1)
then
  $param.setEnabled(true);
  update($param);
end>

It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I get
following exception:

[Error: unexpected end of statement]
[Near : {... def }]
  ^
[Line: 1, Column: 4]
  at
org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1470)
  at
org.mvel2.compiler.AbstractParser.captureCodeBlock(AbstractParser.java:14
46)
  at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:421)
  at
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:1
28)
  at
org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62
)
  at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
  at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
  at
org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:854)
  at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:595)
  at
org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternB
uilder.java:397)
  at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:309)
  at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:132)
  at
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.jav
a:65)
  at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
  at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2241)
  at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:802)
  at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java
:388)
  at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder
.java:566)
  at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:35)
  at
com.proximetry.elmgr.services.DependenciesBean$Expander.addDrl(Depen
denciesBean.java:110)


It is

(def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
EmParamValue(paramDefinitionId == def0, requiredValue == 1))


line that causes the problem - the exeption disappears after removing it.
What's interesting, when I add '$' sign to binding variable name, and the line
looks like:

($def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
EmParamValue(paramDefinitionId == $def0, requiredValue == 1))


instead of the exception I get DRL error:

[DialectError message='Unable to wire compiled classes, probably related to
compilation failures:sun.reflect.generics.reflectiveObjects.WildcardTypeImpl
cannot be cast to java.lang.Class']


For completness, this is how I add DRL resources:

public void addDrl(Reader rdr) {
   KnowledgeBuilder kBuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();

   kBuilder.add( ResourceFactory.newReaderResource(rdr),
ResourceType.DRL);
   if( kBuilder.hasErrors() ){
  

Re: [rules-users] Collecting all items of nested collections / accumulate nested collections

2011-10-05 Thread
Excellent, thanks!
 
From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: 05 October 2011 13:18
To: Rules Users List
Subject: Re: [rules-users] Collecting all items of nested collections /
accumulate nested collections
 
If I understood it correctly and have not missed a comma or parenthesis:

rule "level three"
when
   $l0: Level0()
   $list1: List( size > 0 ) 
  from accumulate (Level1( $level1List: level1List) from
$l0.level1List,
init( List l = new ArrayList(); )
action( l.addAll($level1List); )
return( l ) )
   $date: PartialDate()
  from accumulate (Level2((name in ("name1", "name2"),$occurrence:
occurrence) from $list1, 
  maxDate($occurence) )
then

-W


2011/10/5 Claes, Kenny [JRDBE - Non J&J] 
>
> I have a question regarding creating a list of items that are all in
nested collections of my main object.
>
> A high level overview of the model is like this:
>
>  
>
> public Level0 { 
>  private List level1List; 
> } 
>
>  
>
> public Level1 { 
>  private List level1List; 
> } 
>
>  
>
> public Level2 { 
>  private Date occurence; 
> } 
>
>  
>
> Now, I add objects of type 0 in the working memory and for each of
those objects, I want to find the latest occurrence of a certain Level2,
regardless of which level1 they belong to.
>
>  
>
> If there's only 2 levels and I want to find the latest occurrence of
Level2's with a certain name, I can write:
>
>  
>
> rule "latest level 1"
>
> when
>
> $l0: Level0()
>
> $date: Date() from accumulate (Level1(name in ("name1", "name2"),
$occurence: occurence) from $l0.level1List, maxDate($occurence))
>
> then
>
>   // register fact that latest occurrence of name1/name2 level1
was on $date
>
> end
>
>  
>
> Now, with 3 levels, since I obviously can't replace $l0.level1List
with $l0.level1List.level2List, is there a way to create an intermediate
list that will contain all Level2 objects? No filtering needs to take
place on Level1, but if there's a way to do that too, that would be
nice.
>
>  
>
> What I currently have is this:
>
>  
>
> rule "latest level 2"
>
> when
>
> $l0: Level0()
>
> $l1: Level1() from $l1.level1List
>
> $l2List: List(size > 0) from collect( Level2(name in (("name1",
"name2")) from $l1.level2List )
>
>   $date: PartialDate() from accumulate (Level2( $occurence:
occurence) from $l2List, maxDate($occurence))
>
> then
>
>   // register fact that latest occurrence of name1/name2 level2
was on $date
>
> end
>
>  
>
> But this does not work as it treats each Level1 seperately: it creates
a "latest occurrence" for all accumulated level2 facts within a level1,
instead of one for the entire set of level 2's 'owned' by the level0
object.
>
>  
>
> Any suggestions?
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Compilation errors with 5.3.0.CR1

2011-10-05 Thread Wolfgang Laun
On 5 October 2011 13:27, Wolfgang Laun  wrote:

> Snags like this are due to a completer rework of the DRL parser after
5.1.1.

Snags like this are due to a *complete compiler* rework of the DRL parser
after 5.1.1.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Compilation errors with 5.3.0.CR1

2011-10-05 Thread Wolfgang Laun
For the sake of our readers, I repeat the rule:

rule "enabled paramId: 1, id: 0"
salience 50
when
(def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
EmParamValue(paramDefinitionId == def0, requiredValue == 1))
$param : EmParamValue(id == 1, enabled == false)
not ParentDisabled(id == 1)
then
$param.setEnabled(true);
update($param);
end

and the exception:

[Error: unexpected end of statement]
[Near : {... def }]
^
[Line: 1, Column: 4]
at org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1470)
...

This looks like an MVEL bug. Try this simpler form:
   def0: EmParamDefinition(paramName == "p2", listIndex == -1)
 EmParamValue(paramDefinitionId == def0, requiredValue == 1)

You should also file a JIRA.

Snags like this are due to a completer rework of the DRL parser after 5.1.1.

-W






On 5 October 2011 11:34, wyborowiec  wrote:
>
> Hello
>
> I've got following rule:
>
>
>
> It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I get
> following exception:
>
>
>
> It is
>
>
>
> line that causes the problem - the exeption disappears after removing it.
> What's interesting, when I add '$' sign to binding variable name, and the
> line looks like:
>
>
>
> instead of the exception I get DRL error:
>
>
>
> For completness, this is how I add DRL resources:
>
>
>
> I would be grateful if someone has an idea, why after switching Drools
> version such problem exists.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Compilation-errors-with-5-3-0-CR1-tp3396025p3396025.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Collecting all items of nested collections / accumulate nested collections

2011-10-05 Thread Wolfgang Laun
If I understood it correctly and have not missed a comma or parenthesis:

rule "level three"
when
   $l0: Level0()
   $list1: List( size > 0 )
  from accumulate (Level1( $level1List: level1List) from $l0.level1List,
init( List l = new ArrayList(); )
action( l.addAll($level1List); )
return( l ) )
   $date: PartialDate()
  from accumulate (Level2((name in ("name1", "name2"),$occurrence:
occurrence) from $list1,
  maxDate($occurence) )
then

-W


2011/10/5 Claes, Kenny [JRDBE - Non J&J] 
>
> I have a question regarding creating a list of items that are all in
nested collections of my main object.
>
> A high level overview of the model is like this:
>
>
>
> public Level0 {
>  private List level1List;
> }
>
>
>
> public Level1 {
>  private List level1List;
> }
>
>
>
> public Level2 {
>  private Date occurence;
> }
>
>
>
> Now, I add objects of type 0 in the working memory and for each of those
objects, I want to find the latest occurrence of a certain Level2,
regardless of which level1 they belong to.
>
>
>
> If there’s only 2 levels and I want to find the latest occurrence of
Level2’s with a certain name, I can write:
>
>
>
> rule "latest level 1"
>
> when
>
> $l0: Level0()
>
> $date: Date() from accumulate (Level1(name in ("name1", "name2"),
$occurence: occurence) from $l0.level1List, maxDate($occurence))
>
> then
>
>   // register fact that latest occurrence of name1/name2 level1 was on
$date
>
> end
>
>
>
> Now, with 3 levels, since I obviously can’t replace $l0.level1List with
$l0.level1List.level2List, is there a way to create an intermediate list
that will contain all Level2 objects? No filtering needs to take place on
Level1, but if there’s a way to do that too, that would be nice.
>
>
>
> What I currently have is this:
>
>
>
> rule "latest level 2"
>
> when
>
> $l0: Level0()
>
> $l1: Level1() from $l1.level1List
>
> $l2List: List(size > 0) from collect( Level2(name in (("name1", "name2"))
from $l1.level2List )
>
>   $date: PartialDate() from accumulate (Level2( $occurence: occurence)
from $l2List, maxDate($occurence))
>
> then
>
>   // register fact that latest occurrence of name1/name2 level2 was on
$date
>
> end
>
>
>
> But this does not work as it treats each Level1 seperately: it creates a
“latest occurrence” for all accumulated level2 facts within a level1,
instead of one for the entire set of level 2’s ‘owned’ by the level0 object.
>
>
>
> Any suggestions?
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread Mario Fusco
Hi Alejandro,

I checked if I could reproduce the memory leak in 5.3 by using the test case
posted in the first email of this thread, but I wasn't able to do that. In
other words it seems to me that all listeners are removed as expected in the
dispose method. 

Were you using a different use case that shows the problem? If so could you
share it?

Thanks a lot,
Mario

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3396143.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] Compilation errors with 5.3.0.CR1

2011-10-05 Thread Swindells, Thomas
Why do you need the and in the rule?
Have you tried

> rule "enabled paramId: 1, id: 0"
> salience 50
> when
  def0: EmParamDefinition(paramName == "p2", listIndex == -1)
  EmParamValue(paramDefinitionId == def0, requiredValue == 1)
  $param : EmParamValue(id == 1, enabled == false)
  not ParentDisabled(id == 1)
 then
  $param.setEnabled(true);
  update($param);
 end

Thomas

> -Original Message-
> From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
> boun...@lists.jboss.org] On Behalf Of Waclaw Borowiec
> Sent: 05 October 2011 10:55
> To: rules-users@lists.jboss.org
> Subject: [rules-users] Compilation errors with 5.3.0.CR1
>
> Hello
>
> I'm sending the message once again due to problems with code samples
> visibility in the previous one.
>
> I've got following rule:
>
> rule "enabled paramId: 1, id: 0"
> salience 50
> when
>  (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
>  $param : EmParamValue(id == 1, enabled == false)
>  not ParentDisabled(id == 1)
> then
>  $param.setEnabled(true);
>  update($param);
> end>
>
> It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I get
> following exception:
>
> [Error: unexpected end of statement]
> [Near : {... def }]
>  ^
> [Line: 1, Column: 4]
>  at
> org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1470)
>  at
> org.mvel2.compiler.AbstractParser.captureCodeBlock(AbstractParser.java:14
> 46)
>  at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:421)
>  at
> org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:1
> 28)
>  at
> org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62
> )
>  at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
>  at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
>  at
> org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:854)
>  at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:595)
>  at
> org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternB
> uilder.java:397)
>  at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:309)
>  at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:132)
>  at
> org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.jav
> a:65)
>  at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
>  at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2241)
>  at
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:802)
>  at
> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java
> :388)
>  at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder
> .java:566)
>  at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
> va:35)
>  at
> com.proximetry.elmgr.services.DependenciesBean$Expander.addDrl(Depen
> denciesBean.java:110)
>
>
> It is
>
> (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
>
>
> line that causes the problem - the exeption disappears after removing it.
> What's interesting, when I add '$' sign to binding variable name, and the line
> looks like:
>
> ($def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
> EmParamValue(paramDefinitionId == $def0, requiredValue == 1))
>
>
> instead of the exception I get DRL error:
>
> [DialectError message='Unable to wire compiled classes, probably related to
> compilation failures:sun.reflect.generics.reflectiveObjects.WildcardTypeImpl
> cannot be cast to java.lang.Class']
>
>
> For completness, this is how I add DRL resources:
>
> public void addDrl(Reader rdr) {
>   KnowledgeBuilder kBuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder();
>
>   kBuilder.add( ResourceFactory.newReaderResource(rdr),
> ResourceType.DRL);
>   if( kBuilder.hasErrors() ){
>   for( KnowledgeBuilderError err: kBuilder.getErrors() ){
>   StackTrace.error(this, err);
>   }
>   throw new IllegalStateException( "DRL errors" );
>   }
>   knowledgeBase.addKnowledgePackages(
> kBuilder.getKnowledgePackages() );
>   }
>
>
> I would be grateful if someone has an idea, why after switching Drools
> version such problem exists.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your sy

[rules-users] Compilation errors with 5.3.0.CR1

2011-10-05 Thread Wacław Borowiec
Hello

I'm sending the message once again due to problems with code samples 
visibility in the previous one.

I've got following rule:

rule "enabled paramId: 1, id: 0"
salience 50
when
 (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and 
EmParamValue(paramDefinitionId == def0, requiredValue == 1))
 $param : EmParamValue(id == 1, enabled == false)
 not ParentDisabled(id == 1)
then
 $param.setEnabled(true);
 update($param);
end


It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I 
get following exception:

[Error: unexpected end of statement]
[Near : {... def }]
 ^
[Line: 1, Column: 4]
 at 
org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1470)
 at 
org.mvel2.compiler.AbstractParser.captureCodeBlock(AbstractParser.java:1446)
 at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:421)
 at 
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128)
 at 
org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
 at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
 at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
 at 
org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:854)
 at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:595)
 at 
org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:397)
 at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:309)
 at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:132)
 at 
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:65)
 at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
 at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2241)
 at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:802)
 at 
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:388)
 at 
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:566)
 at 
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:35)
 at 
com.proximetry.elmgr.services.DependenciesBean$Expander.addDrl(DependenciesBean.java:110)


It is

(def0: EmParamDefinition(paramName == "p2", listIndex == -1) and 
EmParamValue(paramDefinitionId == def0, requiredValue == 1))


line that causes the problem - the exeption disappears after removing 
it. What's interesting, when I add '$' sign to binding variable name, 
and the line looks like:

($def0: EmParamDefinition(paramName == "p2", listIndex == -1) and 
EmParamValue(paramDefinitionId == $def0, requiredValue == 1))


instead of the exception I get DRL error:

[DialectError message='Unable to wire compiled classes, probably related to 
compilation failures:sun.reflect.generics.reflectiveObjects.WildcardTypeImpl 
cannot be cast to java.lang.Class']


For completness, this is how I add DRL resources:

public void addDrl(Reader rdr) {
KnowledgeBuilder kBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();

kBuilder.add( ResourceFactory.newReaderResource(rdr), 
ResourceType.DRL);
if( kBuilder.hasErrors() ){
for( KnowledgeBuilderError err: kBuilder.getErrors() ){
StackTrace.error(this, err);
}
throw new IllegalStateException( "DRL errors" );
}
knowledgeBase.addKnowledgePackages( 
kBuilder.getKnowledgePackages() );
}


I would be grateful if someone has an idea, why after switching Drools 
version such problem exists.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Exception Handler not working in Drools flow(bpmn) but working fine in .rf

2011-10-05 Thread rahulkrishnan
Hi,
  I have tried the fault node in drools flow file and it has worked fine
in .rf. Whenever a faultnode is triggered it will search for the fault name
and will be caught at the apropriate Exception Handlers. But When am
implementing the same in .bpmn the fault node is triggered but the flow is
not reaching Exception Handlers ie The flow will exit upon reaching the
fault node.

How can i resolve this problem?  

--
View this message in context: 
http://drools.46999.n3.nabble.com/Exception-Handler-not-working-in-Drools-flow-bpmn-but-working-fine-in-rf-tp3396031p3396031.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] Memory leak in 5.2/5.3

2011-10-05 Thread Mark Proctor
On 04/10/2011 22:51, alopez wrote:
> Good news, I followed your advice and patched drools-core to prevent this,
> focusing on removing all listeners:
>
> AbstractWorkingMemory.java, line 1246:
>
> for ( Iterator it = this.__ruleBaseEventListeners.iterator(); it.hasNext();
> ) {
> this.ruleBase.removeEventListener( (RuleBaseEventListener) it.next()
> );
> }
>
> I changed that to:
>
> for ( Iterator it = this.ruleBase.getRuleBaseEventListeners().iterator();
> it.hasNext(); ) {
> this.ruleBase.removeEventListener( (RuleBaseEventListener) it.next()
> );
> }
>
> And now works OK, no memory leak.
That is not safe, and incorrect. __ruleBaseEventListener is the list of 
rulebase listeners that the current WM adds ot the rulebase.
 public void addEventListener(RuleBaseEventListener listener) {
 this.ruleBase.addEventListener( listener );
 this.__ruleBaseEventListeners.add( listener );
 }
  When the WM is disposed it should remove it's listeners only. so it 
iterates __ruleBaseEventListener to find those, and remove them from the 
rulebase .

What you are doing is iterating the rulebase and removing ALL it's  
listeners, which means it'll remove listeners that belong to other wms.

If you are getting a leak like this, it means some how the wm is adding  
listener, that is not removed - i.e. a listener is not added to 
__ruleBaseEventListener but is still added to rulebase.

If you want this fixed for 5.3,  we need a test producing the issue by 
today.

Mark
>
> Thanks
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3394726.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Compilation errors with 5.3.0.CR1

2011-10-05 Thread wyborowiec
Hello

I've got following rule:



It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I get
following exception:



It is 

 

line that causes the problem - the exeption disappears after removing it.
What's interesting, when I add '$' sign to binding variable name, and the
line looks like:

 

instead of the exception I get DRL error:



For completness, this is how I add DRL resources:



I would be grateful if someone has an idea, why after switching Drools
version such problem exists.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Compilation-errors-with-5-3-0-CR1-tp3396025p3396025.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] Collecting all items of nested collections / accumulate nested collections

2011-10-05 Thread
I have a question regarding creating a list of items that are all in
nested collections of my main object.
A high level overview of the model is like this:
 
public Level0 { 
 private List level1List; 
} 
 
public Level1 { 
 private List level1List; 
} 
 
public Level2 { 
 private Date occurence; 
} 
 
Now, I add objects of type 0 in the working memory and for each of those
objects, I want to find the latest occurrence of a certain Level2,
regardless of which level1 they belong to.
 
If there's only 2 levels and I want to find the latest occurrence of
Level2's with a certain name, I can write:
 
rule "latest level 1"
when
$l0: Level0()
$date: Date() from accumulate (Level1(name in ("name1", "name2"),
$occurence: occurence) from $l0.level1List, maxDate($occurence)) 
then
  // register fact that latest occurrence of name1/name2 level1 was
on $date
end
 
Now, with 3 levels, since I obviously can't replace $l0.level1List with
$l0.level1List.level2List, is there a way to create an intermediate list
that will contain all Level2 objects? No filtering needs to take place
on Level1, but if there's a way to do that too, that would be nice.
 
What I currently have is this:
 
rule "latest level 2"
when
$l0: Level0()
$l1: Level1() from $l1.level1List
$l2List: List(size > 0) from collect( Level2(name in (("name1",
"name2")) from $l1.level2List )
  $date: PartialDate() from accumulate (Level2( $occurence:
occurence) from $l2List, maxDate($occurence))
then
  // register fact that latest occurrence of name1/name2 level2 was
on $date
end
 
But this does not work as it treats each Level1 seperately: it creates a
"latest occurrence" for all accumulated level2 facts within a level1,
instead of one for the entire set of level 2's 'owned' by the level0
object.
 
Any suggestions?
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users