Hi,

didn't you forgot the defclass before the definstance? (8.38 in the doc :
"Creates a "shodow fact" representing the given Java objetc, according to
the named deftemplate (which SHOULD have come from defclass)"



Emmanuel Lecharny, IKTEK
06 08 33 32 61, www.iktek.com <http://www.iktek.com>


-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]De
la part de chinnaswamy gounder
Envoye : jeudi 12 avril 2001 11:43
A : [EMAIL PROTECTED]
Cc : [EMAIL PROTECTED]
Objet : Re: JESS: Re: Using definstance.


Hi Ernest,

   I tried with the simple coding in order to use the
deinstance() method of the Rete class in Jess 6.0a5;
but resulting with errors.  Results and the coding
are:

Results:

It is dynamic

Class Name = A1obj

xxx
0
1000.0

Jess reported an error in routine
DefinstanceList.definstance.
Message: Unknown object class A1obj.

at
jess.DefinstanceList.definstance(DefinstanceList.java:149)

at jess.Rete.definstance(Rete.java:890)

at SampleDefinstance.main(SampleDefinstance.java:26)

Exception in thread "main" Process Exit...


Coding:

 import jess.Rete;
 import jess.Value;
 import jess.JessException;
 import jess.ReflectFunctions;
public class A1obj
 {

  public int kount;
  public double salary;
  public String name;

  A1obj()
  {
        kount =0;
        salary = 1000;
        name = "xxx";
  }
 }

 public class SampleDefinstance
 {
     public static void main( String[] arg) throws
JessException
 {
        boolean dynamic = true;
        Rete rr = new Rete();
        A1obj a1 = new A1obj();

        String className   =  a1.getClass().getName();

        if( dynamic )
                System.out.println( "It is dynamic");
        System.out.println( "Class Name = " + className );

        System.out.println( a1.name + "\n"+a1.kount + "\n" +
a1.salary );

      Value vv = rr.definstance(className,a1,dynamic);

   }
}


Seeking advice on the above problem

Thanks and regards.

Chinnaswamy



--- [EMAIL PROTECTED] wrote:
> 1) Section 4.6 in the Jess 6.x manual shows how to
> use a Funcall object
> to call definstance directly from Java.
>
> 2) Starting with Jess 6.0a5, the Rete class has a
> definstance()
> function you can simply call as
>
> Rete r = ...
> r.definstance(tag, object, true|false);
>
> 3) You can call definstance from Jess code, and
> instead of pushing the
> Java objects in from Java code, you can pull them in
> from Jess; for
> instance, provide a Java method for Jess to call
> which lists all the
> objects to be definstanced in a multifield.
>
> There are surely other ways to do it, too.
>
>
> I think chinnaswamy gounder wrote:
> > Hi All,
> >         I have some 'objects' in java code and I
> want
> > to put them into the knowledge base  using
> definstance
> > Jess script function.
> >
> > ( definstaance <tag> < Java Object>
> <static|dynamic ).
> >
> > One way is tranferring the objects from java to
> jess
> > by using store and fetch functions and then use
> the
> > definstance function.
> >
> > Is there anyother means to chieve this java object
> > transfer to jess.
> >
> > Advance thanks for your advice
> >
> > Chinnaswamy
> >
> >
>
>
>
>
---------------------------------------------------------
> 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]
>
---------------------------------------------------------------------
>


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.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]
---------------------------------------------------------------------


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