I think Waldek Jaronski wrote:
> 
> > Maybe I'm missing some subtlety, but what's wrong with
> >
> > (defrule PERSONALITY_PROBLEMS::r001
> >    (declare (auto-focus TRUE))
> >    ?f1 <- (or (personality_problems (troubling yes) (personality_problems
> nil))
> >               (personality_problems (perceiving yes) (personality_problems
> nil)))
> >    =>
> >    (modify ?f1 (personality_problems yes)))
> >
> 
> You missed that both troubling and perceiving have to be yes for
> personality_problems to be yes as well.


Then the rule is even simpler:

(defrule PERSONALITY_PROBLEMS::r001
    (declare (auto-focus TRUE))
    ?f1 <- (personality_problems (troubling yes) (perceiving yes)
                                 (personality_problems  nil))
    =>
    (modify ?f1 (personality_problems yes)))

But now I'm realizing that you want, somehow, for this rule to encode
the fact that some other rule(s) need to ask one or more questions,
triggered by backward chaining, in some particular order. This
approach isn't well suited to Jess's programming model, since a large
part of what a rule engine does is decide for itself in what order to
do things. If you need something to be ordered, it's often better to
just do it procedurally, rather than working hard to trick Jess into 
doing things it doesn't want to do.

(defrule PERSONALITY_PROBLEMS::r001
    (declare (auto-focus TRUE))
    ?f1 <- (personality_problems (troubling ?t) (perceiving ?p)
                                 (personality_problems  nil))
    =>
    (if (neq ?t yes) then
       (bind ?t (ask "Troubling?")))
    (if (neq ?p yes) then
       (bind ?p (ask "Perceiving?")))
    (bind ?pp nil)
    (if (eq yes ?p ?t) then
      (bind ?pp yes))
    (modify ?f1 (personality_problems ?pp) (troubling ?t)
                (perceiving ?p))))

> Nevertheless, could I ask you to shed some light on the problem with the
> following rule? Why does this rule contributes to assertion of
> (EMOTIONAL_RESPONSE::need-emotional_response (centre_of_attention yes)) when
> the starred pattern is not found. It takes place during the call to retract
> the dashed pattern.

Although there are some other patterns in this rule, this is the  same
combination of duplicate patterns, some explicit, some not,  that
caused a similar problem in your other rules. My advice to you is that
this is really an abuse of what Jess's backward chaining is intended
for, and that you need to consider alternative approaches, like what I
suggested above.


> 
> (defrule EMOTIONAL_RESPONSE::r018
>   (declare (auto-focus TRUE))
> ^  (MAIN::modify)
> *  (exists (EMOTIONAL_RESPONSE::need-emotional_response (emotional_response
> ~~nil)))
>   (explicit (EMOTIONAL_RESPONSE::emotional_response (centre_of_attention
> ?v1)))
>    (test (or (eq ?v1 yes)(eq ?v1 nil)))
>   (EMOTIONAL_RESPONSE::emotional_response (centre_of_attention yes))
>   ?factid <- (explicit (EMOTIONAL_RESPONSE::emotional_response
> (emotional_response nil)))
> =>
>   (modify ?factid (emotional_response yes))
> )
> 
> Thanks in advance,
> Waldek
> 
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

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