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

Reply via email to