Has the Jess book come out yet? I am so ready to order one. Thanks
David -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 8:21 AM To: [EMAIL PROTECTED] Subject: Re: JESS: not CE I think Maxim Tretyak wrote: > (bind ?item <- (assert (car))) > (bind ?customer <- (assert (Peter))) > (assert (purchase (item ?item) (customer ?customer))) > > Then necessity to chek absence of customers, who was not made some > purchases, arise. > What ideas? > Let me modify this just a bit so that "customer" is a known type of fact: (bind ?customer (assert (customer Peter))) (bind ?item (assert (item car))) (deftemplate purchase (slot item) (slot customer)) (assert (purchase (item ?item) (customer ?customer))) Now, how do we write a rule that takes action if there are no customers that have not made purchases? Well, if there ARE such customers, you can find them with the two patterns (customer ?c) (not (purchase (customer ?c))) So to find out if there are no such customers, just use a "not" around all of this: (not (and (customer ?c) (not (purchase (customer ?c))))) Note we have to stick that "and" in there; it's implicit at the top level of a rule. These kind of fancy nested conditional elements are an important new feature in Jess 6.1. If you want to do one thing if there are no such customers, and another thing for each customer that does fit this profile, then you need two rules, one for each condition. --------------------------------------------------------- Ernest Friedman-Hill Distributed Systems Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov -------------------------------------------------------------------- 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] -------------------------------------------------------------------- -------------------------------------------------------------------- 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] --------------------------------------------------------------------