Wow That works correctly. I've been trying to do it with a method similar to
the one mentioned by Wolfgang but it wasn't working correctly.

Thanks a lot!
Neha.

Ernest Friedman-Hill wrote:
> 
> There's a subtle point here: as written, this rule will match for each  
> friend that is not disliked. I think we want to match only once, if  
> there are no friends that are disliked, which is a different thing. I  
> think we want something like
> 
> 
> (defrule check
>    (person (name ?name))
>    (not (and (person (name ?name) (friend $? ?f $?))
>              (dislike ?x)))
>    =>
>    (assert (allow ?name))
> )
> 
> On Mar 7, 2009, at 3:57 PM, Wolfgang Laun wrote:
> 
>> The binding for some element ?x anywhere in a multislot
>> is written like this
>>    (ms $? ?x $?)
>> where $? matches "zero or more elments". Therefore,
>>
>> (defrule check
>> (person (name ?name) (friend $? ?fx $?))
>> (not (dislike ?x))
>> =>
>> (assert (allow ?name))
>> )
>>
>> asserts (allow ?name) iff there is no disliked ?x in ?name's friend  
>> list.
>>
>> -W
>>
>>
>> On Sat, Mar 7, 2009 at 8:57 PM, NehaP <[email protected]> wrote:
>>
>> To make it more clear, if my person template had two slots instead  
>> of a
>> multislot,
>>
>> (deftemplate person
>> (slot name)
>> (slot friend))
>>
>> I would write the rule like this
>>
>> (defrule check
>> (person (name ?name) (friend ?friend))
>> (not (dislike ?friend))
>> =>
>> (assert (allow ?name))
>> )
>>
>> However, my problem is that friend is a multislot and not a slot. So  
>> I would
>> like to check if a fact exists for each member of the multislot  
>> friend. How
>> do I do this?
>>
>> Thanks,
>> Neha.
>> --
>> View this message in context:
>> http://www.nabble.com/JESS%3A-Check-assertion-of-multi-slot-values-in-LHS-of-rule-tp22388880p22391255.html
>> Sent from the Jess mailing list archive at Nabble.com.
>>
>>
>>
>> --------------------------------------------------------------------
>> To unsubscribe, send the words 'unsubscribe jess-users  
>> [email protected]'
>> in the BODY of a message to [email protected], NOT to the list
>> (use your own address!) List problems? Notify [email protected] 
>> .
>> --------------------------------------------------------------------
>>
>>
> 
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Informatics & Decision Sciences          Phone: (925) 294-2154
> Sandia National Labs
> PO Box 969, MS 9012                            [email protected]
> Livermore, CA 94550                             http://www.jessrules.com
> 
> 
> 
> 
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
> in the BODY of a message to [email protected], NOT to the list
> (use your own address!) List problems? Notify [email protected].
> --------------------------------------------------------------------
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/JESS%3A-Check-assertion-of-multi-slot-values-in-LHS-of-rule-tp22388880p22393975.html
Sent from the Jess mailing list archive at Nabble.com.



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------

Reply via email to