Re: [rules-users] Is there a way to get the rule name in the RHS?

2007-09-13 Thread Christopher . Mathrusse

You can access it with the following:
drools.getRule().getName()







"Irving Reid"
<[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
09/13/2007 08:34 PM



Please respond to
Rules Users List 





To



cc



Subject
[rules-users] Is there a
way to get the rule name in the RHS?








I'd like to record which rule executed to update an
object. I know that I could add code to the RHS to explicitly set a hard-coded
rule identifier into the action, but I was wondering if there was a way
to take advantage of the rule name, since it's already there.

 - irving -




___
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] Is there a way to get the rule name in the RHS?

2007-09-13 Thread Irving Reid
I'd like to record which rule executed to update an object. I know that I could 
add code to the RHS to explicitly set a hard-coded rule identifier into the 
action, but I was wondering if there was a way to take advantage of the rule 
name, since it's already there.

 - irving -




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


Re: [rules-users] Drools 4 Stateful Session dispose

2007-09-13 Thread Mark Proctor
The ruleBase retains a reference to each StatefulSession is creates, so 
that it can update them when new rules are added, dispose() is needed to 
release the StatefulSession reference from the RuleBase, without it you 
can get memory leaks.


If you insert your facts and your done, then stateless can be good 
enough for you, if you aren't doing any modifies/retracts then you can 
do stateles+sequential.


Mark
mule1 wrote:

Hello,

I have just started looking at drools 4 to upgrade from drools 3. While
reading the documentation, was wondering whether it is necessary to call
session.dispose() after session.fireAllRules() for the StatefulSession. If I
don't call session.dispose(), does that mean that the session will still be
garbage collected?

Also, Reading the documentation, I was not exactly clear for the difference
between Stateful and Stateless sessions. Can you explain when
StatefulSession and when StatelessSession can be used?

Thanks.
  


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


[rules-users] Using Data Enumerations in BRMS 4.0.1 with DSLs

2007-09-13 Thread Shahad Ahmed
Does anyone know if the new data enumeration functionality in the BRMS
version 4.0.1 works with DSL sentences?

I have a Customer object that has a String attribute called value that can
be be one of the values "High", "Medium" and "Low". I've defined a data
enumeration for this as follows in the BRMS:

'Customer.value': ['High','Medium','Low']

This works fine using the guided editor and I see a drop down list
containing ['High','Medium','Low'] whenever I create a rule involving a
Customer value attribute. I then created a DSL which has the following
definitions in it:

[condition][]There is a Customer=c: Customer()
[condition][]- who is {value} value=value == "{value}"

I then created a guided rule that has the following when condition, where [
] represents the text box the guided editor creates to enter a value for the
{value} placeholder:

There is a Customer
- who is [ ] value

However, I had hoped that the data enumeration stuff would have worked out
that {value} represents a Customer.value attribute and consequently provided
a drop down list of values. So, I'm not sure if this is a bug, or this is
just not implemented and a possible JIRA enhancement request.

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


[rules-users] Drools 4 Stateful Session dispose

2007-09-13 Thread mule1

Hello,

I have just started looking at drools 4 to upgrade from drools 3. While
reading the documentation, was wondering whether it is necessary to call
session.dispose() after session.fireAllRules() for the StatefulSession. If I
don't call session.dispose(), does that mean that the session will still be
garbage collected?

Also, Reading the documentation, I was not exactly clear for the difference
between Stateful and Stateless sessions. Can you explain when
StatefulSession and when StatelessSession can be used?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Drools-4-Stateful-Session-dispose-tf4437732.html#a12661260
Sent from the drools - user 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] Date - Effective & Date - Expire in BRMS

2007-09-13 Thread Knapp, Barry
>From the rule developer perspective: Where can the effective date and
expiration date be updated / set on their decision tables?

 

Thanks

 

 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hehl, Thomas
Sent: Thursday, September 13, 2007 2:25 PM
To: 'Rules Users List'
Subject: RE: [rules-users] Date - Effective & Date - Expire in BRMS 

 

Include them in your session as separate object(s) and make your
references to those object instead of to constants.

 

 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Knapp, Barry
Sent: Thursday, September 13, 2007 2:22 PM
To: Rules Users List
Subject: [rules-users] Date - Effective & Date - Expire in BRMS 

 

Where can the values for Effective date and Expiration date for  a
decision table?  Is there some place in the BRMS to change these dates,
so I do not need to update the rule sheet.

 

Thanks

 

Barry  

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


RE: [rules-users] Date - Effective & Date - Expire in BRMS

2007-09-13 Thread Hehl, Thomas
Include them in your session as separate object(s) and make your references
to those object instead of to constants.

 

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Knapp, Barry
Sent: Thursday, September 13, 2007 2:22 PM
To: Rules Users List
Subject: [rules-users] Date - Effective & Date - Expire in BRMS 

 

Where can the values for Effective date and Expiration date for  a decision
table?  Is there some place in the BRMS to change these dates, so I do not
need to update the rule sheet.

 

Thanks

 

Barry  

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


[rules-users] Date - Effective & Date - Expire in BRMS

2007-09-13 Thread Knapp, Barry
Where can the values for Effective date and Expiration date for  a
decision table?  Is there some place in the BRMS to change these dates,
so I do not need to update the rule sheet.

 

Thanks

 

Barry  

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


Re: [rules-users] Assistance with DSL syntax

2007-09-13 Thread Christopher . Mathrusse

OK, I opened a JIRA for this issue.
JBRULES-1191


Thanks again for the help and the work
around.

Chris Mathrusse
[EMAIL PROTECTED]
Sybase, Inc
One Sybase Drive
Dublin, CA 94568
(925) 236-5553





"Edson Tirelli"
<[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
09/13/2007 10:27 AM



Please respond to
Rules Users List 





To
"Rules Users List"



cc



Subject
Re: [rules-users] Assistance
with DSL syntax








 
    No good. This is a bug. May I ask you please to open a JIRA
for it? I will fix asap.

    Meanwhile, as a workaround, add a space before the retract
call:

[consequence][]Manually release the Order=setManualRelease(drools.getRule().getName());
retract(theOrder); 

    []s
    Edson

2007/9/13, [EMAIL PROTECTED]
<
[EMAIL PROTECTED]>:

I did make certain that my rule file had the extension of .dslr. I discovered
this early on and realized the importance when I renamed it. Of course
I renamed it back to .dslr once I saw the difference.


The DRL preview of  my rule is as follows: 

rule "Maximum
Order Amount Exceeded" 
salience 9800

        when

           theOrder : Order( amount >= 10
) 
        then

        theOrder.setManualRelease(drools.getRule().getName());retract(theOrder);

                
end 


Thanks once again for all the help... 






"Edson Tirelli"
<[EMAIL PROTECTED]>

Sent by: [EMAIL PROTECTED]

09/13/2007 04:39 AM






Please respond to
Rules Users List 





To
"Rules Users
List" 



cc



Subject
Re: [rules-users] Assistance
with DSL syntax











   No, you need to identify which object are you trying to retract,
since you may have multiple facts constrained in the LHS.

   Regarding your problem, make sure your rules file has the extension
".dslr" so that eclipse selects the correct editor when opening
the file. Then click in the DRL preview in the editor bottom tab. Can you
please show me the result of the DRL preview? 

   Thanks
    Edson

2007/9/12, [EMAIL PROTECTED]
<
[EMAIL PROTECTED]>: 

I was just looking for a more "short hand" syntax, one where
I would not need to declare "theOrder".


On the same subject though, I compiled my rules with the DRL/DSL editors
in Eclipse (very nice by the way) and I am getting a compilation error
being caused by my DSL entry: 

[consequence][]Manually release the Order=setManualRelease(drools.getRule().getName());retract(theOrder);



It seems that there is an issue with the retract(theOrder);statement.


The method retract(Order) is undefined for the type Rule_Maximum_Order_Amount_Exceeded_0
        

Might you have any idea as to why this would be occurring or exactly what
the message is meaning? 

Thanks for the help... 





"Edson Tirelli"
<[EMAIL PROTECTED]
> 
Sent by: [EMAIL PROTECTED]

09/12/2007 05:55 PM





Please respond to
Rules Users List 






To
"Rules Users
List"  


cc



Subject
Re: [rules-users] Assistance
with DSL syntax













 Yes, that is correct. 
 Why do you mean by a "cleaner" way?

  []s
  Edson

2007/9/12, [EMAIL PROTECTED]
<[EMAIL PROTECTED]
>: 

I'm using a DSL with my DRL file and I've read through the documentation
but I've gotten hung-up on the syntax. Below is a rule from my DRL and
the expansion in my DSL. 

My rule in the DRL: 
rule "Maximum
Order Amount Exceeded" 
salience 9800

      when

                 There is
an Order with

                 - an amount that
exceeds 10         
      then

              Manually release the Order

              
end 


My DSL: 
[condition][]There is an Order with=Order() 
[condition][]- an amount that exceeds {number}=amount >= {number}

[consequence][]Manually release the Order=setManualRelease(drools.getRule().getName());


What I would like to do is add to my consequence the following in red:

[consequence][]Manually release the Order=setManualRelease(drools.getRule().getName());retract(theOrder);



I know that I would need to modify my condition statement to be able to
use the variable theOrder  in my call to retract:

[condition][]There is an Order with=theOrder
: Order()



but is there a cleaner way to achieve this? 

___
rules-users mailing list
rules-users@lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users





-- 
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646 
 JBoss, a division of Red Hat @ www.jboss.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





-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3529-6000
 Mobile: +55 11 9287-5646 
 JBoss, a division of Red Hat @ www.jboss.

Re: [rules-users] Assistance with DSL syntax

2007-09-13 Thread Edson Tirelli
No good. This is a bug. May I ask you please to open a JIRA for it? I
will fix asap.

Meanwhile, as a workaround, add a space before the retract call:

[consequence][]Manually release the Order=setManualRelease(drools.getRule
().getName());* retract(theOrder);*

[]s
Edson

2007/9/13, [EMAIL PROTECTED] <
[EMAIL PROTECTED]>:
>
>
> I did make certain that my rule file had the extension of .dslr. I
> discovered this early on and realized the importance when I renamed it. Of
> course I renamed it back to .dslr once I saw the difference.
>
> The DRL preview of  my rule is as follows:
>
> *rule* "Maximum Order Amount Exceeded"
> *salience* 9800
> *when*
>theOrder : Order( amount >= 10 )
> *then*
> 
> theOrder.setManualRelease(drools.getRule().getName());*retract*(theOrder);
>
>
> *end*
>
>
> Thanks once again for all the help...
>
>
>
>
>  *"Edson Tirelli" <[EMAIL PROTECTED]>*
> Sent by: [EMAIL PROTECTED]
>
> 09/13/2007 04:39 AM
>  Please respond to
> Rules Users List 
>
>   To
> "Rules Users List"   cc
>
>  Subject
> Re: [rules-users] Assistance with DSL syntax
>
>
>
>
>
>
>
>No, you need to identify which object are you trying to retract, since
> you may have multiple facts constrained in the LHS.
>
>Regarding your problem, make sure your rules file has the extension
> ".dslr" so that eclipse selects the correct editor when opening the file.
> Then click in the DRL preview in the editor bottom tab. Can you please show
> me the result of the DRL preview?
>
>Thanks
> Edson
>
> 2007/9/12, [EMAIL PROTECTED]<[EMAIL PROTECTED]><
> * [EMAIL PROTECTED] <[EMAIL PROTECTED]>>:
>
> I was just looking for a more "short hand" syntax, one where I would not
> need to declare *"theOrder".*
>
> On the same subject though, I compiled my rules with the DRL/DSL editors
> in Eclipse (very nice by the way) and I am getting a compilation error being
> caused by my DSL entry:
>
> [consequence][]Manually release the Order=setManualRelease(drools.getRule
> ().getName());*retract(theOrder);*
>
>
> It seems that there is an issue with the *retract(theOrder);*statement.
> *
> The method retract(Order) is undefined for the type
> Rule_Maximum_Order_Amount_Exceeded_0*
>
> Might you have any idea as to why this would be occurring or exactly what
> the message is meaning?
>
> Thanks for the help...
>
>
>
>   *"Edson Tirelli" <[EMAIL PROTECTED] <[EMAIL PROTECTED]>*>*
> Sent by: [EMAIL PROTECTED]<[EMAIL PROTECTED]>
>
> 09/12/2007 05:55 PM
>   Please respond to
> Rules Users List <[EMAIL PROTECTED]
> >
>
>
>   To
> "Rules Users List" <[EMAIL PROTECTED]
> >  cc
>
>  Subject
> Re: [rules-users] Assistance with DSL syntax
>
>
>
>
>
>
>
>
>
>  Yes, that is correct.
>  Why do you mean by a "cleaner" way?
>
>   []s
>   Edson
>
> 2007/9/12, [EMAIL PROTECTED] *<[EMAIL PROTECTED]>
> <[EMAIL PROTECTED] * <[EMAIL PROTECTED]>>:
>
> I'm using a DSL with my DRL file and I've read through the documentation
> but I've gotten hung-up on the syntax. Below is a rule from my DRL and the
> expansion in my DSL.
>
> My rule in the DRL: *
> rule* "Maximum Order Amount Exceeded" *
> salience* 9800
>   *when*
>  There *is* an Order *with*
>  - an amount that exceeds 10
>   *then*
>   Manually release the Order
>   *
> end*
>
>
> My DSL:
> [condition][]There is an Order with=Order()
> [condition][]- an amount that exceeds {number}=amount >= {number}
> [consequence][]Manually release the Order=setManualRelease(drools.getRule
> ().getName());
>
> What I would like to do is add to my consequence the following in red:
> [consequence][]Manually release the Order=setManualRelease(drools.getRule
> ().getName());*retract(theOrder);*
>
>
> I know that I would need to modify my condition statement to be able to
> use the variable *theOrder*  in my call to retract:
> [condition][]There is an Order with=*theOrder *: Order()
>
>
> but is there a cleaner way to achieve this?
>
> ___
> rules-users mailing list*
> [EMAIL PROTECTED]  *
> **https://lists.jboss.org/mailman/listinfo/rules-users 
> *
>
>
>
>
> --
> Edson Tirelli
> Software Engineer - JBoss Rules Core Developer
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
>  JBoss, a division of Red Hat @ *www.jboss.com* 
> ___
> rules-users mailing list*
> [EMAIL PROTECTED] *
> **https://lists.jboss.org/mailman/listinfo/rules-users*
>
>
> ___
> rules-users mailing list*
> [EMAIL PROTECTED] *
> **https://lists.jboss.org/mailman/listinfo/rules-users*
>
>
>
>
> --
>  Edson Tirelli
>  Software Engineer - JBoss Rules Core Developer
>  Office: +55 11 3529-6000
>  Mobile: +55 11 9287-56

Re: [rules-users] Error writing DSL

2007-09-13 Thread Edson Tirelli
   I recommend you take a look at the manual, and help us improve if it is
not clear there. To add constraints to the previous pattern, you must use
"-" in the beginning of the mapping.

   []s
   Edson

2007/9/13, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> In eclipse, I have this coded in a .dsl
>
> There is a Policy  p:Policy()
> for a male sex = "m"
> with a premium less than {premium} premium < {premium}
> Accept policy  p.setStatus(32)
>
> My .dslr rule file contains this
>
> rule "Low Premium"
> when
> There is a Policy
> for a male
> with a premium less than 50.00
> then
> Accept policy
> end
>
>
> The .drl view shows this
>
> rule "Low Premium"
> when
> p : Policy()
> sex = "m"
> premium < 50.00
> then
> p.setStatus(32);
> end
>
>
> I'm getting the error - Unexpected token 'sex'.  I tried removing the
> 'for a male' part leaving 'with a premium less than 50.00' but then
> I get 'Unexpected token 'premium''.  How do I code the .dsl and/or .dslr
> files to get the expected results.
>
> Thanks,
>
> Rod
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Best practice for "drool-ing" a complex object

2007-09-13 Thread Mito Krkvak
Hi,

I have perhaps a simple question.

Here is my complex Object:

public class Object1 {
  private String id;
  private Set obj2s;
}

public class Object2 {
  private String idof2;
  private Object3 obj3;
  private Object4 obj3;
}

The business logic depends on the Object1 and all of the Object2 in the
list.

My question is what is the best way to pass this to drools and have the
rules be applied. I read somewhere that the best is to have "flat" objects,
with no lists, then pass those objects into the engine. However with
4.0there is a way to go through the lists, but it is still not
suggested. Is
that correct ?

Any suggestions are welcomed.

Thanks.

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


Re: [rules-users] Assistance with DSL syntax

2007-09-13 Thread Christopher . Mathrusse

I did make certain that my rule file
had the extension of .dslr. I discovered this early on and realized the
importance when I renamed it. Of course I renamed it back to .dslr once
I saw the difference.

The DRL preview of  my rule is
as follows:

rule
"Maximum Order
Amount Exceeded"
salience
9800
        when
         
 theOrder : Order( amount >= 10 )
        then

        theOrder.setManualRelease(drools.getRule().getName());retract(theOrder);

         
      
end


Thanks once again for all the help...







"Edson Tirelli"
<[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
09/13/2007 04:39 AM



Please respond to
Rules Users List 





To
"Rules Users List"



cc



Subject
Re: [rules-users] Assistance
with DSL syntax









    No, you need to identify which object are you trying to retract,
since you may have multiple facts constrained in the LHS.

    Regarding your problem, make sure your rules file has the
extension ".dslr" so that eclipse selects the correct editor
when opening the file. Then click in the DRL preview in the editor bottom
tab. Can you please show me the result of the DRL preview? 

    Thanks
     Edson

2007/9/12, [EMAIL PROTECTED]
<
[EMAIL PROTECTED]>:

I was just looking for a more "short hand" syntax, one where
I would not need to declare "theOrder".


On the same subject though, I compiled my rules with the DRL/DSL editors
in Eclipse (very nice by the way) and I am getting a compilation error
being caused by my DSL entry: 

[consequence][]Manually release the Order=setManualRelease(drools.getRule().getName());retract(theOrder);



It seems that there is an issue with the retract(theOrder);statement.


The method retract(Order) is undefined for the type Rule_Maximum_Order_Amount_Exceeded_0
        

Might you have any idea as to why this would be occurring or exactly what
the message is meaning? 

Thanks for the help... 






"Edson Tirelli"
<[EMAIL PROTECTED]>

Sent by: [EMAIL PROTECTED]

09/12/2007 05:55 PM





Please respond to
Rules Users List 






To
"Rules Users
List" 



cc



Subject
Re: [rules-users] Assistance
with DSL syntax











  Yes, that is correct. 
  Why do you mean by a "cleaner" way?

   []s
   Edson

2007/9/12, [EMAIL PROTECTED]
<[EMAIL PROTECTED]
>: 

I'm using a DSL with my DRL file and I've read through the documentation
but I've gotten hung-up on the syntax. Below is a rule from my DRL and
the expansion in my DSL. 

My rule in the DRL: 
rule "Maximum
Order Amount Exceeded" 
salience 9800

       when

                  There is
an Order with

                  - an amount
that exceeds 10         
       then

               Manually release the
Order 
               
end 


My DSL: 
[condition][]There is an Order with=Order() 
[condition][]- an amount that exceeds {number}=amount >= {number}

[consequence][]Manually release the Order=setManualRelease(drools.getRule().getName());


What I would like to do is add to my consequence the following in red:

[consequence][]Manually release the Order=setManualRelease(drools.getRule().getName());retract(theOrder);



I know that I would need to modify my condition statement to be able to
use the variable theOrder  in my call to retract:

[condition][]There is an Order with=theOrder
: Order()



but is there a cleaner way to achieve this? 

___
rules-users mailing list
rules-users@lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users





-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3529-6000
 Mobile: +55 11 9287-5646 
 JBoss, a division of Red Hat @ www.jboss.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




-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646 
  JBoss, a division of Red Hat @ www.jboss.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] Error writing DSL

2007-09-13 Thread kissro
In eclipse, I have this coded in a .dsl

There is a Policy  p:Policy()
for a male sex = "m"
with a premium less than {premium} premium < {premium}
Accept policy  p.setStatus(32)

My .dslr rule file contains this

rule "Low Premium"
when
There is a Policy
for a male
with a premium less than 50.00
then
Accept policy
end


The .drl view shows this

rule "Low Premium"
when
p : Policy()
sex = "m"
premium < 50.00
then
p.setStatus(32);
end


I'm getting the error - Unexpected token 'sex'.  I tried removing the
'for a male' part leaving 'with a premium less than 50.00' but then
I get 'Unexpected token 'premium''.  How do I code the .dsl and/or .dslr
files to get the expected results.

Thanks,

Rod  

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


Re: [rules-users] drools3.0 and drools4.0

2007-09-13 Thread Edson Tirelli
ColumnDescr was renamed to PatternDescr, since "Pattern" is a better
designation.

2007/9/13, vamshidhar reddy chitti <[EMAIL PROTECTED]>:
>
> HI
>
> Can anyone say wat r the api changes w,r.t both versions 3.0 and 4,0
>
> i dont find ColumnDescr in 4.0
>
> thanx
> vamshi
>
> --
> Wissenswertes für Bastler und Hobby Handwerker. *BE A BETTER 
> HEIMWERKER!*
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] column in OR

2007-09-13 Thread Mark Proctor
in decision tables this isn't possible. Are you also aware that CE 'or' 
results in sub rule generation, so in fact each logical outcome is 
internally generated as a separate rule? I recommend you just repeat the 
rule twice.


However it may be you want connective || and && on field constraints, 
just should map fairly easily.


Mark
Raffaele Viola wrote:

Hi all,

how can I put two columns in OR

Thanks
Raffo


___
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] drools3.0 and drools4.0

2007-09-13 Thread vamshidhar reddy chitti
HI 

Can anyone say wat r the api changes w,r.t both versions 3.0 and 4,0

i dont find ColumnDescr in 4.0

thanx
vamshi

   
-
 Wissenswertes für Bastler und Hobby Handwerker.BE A BETTER HEIMWERKER!___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Use of "=" in DSL

2007-09-13 Thread vdelbart

I create this issue :

http://jira.jboss.com/jira/browse/JBRULES-1190
http://jira.jboss.com/jira/browse/JBRULES-1190 

thanks,

V.


-- 
View this message in context: 
http://www.nabble.com/Use-of-%22%3D%22-in-DSL-tf4434499.html#a12653465
Sent from the drools - user 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] java void in LHS

2007-09-13 Thread Knapp, Barry
You could add a helper method to your java class that returns Boolean

class ChessType

public Boolean setPriceWithReturn(){
this.price = price  
return true;
}




rule test123
when
 cheese: Chesse()

--->>> chess.getType().setPriceWithReturn("cheap");

 eval (chesse.getType () == "myType")


then
   .
end




Barry

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, September 12, 2007 5:11 PM
To: rules-users@lists.jboss.org
Subject: [rules-users] java void in LHS

Hi all,

I would like to insert a java void to my condition(LHS). Is there anyway
to
do that? Like an example below, how can I set something to my object
before
evaluate it.


rule test123
when
 cheese: Chesse()

--->>> chess.getType().setPrice("cheap");

 eval (chesse.getType () == "myType")


then
   .
end



Thanks,

Tim

___
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] Use of "=" in DSL

2007-09-13 Thread Edson Tirelli
At this moment, you can't use '=' on your DSL definition. I guess we
should support it though the same way we support escaping special regexp
characters. I will do that today as it is simple and we release it in 4.0.2.
Meanwhile, may I ask you to please open a JIRA for it?

Thanks,
  Edson

2007/9/13, vdelbart <[EMAIL PROTECTED]>:
>
>
> Hello,
>
> In my DSL, I have :
>
> {indicator}:={boolean}
> mapping with
> {indicator}.setValue({boolean});
>
> but in my rule when I write :
> myIndicator:=true
> In the DRL viewer, I have :
> {boolean}myIndicator.setValue({boolean});
>
> I think I can't use the "=" in my DSL...
>
> I try to use simple quote or double quote but nothing works...
>
> Anybody have a solution ?
>
> V.
> --
> View this message in context:
> http://www.nabble.com/Use-of-%22%3D%22-in-DSL-tf4434499.html#a12651260
> Sent from the drools - user mailing list archive at Nabble.com.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Assistance with DSL syntax

2007-09-13 Thread Edson Tirelli
No, you need to identify which object are you trying to retract, since
you may have multiple facts constrained in the LHS.

Regarding your problem, make sure your rules file has the extension
".dslr" so that eclipse selects the correct editor when opening the file.
Then click in the DRL preview in the editor bottom tab. Can you please show
me the result of the DRL preview?

Thanks
 Edson

2007/9/12, [EMAIL PROTECTED] <
[EMAIL PROTECTED]>:
>
>
> I was just looking for a more "short hand" syntax, one where I would not
> need to declare *"theOrder".*
>
> On the same subject though, I compiled my rules with the DRL/DSL editors
> in Eclipse (very nice by the way) and I am getting a compilation error being
> caused by my DSL entry:
>
> [consequence][]Manually release the Order=setManualRelease(drools.getRule
> ().getName());*retract(theOrder);*
>
>
> It seems that there is an issue with the *retract(theOrder);*statement.
>
> *The method retract(Order) is undefined for the type
> Rule_Maximum_Order_Amount_Exceeded_0*
>
> Might you have any idea as to why this would be occurring or exactly what
> the message is meaning?
>
> Thanks for the help...
>
>
>
>
>  *"Edson Tirelli" <[EMAIL PROTECTED]>*
> Sent by: [EMAIL PROTECTED]
>
> 09/12/2007 05:55 PM  Please respond to
> Rules Users List 
>
>   To
> "Rules Users List"   cc
>
>  Subject
> Re: [rules-users] Assistance with DSL syntax
>
>
>
>
>
>
>
>   Yes, that is correct.
>   Why do you mean by a "cleaner" way?
>
>[]s
>Edson
>
> 2007/9/12, [EMAIL PROTECTED] *<[EMAIL PROTECTED]>
> <[EMAIL PROTECTED] <[EMAIL PROTECTED]>>:
>
> I'm using a DSL with my DRL file and I've read through the documentation
> but I've gotten hung-up on the syntax. Below is a rule from my DRL and the
> expansion in my DSL.
>
> My rule in the DRL: *
> rule* "Maximum Order Amount Exceeded" *
> salience* 9800
>*when*
>   There *is* an Order *with*
>   - an amount that exceeds 10
>*then*
>Manually release the Order
>*
> end*
>
>
> My DSL:
> [condition][]There is an Order with=Order()
> [condition][]- an amount that exceeds {number}=amount >= {number}
> [consequence][]Manually release the Order=setManualRelease(drools.getRule
> ().getName());
>
> What I would like to do is add to my consequence the following in red:
> [consequence][]Manually release the Order=setManualRelease(drools.getRule
> ().getName());*retract(theOrder);*
>
>
> I know that I would need to modify my condition statement to be able to
> use the variable *theOrder*  in my call to retract:
> [condition][]There is an Order with=*theOrder *: Order()
>
>
> but is there a cleaner way to achieve this?
>
> ___
> rules-users mailing list*
> [EMAIL PROTECTED] *
> **https://lists.jboss.org/mailman/listinfo/rules-users*
>
>
>
>
> --
>  Edson Tirelli
>  Software Engineer - JBoss Rules Core Developer
>  Office: +55 11 3529-6000
>  Mobile: +55 11 9287-5646
>   JBoss, a division of Red Hat @ *www.jboss.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
>
>


-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to use not operator in drool.

2007-09-13 Thread Mark Proctor
not ( SomeClass() ) is an existential conditional eleemnt operator, 
it goes at the head of pattern, and checks if the pattern plus its field 
constraints exist in the session; it will cause a rule to fire once 
whether there is 1 or 100 matching patterns.


SomeClass( somefield not in ('x, 'y', 'z) ) is a field constraint on a 
pattern, it checks if the value of a field is in a list of values, it 
will cause the rule to fire for each and every possible rule match.


Mark
JOSHI, GAURAV wrote:


Thank's for your sugession of using "not in" instead of "not" but my 
problem is that "not" can also come without "in".


 


Actually I am making a generator of rule file from expression like

 ((NOT (ENDS WITH (G10.2, ",")))

 


 ((NOT (G13.1 IN ("1","2","3"))) OR (G250.8 = Y)))

 

Where G13.2, G250.8, G10.2 are variables coming from a map inserted in 
working memory.


 


I am accessing these variables from map.

 


My rules are as follows

 


This rule is working fine.

 


rule "Editable_G10.3"

when

 


* ((Map( this["G10.3"] !=8))||(Map( this["G10.2"] ==19)))*

 


then

System.out.println("comming 
here->");


End

 


*This is not working*

 


rule "Mandatory_G10.3"

when

* (not((Map( this["G10.3"] !=8))||(Map( this["G10.2"] ==19 *

Then

System.out.println("comming 
here->");


End

 


In also tried following approaches:

1)  *eval(not((Map( this["G10.3"] !=8))||(Map( this["G10.2"] 
==19 *


* *

*2) eval(!((Map( this["G10.3"] !=8))||(Map( this["G10.2"] ==19 *

* *

But in both cases it is giving same error:

org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule 
name=ValidationRuleExp_G10.3, agendaGroup=MAIN, salience=0, no-loop=false]


  
com/telekurs/nva/mde/fe/ak/validation/Rule_ValidationRuleExp_G10_3_0.java 
(11:495) : Cannot use this in a static context


  
com/telekurs/nva/mde/fe/ak/validation/Rule_ValidationRuleExp_G10_3_0.java 
(11:500) : Type mismatch: cannot convert from String to int


 

I am trying to find out some general concept so that I can change just 
achieve the functionality of not.


 


Thanks

Gaurav

 




*From:* [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] *On Behalf Of *Edson Tirelli

*Sent:* Wednesday, September 12, 2007 10:20 PM
*To:* Rules Users List
*Subject:* Re: [rules-users] How to use not operator in drool.

 



   Remove your "eval" and use "or" instead of "||" for the OR CE.

   Although, I feel that this is not what you want... what you want is 
simply:


when
Map( this['city'] not in ( "mumbai", "delhi" ) )
then
//...
end
 
[]s

Edson

2007/9/12, Gaurav2007 <[EMAIL PROTECTED] 
>:



Hi ALL,

I am using drool4.0.1 in my application i am able to use IN,OR,AND 
operator

but i am facing problem in using not operator.

my requirement of not operator is just like a not gate.

the way i am using it is :

eval(not((Map( this["city"] !="mumbai"))||(Map( this["city"] =="delhi"


so can you please help me out to solve this problem:
should i use not operator or some thing else in drool.

Thanks,


--
View this message in context: 
http://www.nabble.com/How-to-use-not-operator-in-drool.-tf4430240.html#a12638430 

Sent from the drools - user mailing list archive at Nabble.com 
.


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




--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com 

This message contains information that may be privileged or 
confidential and is the property of the Capgemini Group. It is 
intended only for the person to whom it is addressed. If you are not 
the intended recipient, you are not authorized to read, print, retain, 
copy, disseminate, distribute, or use this message or any part 
thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.




___
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] How to use not operator in drool.

2007-09-13 Thread Mark Proctor

[EMAIL PROTECTED] wrote:

I thought when you use eval, it is Java, not mvel. So i think this should
work:   eval (! (Map (.

  

eval will use the language of dialect you specify for the rule.

Tim



   
 Gaurav2007
 <[EMAIL PROTECTED] 
 apgemini.com>  To 
 Sent by:  rules-users@lists.jboss.org 
 rules-users-bounc  cc 
 [EMAIL PROTECTED] 
 g Subject 
   [rules-users] How to use not
   operator in drool.  
 09/12/2007 08:49  
 AM
   
   
 Please respond to 
 Rules Users List  
 <[EMAIL PROTECTED] 
   s.jboss.org>
   
   






Hi ALL,

I am using drool4.0.1 in my application i am able to use IN,OR,AND operator
but i am facing problem in using not operator.

my requirement of not operator is just like a not gate.

the way i am using it is :

eval(not((Map( this["city"] !="mumbai"))||(Map( this["city"] =="delhi"


so can you please help me out to solve this problem:
should i use not operator or some thing else in drool.

Thanks,


--
View this message in context:
http://www.nabble.com/How-to-use-not-operator-in-drool.-tf4430240.html#a12638430

Sent from the drools - user 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] Use of "=" in DSL

2007-09-13 Thread vdelbart

Hello,

In my DSL, I have :

{indicator}:={boolean}
mapping with
{indicator}.setValue({boolean});

but in my rule when I write :
myIndicator:=true 
In the DRL viewer, I have :
{boolean}myIndicator.setValue({boolean});

I think I can't use the "=" in my DSL...

I try to use simple quote or double quote but nothing works...

Anybody have a solution ?

V.
-- 
View this message in context: 
http://www.nabble.com/Use-of-%22%3D%22-in-DSL-tf4434499.html#a12651260
Sent from the drools - user mailing list archive at Nabble.com.

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


RE: [rules-users] How to use not operator in drool.

2007-09-13 Thread Anstis, Michael \(M.\)
What dialect do your rules use?
 
You could also simplify the logic using DeMorgans Theorem (which might
be troublesome to accomplish programmatically)
 
I don't know whether your example is flawed as the brackets don't match,
but assuming you mean something like this:-
 
(NOT (G13.1 IN ("1","2","3") OR (G250.8 = Y)))

 

You can re-write this as

 

(G13.1 NOT IN ("1","2","3") AND G250.8 != Y)

 

With kind regards,

 

Mike

 





From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JOSHI, GAURAV
Sent: 13 September 2007 08:20
To: Rules Users List
Subject: RE: [rules-users] How to use not operator in drool.



Thank's for your sugession of using "not in" instead of "not"
but my problem is that "not" can also come without "in".

 

Actually I am making a generator of rule file from expression
like

 ((NOT (ENDS WITH (G10.2, ",")))

 

 ((NOT (G13.1 IN ("1","2","3"))) OR (G250.8 = Y)))

 

Where G13.2, G250.8, G10.2 are variables coming from a map
inserted in working memory.

 

I am accessing these variables from map.

 

My rules are as follows

 

This rule is working fine.

 

rule "Editable_G10.3"

when

 

 ((Map( this["G10.3"] !=8))||(Map( this["G10.2"] ==19)))

 

then

System.out.println("comming
here->");

End

 

This is not working

 

rule "Mandatory_G10.3"

when

 (not((Map( this["G10.3"] !=8))||(Map( this["G10.2"] ==19 

Then

System.out.println("comming
here->");

End

 

In also tried following approaches:

1)  eval(not((Map( this["G10.3"] !=8))||(Map( this["G10.2"]
==19 

 

2) eval(!((Map( this["G10.3"] !=8))||(Map( this["G10.2"]
==19 

 

But in both cases it is giving same error:

org.drools.rule.InvalidRulePackage: Rule Compilation error :
[Rule name=ValidationRuleExp_G10.3, agendaGroup=MAIN, salience=0,
no-loop=false]


com/telekurs/nva/mde/fe/ak/validation/Rule_ValidationRuleExp_G10_3_0.jav
a (11:495) : Cannot use this in a static context 


com/telekurs/nva/mde/fe/ak/validation/Rule_ValidationRuleExp_G10_3_0.jav
a (11:500) : Type mismatch: cannot convert from String to int

 

I am trying to find out some general concept so that I can
change just achieve the functionality of not.

 

Thanks

Gaurav 

 





From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli
Sent: Wednesday, September 12, 2007 10:20 PM
To: Rules Users List
Subject: Re: [rules-users] How to use not operator in drool.

 


   Remove your "eval" and use "or" instead of "||" for the OR
CE.

   Although, I feel that this is not what you want... what you
want is simply:

when
Map( this['city'] not in ( "mumbai", "delhi" ) ) 
then
//...
end
 
[]s
Edson

2007/9/12, Gaurav2007 <[EMAIL PROTECTED]>:


Hi ALL,

I am using drool4.0.1 in my application i am able to use
IN,OR,AND operator
but i am facing problem in using not operator.

my requirement of not operator is just like a not gate.

the way i am using it is : 

eval(not((Map( this["city"] !="mumbai"))||(Map( this["city"]
=="delhi"


so can you please help me out to solve this problem:
should i use not operator or some thing else in drool. 

Thanks,


--
View this message in context:
http://www.nabble.com/How-to-use-not-operator-in-drool.-tf4430240.html#a
12638430
 
Sent from the drools - user mailing list archive at Nabble.com.

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




-- 
  Edson Tirelli 
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com 

This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,
you are not authorized to 

Re: [rules-users] Assistance with DSL syntax

2007-09-13 Thread vdelbart

I think it's impossible... I have the same problem and to do this I mixed
globals and working memory... but I have only one Order()... It was easier.

v.


-- 
View this message in context: 
http://www.nabble.com/Assistance-with-DSL-syntax-tf4432759.html#a12650375
Sent from the drools - user 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] RE: How to use not operator in drool.

2007-09-13 Thread vdelbart

Your errors are multiple :

 - Cannot use this in a static context : I don't know why ...
 - cannot convert from String to int : perhaps the value of your Map is
String and not Integer object ?

Maybe you have to fix it, before move on.

I can give you a tips for eval(), you have to use java instead of mvel. You
can't use Map(), it's mvel coding.

Try this :

when
m:Map()
eval(!((Integer)m.get["G10.3"] !=8) || ((Integer)m.get["G10.2"] ==19))
then 
 

good luck,

vdelbart

-- 
View this message in context: 
http://www.nabble.com/How-to-use-not-operator-in-drool.-tf4430240.html#a12650325
Sent from the drools - user 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] Assistance with DSL syntax

2007-09-13 Thread Anstis, Michael \(M.\)
I think there was an API change for 4.0.x - "retract" became
"retractObject".




From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 13 September 2007 02:18
To: Rules Users List
Subject: Re: [rules-users] Assistance with DSL syntax



I was just looking for a more "short hand" syntax, one where I
would not need to declare "theOrder". 

On the same subject though, I compiled my rules with the DRL/DSL
editors in Eclipse (very nice by the way) and I am getting a compilation
error being caused by my DSL entry: 

[consequence][]Manually release the
Order=setManualRelease(drools.getRule().getName());retract(theOrder); 


It seems that there is an issue with the
retract(theOrder);statement. 

The method retract(Order) is undefined for the type
Rule_Maximum_Order_Amount_Exceeded_0 

Might you have any idea as to why this would be occurring or
exactly what the message is meaning? 

Thanks for the help... 





"Edson Tirelli" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED] 

09/12/2007 05:55 PM 
Please respond to
Rules Users List 


To
"Rules Users List"  
cc
Subject
Re: [rules-users] Assistance with DSL syntax







  Yes, that is correct. 
  Why do you mean by a "cleaner" way?

   []s
   Edson

2007/9/12, [EMAIL PROTECTED]

<[EMAIL PROTECTED]
 >: 

I'm using a DSL with my DRL file and I've read through the
documentation but I've gotten hung-up on the syntax. Below is a rule
from my DRL and the expansion in my DSL. 

My rule in the DRL: 
rule "Maximum Order Amount Exceeded" 
salience 9800 
   when 
  There is an Order with 
  - an amount that exceeds 10 
   then 
   Manually release the Order 
   
end 


My DSL: 
[condition][]There is an Order with=Order() 
[condition][]- an amount that exceeds {number}=amount >=
{number} 
[consequence][]Manually release the
Order=setManualRelease(drools.getRule().getName()); 

What I would like to do is add to my consequence the following
in red: 
[consequence][]Manually release the
Order=setManualRelease(drools.getRule().getName());retract(theOrder); 


I know that I would need to modify my condition statement to be
able to use the variable theOrder  in my call to retract: 
[condition][]There is an Order with=theOrder : Order() 


but is there a cleaner way to achieve this? 

___
rules-users mailing list
rules-users@lists.jboss.org 

https://lists.jboss.org/mailman/listinfo/rules-users
 




-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3529-6000
 Mobile: +55 11 9287-5646 
 JBoss, a division of Red Hat @ www.jboss.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] java void in LHS

2007-09-13 Thread Anstis, Michael \(M.\)
I'd assume you need two rules:-

rule test123a
when
$c : Cheese()
$ct : CheeseType(cheese = $c)
then
$ct.setPrice("cheap");
update($ct);
end

rule test123b
when
$c : Cheese( type = "myType" )
CheeseType(cheese = $c, price = "cheap" )
then
...
end
 
Java dialect doesn't support object graphs - I think MVEL does but I'm
unfamilair with the syntax.

You could also replace the two patterns (one for Cheese and the other
CheeseType) with an eval but you'll loose performance.

Forgive me if I'm wrong and this is 3.0.x and not 4.0.x.

With kind regards,

Mike

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 12 September 2007 22:11
To: rules-users@lists.jboss.org
Subject: [rules-users] java void in LHS

Hi all,

I would like to insert a java void to my condition(LHS). Is there anyway
to
do that? Like an example below, how can I set something to my object
before
evaluate it.


rule test123
when
 cheese: Chesse()

--->>> chess.getType().setPrice("cheap");

 eval (chesse.getType () == "myType")


then
   .
end



Thanks,

Tim

___
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] How to use not operator in drool.

2007-09-13 Thread JOSHI, GAURAV

Thank's for your sugession of using "not in" instead of "not" but my
problem is that "not" can also come without "in".

 

Actually I am making a generator of rule file from expression like

 ((NOT (ENDS WITH (G10.2, ",")))

 

 ((NOT (G13.1 IN ("1","2","3"))) OR (G250.8 = Y)))

 

Where G13.2, G250.8, G10.2 are variables coming from a map inserted in
working memory.

 

I am accessing these variables from map.

 

My rules are as follows

 

This rule is working fine.

 

rule "Editable_G10.3"

when

 

 ((Map( this["G10.3"] !=8))||(Map( this["G10.2"] ==19)))

 

then

System.out.println("comming
here->");

End

 

This is not working

 

rule "Mandatory_G10.3"

when

 (not((Map( this["G10.3"] !=8))||(Map( this["G10.2"] ==19 

Then

System.out.println("comming
here->");

End

 

In also tried following approaches:

1)  eval(not((Map( this["G10.3"] !=8))||(Map( this["G10.2"] ==19


 

2) eval(!((Map( this["G10.3"] !=8))||(Map( this["G10.2"] ==19 

 

But in both cases it is giving same error:

org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
name=ValidationRuleExp_G10.3, agendaGroup=MAIN, salience=0,
no-loop=false]

 
com/telekurs/nva/mde/fe/ak/validation/Rule_ValidationRuleExp_G10_3_0.jav
a (11:495) : Cannot use this in a static context 

 
com/telekurs/nva/mde/fe/ak/validation/Rule_ValidationRuleExp_G10_3_0.jav
a (11:500) : Type mismatch: cannot convert from String to int

 

I am trying to find out some general concept so that I can change just
achieve the functionality of not.

 

Thanks

Gaurav 

 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli
Sent: Wednesday, September 12, 2007 10:20 PM
To: Rules Users List
Subject: Re: [rules-users] How to use not operator in drool.

 


   Remove your "eval" and use "or" instead of "||" for the OR CE.

   Although, I feel that this is not what you want... what you want is
simply:

when
Map( this['city'] not in ( "mumbai", "delhi" ) ) 
then
//...
end
 
[]s
Edson

2007/9/12, Gaurav2007 <[EMAIL PROTECTED]>:


Hi ALL,

I am using drool4.0.1 in my application i am able to use IN,OR,AND
operator
but i am facing problem in using not operator.

my requirement of not operator is just like a not gate.

the way i am using it is : 

eval(not((Map( this["city"] !="mumbai"))||(Map( this["city"]
=="delhi"


so can you please help me out to solve this problem:
should i use not operator or some thing else in drool. 

Thanks,


--
View this message in context:
http://www.nabble.com/How-to-use-not-operator-in-drool.-tf4430240.html#a
12638430 
Sent from the drools - user mailing list archive at Nabble.com.

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




-- 
  Edson Tirelli 
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com 



This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users