It's definitely a bug, and no patch has been released yet. To work
around it, you could add an extra pattern to the rule right before the
test and after the "or":
(defrule r3
(s)
(or (not (a))
(and ?x <- (a)
(b ?x) ) )
(initial-fact)
(test (= qwe asd))
=> ...
Alternatively you could move the test before the "or".
On Sep 7, 2010, at 5:10 AM, Henrique Lopes Cardoso wrote:
Hi,
Is there any update on this issue?
Since I did not get any answer to my last question in the previous
e-mail (below), I am asking again:
- Is there a way to stop Jess from transforming rules and keep the
original coding, possibly with some loss of performance?
Or even better: is the bug solved?
Thanks,
Henrique
Henrique Lopes Cardoso wrote:
Hi again,
In the sequel of this problem, I've fond another (possibly related)
situation where the rule does not seem to compile correctly.
I managed to simplify the example to the following rule:
(defrule r3
(s)
(or (not (a))
(and ?x <- (a)
(b ?x) ) )
(test (= qwe asd)) ; stupid test, just to expose the problem
=>
(printout t "tssss!" crlf) )
Using (ppdefrule), we see that this rule compiles to:
(defrule MAIN::r3
(or
(and
(s)
(not (a)))
(and
(s)
?x <- (a)
(and (b ?x)
(test (= qwe asd)))))
=>
(printout t "tssss!" crlf))
Therefore, the test is not done in the first branch of (or).
Is there a way to stop Jess from transforming rules and keep the
original coding, possibly with some loss of performance? The point
here
is to avoid the apparently buggy transformations that are being made.
Thanks.
Henrique
Ernest Friedman-Hill wrote:
Indeed, the rule doesn't seem to compile correctly; the two ?x's are
not merged.
Jess> (ppdefrule r)
"(defrule MAIN::r
(initial-fact)
(not ?x <- (and ?x <- (a ?_021__blank_2) (not (b ?_0022_x))))
=>
(printout t \"sure thing!\" crlf))"
On Jul 20, 2010, at 4:04 PM, Henrique Lopes Cardoso wrote:
Actually, asserts do work, because (deffacts) are added to working
memory by a call to (reset). This is wy I am calling (facts) before
(run), to make sure facts are in working memory as intended.
Anyway, I tried (assert)ing them one by one and it still does not
work
as expected.
It must be something else.
Henrique
--------------------------------------------------------------------
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
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012 [email protected]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
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].
--------------------------------------------------------------------