There are many ways. One easy one is to use the 'store' and 'fetch'
functions.

    (defrule find-os
       ?ask-stmt <- (ask-os ?hostname)
       (has-os ?hostname ?osname)
     =>
       (retract ?ask-stmt)
       (store OSNAME ?osname)
    (assert (host-os myhost unix))


   Rete rete = ...
   rete.executeCommand("(assert (ask-os myhost))");
   rete.run();
   String osname = rete.fetch("OSNAME").stringValue();

See the README for details.

I think Kyung Koo Jun wrote:
> 
> 
>   Hi, all,
> 
>   In my case, test.clp is
> 
>    (defrule find-os
>       ?ask-stmt <- (ask-os ?hostname)
>       (has-os ?hostname ?osname)
>     =>
>       (retract ?ask-stmt)
>       (printout t ?osname crlf))
>    (assert (host-os myhost unix))
> 
>   in Java application
> 
>   Rete rete = ...
>   rete.executeCommand("(assert (ask-os myhost))");
>   rete.run();
> 
>   then Jess will print the result "unix" into
>   standard output.
>   However I'd like to make the Java application get 
>   the result.
> 
>   Which way is the smartest one?
>   Thanks in advance for the answers to the studpid question.
> 
>   
> 
> ---------------------------------------------------------------------
> 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: (925) 294-2154
Sandia National Labs                FAX:   (925) 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]
---------------------------------------------------------------------

Reply via email to