I think qfhe wrote:

> 
> 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. 

That's exactly what the example I gave does. ?n is an unknown, like in
algebra. "Given some customer, who has a name, call his name X. Then
given some other customer, whose name is also X..."


> 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.

No. The manual hasn't entirely caught up with the newest features of
Jess. Everything the manual says about deftemplates and defclasses is
true, but in many ways, having that level of control is just too
low-level to be convenient. Therefore, in Jess 7, the Rete class has
this new add(Object) method. When you call add() with an instance of
some class (Customer, here), add() checks to see if there's already a
deftemplate with the same name as the class with the package part
removed. If there is, it is used to call definstance. Otherwise, such
a template is created and used.

The end result is that you don't have to worry about the details: you
can just call Rete.add() to put your objects in, and Jess will do the
right thing automatically. Then you write rules just using the name of
the class, and the names of the JavaBean properties. 

One remaining issue is that the rules won't compile if the templates
aren't defined, and so you actually do (right now, anyway) have to
tell Jess about the classes you're going to use first. You can just
include something like this in the rule file, before the rules are defined:

(defclass Customer "com.whatever.Customer")

> 
> 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. 

Now I'm confused. The rules are the things you're already looking at;
the classes are the things that are missing. Maybe you're expecting a
whole application that these are excerpted from? That's not coming;
these are just example rules.



---------------------------------------------------------
Ernest Friedman-Hill  
Advanced Software 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]
--------------------------------------------------------------------

Reply via email to