Try:
(deftemplate commitment
(slot debtor)
(slot creditor)
(slot cond)
)
(assert (commitment (debtor Amit) (creditor Jane) (cond money)))
(defrule resolve-commitment
(commitment (cond ?x))
=>
(printout t "resolved" crlf )
)
(run)
Good luck!
alan
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of Amit Chopra
> Sent: Tuesday, May 25, 2004 3:17 PM
> To: [EMAIL PROTECTED]
> Subject: JESS: Newbie Question: Pattern Matching ordered facts
>
>
> Hi,
>
> I have been using Jess for a couple of weeks now. I am stuck
> with some pattern matching problems. Basically I do this at
> the jess prompt
>
> > (deftemplate commitment (slot debtor) (slot creditor)
> (slot cond)) > (assert (commitment (debot Amit) (creditor
> Jane) (cond money)) > (assert (money))
>
> Everything goes fine till here. Then,
>
> > defrule resolve-commitment
> (and (?x) (commitment (cond ?x))) => (printout t
> "resolved" crlf))
>
> Basically I'm trying to match a condition of the commitment
> (money) with an event (money). If such an event is found, the
> commitment is said to be resolved. I expect ?x to be bound to
> money when the rule fires.
>
> However, I'm getting exceptions with the defrule. I tried
> removing the brackets around ?x, but still problematic. Any
> ideas how to do get it to work will be greatly appreciated.
>
> Of course, I tried an alternate scenario where I have a
> (deftemplate event (slot name)) and asserting (event (name
> money)). Then if I modify the defrule to have (event (name
> ?x)) instead of (?x), it works fine. However, I want to learn
> how to pattern match ordered facts.
>
> Sincerely,
> Amit.
>
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
>