The first way proposed by Ernest can be implemented in a Userfunction. See
http://herzberg.ca.sandia.gov/jesswiki/edit?FactOnFiring

With some rule A and a deftemplate FiredA you call the function
   (fact-on-firing A FiredA)
Using FiredA in some other rule should give you the desired behavior.

Additional features include:

   - automatic retracting of generated facts
   - providing of the rule in a slot of the generated fact
   - saving the facts causing the rule to fire in a multislot of the
   generated fact.

kr
Wolfgang


On 10/24/07, Ernest Friedman-Hill <[EMAIL PROTECTED]> wrote:
>
> There are a couple of ways you could do this now. One would  be to
> use JessEvents. Register a JessListener and let it handle
> DEFULE_FIRED events by invoking a function you specify, under
> conditions you specify. I've attached a short Jess-language program
> which demonstrates something like this.
>
> Another way would be to extend jess.Rete and override "aboutToFire()"
> or "justFired()"; these hooks are provided to let you do per-rule
> processing like this.
>
>
>
> On Oct 23, 2007, at 4:13 PM, Shi Paul wrote:
>
> > Hi Ernest or others,
> > Here is the situation, say there are 2 rules A and B, I want
> > whenever A fires B fires as well(or less frequently based on some
> > other conditions) and I don't want to just copy A's conditions into
> > B since that way I have to maintain 2 places. What I'd like to see
> > in Jess is some kind of instructional command (for example (follow-
> > rule A) in B's LHS), or better yet if Jess can hook up with some
> > rules before or after A fires (which resembles AspectJ
> > programming). I think it'd be a great feature if Jess allows that.
> >
> > Thanks,
> > Paul
> >
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Informatics & Decision Sciences          Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> PO Box 969, MS 9012                 [EMAIL PROTECTED]
> Livermore, CA 94550                 http://www.jessrules.com
>
>
>
>
>
>

Reply via email to