I think Alexander Lamb wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Well,
>
> The problem is that I populate the value from the Java side, using an
> accessor method.
>
i.e., the value is null when you first definstance the object. This
changes everything, because technically, JavaBeans properties aren't
allowed to contain null.
> Also, I get the following message even before selectedCompleterResponse has
> a value:
Yes, sure, because ?r contains the symbol "nil". Jess always tries to
be as helpful as possible, and here it's trying to call the function
getKeyCode on the java.lang.String "nil", and failing -- hence the
error.
If you're going to be passing "invalid" Beans with null properties to
definstance, then all your conditionals will need to take this into
account -- i.e.,
(slotname ?r&:(and (neq ?r nil) (eq (get ?r keyCode) whatever)))
The "and" function does short-circuit evaluation so this is safe.
>
> Async Error: Jess reported an error in routine get
> while executing (get ?r keyCode)
> while executing (eq "ASP" (get ?r keyCode))
> while executing rule LHS (TEQ)
> while executing rule LHS (TEQ)
> while executing rule LHS (TECT).
> Message: No such property: keyCode.
>
> What happens in that case if selectedCompleterResponse is null (I was
> assuming it would not try to go further)?
>
> Alex
>
> On 3.10.2002 16:39, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > 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]
> > --------------------------------------------------------------------
> >
>
> --
> Alexander Lamb
> Groupe Serveurs Applicatifs
> Division d'Informatique Midicale
> Htpitaux Universitaires de Genhve
> 21 rue Micheli-du-Crest
> CH-1211 Genhve 4 / Switzerland
> Tel: +41-22 372.48.46 Fax: +41-22 382.86.80
> [EMAIL PROTECTED] / http://www.hcuge.ch
>
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
>
---------------------------------------------------------
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]
--------------------------------------------------------------------