Hi,

I am stucked here for too long and can't resist making a post here. Hope that
someone can clear my mind.

I have written the following code segment in my program. Basically, what I
want to do is just:

1) Bind a hashtable to a global variable.
2) Run the rules.
3) Access the results in the hashtable from inside the program.

I am getting some unexpected results when I run the program. The story
begins here. The program returns me 4 elements in the hashtable.
Unconvinced, I tried running the following Jess commands exactly in
the same sequence using the same files in the Jess console. Executing
the commands directly in the Jess environment returns me the results
that I am expecting.

Can someone please explain to me why I am getting inconsistent results?
I am short of ideas now... :(. Thanks in advance!

engine.executeCommand("(batch ../rules/scriptlib.clp)");
engine.executeCommand("(defglobal ?*result* = (new java.util.Hashtable))");
engine.executeCommand("(batch ../rules/axis1.clp)");
engine.reset();
while (/*more facts*/) {
   Fact f=new Fact(fact, engine);
   f.setSlotValue("__data", new Value(val, RU.ATOM));
   engine.assert(f);
}
engine.run();
Context env=engine.getGlobalContext();
Value val=env.getVariable("*result*");
Hashtable results=(Hashtable)val.externalAddressValue(env);

--
Regards,
Jerry


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