On May 6, 2008, at 6:40 AM, John Chrysakis wrote:
BUT, If I want to compare values between strings or integers I don't
have
the know how. For example the rule is not correct since string MODE
is not
recognized:
(defrule testRule1
"Testing the rule."
(Ontology { MODE == "Something" })=> (calling MyFunction)
)
I have defined in Ontology:
private String Mode = "Something";
and
public String getMode(){
return Mode;
But in Jess Editor an error appears in mode: No such slot Mode in
template
MAIN::Ontology at token 'Mode'.
What it is going wrong?
Jess, like Java, is case-sensitive. Jess uses the standard JavaBeans
conventions to derive property names from getter method names, so the
method getMode() gives rise to a property named "mode", all in lower-
case. Therefore just
(defrule testRule1
"Testing the rule."
(Ontology { mode == "Something" })=> ...
should work fine,
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
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]
--------------------------------------------------------------------