Perhaps my earlier suggestion wasn't formulated well enough. There are Jess functions that list a deftemplate. Its possible that the detailed listing of the reportedly redefined deftemplate Main::painting2 indicates how the original definition was achieved. (Ernest has mentioned the possibilities.)
Also, consider *everything* that has happened before this script was invoked. Was it run on a clean engine? If this script is executed repeatedly, without proper clearing and resetting, the same error message results. -W -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]]im Auftrag von Ernest Friedman-Hill Gesendet: Montag, 06. April 2009 15:53 An: jess-users Betreff: Re: JESS: Inheritance in Deftemplates If you're getting this error on this line of code, then something has already defined a template "painting2" beforehand. It could be an actual deftemplate construct, but it could also be a defclass, an "add", or using the name in a defrule. Just make sure you defined your templates first, before you do anything else. On Apr 6, 2009, at 8:50 AM, John Chrysakis wrote: > > Hello Ernest and thanks a lot for your reply > > I am still getting the following error: > > Message: Cannot redefine deftemplate MAIN::painting2. > Program text: ( deftemplate painting2 extends artifact ( declare ( > from-class painting2 ) ) ) at line 4. > > Is there any problem of using add method for each instance of > painting? > > thanks again, > > John. > ----------------------------------------------------- > > > On Fri, 3 Apr 2009, Ernest Friedman-Hill wrote: > >> >> On Apr 3, 2009, at 11:00 AM, John Chrysakis wrote: >> >>> >>> (import factclasses.*,factinterface.*) >> >> >> This will have no effect. You need two separate import calls here. >> >>> >>> (deftemplate Painter(declare (from-class factclasses.painter ))) >> >> Since Painter is to be a subclass of Artifact, you want to declare >> Artifact first, right? >> >> >>> (deftemplate artifact (declare (from-class factclasses.artifact))) >> >> >> This is OK. Instead of the the above three lines, you could have >> something like >> >> (import factclasses.* >> (import factinterface.*) >> (deftemplate artifact (declare (from-class artifact))) >> (deftemplate painting extends artifact (declare (from-class >> painting))) >> >> >>> (ppdeftemplate MAIN::painting extends artifact) >> >> "ppdeftemplate" pretty-prints a template; it doesn't change anything. >> You've just supplied some extra arguments, which Jess ignores. >> >> >> --------------------------------------------------------- >> Ernest Friedman-Hill >> Informatics & Decision Sciences Phone: (925) 294-2154 >> Sandia National Labs >> PO Box 969, MS 9012 [email protected] >> Livermore, CA 94550 http://www.jessrules.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] > . > -------------------------------------------------------------------- --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences Phone: (925) 294-2154 Sandia National Labs PO Box 969, MS 9012 [email protected] Livermore, CA 94550 http://www.jessrules.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]. --------------------------------------------------------------------
