The answer to the question is: yes. A ppdefpattern shows that the test is
just a trailing appendix of the preceding pattern:
(defrule MAIN::related1
(or
(and
(parent ?z ?x)
(parent ?z ?y))
(and
(parent ?x ?y))
(and
(and (parent ?y ?x)
(test
David's expectation of what *should* happen is correct, as is
Wolfgang's of what *is* happening. Looks like a bug.
That said, the bug is in the optimizer that's trying to turn what
David originally had, into what Wolfgang suggests is better. So you
can avoid the bug and improve the code by
Ernest, I suspect that this is a question for you.
The documentation on the test CE states:
A test CE is evaluated every time the preceding pattern on the rule's LHS is
evaluated.
(page 41 of the current Jess manual.)
The problem has been simplified from the original but the intent remains