I think Michael Knapik wrote:
> 

> (subject (caseStatus ?caseStatus&:(= (?caseStatus "Suspect")) (OBJECT ?p))
> =>
> ...

There are a whole bunch of things going on here. First, the error
being reported that caseStatus is not a multislot. This is happening
because the parenthesis that should be closing the caseStatus slot is
missing; therefore the parenthesis after (OBJECT ?p) (the one that is
intended to be the end of the "subject" fact) is seen as being the end
of caseStatus, and therefore there are two separate test items inside
the slot description (the second one is the "(OBJECT ?p)"). Since this
is a single slot and not a multislot, Jess complains, rightly.

Matching parentheses by eye is hard -- but matching brackets in Java
is hard, too. Good tools can help a lot. I've always used Emacs to
edit Jess code, which works great. The Charlemagne IDE will be even
better at this.

Anyway, there are three other things wrong in this little line of
code. One is an extra set of parentheses around the arguments to
"=". A proper call to "=" would look like (= ?caseStatus "Suspect").

Second, the "=" function is for comparing numerics only, and you'll
get a runtime error if you use it to compare Strings like this. You
can use "eq" to compare arbitrary items -- (eq ?caseStatus "Suspect").

Finally (and it seems like I've been saying this on the list every
day, lately:) when you can match directly, without using a function
call, do so -- it's more efficient, less typing, and easier to
understand. So I'd write this whole pattern, corrected, as

(subject (caseStatus "Suspect") (OBJECT ?p))

or if you really wanted the variable ?caseStatus bound to the constant
"Suspect" you could write

(subject (caseStatus ?caseStatus&"Suspect") (OBJECT ?p))



---------------------------------------------------------
Ernest Friedman-Hill  
Science and Engineering PSEs        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to