[rules-users] Memory leak in 5.2/5.3

2011-08-24 Thread Swindells, Thomas
I'm in the middle of trying to upgrade our application to Drools 5.2 from 5.1 
however I keep facing out of memory issues (I've also tried on the current 5.3 
beta).
I've simplified my code into the following test case which on my machine after 
about 600 or so iterations gives an Out of memory exception:

@Test
   public void testCase() throws InterruptedException
   {
  KnowledgeBuilder kbuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();
  KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
  kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());

  for(int i = 0; i  1000; i++) {
 System.out.println(Run  + i);
 StatefulKnowledgeSession session = 
kbase.newStatefulKnowledgeSession();
 for(int j = 0; j  100; j++) {
   session.insert(new byte[10240]);
 }

 session.dispose();
 session = null;
 System.gc();
  }
   }

Am I missing anything here - I'm calling session.dispose() which is all I 
believe is necessary when finishing the session, however using a profiler shows 
that all the StatefulKnowledgeSessionImpl and ReteooStatefulSessions are still 
present and therefore keeping hold of all the byte arrays and memory.

Using a profiler it shows that the GC roots of the StatefulKnowledgeSessionImpl 
are
kruntime of org.jbpm.process.instance.ProcessRuntimeImpl
kruntime of org.jbpm.process.instance.event.DefaultSignalManager
kruntime of org.jbpm.process.instance.timer.TimerManager
kruntime of org.drools.reteoo.ReteooStatefulSession

Similarly for the ReteooStatefulSession:
session of org.drools.impl.StatefulKnowledgeSessionImpl
session of org.drools.impl.StatefulKnowledgeSessionImpl
workingMemory of org.jbpm.process.instance.ProcessRuntimeImpl
workingMemory of org.jbpm.process.instance.ProcessRuntimeImpl
workingMemory of org.jbpm.process.instance.ProcessRuntimeImpl

Is this a known issue? Am I missing anything in my code above.
I guess the alternative is to reuse my sessions - what is the most efficient 
way to remove all the facts from the working memory and get it back into a 
pristine state?

Thanks,

Thomas



**
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 system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 5.2 performance building KnowledgeBase

2011-08-24 Thread Swindells, Thomas
Cheers, thanks for the info, that does greatly improve compilation time - I 
take it it is your maxpermsize that you had to increase in jboss?

Thomas

 -Original Message-
 From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
 boun...@lists.jboss.org] On Behalf Of darktyco
 Sent: 24 August 2011 04:17
 To: rules-users@lists.jboss.org
 Subject: Re: [rules-users] Drools 5.2 performance building KnowledgeBase

 In case anyone else is struggling with this problem I found that using the
 latest beta mvel jar (beta 6) helps a lot. Performance and memory use
 building and loading my large KnowledgeBase is much better- on my slower
 machine I'm down to 20 minutes (from 60) of compile time. Not back to
 Drools
 5.1 (10 minutes) speed. and I still have to give JBoss extra memory to deploy
 my webapp, but still much better.

 --
 View this message in context: http://drools.46999.n3.nabble.com/Drools-5-
 2-performance-building-KnowledgeBase-tp3239746p3279902.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


**
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 system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

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


[rules-users] Adventure with Drools

2011-08-24 Thread Mark Proctor
Still got some tidying up to do, but it's at a stage where peopel can 
start playing with it:
http://blog.athico.com/2011/08/text-adventures-with-drools.html

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


[rules-users] Inconsistent syntax behaviour

2011-08-24 Thread Swindells, Thomas
Continuing trying to upgrade from drools 5.1 I've been finding some strange 
funnies in rules behavior. Currently I'm using 
droolsVersion5.3.0.Beta1/droolsVersion
  jbpmVersion5.1.0.Final/jbpmVersion
  mvelVersion2.1.Beta6/mvelVersion

In our model we've got some lists (Yuck I know) and we want to test whether 
they are not empty, there are three variations of the rules that we could use

rule TESTa
   when
  t : Title(t.getMyList().isEmpty() == false)
   then
   logger.debug(drools.getRule().getName() +   + drools.getTuple());
end


rule TESTb
   when
  t : Title(myList.isEmpty() == false)
   then
   logger.debug(drools.getRule().getName() +   + drools.getTuple());
end


rule TESTc
   when
  t : Title(myList.empty == false)
   then
   logger.debug(drools.getRule().getName() +   + drools.getTuple());
end

I'd expect all of these formats to work (particularly c) however only TESTa 
succeeds, the other two FAIL SILENTLY, failing to match anything but not 
generating any errors or warnings.

Thomas



**
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 system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Error is Java.lang.RuntimeException

2011-08-24 Thread Manohar Kokkula
Hi Frank,

I already did as you said, but still i am getting the following error:



Error is java.lang.RuntimeException: [12,19]: [ERR 101] Line 12:19 no 
viable alternative at input ''[12,27]: [ERR 101] Line 12:27 no viable 
alternative at input ''[13,15]: [ERR 101] Line 13:15 no viable alternative 
at input ''[13,21]: [ERR 101] Line 13:21 no viable alternative at input 
''[23,19]: [ERR 101] Line 23:19 no viable alternative at input ''[23,27]: 
[ERR 101] Line 23:27 no viable alternative at input ''[24,15]: [ERR 101] 
Line 24:15 no viable alternative at input ''[24,21]: [ERR 101] Line 24:21 
no viable alternative at input ''[34,19]: [ERR 101] Line 34:19 no viable 
alternative at input ''[34,25]: [ERR 101] Line 34:25 no viable alternative 
at input ''[35,15]: [ERR 101] Line 35:15 no viable alternative at input 
''[35,21]: [ERR 101] Line 35:21 no viable alternative at input ''[45,19]: 
[ERR 101] Line 45:19 no viable alternative at input ''[45,27]: [ERR 101] 
Line 45:27 no viable alternative at input ''[46,15]: [ERR 101] Line 46:15 
no viable alternative at input ''[46,21]: [ERR 101] Line 46:21 no viable 
alternative at input ''




Thanks and Regards
Manohar Kokkula
Mailto: manohar.kokk...@tcs.com
=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


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


[rules-users] Question about custom accumulation functions

2011-08-24 Thread Bruno Freudensprung
Hi,

While testing my custom accumulation function I noticed an unexpected 
behavior (th'ats of course a personal point of view).
It seems that Drools 5.1 calls accumulate(...) and getResult(...) as 
many times as the number of accumulated facts (accumulate, getResult, 
accumulate, getResult, etc...).
Is it supposed to work like this?

Best regards,

Bruno.

___
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-08-24 Thread Lukáš Petrovický
Swindells, Thomas píše v St 24. 08. 2011 v 09:14 +0100:
 I’ve simplified my code into the following test case which on my
 machine after about 600 or so iterations gives an Out of memory
 exception:

Have you tried removing jBPM jar files? If it fixes the issue, then it's
a known bug that should be already fixed on master (aka. Drools 5.3.)
Unfortunately the fix didn't make Beta1.

It's also fixed on 5.2.x branch but I don't think there will be any
further Drools releases from that.

-- 
Lukáš Petrovický
QE Lead, JBoss Enterprise BRMS
Phone: +420 532 294 123
irc: lpetrovi, triceo

Red Hat Czech, s. r. o.
Purkyňova 99, 612 00 Brno, Czech Republic


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


Re: [rules-users] (no subject)

2011-08-24 Thread Esteban Aliverti
About the duplicated $s varaible, is because you have 2 DIFFERENT conditions
saying $s:Student (same thing for $c)
The rules you have there are translated to (when age field has a value):

when
 $s:Student (age == 18)  //if age value was 18
 $s:Student (mark == 20)
 $c:College (ranking == 85 A)
 $c:College (location == Delhi)
then
 
end

If you want to join constraint about Student and constraint about
Collegues to get something like:

when
 $s:Student (age == 18, mark == 20)
 $c:College (ranking == 85 A, location == Delhi)
then
 
end

you will need to merge the 2 cells containing $s:Student and the 2 cells
containing $c:College. This way is how you tell drools that you want to
define 1 condition with multiple constraints instead of multiple condition
with one constraint each.

Best Regards,




Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Wed, Aug 24, 2011 at 2:12 PM, FrankVhh frank.vanhoensho...@agserv.euwrote:

 Hi to you,

 The error message seems to indicate that you are having 2 (types of) errors
 in your decision table.

 Error type 1: You have duplicate names.
 As I am assuming that you are comparing 1 student with 1 college, you can
 delete one $s: Student() and one $c: College() cell. Then, you merge the
 cells above the columns. That way the engine will not have a duplicate $c,
 but work on the same student data.

 Error type 2: you are trying to set a String value to a certain attribute.
 Bear in mind that the $param parameter is replaced by exactly what is in
 the
 cell and only what is in the cell. Therefore, you need to include  around
 you strings. F.e. $c.setValue($param);

 There might be some other things missing as well, but this is what the
 error
 message is stating.

 Regards,
 Frank


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-no-subject-tp3280773p3280800.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] Adventure with Drools

2011-08-24 Thread Mauricio Salatino
I will put my hands on that game, as soon as Sotty give me some free time to
play with it!

On Wed, Aug 24, 2011 at 7:56 AM, Mark Proctor mproc...@redhat.com wrote:

 Still got some tidying up to do, but it's at a stage where peopel can
 start playing with it:
 http://blog.athico.com/2011/08/text-adventures-with-drools.html

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




-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino Salaboy Mauricio -
___
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-08-24 Thread Swindells, Thomas
 Swindells, Thomas píše v St 24. 08. 2011 v 09:14 +0100:
  I’ve simplified my code into the following test case which on my
  machine after about 600 or so iterations gives an Out of memory
  exception:

 Have you tried removing jBPM jar files? If it fixes the issue, then it's a 
 known
 bug that should be already fixed on master (aka. Drools 5.3.) Unfortunately
 the fix didn't make Beta1.
[Swindells, Thomas] We need it unfortunately, any idea when beta2 will be out?
I've worked round it for now by reusing the sessions (cleaning out all the 
facts before I do so) but would be nice to get a proper fix :)

 It's also fixed on 5.2.x branch but I don't think there will be any further 
 Drools
 releases from that.

 --
 Lukáš Petrovický
 QE Lead, JBoss Enterprise BRMS
 Phone: +420 532 294 123
 irc: lpetrovi, triceo

 Red Hat Czech, s. r. o.
 Purkyňova 99, 612 00 Brno, Czech Republic


 ___
 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 system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

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


Re: [rules-users] Rules stop firing when white-space is changed

2011-08-24 Thread dcrissman

Esteban wrote:
 
 What are the steps you are following? Something like this?:
 
 The agent creates the kbase
 Get kbase from kagent
 Create a stateless ksession
 insert some facts
 fire all rules
 check result
 modify drl
 wait until kagent rebuilds the kbase
 get the new kbase from kagent
 Create a stateless ksession
 insert some facts
 fire all rules
 check result
 
 Also, which version of Drools are you using?
 

The steps you outline are correct.
That modification can be white space or an actual logic change; but does not
need to be localized in the rule that stops working.
Drools Version: 5.1.0


Wolfgang wrote:
 
 Incremental change set processing might create the effect you describe.
 Declared types are always replaced; rules only if they differ.
 


Esteban wrote:
 
 He doesn't seem to be using KAgent in incremental mode. So, each time a
 change is detected, a new KBase is created. All sessions previously
 created will continue using the old kbase.
 He is using Stateless ksessions.
 

As Esteban inferred, incremental mode is not being used. A new session is
created with each run.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-stop-firing-when-white-space-is-changed-tp3278986p3280973.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] Error is Java.lang.RuntimeException

2011-08-24 Thread Manohar Kokkula
 Hi,I put $param in the blank places, but still i am getting same error:Error is java.lang.RuntimeException: [10,23]: [ERR 101] Line 10:23 no viable alternative at input ''[10,25]: [ERR 101] Line 10:25 no viable alternative at input ''[10,38]: [ERR 101] Line 10:38 no viable alternative at input ''[10,44]: [ERR 101] Line 10:44 no viable alternative at input ''[12,19]: [ERR 101] Line 12:19 no viable alternative at input ''[12,27]: [ERR 101] Line 12:27 no viable alternative at input ''[13,15]: [ERR 101] Line 13:15 no viable alternative at input ''[13,21]: [ERR 101] Line 13:21 no viable alternative at input ''[21,23]: [ERR 101] Line 21:23 no viable alternative at input ''[21,25]: [ERR 101] Line 21:25 no viable alternative at input ''[21,38]: [ERR 101] Line 21:38 no viable alternative at input ''[21,45]: [ERR 101] Line 21:45 no viable alternative at input ''[23,19]: [ERR 101] Line 23:19 no viable alternative at input ''[23,27]: [ERR 101] Line 23:27 no viable alternative at input ''[24,15]: [ERR 101] Line 24:15 no viable alternative at input ''[24,21]: [ERR 101] Line 24:21 no viable alternative at input ''[32,23]: [ERR 101] Line 32:23 no viable alternative at input ''[32,25]: [ERR 101] Line 32:25 no viable alternative at input ''[32,38]: [ERR 101] Line 32:38 no viable alternative at input ''[32,45]: [ERR 101] Line 32:45 no viable alternative at input ''[34,19]: [ERR 101] Line 34:19 no viable alternative at input ''[34,25]: [ERR 101] Line 34:25 no viable alternative at input ''[35,15]: [ERR 101] Line 35:15 no viable alternative at input ''[35,21]: [ERR 101] Line 35:21 no viable alternative at input ''[43,23]: [ERR 101] Line 43:23 no viable alternative at input ''[43,25]: [ERR 101] Line 43:25 no viable alternative at input ''[43,38]: [ERR 101] Line 43:38 no viable alternative at input ''[43,48]: [ERR 101] Line 43:48 no viable alternative at input ''[45,19]: [ERR 101] Line 45:19 no viable alternative at input ''[45,27]: [ERR 101] Line 45:27 no viable alternative at input ''[46,15]: [ERR 101] Line 46:15 no viable alternative at input ''[46,21]: [ERR 101] Line 46:21 no viable alternative at input ''Please any one help me in getting out of this error.Thanks and regards,Manohar KokkulaMailto: manohar.kokk...@tcs.com-rules-users-boun...@lists.jboss.org wrote: -To: rules-users@lists.jboss.orgFrom: FrankVhh Sent by: rules-users-boun...@lists.jboss.orgDate: 08/24/2011 07:34PMSubject: Re: [rules-users] Error is Java.lang.RuntimeExceptionHi,

It was something that I did not spot immediately, but you also forgot to put
$param in the cells where you evaluate an integer value

marks == $param in stead of marks == blank

But maybe that was something that you already corrected.

I also noticed that Esteban explained the cell merging much more clearly
than I did. I will work on that part, to be of better service next time.

Regards,
Frank


Manohar Kokkula wrote:
 
 Hi Frank,
 
 I already did as you said, but still i am getting the following error:
 
 
 
 Error is java.lang.RuntimeException: [12,19]: [ERR 101] Line 12:19 no 
 viable alternative at input ''[12,27]: [ERR 101] Line 12:27 no viable 
 alternative at input ''[13,15]: [ERR 101] Line 13:15 no viable alternative 
 at input ''[13,21]: [ERR 101] Line 13:21 no viable alternative at input 
 ''[23,19]: [ERR 101] Line 23:19 no viable alternative at input ''[23,27]: 
 [ERR 101] Line 23:27 no viable alternative at input ''[24,15]: [ERR 101] 
 Line 24:15 no viable alternative at input ''[24,21]: [ERR 101] Line 24:21 
 no viable alternative at input ''[34,19]: [ERR 101] Line 34:19 no viable 
 alternative at input ''[34,25]: [ERR 101] Line 34:25 no viable alternative 
 at input ''[35,15]: [ERR 101] Line 35:15 no viable alternative at input 
 ''[35,21]: [ERR 101] Line 35:21 no viable alternative at input ''[45,19]: 
 [ERR 101] Line 45:19 no viable alternative at input ''[45,27]: [ERR 101] 
 Line 45:27 no viable alternative at input ''[46,15]: [ERR 101] Line 46:15 
 no viable alternative at input ''[46,21]: [ERR 101] Line 46:21 no viable 
 alternative at input ''
 
 
 
 
 Thanks and Regards
 Manohar Kokkula
 Mailto: manohar.kokk...@tcs.com
 =-=-=
 Notice: The information contained in this e-mail
 message and/or attachments to it may contain 
 confidential or privileged information. If you are 
 not the intended recipient, any dissemination, use, 
 review, distribution, printing or copying of the 
 information contained in this e-mail message 
 and/or attachments to it are strictly prohibited. If 
 you have received this communication in error, 
 please notify us by reply e-mail or telephone and 
 immediately and permanently delete the message 
 and any attachments. Thank you
 
 
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 


--
View this message in context: 

Re: [rules-users] Error is Java.lang.RuntimeException

2011-08-24 Thread FrankVhh
Hi,

Maybe you can put something like the following in the code:

SpreadsheetCompiler xlsCompiler = new SpreadsheetCompiler();
String drl =
xlsCompiler.compile(ResourceFactory.newClassPathResource(Sample.xls).getInputStream(),InputType.XLS);
System.out.println(drl);

This should enable you to see the generated drl (Syntax not checked, also I
am not entirely certain whether it always works)

Otherwise, maybe you could post your .xls file. Together with your code, it
shouldn't be to hard to replicate the error.

Regards,
Frank 

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-no-subject-tp3280773p3281195.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] Error is Java.lang.RuntimeException

2011-08-24 Thread Wolfgang Laun
For the conditions where a field is tested for equality with some value, the
field name alone is sufficient. So, use [age] rather than [age==]. For other
comparison operators, add the operator, and each value is appended, as
written in a cell below. For more complicated expressions, use an expression
containing $param but make sure to surround it with quotes if the field is
of type String.

-W


On 24 August 2011 17:02, FrankVhh frank.vanhoensho...@agserv.eu wrote:

 Hi,

 Maybe you can put something like the following in the code:

 SpreadsheetCompiler xlsCompiler = new SpreadsheetCompiler();
 String drl =

 xlsCompiler.compile(ResourceFactory.newClassPathResource(Sample.xls).getInputStream(),InputType.XLS);
 System.out.println(drl);

 This should enable you to see the generated drl (Syntax not checked, also I
 am not entirely certain whether it always works)

 Otherwise, maybe you could post your .xls file. Together with your code, it
 shouldn't be to hard to replicate the error.

 Regards,
 Frank

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-no-subject-tp3280773p3281195.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] Drools 5.2 performance building KnowledgeBase

2011-08-24 Thread lhorton
I don't see a Beta6 jar.  The one in Drools 5.3 is mvel2-2.1.Beta5.jar -- is
that the one you mean?  Are you at drools 5.3 beta1 code level?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-5-2-performance-building-KnowledgeBase-tp3239746p3281751.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] Error in Guvnor with Enumerations (5.1.1)

2011-08-24 Thread John Peterson
Reposting since I didn't get any takers.  I'm hoping it might have been because 
I sent it to the list on a Friday afternoon (2 weeks ago).

Hey,

I'm trying to utilize a load method for Guvnor, but I can't seem to get it 
working.  His is my DataHelper class (modeling it off the documentation):

package com.enumerations;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class DataHelper {

public ListString getQuestionNumberList(){
ArrayList returnList = new ArrayList();

Iterator it = 
com.enumerations.DroolsTest.questionList.iterator();
while (it.hasNext()){
QuestionAndAnswer qAndA = (QuestionAndAnswer)it.next();
if (!returnList.contains(qAndA.getQuestionNumber())){

returnList.add((String)qAndA.getQuestionNumber());
}
}
return (ListString)returnList;
}
}

I've placed this (both as a .jar and .class file) in my JBoss installation 
under 
\jboss-4.2.3.GA\server\default\deploy\drools-guvnor.war\WEB-INF\classes\com\enumerations.

Using this syntax as an enumeration in Guvnor:

'QuestionAndAnswer.questionNumber' : (new 
com.enumerations.DataHelper()).getQuestionNumberList()

I get the following errors:

[Enumerations] Unable to load enumeration data.
[Enumerations] [Error: failed to access property: getQuestionNumberList(): 
[Error: unable to invoke method: getQuestionNumberList] [Near : {... Unknown 
}] ^[Line: 1, Column: 0]][Near : {... r()).getQuestionNumberList() }] ^ 
[Line: 1, Column: 0] [Enumerations] Error type: 
org.mvel2.PropertyAccessException

I am using Drools 5.1.1.  Does anyone have any suggestions on what to do to 
correct this error?

jp


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


[rules-users] Stateless vs Stateful

2011-08-24 Thread Rob Fisher
We have a batch application that will have 50 - 60 rule sets, comprised of 5 - 
75 rules each.  We'll run a group of individuals through the rules and 
potentially qualify them for various awards.   We'll insert 10 facts, each 
containing a unique set of attributes which will be used in the rule sets to 
determine potential qualification.  The batch process will insert one 
individual's data (10 facts) at a time, fire the rules, and return the results. 
 The data on the objects inserted will remain static.

Also, in the future, we'd like to integrate the rule sets with a 'what if' web 
application, wherein the individual can modify the input data, fire the rules, 
and see the results.

Given this, can you recommend whether a Stateful or Stateless knowledge session 
is more appropriate than the other?  Is one more appropriate for a batch vs 
online application?

Thanks
Rob



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


[rules-users] Options for rule versioning

2011-08-24 Thread Rob Fisher
Looking for best practice recommendations around the versioning of a rule.  Our 
application will have 50-60 rule sets comprised of up to 70 rules each.  The 
activation of many of the rules will be based on a processing date (inserted 
fact attribute).  The application processing date can be prior, equal, or after 
the system date.


For example, 2 rules, with slightly different logic

Eligibility rule version 1
//to be potentially activated  for application processing time period prior to 
2011
When
 Car(color = blue)
Then
Terms(eligible = yes)

Eligibility rule version 2
//to be potentially activated  for application processing time period 2011 and 
forward
When
   Car(color = blue, type=coupe)
Then
  Terms(eligible = yes)

We've come up with a couple of different ways to handle this:
1.  Add Date logic to LHS of the rule . i.e  add Control(processingDate  
'01/01/2011') to 1st rule and  Control(processingDate = '01/01/2011') to 
2nd rule.   First rule would activate with processing date = 12/31/2010 and 2nd 
rule would activate with processing date = 07/31/2011.  When originally 
authored, first rule would be written without date logic.  When 2nd rule is 
authored, data logic will need to get added to both.
2.  We explored a way of setting the session clock to the processing date 
and using the 'date-effective' and 'date-expires' attributes to do the 
filtering.  i.e. 1st rule is effective until 12/31/2010 and 2nd rule is 
effective from 01/01/2011 to 12/31/.  However, we could only figure out how 
to do this with a stateful knowledge session.  Is it possible in a Stateless?
3.  We added metadata to the rules (@EffectiveDate and @ExpirationDate), 
and using agendafilter, we compared processing date to the metadata and return 
true or false dependent on comparison.

What are your opinions on these three methods?  What are other options?

Thanks
Rob



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


Re: [rules-users] Options for rule versioning

2011-08-24 Thread Ansgar Konermann

Hi Rob,

another approach we're considering to version rulesets used to perform
mortgage risk assessment looks roughly as follows:

- each of the rulesets is versioned as a whole (i. e. compile all *.drl
pertaining to a ruleset into a *.pkg file and give this *.pkg a version
number).
- the scoring service is aware that rules evolve and selects the ruleset
which fits the processing date. the processing date is part of the
scoring request we send to the service
- scoring service loads selected ruleset and performs risk assessment,
sending back risk indicators

We don't like the idea of time-dependent rules very much, as this
introduces *versioning* into the rule source code itself, which is
additional complexity we'd like to keep out of the *.drl files. We want
to be able to drop old rules from the source code once they are not
valid any more, but still have them compiled with a version number
somewhere in a repository, just in case a mortgage application needs
re-scoring based on an older version of the rules. We can afford this
rather static approach as our rules don't change too often (like a few
rules every week or two).

Best regards

Ansgar


Am 24.08.2011 21:42, schrieb Rob Fisher:
 Looking for best practice recommendations around the versioning of a
 rule.  Our application will have 50-60 rule sets comprised of up to 70
 rules each.  The activation of many of the rules will be based on a
 processing date (inserted fact attribute).  The application processing
 date can be prior, equal, or after the system date.
  
  
 For example, 2 rules, with slightly different logic
  
 Eligibility rule version 1
 //to be potentially activated  for application processing time period
 prior to 2011
 When
  Car(color = blue)
 Then
 Terms(eligible = yes)
  
 Eligibility rule version 2
 //to be potentially activated for application processing time period
 2011 and forward
 When
Car(color = blue, type=coupe)
 Then
   Terms(eligible = yes)
  
 We've come up with a couple of different ways to handle this:

1. Add Date logic to LHS of the rule . i.e add
   Control(processingDate  '01/01/2011') to 1st rule and 
   Control(processingDate = '01/01/2011') to 2^nd rule. First
   rule would activate with processing date = 12/31/2010 and 2^nd
   rule would activate with processing date = 07/31/2011.  When
   originally authored, first rule would be written without date
   logic.  When 2^nd rule is authored, data logic will need to get
   added to both.
2. We explored a way of setting the session clock to the processing
   date and using the 'date-effective' and 'date-expires'
   attributes to do the filtering.  i.e. 1^st rule is effective
   until 12/31/2010 and 2^nd rule is effective from 01/01/2011 to
   12/31/.  However, we could only figure out how to do this
   with a stateful knowledge session.  Is it possible in a Stateless?
3. We added metadata to the rules (@EffectiveDate and
   @ExpirationDate), and using agendafilter, we compared processing
   date to the metadata and return true or false dependent on
   comparison.

  
 What are your opinions on these three methods?  What are other options?
  
 Thanks
 Rob
  
  
  


 ___
 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] How to pass global variables to a function called in a condition

2011-08-24 Thread Matthew Erler
In Drools 5 I'm passing in two global Date objects and need to find the 
difference in days between them.  I've discovered that the function parameters 
(fromDate and toDate in my case) are null in the condition when the function is 
called, but when the function is called in the consequence they have values.  I 
can see that because the output of the following rule is:
fromDate is null
toDate is null

I'm in dateDiff and the date diff is: 14

I'm guessing that Drools doesn't make globals t available at the point that I 
need them.  Can anyone confirm this and offer a solution?


Here is the rule file itself:

import java.util.Date;
import org.joda.time.DateMidnight;
import org.joda.time.Days;

global java.util.Date fromDate;
global java.util.Date toDate;


rule dateDiff
dialect mvel
 when
  eval(getDaysBetweenStartAndEndDate(fromDate, toDate)  10)
 then  
  System.out.println( I'm in dateDiff and the date diff is:  +    
getDaysBetweenStartAndEndDate(fromDate, toDate));   
end 


function int getDaysBetweenStartAndEndDate(Date fromDate, Date toDate) {
    if (fromDate==null) System.out.println(fromDate is null);
    if (toDate==null) System.out.println(toDate is null);
  return Days.daysBetween(new DateMidnight(fromDate), new 
DateMidnight(toDate)).getDays();
} 
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 5.2 performance building KnowledgeBase

2011-08-24 Thread darktyco
I got it directly from the MVEL Web site:

http://mvel.codehaus.org/Downloading+MVEL
http://mvel.codehaus.org/Downloading+MVEL 

Good luck! Hopefully this version, or an even better one, will be included
with Drools 5.3 final.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-5-2-performance-building-KnowledgeBase-tp3239746p3282765.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] Drools 5.2 performance building KnowledgeBase

2011-08-24 Thread darktyco
I forgot to answer your other question: I'm on Drools 5.2. I had tried the
Drools 5.3 Beta 1 distribution but there was no improvement- it seems
something was fixed specifically in MVEL 2.1 Beta6.

Also, to Thomas: I have to specify -Xmx512m in order to run a pretty bare
minimum unit test (this does include a Spring application context but it is
very small) using this Drools setup to run or I will get an OOM Java Heap
exception within seconds. It is actually kind of strange how quickly the
exception is thrown. I will double check the 512 figure and get back to you
if I can indeed get it to run with less memory, I really dislike spreading
bad info around. The full Webapp needs more than that plus a MaxPermSize
increase, but there is a lot of other stuff going on in the war.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-5-2-performance-building-KnowledgeBase-tp3239746p3282810.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] Guvnor 5.2 method call in rhs

2011-08-24 Thread Toni Rikkola
Best place for bugs is the Guvnor Jira. I opened a ticket for you and I'm 
working on this  https://issues.jboss.org/browse/GUVNOR-1609

Toni

On Aug 22, 2011, at 10:54 PM, pamerida wrote:

 This version: guvnor-5.2.0.Final-tomcat-6.0.war
 
 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Guvnor-5-2-method-call-in-rhs-tp3275866p3276180.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