RE: JESS: unimplemented function detemplate

2004-09-21 Thread Jason Morris
I think that Thao wrote:
 then there is an error: unimplemented function deftemplate. I dont know
why !??:(

Hold on there, Thao!
You may be giving poor Ernest a stroke as I write this, not to mention
violating the Zen of Jess http://herzberg.ca.sandia.gov/jess/zen.shtml  :-D
Hopefully he's off eating dinner now.

Jess is rightly complaining because you *cannot* define a deftemplate inside
a rule like this.  Defrule and deftemplate are two separate constructs,
not true functions as Ernest points out in JIA and in the Jess
documentation -- and the RHS of rules are supposed to be function calls.
Also, the deftemplate for a fact should come before the rules that use it.

Why don't you tell us what you're trying to do so that we can suggest
something?

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: unimplemented function detemplate [debug code]

2004-09-21 Thread Jason Morris
Hi again Thao,

I moved the (deftemplate parameter) out of your rule and formatted your code
a bit.
Try this...

;; = thao.clp ===
(clear)
(watch all)
(reset) ;; See JIA pp. 79-80 about doing a (reset) when starting a program.

(deftemplate parameter
(multislot name )
(multislot value)
(multislot unit ))

(defrule inputParameterSpannungsnachweis
(nachweis Spannungsnachweis)
=
(import java.lang.*)
(bind ?querschnitt Querschnitt)
(bind ?Fx Fx)
(bind ?Fy Fy)
(bind ?My My)
(bind ?querschnittValue (new java.lang.String I120))
(bind ?FxValue (new java.lang.Double 150.0 ))
(bind ?FyValue (new java.lang.Double 200.0 ))
(bind ?MyValue (new java.lang.Double 200.0 ))
(bind ?querschnittsUnit )
(bind ?FxUnit KN)
(bind ?FyUnit KN)
(bind ?MyUnit KNcm)
(bind ?x (assert (parameter (name  ?querschnitt ?Fx ?Fy ?My)
(value ?querschnittValue ?FxValue ?FyValue ?MyValue)
(unit ?querschnittsUnit ?FxUnit ?FyUnit ?MyUnit)

(assert (nachweis Spannungsnachweis))
(run)
;; 

. and I got this output

 == Focus MAIN
 == f-0 (MAIN::initial-fact)
MAIN::inputParameterSpannungsnachweis: +1+1+1+1+t
 == f-1 (MAIN::nachweis Spannungsnachweis)
== Activation: MAIN::inputParameterSpannungsnachweis :  f-1
FIRE 1 MAIN::inputParameterSpannungsnachweis f-1
 == f-2 (MAIN::parameter (name Querschnitt Fx Fy My)
 (value External-Address:java.lang.String
External-Address:java.lang.Double
External-Address:java.lang.Double
External-Address:java.lang.Double)
   (unit  KN KN KNcm))
 == Focus MAIN

Is this what you wanted?

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]