How about returning the rule itself? An alternative would be to return the
current activation.

My 2cts...

alan

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 5:33 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: How to get rule name


I think Richard Kasperowski wrote:
> [EMAIL PROTECTED] wrote:
> > I think Richard Kasperowski wrote:
> > 
> >>In the RHS of a rule, is there a way to get the rule name?
> >>
> > 
> > 
> > Write a JessListener class which watches for DEFRULE_FIRED events. The
> > event will arrive just before the RHS of the rule executes. Call
> > getObject() on the JessEvent. It'll be a jess.Activation objects. The
> > name of the rule will be in Activation.getRule().getName(). Call
> > Rete.store("RULE", theName). Then on a rule's RHS you can (fetch RULE)
> > to get the name.
> 
> Can I request a new feature?  It would be nice if there were a built-in 
> function like (rule) or (this) or (self) that would return the rule 
> object when you evaluate it on the RHS of a rule.

OK, I'll stick it in as a function on Rete, so you can call it like

        (bind ?rule ((engine) getCurrentRuleName))




---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

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

Reply via email to