Thanks so much for such a quick response. Pls see my comments below. --- [EMAIL PROTECTED] wrote: > You wouldn't say this as "if the two customers have > different names", > but rather "if there's a customer with name ?n and a > different > customer whose name is also ?n". This way the same > rule works no > matter how many customers there are. One way to > write this:
What if ?n is unknown? In that case, I just want to find out two customers from the working memory who have the same names. It is similar to a SQL query. > > (defrule two-customers-same-name > ;; Read this as "There's a Customer object ?o1 > with name ?n" > (Customer (OBJECT ?o1) (name ?n)) > > ;; Read this as "There's another Customer ?o2 > which is not ?o1, > ;; and whose name is also ?n > (Customer (OBJECT ?o2&~?o1) (name ?n)) > => > ;; Here the variables ?o1 and ?o2 refer to the > two Customer > ;; objects, and ?n1 is their shared name; you > can take > ;; whatever action you like. > It would require a class named "Order" with a bean > property "total", > and class "Offer" with a constructor that took a > String and a number > as constructor arguments. The example should be > complete in the final > release; note that Jess 7 is still in beta. Yes, it would require the associated java classes. What I'm still working on is the rule specification syntax. Does the sample code require (deftemplate ...) or (defclass ...)? That part is what I'm struggling with right now. If you can release a draft copy of this .clp file that contains the rules, that would be fantastic and very much appreciated. I don't need those java files. Best regards, __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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] --------------------------------------------------------------------
