I think Vicken Kasparian wrote:
> 
>               Funcall f = new Funcall("definstance", rete);               
>               f.add(new Value("pump", RU.ATOM));
>               f.add(new Value(p));
>               f.execute(rete.getGlobalContext());
> 
> In my application, have thousands of objects that I am working with and they
> are being created and deleted dynamically.
> 
> Q1. Do I need to tell Jess about each instance of an object for which I have
> rules for, or can the rules be defined to work for a class of objects?

You have to tell Jess about each object somehow. Of course, you might
be able to make it automatic -- for instance, by doing it in
the class's constructors.

>  If yes then do I need to call f = new Funcall("definstance", rete) for each
> instance of an object that I create? (Any limitations or performance issues
> if that is the case?)

You can recycle one Funcall object, if you'd like After the first
execute() call, just replace the one argument that changes -- i.e.,

          f.set(new Value(myObject), 2);

and then call execute again. See docs/api/jess/ValueVector.html for
the set() function.
          
> 
> Q2. Is there an explanation somewhere about how the LHS of rules match
> patterns for objects defined in a Java code. For example,
>       (defrule warn-if-low
>         (tank (name ?name) (low TRUE) (intact TRUE))
>       "low" and "intact" are not attributes (properties) of tank. How are
> the being used in this rule?

Download and read the Java Beans spec, or buy a book about Java
Beans. "low" and "intact" are indeed Java Bean properties of the Tank class
-- generated from the isLow() and isIntact() member functions.

> 
> Q3. Can you have a function call that returns a Boolean on the [LHS] of a
> rule? For example, I would like to check in a rule the existence of an
> object in the Java app's working memory that matches a certain pattern. This
> can be used to do correlation of patterns across multiple instances of
> objects. (If not, any ideas for a workaround??)

I'm afraid I don't understand the example, but to have a boolean test
on the LHS of a rule, use the (test) CE -- see manual section 2.8.1.5.



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

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