Gavin
I had the same issue while trying to get values from jess. Ernest told me to use
either a store and fetch method. or to use Defglobals.
I chose to use Defglobal (because it worked)!.
Here is how I have written the code (Ernest correct me if I have any mistakes in the
code).
Here is my rule declaration
(defglobal ?*p* = (new java.util.Vector))
defrule Rule1
;LHS
=>
(call ?*p* addElement (new java.lang.String "Rule1 one run"))
defrule Rule2;LHS
=>
(call ?*p* addElement (new java.lang.String "Rule2 one run"))
Java Code
Rete r = new Rete();
r.executeCommand("(Rule.clp)");
r.executeCommand("(run)");
Vector list = new Vector();
list = (Vector) r.getGlobalContext().getVariable("*p*").externalAddressValue(null);
This will return the vector to java. It worked for me. I tried to use store and fetch
but could not make it to work. Hope this helps.
Sobha
>>> <[EMAIL PROTECTED]> 04/13/00 08:24AM >>>
I've told Gavin in another email to use store and fetch as described
in manual section 4.4.4.
I think Gavin Nunns wrote:
> HI
>
> I need to get a value (string or int) out of jess when I assert a fact in
> java which triggers a rule.
>
> Please can anyone help me I've been strugling with this for a while now and
> I haven't got much time left to get this working.
>
> Thanks in advance
>
> Gavin Nunns (Plymouth University)
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [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 (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------
---------------------------------------------------------------------
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]
---------------------------------------------------------------------