Thanks for the explanation. I was in fact trying to operate on a single
fact but was seeing the rule fire on data from multiple facts. Thanks
for showing the error of my ways. 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of [EMAIL PROTECTED]
Sent: Friday, September 09, 2005 4:15 PM
To: jess-users@sandia.gov
Subject: Re: JESS: Pattern Binding for CE

I think Krasnigor, Scott L (N-AST) wrote:

> I have an ID slot defined for the Bean object used to define the facts

> but can't seem to figure out how to get the fact that triggered the 
> rule so I can modify it for this particular case (all my other rules 
> allow pattern binding).

I formatted your rule to make it easier to understand.

(defrule doctrine-untripped
    ;; sets qualDoctrine to FALSE if any check flags are FALSE
    ?docFact <- (or
                    (and (testTrkClass (qualRng FALSE))
                         (testTrkClass (qualDoctrine ~FALSE)))

                    (and (testTrkClass (qualBrg FALSE))
                         (testTrkClass (qualDoctrine ~FALSE))))
    =>
    (modify  ?docFact (qualDoctrine FALSE)))

So the "or" has two branches, each of which is an "and". Those "and"s,
in turn, each match two facts (the two could, in fact, be the same one,
or they could be different.)

Based on your comment, and on your problem description, my guess is that
you didn't realize that, and you intend the "and" to simply group
together multiple tests on the same fact. It doesn't work that way:
you should write all the tests for a single fact in a single pattern, or
else the rule can match bits and pieces from multiple facts. So really I
think you mean

(defrule doctrine-untripped
    ;; sets qualDoctrine to FALSE if any check flags are FALSE
    ?docFact <- (or
                    (testTrkClass (qualRng FALSE) (qualDoctrine ~FALSE))
                    (testTrkClass (qualBrg FALSE) (qualDoctrine ~FALSE))
    =>
    (modify  ?docFact (qualDoctrine FALSE)))

Because each branch of the "or" matches a single branch, the pattern
binding is OK.



---------------------------------------------------------
Ernest Friedman-Hill  
Advanced Software 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