RE: JESS: calling defclass from Java behavior verification

2004-08-25 Thread PierceJ




Thanks for the response.

Yes, Integer was a bad example - the only method that is found is getClass.
However, the behaviour happens with real JavaBeans as well.  It also
happens with the command line.  After further study, I understand why it is
this way.  I would like to add that when you further the rules to reference
a slot value, you get a parser error.  It's obvious then you must define
your classes to Jess before loading the rules.

Thanks,
Jeff

PS: Thanks for the other advice.  I regularly use the command line, Web
references  forum, and have practically wore the cover off my JIA.





   
 Jason Morris
 [EMAIL PROTECTED] 
 erizon.netTo 
 Sent by:  [EMAIL PROTECTED]   
 owner-jess-users@  cc 
 sandia.gov
   Subject 
   RE: JESS: calling defclass from 
 08/24/2004 06:57  Java behavior verification  
 PM
   
   
 Please respond to 
 [EMAIL PROTECTED] 
   .gov
   
   




I think that PierceJ wrote:
It appears I must first call Rete.defclass(...)  BEFORE loading the rules
file.  What I am seeing is a
deftemplate is created when the rules file is loaded.

Hi Pierce,
You may be violating the Zen Of Jess
http://herzberg.ca.sandia.gov/jess/zen.shtml here. :-D

The Rete.defclass method is intended for creating a deftemplate of a
JavaBean to be shadowed in working memory as a shadow fact.  Note that
the private fields of a JavaBean correspond to the slots in a shadow-fact,
and that Jess is expecting your class to be like a JavaBean (proper field
names, getters and setters, etc. so that Jess can use reflection to read
the bean) -- you certainly shouldn't pass Rete.defclass an Integer and
expect this to work.

Once Jess knows how to store your bean as a fact, then you can use that
deftemplate to add shadow-facts to working memory using Rete.definstance.
If you really want to try this via the API now, I recommend reading Jess In
Action section 6.5 or click here
http://herzberg.ca.sandia.gov/jess/docs/61/language.html#definstance_facts
and work through the examples.  If you do that, I'll be happy to hack
through some examples with you afterward.

IMHO - You're always better off learning Jess from the command line using
the Jess language before trying to program Jess's API directly.  Why?
Because you'll develop a better feel for when it's more efficient to write
Jess script, when to program the API itself, or when to integrate the two.
This flexibility is what separates Jess from other rule languages and
shells.

Hope this helps!
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]







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: calling defclass from Java behavior verification

2004-08-25 Thread Jason Morris
I think that PierceJ wrote:

It's obvious then you must define your classes to Jess before loading the
rules.
Indeed.  Glad that you figured it out.  I'm a big fan of self-reliance.

I regularly use the command line, Web references  forum, and have
practically wore the cover off my JIA.
As I've often stated, my JIA is now held together with duct tape and a
rubber band.  I cracked the binding after the first three months (Dover
publishing is about the only publisher that I know of that sews the
paperback pages in signatures then glues them to the spine so that this
doesn't happen)!

BTW - as an exercise, you might want to try what you just did with the API
from the command line using just the Jess language, and see which one is
easier to do.

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: calling defclass from Java behavior verification

2004-08-24 Thread Jason Morris
I think that PierceJ wrote:
It appears I must first call Rete.defclass(...)  BEFORE loading the rules
file.  What I am seeing is a
deftemplate is created when the rules file is loaded.

Hi Pierce,
You may be violating the Zen Of Jess
http://herzberg.ca.sandia.gov/jess/zen.shtml here. :-D

The Rete.defclass method is intended for creating a deftemplate of a
JavaBean to be shadowed in working memory as a shadow fact.  Note that
the private fields of a JavaBean correspond to the slots in a shadow-fact,
and that Jess is expecting your class to be like a JavaBean (proper field
names, getters and setters, etc. so that Jess can use reflection to read
the bean) -- you certainly shouldn't pass Rete.defclass an Integer and
expect this to work.

Once Jess knows how to store your bean as a fact, then you can use that
deftemplate to add shadow-facts to working memory using Rete.definstance.
If you really want to try this via the API now, I recommend reading Jess In
Action section 6.5 or click here
http://herzberg.ca.sandia.gov/jess/docs/61/language.html#definstance_facts
and work through the examples.  If you do that, I'll be happy to hack
through some examples with you afterward.

IMHO - You're always better off learning Jess from the command line using
the Jess language before trying to program Jess's API directly.  Why?
Because you'll develop a better feel for when it's more efficient to write
Jess script, when to program the API itself, or when to integrate the two.
This flexibility is what separates Jess from other rule languages and
shells.

Hope this helps!
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]