On Mar 29, 2008, at 8:10 AM, Manolis Nikoloudakis wrote:
I am using jess defrules from java and I call this code:
try {
JessHandler rRules=new JessHandler();
rRules.add(jUser);
rRules.run();
} catch (JessException e) {
e.printStackTrace();
}
every time I expect that a change in jUser object has been made to
trigger some
defrules that are batched from a clp file.
Is there a way from java to have the engine running and when I add
jUser and
a defrule is satisfied to be triggered,instead of using 'rRules.run
();' every time I
add jUser?
Since "JessHandler" must be a class of your own creation (there's no
such class in the Jess library), you might consider simply adding a
call to Rete.run() to your JessHandler.add() method.
But the standard way to do this in Jess is to have a thread dedicated
to running the Rete.runUntilHalt() method. This method sleeps until
there are rules to fire, but wakes up when new working memory
elements are added.
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.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]
--------------------------------------------------------------------