Re: [rules-users] Rule not compiling in IDE after migration to 5.2

2011-07-20 Thread Michael Anstis
Is it possible for you to provide a self contained repository export
demonstrating the issue?

sent on the move

On 19 Jul 2011 23:01, Jamie js...@llbean.com wrote:
 I do mean Eclipse. What do you mean by 'vanilla DRL'? It does seem to
 compile and run correctly when I deploy it.

 --
 View this message in context:
http://drools.46999.n3.nabble.com/Rule-not-compiling-in-IDE-after-migration-to-5-2-tp3183689p3183863.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 Integration for which Camel Version?

2011-07-20 Thread Andre
spring version 3.0.5 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Integration-for-which-Camel-Version-tp3182385p3184752.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 not compiling in IDE after migration to 5.2

2011-07-20 Thread Wolfgang Laun
On 19 July 2011 22:52, Jamie js...@llbean.com wrote:

 This rule used to compile in the IDE under Drools 5.1.1:

 when
  $order: OrderFact(numberOfCreditCardDeclines 
 FraudCCDeclines.find().getCreditCardDeclinesThreshold())


For Drools 5.1.1, this is syntactically incorrect. All but very simple
expressions on the right hand side of a comparison operator must be enclosed
in parentheses. A simple literal is one of the forms that are acceptable
without parentheses.

5.2.0 is much more tolerant.

-W



 then
  //do something

 but it's breaking since I moved to 5.2, although it runs fine when I deploy
 it to the server.  Any idea why?

 If I make the  comparison static, like this:

 when
  $order: OrderFact(numberOfCreditCardDeclines  5)

 then
  //do something

 It also works fine.  What's wrong?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Rule-not-compiling-in-IDE-after-migration-to-5-2-tp3183689p3183689.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] [Drools4]: Filter executed rules by *.drl file

2011-07-20 Thread magendo
Thanks for your answers.

The context fact thing would work, but it is really polluting the rules and
makes a lot of unnecessary constraint checks. Furthermore the extends is not
implemented in Drools 4 or I am blind (maybe it would be a good idea to
switch to drools 5 anyway...).

So I think I will go with the one drl per rulebase solution.
@manstis: Could you explain why you think the control fact solution is
better?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools4-Filter-executed-rules-by-drl-file-tp3182568p3184864.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] Unexpected variable binding behavior and conditional logic

2011-07-20 Thread Wolfgang Laun
You are using 5.2.0?

I don't think that the *greatly simplified* version of your problem fails
the way you described.

However: https://issues.jboss.org/browse/JBRULES-3111 describes a very
similar issue, a severe regression from 5.1.1.

-W

On 19 July 2011 20:59, ChrisG cgib...@excite.com wrote:

 Apologies if this has been addressed elsewhere: I couldn't find anything
 quite like my issue.

 My (greatly simplified and completely made-up) example:

 Let's say I have this java class:

 public class BaseballPitcher
 {
 public String getName();
 public boolean isRightHanded();
 public boolean isKnuckleBaller();
 }

 Multiple instances of this class are created with a variety of combinations
 for the name and two boolean parameters.
 Now I have a rule:

 rule Match pitchers: righties or knuckle-ballers
 when
$kbPitcher1 : BaseballPitcher($name: name, $righty: rightHanded == true
 ||
   $knuckleballer: knuckleBaller == true)
$kbPitcher2:  BaseballPitcher(name != $name, rightHanded == $righty,
 knuckleBaller == $knuckleballer)
 then
// Do something with these two pitchers $kbPitcher1 and $kbPitcher2
 end

 I am getting the curious result that this rule fires its conclusion when
 $kbPitcher1 is in fact NEITHER right-handed nor a knuckle-baller (i.e.
 rightHanded == false  knuckleBaller == false).

 I've worked around this by changing the first condition in either of the
 following two ways:
 *// eval() the condition*
$kbPitcher1 : BaseballPitcher($name: name, $righty: rightHanded,
 $knuckleballer: knuckleBaller,
  *eval(isRightHanded() == true || isKnuckleBaller() == true)*)
 ...or
 *// bind the variables before checking values*
$kbPitcher1 : BaseballPitcher($name: name, $righty: rightHanded,
 $knuckleballer: knuckleBaller,
  *rightHanded == true || knuckleBaller == true*)

 Does this make sense?  Both are easy workarounds, and I believe the second
 option (i.e. the one NOT using the eval) is the better solution from a
 performance perspective, allowing the engine to index the these facts
 rather
 than dynamically evaluate the condition every time.

 But I'm a little surprised the first approach didn't work.  Any ideas why
 not?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Unexpected-variable-binding-behavior-and-conditional-logic-tp3183355p3183355.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] [Drools4]: Filter executed rules by *.drl file

2011-07-20 Thread Michael Anstis
It was just a feeling, but Vincent's words from (presumably) experience
gives the individual rulebase option more credence.

On 20 July 2011 09:29, magendo robert.heisenb...@yahoo.com wrote:

 Thanks for your answers.

 The context fact thing would work, but it is really polluting the rules and
 makes a lot of unnecessary constraint checks. Furthermore the extends is
 not
 implemented in Drools 4 or I am blind (maybe it would be a good idea to
 switch to drools 5 anyway...).

 So I think I will go with the one drl per rulebase solution.
 @manstis: Could you explain why you think the control fact solution is
 better?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Drools4-Filter-executed-rules-by-drl-file-tp3182568p3184864.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] [Drools4]: Filter executed rules by *.drl file

2011-07-20 Thread Vincent LEGENDRE


Control facts could be a good solution if a execution (of rules) can use some 
multiple DRL, and if you are using a lot of facts. 

For example, if you want to do DRL1 and then DRL5 (because of some logic) on 
the same facts, in that order, you can add control rules to your KB that 
set/update the Context fact according to some conditions. 

Note that you can do the same with multiple KB, but then you have to re-insert 
the objects from one session to another (but it is not so complex, nor so 
costly). 



But for the number of DRL you have, I really think that cutting them in KB will 
be better. Moreover you can implement a big chief controller, that stores the 
KB in a map, lazily complied when needed. This way, you may not have the whole 
300 KB in memory ... 

And you can even distribute the KB in distributed Agents, and implement the 
big chief controller with drools (with fusion?) to store some logic about 
launching the suitable KB according to the event you get, or chain KB, or 
whatever you can imagine. 




- Mail original -


De: Michael Anstis michael.ans...@gmail.com 
À: Rules Users List rules-users@lists.jboss.org 
Envoyé: Mercredi 20 Juillet 2011 11:32:12 
Objet: Re: [rules-users] [Drools4]: Filter executed rules by *.drl file 

It was just a feeling, but Vincent's words from (presumably) experience gives 
the individual rulebase option more credence. 


On 20 July 2011 09:29, magendo  robert.heisenb...@yahoo.com  wrote: 


Thanks for your answers. 

The context fact thing would work, but it is really polluting the rules and 
makes a lot of unnecessary constraint checks. Furthermore the extends is not 
implemented in Drools 4 or I am blind (maybe it would be a good idea to 
switch to drools 5 anyway...). 

So I think I will go with the one drl per rulebase solution. 
@manstis: Could you explain why you think the control fact solution is 
better? 

-- 
View this message in context: 
http://drools.46999.n3.nabble.com/Drools4-Filter-executed-rules-by-drl-file-tp3182568p3184864.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] accumlator and BigDecimal

2011-07-20 Thread mjohansen
I'm trying to create an accumulator to sum a BigDecimal. Here's what I wrote:

$upcharge : BigDecimal(  ) 
from accumulate( GroupUpcharges( row$gb.row  row=$gu.row, $value :
upcharge),
  init( BigDecimal total = BigDecimal.ZERO; ),
  action( total=total.add($value); ),
  reverse( total=total.subtract($value); ),
  result( total ) )

$gb and $gu are set earlier in the WHEN clause.

When I run this, it compiles successfully, but then flows up at run time
with a null pointer exception. What am I doing wrong?

--
View this message in context: 
http://drools.46999.n3.nabble.com/accumlator-and-BigDecimal-tp3185872p3185872.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] Problem with running examples from drools-distribution-5.2.0

2011-07-20 Thread Scholz. Ulrich
Dear all,

I try to run the examples given in 
http://download.jboss.org/drools/release/5.2.0.Final/drools-distribution-5.2.0.Final.zip
 (Drools 5.2.0 final downloads)

I've installed the plugin and the example as given in ReadMeDrools.txt

Nevertheless, I get many Eclipse errors (1913) and cannot run the example. For 
example, the first error is

DescriptionResource Path   Location   Type
[ERR 102] Line 56:49 mismatched input '' expecting ')' in rule Free Fish 
Food Sample   PetStore.drl   
/drools-examples/src/main/resources/org/drools/examples/petstore  line 56   
Drools Error

If I run the example despite the errors, I get the message Could not find the 
main class: org.drools.examples.DroosExamplesApp. Program will exit.

What could I do?

Thanks, Ulrich

--
Eclipse Java EE IDE for Web Developers.

Version: Indigo Release
Build id: 20110615-0604

(c) Copyright Eclipse contributors and others 2005, 2011.  All rights reserved.
Visit http://www.eclipse.org/webtools
--
  Graphical Editing Framework GEF   
3.7.0.v20110425-2050-777D-81B2Bz0685C3A6E34272
org.eclipse.gef.feature.groupEclipse Modeling Project
Graphical Editing Framework Draw2d 3.7.0.v20110425-2050-46-7w3122153603161  
   org.eclipse.draw2d.feature.groupEclipse Modeling Project
  JBoss Drools Core  5.2.0.v20110116-0638-H14
org.drools.eclipse.feature.feature.group JBoss by Red Hat
  JBoss Drools Guvnor 5.2.0.v20110116-0638-H14
org.guvnor.tools.feature.feature.groupJBoss by Red Hat
  JBoss Drools Task   5.2.0.v20110116-0638-H14
org.drools.eclipse.task.feature.feature.groupJBoss by Red Hat
--





...




SEEBURGER AGVorstand/Seeburger Executive Board:
Sitz der Gesellschaft/Registered Office:Bernd Seeburger, Axel 
Haas, Michael Kleeberg
Edisonstr. 1
D-75015 Bretten Vorsitzender des Aufsichtsrats/Chairperson of the 
Seeburger Supervisory Board:
Tel.: 07252 / 96 - 0Dr. Franz Scherer
Fax: 07252 / 96 - 
Internet: http://www.seeburger.de   Registergericht/Commercial 
Register:
e-mail: i...@seeburger.de   HRB 240708 Mannheim


Dieses E-Mail ist nur f?r den Empf?nger bestimmt, an den es gerichtet ist und 
kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material enthalten. 
Jegliche darin enthaltene Ansicht oder Meinungs?u?erung ist die des Autors und 
stellt nicht notwendigerweise die Ansicht oder Meinung der SEEBURGER AG dar. 
Sind Sie nicht der Empf?nger, so haben Sie diese E-Mail irrt?mlich erhalten und 
jegliche Verwendung, Ver?ffentlichung, Weiterleitung, Abschrift oder jeglicher 
Druck dieser E-Mail ist strengstens untersagt. Weder die SEEBURGER AG noch der 
Absender ( Scholz. Ulrich ) ?bernehmen die Haftung f?r Viren; es obliegt Ihrer 
Verantwortung, die E-Mail und deren Anh?nge auf Viren zu pr?fen.


The present email addresses only the addressee which it targets and may contain 
confidential material that may be protected by the professional secret. The 
opinions reflected herein are not necessarily the one of the SEEBURGER AG. If 
you are not the addressee, you have accidentally got this email and are not 
enabled to use, publish, forward, copy or print it in any way. Neither 
SEEBURGER AG , nor the sender (Scholz. Ulrich) are liable for viruses, being 
your own responsibility to check this email and its attachments for this 
purpose.

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


Re: [rules-users] Problem with running examples from drools-distribution-5.2.0

2011-07-20 Thread Wolfgang Laun
The logical and between *patterns* cannot be written as '' any more.
Replace it with 'and'.

-W



2011/7/20 Scholz. Ulrich u.sch...@seeburger.de

  Dear all,



 I try to run the examples given in
 http://download.jboss.org/drools/release/5.2.0.Final/drools-distribution-5.2.0.Final.zip(Drools
  5.2.0 final downloads)



 I’ve installed the plugin and the example as given in ReadMeDrools.txt



 Nevertheless, I get many Eclipse errors (1913) and cannot run the example.
 For example, the first error is



 DescriptionResource Path   Location
 Type

 [ERR 102] Line 56:49 mismatched input '' expecting ')' in rule Free Fish
 Food Sample   PetStore.drl
 /drools-examples/src/main/resources/org/drools/examples/petstore  line 56
 Drools Error



 If I run the example despite the errors, I get the message “Could not find
 the main class: org.drools.examples.DroosExamplesApp. Program will exit.”



 What could I do?



 Thanks, Ulrich



 --

 Eclipse Java EE IDE for Web Developers.



 Version: Indigo Release

 Build id: 20110615-0604



 (c) Copyright Eclipse contributors and others 2005, 2011.  All rights
 reserved.

 Visit http://www.eclipse.org/webtools

 --

   Graphical Editing Framework GEF
 3.7.0.v20110425-2050-777D-81B2Bz0685C3A6E34272
 org.eclipse.gef.feature.groupEclipse Modeling Project

 Graphical Editing Framework Draw2d
 3.7.0.v20110425-2050-46-7w3122153603161
 org.eclipse.draw2d.feature.groupEclipse Modeling Project

   JBoss Drools Core  5.2.0.v20110116-0638-H14
 org.drools.eclipse.feature.feature.group JBoss by Red Hat

   JBoss Drools Guvnor 5.2.0.v20110116-0638-H14
 org.guvnor.tools.feature.feature.groupJBoss by Red Hat

   JBoss Drools Task   5.2.0.v20110116-0638-H14
 org.drools.eclipse.task.feature.feature.groupJBoss by Red Hat

 --







 ...



   *SEEBURGER AG*   Vorstand/Seeburger Executive Board:  Sitz der
 Gesellschaft/Registered Office:   Bernd Seeburger, Axel Haas, Michael
 Kleeberg  Edisonstr. 1D-75015 Bretten Vorsitzender des
 Aufsichtsrats/Chairperson of the Seeburger Supervisory Board:  Tel.: 07252
 / 96 - 0 Dr. Franz Scherer  Fax: 07252 / 96 -    Internet:
 http://www.seeburger.de Registergericht/Commercial Register:  e-mail:
 i...@seeburger.de HRB 240708 Mannheim


  Dieses E-Mail ist nur für den Empfänger bestimmt, an den es gerichtet ist
 und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material
 enthalten. Jegliche darin enthaltene Ansicht oder Meinungsäußerung ist die
 des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung der
 SEEBURGER AG dar. Sind Sie nicht der Empfänger, so haben Sie diese E-Mail
 irrtümlich erhalten und jegliche Verwendung, Veröffentlichung,
 Weiterleitung, Abschrift oder jeglicher Druck dieser E-Mail ist strengstens
 untersagt. Weder die SEEBURGER AG noch der Absender ( Scholz. Ulrich )
 übernehmen die Haftung für Viren; es obliegt Ihrer Verantwortung, die E-Mail
 und deren Anhänge auf Viren zu prüfen.

  The present email addresses only the addressee which it targets and may
 contain confidential material that may be protected by the professional
 secret. The opinions reflected herein are not necessarily the one of the
 SEEBURGER AG. If you are not the addressee, you have accidentally got this
 email and are not enabled to use, publish, forward, copy or print it in any
 way. Neither SEEBURGER AG , nor the sender (Scholz. Ulrich) are liable for
 viruses, being your own responsibility to check this email and its
 attachments for this purpose.


 ___
 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] accumlator and BigDecimal

2011-07-20 Thread Wolfgang Laun
Stack dump? Version?
Is $gb.row and $gu.row not null?
Is upcharge in all selected GroupUpcharges not null?
-W


On 20 July 2011 18:20, mjohansen mjohan...@lazboy.com wrote:

 I'm trying to create an accumulator to sum a BigDecimal. Here's what I
 wrote:

$upcharge : BigDecimal(  )
from accumulate( GroupUpcharges( row$gb.row  row=$gu.row, $value :
 upcharge),
  init( BigDecimal total = BigDecimal.ZERO; ),
  action( total=total.add($value); ),
  reverse( total=total.subtract($value); ),
  result( total ) )

 $gb and $gu are set earlier in the WHEN clause.

 When I run this, it compiles successfully, but then flows up at run time
 with a null pointer exception. What am I doing wrong?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/accumlator-and-BigDecimal-tp3185872p3185872.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 not compiling in IDE after migration to 5.2

2011-07-20 Thread Jamie
Thanks for pointing that out, Wolfgang.  I had stripped out some parentheses
during some testing.  We had them there in the 5.1.1 version.  They don't
seem to make a difference in 5.2.0 for the cases I've been working with.

In an attempt to create something stand-alone that I could share in response
to Manstis's reply, I found something very interesting.  It appears that the
trouble stems from a static initialization in one of the called classes that
retrieves a string value from a property file and parses it into an int.  I
was able to recreate the issue with a very simple example.  It doesn't even
matter if you refer to the variable in your code.  Here's are the classes:

package com.test;

import java.util.ResourceBundle;

public class RuleTest {

private static ResourceBundle resourceBundle =
ResourceBundle.getBundle(some file);

public static String getSomeValue() {
return some value;
}
}


package com.test;

public class TestFact {

public int getSomeValue() {
return 17;
}
}

and here's the rule:

package com.test

rule Test Rule

when
$testFact: TestFact(someValue  (RuleTest.getSomeValue()));
then
//Do something useful

end

If you remove the 'static' modifier from the resourceBundle variable
declaration above, the rule compiles fine in the IDE.  Note that it executes
fine with or without the static modifier when deployed.


--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-not-compiling-in-IDE-after-migration-to-5-2-tp3183689p3186253.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] How to write rules with optional parts?

2011-07-20 Thread Edward Johnson
How do you do rules that are a sequence of events where some of them are 
optional?

Example:

Alert if DAVID enters a room after ALICE or after ALICE and BOB
If it were a string, this is roughly equivalant to the regex /ALICE( BOB)? 
DAVID/

So:
Alice then David = alert
Alice then Bob then David = alert
Alice then Charles then David = no alert

I could write this as two rules but as the rules get more complex it could by 
hard to manage the resulting combatorial explosion.  Here it is as two rules:

Rule 1:
  $p1:person (name==Alice)
  $p2:person (name==David, this after[0,1] $p1)

Rule 2:
  $p1:person (name==Alice)
  $p2:person (name==Bob, this after[0,1] $p1)
  $p3:person (name==David, this after[0,1] $p2)
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Globals from functions...

2011-07-20 Thread bob.breitling
I have a global defined and I am trying to use it from a function.  When my
rule gets loaded into my knowledge base, I always get an error complaining
about the global not being resolved.  

 simplified snippet 

global int x;

function void foo(int n) {
x = n;
}

--

I get this kind of error Function Compilation error: foo (line:20) x can
not resolved.

Should this work?

TIA,

Bob

--
View this message in context: 
http://drools.46999.n3.nabble.com/Globals-from-functions-tp3186882p3186882.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] Globals from functions...

2011-07-20 Thread kkelleyjr
Do not know if this helps or explains but I found this in the documentation
in section 5.5.2 
http://docs.jboss.org/drools/release/5.2.0.Final/drools-expert-docs/html/ch05.html#d0e3313
here .

From the document:
/Globals are not designed to share data between rules and they should never
be used for that purpose. Rules always reason and react to the working
memory state, so if you want to pass data from rule to rule, assert the data
as facts into the working memory.

It is strongly discouraged to set or change a global value from inside your
rules. We recommend to you always set the value from your application using
the working memory interface./

How I read that is prolly not... However, I am not entirely sure I
understand why you are doing what you are doing...

Hope it points you in the direction of your solution...

--
View this message in context: 
http://drools.46999.n3.nabble.com/Globals-from-functions-tp3186882p3187034.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