Re: JESS: java reflection

2004-09-21 Thread ejfried
I think Thao wrote:
>
> class Parameter not found ! Why is the path for class
> Parameter wrong ?
>

Just as with any other Java program, the class path needs to properly
include the Parameter class, and the class itself needs to be
public. Make sure that when you start Jess, the CLASSPATH environment
variable, or the -classpath switch, properly includes the location of
the Parameter class.


> (bind ?x (new Parameter "Laenge" (new Double 125.5) "meter"))

Looks perfect.



-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov


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]




RE: JESS: java reflection

2004-09-21 Thread Jason Morris
I think that Thao wrote:
>>Why is the path for class Parameter wrong ?

Hi Thao,

In general, make sure that you have the inf.verification.core package on
your Jess classpath, else Jess can't find your class.

Send us your path so we can check it.

>>And is the syntax :(bind ?x (new Parameter "Laenge" (new Double 125.5)
"meter")) correctly?

Yes, that should work fine.

BTW - java.lang.* is implictly imported in Jess -- no need to explicitly
import it.

Cheers,
Jason



Jason Morris
Morris Technical Solutions
[EMAIL PROTECTED]
www.morristechnicalsolutions.com
fax/phone: 503.692.1088





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]




Re: JESS: Java reflection again

2004-09-14 Thread ejfried
I think Thao wrote:

> 
> System.out.println(r.fetch("X").factValue(c).get(0).listValue(c).get(0).externalAddressValue(c).toString());
> 
> it prints :
> 
> class java.lang.Double
> 
> 1.1
> 
> I think, after externalAddressValue(c) i would have a Double object and i 
> could call the methode doubleValue()  of the class Double. But i can not !
> 

An impressive chain of function calls!

externalAddressValue() returns Object; if you want to call
doubleValue(), you have to cast to Double, right? i.e.,

System.out.println(((Double)
   r.fetch("X").factValue(c).
   get(0).listValue(c).
   get(0).externalAddressValue(c)).
doubleValue());

You might want to consider breaking that into multiple statements...


-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov


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]




Re: JESS: Java reflection

2004-09-14 Thread ejfried
I think Thao wrote:

> But after : (printout t ?a crlf)
> i get only : (External-Address:java.lang.Double)
> why not 1.1  ?

Because "printout" doesn't call "toString()" to print Java objects. If
it did, there would be no easy way to tell that ?a held a Double, not
a double.

You can certainly call it yourself:

  (printout t (?a toString) crlf)





-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov


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]




Re: JESS: Java Reflection

2002-03-29 Thread ejfried


It's most likely a CLASSPATH issue, and so the answer is specific to
the individual servlet container you're using and the ClassLoaders it
incorporates. You might examine the documentation for your web
server/servlet container to see what it says about class access by
servlets. If the classes you've written are not themselves defined
inside a package -- i.e., they're in the default package -- this can
be a particularly tricky situation to deal with; best to define all
your classes in packages of their own.

OTOH, it could also be an access issue. Jess can only work with the
public interfaces of classes -- i.e., it can't create instances of
non-public classes, or call non-public methods; that's just how
reflection works.

I think Hissam wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hi,
> I develop an aplication with many applets communicating with a servlet.
> After decoding messages, the servlet call an instance of Rete to batch a
> file that uses some commands calling external classes writed by me. The
> problem is that  these classes are not recognized. What must I do to resolve
> this problem ?
> Thank you.
> 



-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (925) 294-2154
Sandia National LabsFAX:   (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]





Re: JESS: Java reflection - the store () command

2001-01-15 Thread Thomas Barnekow

When your command

> (defclass dates RelevantDate)

yields a deftemplate definition

>(deftemplate dates extends __fact "$JAVA-OBJECT$ RelevantDate" 
> (slot class ...)
> (slot OBJECT (type 2048)))

then the RelevantDate class does most likely not conform to the JavaBean
standard of naming getter/setter methods for the Bean's attributes.

Thomas

-- 
Sent through GMX FreeMail - http://www.gmx.net

Hello all,
 
I'm having trouble using the Jess command store() from Java to insert Java objects as facts into a Rete engine. The example in the user manual works, when calling Java's core packages i.e..
 
app.rete.store("BUTTON", new java.awt.Button("Press Me!"));
app.rete.executeCommand("(defclass button java.awt.Button)");app.rete.executeCommand("(definstance button (fetch BUTTON) static)");
 
 
As expected, these commands create a deftemplate with the requisite slots for an instance of Button, and creats a fact with the slots filled. However, when storing a class defined in my program (here RelevantDate), only one slot seems to be created ( 
app.rete.store("DATE1", app.date1);
app.rete.executeCommand("(defclass dates RelevantDate)");
app.rete.executeCommand("(definstance dates (fetch DATE1) static)");
 
The resulting deftemplate:
 
(deftemplate dates extends __fact "$JAVA-OBJECT$ RelevantDate"  (slot class (default ))  (slot OBJECT (type 2048)))
 
I have no trouble retrieving this object direct from the Java code, but I need a way to create individual slots for the variables in a RelevantDate object in Jess. Can anyone help?
 
Thanks in advance, Scott DuguidGet Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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]
-


Re: JESS: Java reflection - the store () command

2001-01-15 Thread ejfried

Hi Scott,

First, an aside: please don't sent HTML mail to mailing lists. As you
can see below, many folks will just get mostly gibberish.

To answer your question: the slots in a defclass correspond to Java
Beans properties, which are implemented as methods or method pairs
(i.e., getX() and/or setX() methods,) not member variables. Jess can
only pattern match on well-formed Bean properties. See section 2.7.4
of the Jess manual.


I think Scott Duguid wrote:
[text/html is unsupported, treating like TEXT/PLAIN]

> 
> Hello all,
>  
> I'm having trouble using the Jess command store() from Java to insert Java 
>objects as facts into a Rete engine. The example in the user manual works, when 
>calling Java's core packages i.e..
>  
> app.rete.store("BUTTON", new java.awt.Button("Press Me!"));
> app.rete.executeCommand("(defclass button 
>java.awt.Button)");app.rete.executeCommand("(definstance button (fetch BUTTON) 
>static)");
>  
>  
> As expected, these commands create a deftemplate with the requisite slots for 
>an instance of Button, and creats a fact with the slots filled. However, when storing 
>a class defined in my program (here RelevantDate), only one slot seems to be created 
>(app.date1 is an instantiated instance of RelevantDate class
>  
> app.rete.store("DATE1", app.date1);
> app.rete.executeCommand("(defclass dates RelevantDate)");
> app.rete.executeCommand("(definstance dates (fetch DATE1) static)");
>  
> The resulting deftemplate:
>  
> (deftemplate dates extends __fact "$JAVA-OBJECT$ RelevantDate"  (slot 
>class (default )) 
> (slot OBJECT (type 2048)))
>  
> I have no trouble retrieving this object direct from the Java code, but I need 
>a way to create individual slots for the variables in a RelevantDate object in Jess. 
>Can anyone help?
>  
> Thanks in advance, Scott DuguidGet Your 
>Private, Free E-mail from MSN Hotmail at href="http://www.hotmail.com">http://www.hotmail.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]
> -
> 



-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (925) 294-2154
Sandia National LabsFAX:   (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]
-