[rules-users] Plz reply : Descending order rule

Barath barathguna at gmail.com
Thu Feb 21 07:33:46 EST 2008


Hi,

Thank you for replying.

I want to know the logic behind it so can u explain with 3 facts.

Where i am going wrong in my explanation i posted with 3 facts ?

Thanks in advance,
Barath.


Anstis, Michael (M.) wrote:
> 
> Are you sure you only have three facts?
> 
> Your original resultset showed "Order value=5" which is not in the dataset
> shown in your most recent email.
>  
> 
> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Barath
> Sent: 21 February 2008 10:34
> To: rules-users at lists.jboss.org
> Subject: Re: [rules-users] Plz reply : Descending order rule
> 
> 
> Hi,
> 
> Let me say my understanding about this rule...
> 
> rule "Descending order"
>     when
>         $a : Order( $value : value )
>         not Order( value > $value)
>     then
>         System.out.println("value :"+$value);                	
>         retract($a);
> end
> 
> 1. Order value=1    let this be A
> 2. Order value=2    let this be B
> 3. Order value=3    let this be C
> 
> Case 1 :   $a : Order($value : 1)
>               not Order(2 > 1)
>            So this rule is True.
> 
> Case 2 :   $a : Order($value : 1)
>               not Order(3 > 1)
>            So this rule is True.
> 
> Case 3 :   $a : Order($value : 2)
>               not Order(2 > 3)
>            So this rule is True.
> 
> Case 4 :   $a : Order($value : 2)
>               not Order(2 > 1)
>            So this rule is False.
> 
> Case 5 :   $a : Order($value : 3)
>               not Order(3 > 1)
>            So this rule is False.
> 
> Case 6 :   $a : Order($value : 3)
>               not Order(3 > 2)
>            So this rule is False.
> 
> This indicates the rule should fire for three times but its not the case.
> I know i going wrong some where but i couldn't figure out.
> Plz do help me.....
> 
> Barath.
> 
> 
> Barath wrote:
>> 
>> Hi,
>> 
>> Can u explain me the rule flow for the below rule ?.
>> This will help me to get some clear idea about rules.
>> 
>> rule "Descending order"
>>     when
>>         $a : Order( $value : value )
>>         not Order( value > $value)
>>     then
>>         System.out.println("value :"+$value);                	
>>         retract($a);
>> end
>> 
>> I am having the following ,
>> 
>> 1. Order value=1
>> 2. Order value=2
>> 3. Order value=3
>> 4. Order value=4
>> 5. Order value=5
>> 
>> Can u explain the flow(when part) for this 5 object ?
>> 
>> Note my understanding(in when) : 1st line  take one order object
>>                                                  2nd line check for
>> any other object with grater 'value'
>>                                                  But i dont know
>> sequence in which the objects are taken.
>> 
>> Plz do reply......
>> 
>> Thanks in advance,
>> Barath.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Plz-reply-%3A-Descending-order-rule-tp15606103p1560726
> 1.html
> Sent from the drools - user mailing list archive at Nabble.com.
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
>  
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Plz-reply-%3A-Descending-order-rule-tp15606103p15609808.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list