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 the same, that is, two identify two people who are related by blood (i.e. have a common ancestor or one is the ancestor of the other). The test CE is used to prevent a person from being related to him/herself. If the test is placed immediately after the AND, everything works as desired (see related3 and related4) but if the test follows a different pattern (see related1 and related2), duplicates are generated. The question is: does the test apply only to the pattern that immediately precedes it, even if that pattern is part of a compound pattern? Thanks David Scuse (Yes, I know that the definition of related is not general; this was done on purpose.)
related.clp
Description: Binary data