I think Amit Chopra wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]

>  > (defrule foo-res
>    (foo (name ?x)) => (call 'fact that matched' assign))
> 
> I want to know how to find 'fact that matched' to be able
> to call assign on it.


OK, two things. First, to get a reference to the actual Fact object
that matches any pattern in any rule, you simply bind that pattern to
a variable in the rule left-hand-side using the "<-" operator:

  (defrule foo-res
    ?foo <- (foo (name ?x))
    =>
    ;; the variable ?foo is the matching jess.Fact object
    ...

But second, as you say this is a shadow fact and you want to "call a
method on it" I think what you mean is that you want to call a method
on the object that's being shadowed. There's a reference to that
object in the OBJECT slot of the shadow fact, so instead what you
actually want to do is

  (defrule foo-res
    (foo (name ?x) (OBJECT ?foo))
    =>
    ;; the variable ?foo is the JavaBean and you can call "assign"



---------------------------------------------------------
Ernest Friedman-Hill  
Science and Engineering PSEs        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]
--------------------------------------------------------------------

Reply via email to