On Jan 9, 2008, at 10:14 AM, Manolis Nikoloudakis wrote:
(defrule lockRule
"Testing the rule."
(JessUser { reportsLock == TRUE } (reportsLock ?value))=>
(printout t "ReportsLock: " ?value crlf)(calling DynamicReplanning
specificUser)
)
where i want to express that if reportsLock bean of JessUser class
is true,call(through calling variable) JessCaller file with a
String argument(DynamicReplanning) and a User Object argument
(specificUser).
When I batch and run the clp file,I get the first argument
right,but when I get the java object:
'User specificUser=(User)vv.get(2).javaObjectValue(context);'
I have a java.lang.ClassCastException: java.lang.String cannot be
cast to ProtegeCode.User.
I imagine that the wrong part is in the defrule and I should
declare 'specificUser' Object in another way,but I don't know exactly.
OK. In the rule as you've written it, "specificUser" is just a Jess
symbol; calling javaObjectValue() is indeed going to convert that
symbol to a String. What you want there instead is something that
refers to an instance of your User class, yes? So where should this
User object come from? Is is a property of the JessUser object, or
would it come from somewhere else?
---------------------------------------------------------
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]
--------------------------------------------------------------------