Hi!

> 1.    Will like to know which rule gets triggered each time. Since there
> could be more than one rules which meet the requirement. My java application
> will need to know specifically which rule was triggered and at what
> sequence.

This sounds pretty procedural to me. Why would you need to know that?
Anyway, you can install a JessListener listening to rule firings:

        // Make Rete engine fire the DEFRULE_FIRED event
        int mask = rete.getEventMask() | JessEvent.DEFRULE_FIRED;
        rete.setEventMask(mask);

        // Install JessListener
        rete.addJessListener(new MyRuleListener());

See also:

        Rete::getEventMask() : int
        Rete::setEventMask() : void
        JessEvent 
        JessListener

> 2.    When no rule gets triggered, my java application will result in a
> "hang" mode waiting for something to happen. Is there a work around?

The Rete.run() method returns the number of rules that have been fired. You could 
check if the return value is zero. In that case you'd know that no rules have been 
fired.

> 3.    I understand that I can instantiate object using the Jess scripts. I'm
> wondering if I can pass the reference of an object instance if rules are
> loaded through an Java Application?

There are different possibilties to pass an object reference to the Java application: 
(1) store and fetch, and (2) global variables. Using store and fetch you'd do the 
following:

Jess language: 

        (store MY_KEY (new MyObject))

Java: 
        Context context = rete.getGlobalContext();
        MyObject o = rete.fetch("MY_KEY").externalAddressValue(context);

See also:

        (store <string-or-atom> <expression>
        (fetch <string-or-atom>)

        Rete::store(String, Object) : Value
        Rete::store(String, Value) : Value
        Rete::fetch(String) : Value

Hope that helped.

Thomas

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