Amit,
Page 90 of Jess In Action talks about the OBJECT slot of a shadow fact and
how it always contains a reference to its parent JavaBean.

so... assuming foo is a shadow fact, you could write

(defrule foo-bar
    (foo (name ?name) (OBJECT ?fooBean))
    =>
    (call ?fooBean assign))


BTW - Just bind the LHS pattern to a variable to get a handle to that fact.

?fact <- (foo (name ?name))

Sorry for the spam code earlier.
-JM
------------------------

Jason Morris
Morris Technical Solutions
[EMAIL PROTECTED]
www.morristechnicalsolutions.com
fax/phone: 503.692.1088



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Amit Chopra
> Sent: Thursday, May 27, 2004 10:58 AM
> To: [EMAIL PROTECTED]
> Subject: JESS: Getting a handle to the fact that matched given pattern
>
>
> Hi all,
>
> I am trying to find the fact that matches a given pattern in rule.
> I tried something, but it wouldn't work.
>
> I want to do something like this (this does not work in Jess, its
> pseudocode). foo is a shadow fact of a java object that has a
> method, lets say, 'assign'.
>
>  > (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.
>
> I suspect I'll have to use defquery to do this. But then,
> matching and searching are not atomic, in that, they'll
> be two separate operations.
>
> Help is appreciated.
>
> Sincerely,
> Amit.
>
> --------------------------------------------------------------------
> 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