I think Vijayan Sugumaran wrote:
> 
> Hi Everyone:
> I am starting to experiment with creating GUI using jess.  In this simple 
> example, I am attempting to create a frame with two buttons and when the user 
> clicks on a button, I want to fire a rule.  When a button is clicked, the 
> actionlistener calls the deffunction which asserts a fact.  This fact should
> cause the LHS of a rule to be satisfied  and consequently fire that rule.  
> The RHS of the rule is just a printout to the standard output device.  
> 
> When I execute the example, the frame and the buttons come up fine.  When I 
> click on a button, the corresponding deffunction gets executed which 
> printsout the message "Clicked on Button One" or "Clicked on Button Two".  
> However, the rule is not getting fired.  Since the message "Fired the 
> first rule" or  "Fired the second rule" does not show up on the console, I 
> am assuming that the rules are not getting fired.

This is a very common question - I seem to answer it about once every
other day (question for you: where is the README should it ay this, so
that you would have read it?). The engine has to be running for any
rules to fire. One easy way to do this is to have the actionListener
call (run) after it asserts the fact. Another possibility is to
include a 'daemon rule' like the sleep-when-idle rule in the pumps.clp
example. The (run) command at the end of your script isn't much help
because (run) terminates as soon as there are no more rules to fire.

> 
> I am not clear on how to set up the actionlisteners to fire rules and do 
> some processing and then provide some feedback to the user. 

This is too open-ended a question, because the possibilities are
limitless. Do you want to do this in Java, or in Jess? Feedback in a
GUI, in a file, on the console? If you can imagine it, you can do it.

> I also have a 
> couple of other questions.  Is there some thing in jess equivalent to 
> "agenda" where we can see which rules have their LHS satisfied?

There's no (agenda) command, but you can execute (watch activations)
to see when individual rules get fired.

> Also, is 
> there a easy way to debug the application in jess?

Well, there are so many things going on, so there are many aspects of
debugging. (watch all) is handy to see what the rule engine is
doing. Java debuggers like (jikes debugger from www.alphaworks.ibm.com
is  my favorite) help you debug your Java code. The (view) command can
help to debug Jess itself if you think that a rule isn't getting
compiled correctly.

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

Reply via email to