"A pattern with test as the head is special; the body consists not of a pattern to match against the
knowledge base but of one or more boolean functions, which are evaluated in order. The results
determine whether the pattern matches. A test pattern fails if and only if one of the functions evaluates
to the atom FALSE; if they all evaluate to TRUE or any other value, the pattern with "match." "
I had taken this to mean that the test conditional element could be followed by a number of functions that return boolean results. For example, i would expect to be able to use the following rule:
(defrule testing-test
"Test to see if the test conditional element can take more than one function"
;LHS
(test (< 3 2) (< 3 2))
=>
;RHS
(printout t "testing-test satisfied" crlf)
)However, this generates the following error:
Jess> (batch ben_ex/testTest.clp)
Jess reported an error in routine Jesp.parsePattern
while executing (batch ben_ex/testTest.clp).
Message: Expected ')' .
Program text: ( defrule testing-test "Test to see if the test conditional elem
ent can take more than one function" ( test ( < 3 2 ) ( at line 5.
at jess.Jesp.parseError(Jesp.java:1622)
at jess.Jesp.parsePattern(Jesp.java:1229)
at jess.Jesp.parseLHS(Jesp.java:1111)
at jess.Jesp.doParseDefrule(Jesp.java:933)
at jess.Jesp.parseDefrule(Jesp.java:893)
at jess.Jesp.parseSexp(Jesp.java:149)
at jess.Jesp.parse(Jesp.java:69)
at jess.Jesp.parse(Jesp.java:54)
at jess.Batch.batch(Batch.java:43)
at jess.Batch.call(Batch.java:57)
at jess.FunctionHolder.call(FunctionHolder.java:30)
at jess.Funcall.execute(Funcall.java:266)
at jess.Jesp.parseAndExecuteFuncall(Jesp.java:1590)
at jess.Jesp.parseSexp(Jesp.java:173)
at jess.Jesp.parse(Jesp.java:69)
at jess.Jesp.parse(Jesp.java:54)
at jess.Main.execute(Main.java:126)
at jess.Main.main(Main.java:24)
This error would suggest that only one function can be passed to the test CE. This would in turn suggest that if i wished to implement the above example, i would have to write the example in the style below:
(defrule testing-test
"Test to see if the test conditional element can take more than one function"
;LHS
(test (< 3 2))
(test (< 3 2))
=>
;RHS
(printout t "testing-test satisfied" crlf)
)Which does parse.
I am slightly confused. Have i made an oversight or is this just the way you have to work work with the test CE i.e. multiple test elements as opposed to a single test element containing multiple functions?
Any help would be greatly appreciated,
Ben Allen
-------------------------------------------------------------------- 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] --------------------------------------------------------------------
