Hi:
In my application, I have Java class objects being created and deleted
dynamically. At a given time, I could have thousands of objects that I want
to write rules against.
I was trying to follow the example of the "pumps-fromjava". In that example,
only two objects are created, a pump and a tank. Those objects are made
accessible to the rule engine through the following statements:
// Tell Jess about them
Funcall f = new Funcall("definstance", rete);
f.add(new Value("pump", RU.ATOM));
f.add(new Value(p));
f.execute(rete.getGlobalContext());
f = new Funcall("definstance", rete);
f.add(new Value("tank", RU.ATOM));
f.add(new Value(t));
f.execute(rete.getGlobalContext());
Then the rule engine is run by :
rete.executeCommand("(run)");
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?
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?)
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?
Q3. Can you have a function call that returns a Boolean on the RHS 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??)
Thank you in advance for any feedback.
Regards,
_________
Vicken Kasparian
Cheetah Technologies
941-739-3904 ext. 3550
http://www.cheetahtech.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]
---------------------------------------------------------------------