Hi,

Thanks for your reply. I tried doing something similar before but didn't get
the expected result.
I tried the following again and am still not able to get what I expect.

Jess> (deftemplate person
(slot name)
(multislot friend))
TRUE
Jess> (defrule
likers
(person (name ?name) (friend $? ?friend $?))
(not (dislike ?friend))
=>
(assert (allow ?name))
)
TRUE
Jess> (assert (dislike mary))
<Fact-0>
Jess> (assert (dislike john))
<Fact-1>
Jess> (assert (person (name susan) (friend mary lily)))
<Fact-2>
Jess> (run)
1
Jess> (facts)
f-0   (MAIN::dislike mary)
f-1   (MAIN::dislike john)
f-2   (MAIN::person (name susan) (friend mary lily))
f-3   (MAIN::allow susan)
For a total of 4 facts in module MAIN.
Jess>

Am I doing something very fundamentally wrong here?

Thanks,
Neha.


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


-- 
View this message in context: 
http://www.nabble.com/JESS%3A-Check-assertion-of-multi-slot-values-in-LHS-of-rule-tp22388880p22393831.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