Well, I'm sure that this isn't an exact cut-and-paste of the Java
code, since this wouldn't even compile; there are some missing
double-quotes and semicolons. But assuming it's close, there are at
least three significant problems. One is that I don't see you reading
in the .clp file after creating the Rete object; maybe this is just
due to the transcription. Second, in Jess code you call (new Vector),
which won't work unless there's a previous (import java.util.*) in the
Jess code; otherwise you have to use (new java.util.Vector), just like
in Java. Third, you define a rule, but you never issue a (reset)
command (to assert the facts in the deffacts) or a (run) command (to
make the rule actually fire.) Given that the error you're seeing is an
ArrayIndexOutOfBounds error, I'd guess that this third observation is
the cause of your problem, and the others are just differences between
your actual code and this example.

As I've told you in the past in private email, it helps to take these
things one step at a time. Make sure that each line of code is
actually doing what you think it is before testing next one. Use
(watch all) to follow the progress of the Jess code, so you can see if
the facts are being asserted and the rules firing -- don't just assume
that they are.


I think devdatt wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> hai all
>    i am getting a problem in getting the Vector elements.
> 
> 
>   i have a clip file:
> 
>        (deftemplate ask (slot paper)(slot code))
>       (deffacts again (ask (paper one)(code code1))
>                               (ask (paper two)(code code2))
>                               (ask (paper one)(code code3))
>                          (ask (paper one)(code code3)))
> 
> 
>  in jess file ....
>  // when i tried to get the elements matched with paper one in rules RHS i
> am geting and ArrayIndexOutOfBounds Exception for the vector to where i want
> to store .
> 
>   // here is the code
>       Rete r= new Rete();
>       //functios
>       r.executeCommand("(defglobal ?*v* = (new Vector)) ");
>       r.executeCommand("(store RESULT ?*v* )");
>       r.executeCommand("(defrule urs (ask (paper one )(code ?z)) => (call
> ?*v* addElement ?z))
>       Vector sk=new Vector();
>        sk= (Vector)r.fetch("RESULT").externalAddressValue(null);
>       System.out.println("Element 1 " + sk.elementAt (0));
>     // here the elements are not being added and i am getting
> arrayindexoutof bounds exception
> //any one please help me......
> // lots of thanks in advance
> Dev.
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------

Reply via email to