Hi Ned,
The about-to-be-released Jess4.1b4 has a nifty new mechanism for
dealing with this in a much simpler and more obvious way. But to do
this in other versions of Jess, the thing to do is
1) use a Funcall to bind a global variable ?*g* to the object (this is
described thoroughly in the 4.1b3 manual); 2) then use
rete.executeCommand to do the assert:
rete.executeCommand("(defglobal ?*g* = 0)");
Funcall f = new Funcall("bind", rete);
f.add(new Value("*g*", RU.VARIABLE));
f.add(new Value(aJavaObject, RU.EXTERNAL_ADDRESS));
f.simpleExecute(f, rete.globalContext());
rete.executeCommand("(assert (some-name-of-some-sort ?*g*))");
In Jess4.1b4, you can do this instead:
rete.store("some-name", aJavaObject);
rete.executeCommand("(assert (some-name-of-some-sort (fetch some-name)))");
This is a nice obvious mechanism, I think, for transferring objects. It
works in the other direction, too.
I think Ned Wolpert wrote:
>
> Folks-
> I'm looking for the best way to 'assert' a java object into the jess
> rule rete... or something like this...
>
> (bind ?a aJavaObject)
> (assert some-name-of-some-sort ?a)
>
> I want to do this from the java side, after the rules have been entered,
> before the '(run)' engine command is called. What is the best way?
> (Perhaps it's best asked, what is the best way to assert a fact that contains
> a java object using the FUNCALL technique with ValueVectors?)
>
> Thanks...
> Ned Wolpert | "It is not man who pursues truth,
> [EMAIL PROTECTED] | but truth man." -Shestov
> ____________________/ http://www.novazen.com/
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (510) 294-2154
Sandia National Labs FAX: (510) 294-2234
Org. 8920, MS 9214 [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. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------