I think Alexander Lamb wrote:

>     (OrmedContext
>         (readyToRun TRUE)
>         (task "script")
>         (selectedCompleterResponse ?r & :(eq "ASP" get ?r keyCode))
>         (OBJECT ?x)
...
> The problem is that my LHS never evaluates to true

Sure -- the call of "eq" is asking whether the string "ASP", the
symbol "get", the contents of the variable "?r" and the symbol
"keyCode" all have the same type ans value -- and of course, this will
always return FALSE. You've left off the parentheses around the call
to "get". So while this is syntactically correct, it's semantically
nonsensical.

> Now, last time you had Suggested I use the following format:
> 
>         (selectedCompleterResponse ?r & :(eq "ASP" (get ?r keyCode)))
> 
> To match the value of the contained object (see the parenthesis around the
> get).
> Unfortunately, the engine tells me _unknown slot keyCode_. But keyCode does
> exist in the selectedCompleterResponse
> Class and the class is defined with a deffclass.


Whether there is a defclass or not is irrelevant. Only one thing
matters here: that ?r is a Java object that has a method named
getKeyCode(). If it isn't, then you'll get an exception. If it is,
then this will work.

Now, since you're getting an error, and since you mention a defclass,
it's possible that perhaps you haven't stored the actual Java object
in the selectedCompleterResponse slot, but instead you put another
jess.Fact object in there -- a shadow Fact which -refers- to an an
object that has a getKeyCode method. (Only you know how the
selectedCompleterResponse slot of the OrmedComplex fact was populated,
or what the data type of the Java object is, as we haven't seen your
whole application.) If you're storing a Fact in there, rather than the
Java object, then you've got to use a Fact method to get the value you
want -- i.e., something like

   ;; Assuming ?r holds a jess.Fact object with a "keyCode" slot
   (selectedCompleterResponse ?r&:(eq "ASP" (?r getSlotValue keyCode)))

So you understand the difference?


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

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