The Jess function "engine" returns the active Rete instance. So
(new chars.Ssomething (engine))
would construct a new instance of your "Ssomething" class and pass
the Rete instance to the constructor. It seems like you may have
known this already, but just didn't have the syntax quite right. The
parentheses are needed because "engine" is a function and you are
calling it.
On Apr 7, 2007, at 11:08 PM, Mrinal Khanvilkar wrote:
Hi,
i have the following rule.
(defrule someRule
"comment"
(Callhome (thing1 ?a)(thing2 ?b))
(test (try
(eq ?a ?b)
catch
FALSE))
;(test(eq ?b TRUE))
=>
(printout t crlf (jess-type engine) )
(new chars.Ssomething engine)
(try (printout t "done" crlf) catch )
)
and my Ssomething program looks like this
package chars;
import jess.Rete;
public class Ssomething {
public Ssomething(Rete engine){
try {
System.out.println (engine.eval("(printout t crlf
\"helloworld\")"));
} catch (Exception Ex) {
Ex.printStackTrace();
}
}
}
Now as seen above , i want to pass the refernce of me rete (engine)
from my jess rule to my java program, can this be done?
Actually i have three programs running.
1. this is the main web application for the user interface
2. from this main application i am calling the Jess engine and
passing facts and rules to it.
Now in the conclusion of the rule i am running a expect
script which later calls a different java program itself.
3. Here in this java program(called from expect) i want to create
another fact and pass it to the engine. So can i pass the reference
of the jess Engine from the jess rule itself (something like "this")?
Thanks,
Mrinal
---------------------------------------------------------
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://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]
--------------------------------------------------------------------