thank you very much, now it's ok.
in the case of eval, it remains opened for me why a fact, that not satisfied 
the eval condition, fires the rule.

thank for your help.
matteo.

-----Messaggio originale-----
Da: Mark Proctor [mailto:[EMAIL PROTECTED] 
Inviato: martedì 2 maggio 2006 19.00
A: [email protected]
Oggetto: Re: [drools-user] R: [drools-user] R: [drools-user] and with binding

In your example you don't need "e:" as you arne't using it. Also that 
would be better written
EventWM(field != "f1", field != "f2")

Eval is not indexed, and thus slow - where as the first relies on field 
constraints and is thus indexed and fast.

Mark

Demichelis Matteo wrote:
> I solved writing a rule in this way:
>
> rule "AND"
>       when
>               e : EventWM(field : field)
>               eval(field !="f1" && field !="f2")
>       then
>               System.out.println("RULE AND");
> end
>
>
> (similar to CLIPS "test conditional element").
>
> Thanks.
> matteo.
>
>
> -----Messaggio originale-----
> Da: Mark Proctor [mailto:[EMAIL PROTECTED] 
> Inviato: martedì 2 maggio 2006 17.36
> A: [email protected]
> Oggetto: Re: [drools-user] R: [drools-user] and with binding
>
> think about it for a second:
> a : Fact()
> binds a variable to a Fact. How can you have a variable bound to two 
> facts? With 'or' its allowed, as it can bind to one Fact in the first 
> logic outcome and then to the other fact in the second logic outcome.
>
> Mark
> Demichelis Matteo wrote:
>   
>> I tried, it compiles but the behaviour is not correct
>> because this LHS:
>> e : TestFact( field1 !="f1") && TestFact( field1 != "f2")
>>
>> and this:
>> e : TestFact( field1 !="f1")
>>
>> strangely match the same facts.
>>
>> It seems the problem is the compiler not supporting the binding with a '(' 
>> that follows.
>> The same with a "or with binding", the 3.15 example seems not supported.
>>
>>
>>
>>
>> -----Messaggio originale-----
>> Da: Christopher G. Stach II [mailto:[EMAIL PROTECTED] 
>> Inviato: martedì 2 maggio 2006 17.05
>> A: [email protected]
>> Oggetto: Re: [drools-user] and with binding
>>
>> Demichelis Matteo wrote:
>>   
>>     
>>> Hello,
>>>
>>>  
>>>
>>> following the example 3.15 in JBoss Rules, "or with binding":
>>>
>>> pensioner: ( Person(....) or Person(...) )
>>>
>>>  
>>>
>>> I wrote this rule using "and with binding":
>>>
>>>  
>>>
>>> rule "ClearUnknownDevice"
>>>
>>>       when
>>>
>>>             e : ( TestFact( field1 !="f1") && TestFact( field1 != "f2")
>>> )
>>>
>>>       then
>>>
>>>             retract( e );
>>>
>>> end
>>>
>>>  
>>>
>>> I got 2 compilation error:
>>>
>>> unknown:8:6 mismatched token: [EMAIL PROTECTED],133:133='(',<21>,8:6]; 
>>> expecting type
>>> ID
>>>
>>> unknown:8:76 Unexpected token ')'
>>>
>>>  
>>>
>>> perhaps "and with binding" is not supported yet?
>>>
>>>  
>>>
>>> thanks.
>>>
>>> matteo,.
>>>
>>>     
>>>       
>> Try this:
>>
>> rule "ClearUnknownDevice"
>>
>>       when
>>
>>             e : TestFact( field1 !="f1") && TestFact( field1 != "f2")
>>
>>       then
>>
>>             retract( e );
>>
>> end
>>
>>   
>>     
>
> --------------------------------------------------------------------
>
> CONFIDENTIALITY NOTICE
>
> This message and its attachments are addressed solely to the persons above 
> and may contain confidential information. If you have received the message in 
> error, be informed that any use of the content hereof is prohibited. Please 
> return it immediately to the sender and delete the message. Should you have 
> any questions, please contact us by replying to [EMAIL PROTECTED]
>
>         Thank you
>
>                                         www.telecomitalia.it
>
> --------------------------------------------------------------------
>                         
>   

--------------------------------------------------------------------

CONFIDENTIALITY NOTICE

This message and its attachments are addressed solely to the persons above and 
may contain confidential information. If you have received the message in 
error, be informed that any use of the content hereof is prohibited. Please 
return it immediately to the sender and delete the message. Should you have any 
questions, please contact us by replying to [EMAIL PROTECTED]

        Thank you

                                        www.telecomitalia.it

--------------------------------------------------------------------

Reply via email to