(import factclasses.*,factinterface.*)
(deftemplate Painter(declare (from-class factclasses.painter )))
(deftemplate artifact (declare (from-class factclasses.artifact)))
(ppdeftemplate MAIN::painting extends artifact)



(defrule checkAPP

"Setting a property for all instances"
 (artifact(OBJECT ?app) )

=>
    (?app setDatatypeProperty_1 "HELLO")
    (update ?app)
)


It would be desirable to set HELLO for both artifact and painting
instances.
But this occurs only fot artifact instances.. Why?


thanks for your time!


On Thu, 2 Apr 2009, Wolfgang Laun wrote:

> Put
>    (ppdeftemplate MAIN::painting)
> right in front of the (deftemplate painting...)
>
> What is printed?
> -W
>
>
> On Thu, Apr 2, 2009 at 3:14 PM, John Chrysakis <[email protected]>wrote:
>
> >
> > Hello,
> >
> > I've tried both of them (deftemplates or defclass)
> >
> > but I am getting the same:
> >
> >  Message: Cannot redefine deftemplate MAIN::painting
> >
> > any ideas?
> >
> >
> > On Wed, 1 Apr 2009, Wolfgang Laun wrote:
> >
> > > You may also use deftemplate, e.g.
> > >     (deftemplate painting extends artifact (declare (from-class
> > painting)))
> > >
> > > The pros and cons for either form are discussed in the Jess manual, 5.3.1
> > >
> > > Also note that, from Jess, you don't need to go the roundabout way using
> > > OBJECT;
> > > you can modify the slot in the Shadow Fact, and the Java object will  be
> > > updated
> > > automatically.
> > >
> > > -W
> > >
> > > On Tue, Mar 31, 2009 at 9:15 PM, <[email protected]> wrote:
> > >
> > > > I think the "extends" in the defclass is what you want.
> > > >
> > > > (defclass artifact artifact)
> > > > (defclass painting painting extends artifact)
> > > > (defclass statue statue extends artifact)
> > > >
> > > > -Russ
> > > >
> > > > -----Original Message-----
> > > > From: [email protected] [mailto:[email protected]]
> > > > On Behalf Of John Chrysakis
> > > > Sent: Tuesday, March 31, 2009 11:50 AM
> > > > To: [email protected]
> > > > Subject: JESS: Inheritance in Deftemplates
> > > >
> > > >
> > > > Hello again,
> > > >
> > > > I have the Java classes painting,statue which extend the class
> > artifact.
> > > > I need to model them in deftemplates in such a way that I could get
> > both
> > > > of instances with one defrule:
> > > >
> > > > (defrule checkAPP
> > > >
> > > > "Setting a property for all instances"
> > > >  (artifact (OBJECT ?art) )
> > > >
> > > > =>
> > > >    (?art setDatatypeProperty_1 "OK")
> > > >    (update ?art)
> > > > )
> > > >
> > > >
> > > > How I can do that?
> > > >
> > > > thanks in advance,
> > > > John.
> > > >
> > > >
> > > >
> > > > --------------------------------------------------------------------
> > > > 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].
> > > > --------------------------------------------------------------------
> > > >
> > > >
> > >
> >
> >
> > --------------------------------------------------------------------
> > 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].
--------------------------------------------------------------------

Reply via email to