|
|
|
Re: converting EXPRESS to ECORE: derived attribute [message #687136 is a reply to message #687135] |
Fri, 03 June 2011 04:38 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Comments below.
exquisitus wrote:
>
> >>
> >> in EXPRESS (some old metametamodell used in architecture) it is
> >> possible to define an attribute A in class X, and set it as derived in
> >> class Y which derives from class X. Ecore cannot redefine modifiers in
> >> derived classes, any idea to model this with Ecore nevertheless?
>
>
> > What are you hoping
> > to accomplish by marking it as derived?
>
> As I currently know WHAT the derived values are, I explicitely assign
> the derive values when an instance of the subtype is created.
So we're just talking about different defaults. That has nothing to do
with derived in these sense that Ecore uses; i.e., it's not a value
that's computed from other values and therefore would never need to be
copied.
> The disadvantage of this approach is that the assigned values get
> stored in a database for example.
Because eIsSet is considered true.
> So e.g. I thought about overwriting getA() in AImpl and return the
> derived values there.
Yes, probably better.
> I dont know if this is compatible with CDO if I just add a getA()
> method in an Impl class, since CDO retrieves the values for features
> reflectively, not calling the getters I think.
It depends on whether you use reflective delegation (getA would get
called) or dynamic delegation (it's more efficient and doesn't call getA).
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: converting EXPRESS to ECORE: derived attribute [message #687369 is a reply to message #687123] |
Thu, 02 June 2011 14:17 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Likely Ed Willink will suggest using UML which supports a kind of
redefinition and maps it to Ecore via EAnnotation. What are you hoping
to accomplish by marking it as derived? There's not so much impact of
doing that; EcoreUtil.copy won't copy it (though it knows nothing about
UML's EAnnotations, so that won't help).
exquisitus wrote:
> Hi,
>
> in EXPRESS (some old metametamodell used in architecture) it is
> possible to define an attribute A in class X, and set it as derived in
> class Y which derives from class X. Ecore cannot redefine modifiers in
> derived classes, any idea to model this with Ecore nevertheless?
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: converting EXPRESS to ECORE: derived attribute [message #687373 is a reply to message #687135] |
Fri, 03 June 2011 04:38 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Comments below.
exquisitus wrote:
>
> >>
> >> in EXPRESS (some old metametamodell used in architecture) it is
> >> possible to define an attribute A in class X, and set it as derived in
> >> class Y which derives from class X. Ecore cannot redefine modifiers in
> >> derived classes, any idea to model this with Ecore nevertheless?
>
>
> > What are you hoping
> > to accomplish by marking it as derived?
>
> As I currently know WHAT the derived values are, I explicitely assign
> the derive values when an instance of the subtype is created.
So we're just talking about different defaults. That has nothing to do
with derived in these sense that Ecore uses; i.e., it's not a value
that's computed from other values and therefore would never need to be
copied.
> The disadvantage of this approach is that the assigned values get
> stored in a database for example.
Because eIsSet is considered true.
> So e.g. I thought about overwriting getA() in AImpl and return the
> derived values there.
Yes, probably better.
> I dont know if this is compatible with CDO if I just add a getA()
> method in an Impl class, since CDO retrieves the values for features
> reflectively, not calling the getters I think.
It depends on whether you use reflective delegation (getA would get
called) or dynamic delegation (it's more efficient and doesn't call getA).
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04388 seconds