Thanks Ernest. That solved my silly problem :) I have another question. can
i use "call" function only on the RHS side? I tried the following rule and
its working in case 2 and not in case 1.

case1:
        (defrule testbeans2 
        (test1 (name ?name) (clli ?clli) (netPlane 1) (OBJECT ?test1))
        (call ?test1 hasLink "link1")
        =>
        (printout t "The NE matched with link1 is :" ?name  crlf)
)

case1:
        (defrule testbeans2 
        (test1 (name ?name) (clli ?clli) (netPlane 1) (OBJECT ?test1))
        =>
        (call ?test1 hasLink "link1")
        (printout t "The NE matched with link1 is :" ?name  crlf)
)

In case2 the method hasLink is getting called and it returns a boolean true.
I even printed whats being returned on to the jess side and it turns out to
be the atom TRUE. So am i right in assuming i can not use call on the LHS
side? or do i need to handle the return value in any specifc manner? 

I am basically testing how i can call methods in a java object by pasing
certain arguments and also when that method call returns true so the
condition evaluates to true (if called from LHS).

Thanks for the help
Satish.




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 18, 2001 10:07 PM
To: Satish boggavarapu
Cc: '[EMAIL PROTECTED]'
Subject: Re: JESS: definstance on beans


I think Satish boggavarapu wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> 
> Hi All,
> 
> I am trying to create definstances on a set of beans which has an
ArrayList
> in it with out much success. I am enclosing the error log and the code
> snippets here. I appreciate any help indicating where i am going wrong.
> 
> public interface Test1Intf {
...
>     public ArrayList getLinks();
>     public void setLinks(ArrayList aList);
...
> public class Test2 extends Test1 implements Test2Intf {
> ...................
> }
> 
...
> (defclass test1 jess.examples.pumps.Test1Intf)
> (defclass test2 jess.examples.pumps.Test2Intf extends test1)
> 
...
> 
> (defrule testbeans2 
>       (test2 (name ?name) (clli ?clli) (netPlane 1) (link ?link)
>       =>
>       (printout t "The NE matched is :" ?name ?link crlf)
> )
> 
> 
> I am getting the following error. Where am i going wrong?
> 

Sorry that Jess doesn't do a better job of reporting this error in a
sensible way. The message "Bad index -3 in call to get() on this
vector..." when defining a rule always means you've tried to match a
nonexistent slot; usually it's a typo. The rule testbeans2 above is
trying to match a slot named "link", but there is no such slot in any
of your defclasses: there is, though, one named "links", as I've shown
in Test1Intf above.

> java jess.examples.pumps.Test
> Exception in thread "main" Jess reported an error in routine
ValueVector.get
>       while executing (batch jess/examples/pumps/test.clp).
>   Message: Bad index -3 in call to get() on this vector:  (clli
> <External-Address:jess.SerializablePropertyDescriptor> -1 links
> <External-Address:jess.SerializablePropertyDescriptor> -1 location
> <External-Address:jess.SerializablePropertyDescriptor> -1 name
> <External-Address:jess.SerializablePropertyDescriptor> -1 netPlane
> <External-Address:jess.SerializablePropertyDescriptor> -1 OBJECT nil
2048).




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