Try the following instead:
(deftemplate t (slot a) (slot b) (slot c) (slot d))
(assert (t (a 5) (b 4) (c 3) (d 2)))
(defrule rl
(t (a ?a) (b ?b) (c ?c) (d ?d))
(test (> ?a ?b))
(test (or (> ?b ?d) (> ?c ?d)))
=>
(printout t "test" crlf)
)
(run)
test
1
There are, of course, other ways of expressing the tests.
Andrew Meng wrote:
Hello,
I try to write a rule to compare values in two slot but it does not
fire. See the jess code below. Can anyone point me the issue or a
better way to do it?
Thanks a lot!
Andrew
Jess> (reset)
TRUE
Jess> (deftemplate t (slot a ) (slot b) (slot c) (slot d))
TRUE
Jess> (assert (t (a 5) (b 4) (c 3) (d 2))
)
<Fact-1>
Jess> (defrule rl
(a ?a)
(b ?b&:(> ?a ?b))
(d ?d)
(or
(c ?c&:(> ?c ?d))
(test (> ?b ?d))
)
=>
(printout t "test" crlf)
)
TRUE
Jess> (facts)
f-0 (MAIN::initial-fact)
f-1 (MAIN::t (a 5) (b 4) (c 3) (d 2))
For a total of 2 facts in module MAIN.
Jess> (run)
0
------------------------------------------------------------------------
Hotmail has tools for the New Busy. Search, chat and e-mail from your
inbox. Learn More.
<http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_1>
begin:vcard
fn:Win Carus
n:Carus;Win
org:Information Extraction Systems, Inc. (tm)
adr:;;20 East Quinobequin Road;Waban;MA;02468;USA
email;internet:[email protected]
title:President
tel;work:(617) 244-5068
tel;fax:(617) 244-5068
note;quoted-printable:=E2=80=9CInformation Extraction Systems=E2=80=9D,
=E2=80=9CInfoExtract=E2=
=80=9D, and =E2=80=9CIEBuilder=E2=80=9D are trademarks or registered
trad=
emarks owned by Information Extraction Systems, Inc.
x-mozilla-html:FALSE
url:http://www.InfoExtract.com
version:2.1
end:vcard