Re: JESS: Re: Test CE
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 (neq ?x ?y) = ... In any case, to avoid a child being found as its own sibling, a pattern such as (parent ?z ?x) (parent ?z ?y~?x) is probably preferable. -W On Mon, Oct 12, 2009 at 9:54 PM, David Scuse sc...@cs.umanitoba.ca wrote: 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.)
Re: JESS: Re: Test CE
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 going with that suggestion. We're putting together an update release right now, and I'll see if this can be fixed for that release. On Oct 15, 2009, at 2:19 AM, Wolfgang Laun wrote: 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 (neq ?x ?y) = ... In any case, to avoid a child being found as its own sibling, a pattern such as (parent ?z ?x) (parent ?z ?y~?x) is probably preferable. -W On Mon, Oct 12, 2009 at 9:54 PM, David Scuse sc...@cs.umanitoba.ca wrote: 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.) - Ernest Friedman-Hill Informatics Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
JESS: Re: Test CE
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