Just as when you're writing this in Jess code, you have to define the
defclass "A1obj" first -- Rete now has a defclass() method you can use
for that, too:
rr.defclass(className, className, null);
I think chinnaswamy gounder wrote:
> 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/
>
---------------------------------------------------------
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]
---------------------------------------------------------------------