Home » Archived » M2M (model-to-model transformation) » MOF2UML inheritance
| | | | | |
Re: MOF2UML inheritance [message #36307 is a reply to message #36240] |
Mon, 07 May 2007 11:55   |
Eclipse User |
|
|
|
Hello,
> Is it possible to override values in subrules which are set by
> superrules? For example, to override atttribute b of class t:
>
> rule A { -- superrule, either lazy or abstract
> from s : mm!s
> to t : mm!t(
> a <- s.a,
> b <- 'super'
> )
> }
>
> rule B extends A {
> from s : mm!s
> to t : mm!t{
> b <- 'sub'
> )
> }
Yes, you can do this. However, rule inheritance is not implemented for
lazy rules yet.
Note that b <- 'super' will not be "executed" at all.
This means that if a lazy rule was called in the super rule, it will not
be called in the subrule unless you call it explicitly.
Moreover, you can definitely not reuse the value of t.b by writing
something like:
-- INCORRECT
rule B extends A {
from s : mm!s
to t : mm!t{
b <- t.b + '_sub'
)
}
, which is anyway incorrect because it also involves target model
navigation.
If you want to reuse a computed value, simply use an attribute helper
instead:
helper context mm!s def: value : String =
'super';
rule A {
from s : mm!s
to t : mm!t(
a <- s.a,
b <- s.value
)
}
rule B extends A {
from s : mm!s
to t : mm!t{
b <- s.value + '_sub'
)
}
Regards,
Frédéric Jouault
|
|
|
Re: MOF2UML inheritance [message #36371 is a reply to message #36307] |
Tue, 08 May 2007 04:10   |
Eclipse User |
|
|
|
Originally posted by: r.c.ladan.tue.nl
Frédéric Jouault wrote:
> Hello,
>
> > Is it possible to override values in subrules which are set by
> > superrules? For example, to override atttribute b of class t:
> >
> > rule A { -- superrule, either lazy or abstract
> > from s : mm!s
> > to t : mm!t(
> > a <- s.a,
> > b <- 'super'
> > )
> > }
> >
> > rule B extends A {
> > from s : mm!s
> > to t : mm!t{
> > b <- 'sub'
> > )
> > }
>
> Yes, you can do this. However, rule inheritance is not implemented for
> lazy rules yet.
>
Is there a timeline for the implementation of lazy rule inheritance?
I have a superimposed ATL rule 'library' which contains lazy rules to be
executed on demand. As an alternative, I guess I can turn the lazy
superrules into abstract superrules since abstract rules aren't
standalone anyway.
>
> Note that b <- 'super' will not be "executed" at all.
>
So if rule A is lazy, the output of thisModule.A(s_in) would be {t.a =
s_in.a , t.b = <undefined>} ?
And if rule A is lazy and rule B (either lazy or normal) is executed
with s = s_in2, its output would be {t.a = s_in2.a (inherited from rule
), t.b = 'sub'} ?
> This means that if a lazy rule was called in the super rule, it will not
> be called in the subrule unless you call it explicitly.
>
> Moreover, you can definitely not reuse the value of t.b by writing
> something like:
>
[...]
It wasn't my intention to reuse variables, but to have a "use the value
of the superrule if not set here" policy (just like imperative object
orientation).
Regards,
Rene
|
|
| |
Re: [ATL] MOF2UML inheritance [message #36629 is a reply to message #36371] |
Wed, 09 May 2007 11:43  |
Eclipse User |
|
|
|
Hello,
I have just noticed that we have been discussing in this thread without
prefixing its subject with [ATL]. This is now corrected. Please, keep
this in mind for your future posts ;-).
>> Yes, you can do this. However, rule inheritance is not implemented for
>> lazy rules yet.
>>
> Is there a timeline for the implementation of lazy rule inheritance?
So far, we have been delaying the implementation of lazy rule
inheritance because we wanted to integrate it with an improved resolving
algorithm.
However, if the interest in lazy rule inheritance is strong enough, we
may decide to work on a first (simpler) version, without needing the
improved resolving algorithm.
>> Note that b <- 'super' will not be "executed" at all.
>>
> So if rule A is lazy, the output of thisModule.A(s_in) would be {t.a =
> s_in.a , t.b = <undefined>} ?
> And if rule A is lazy and rule B (either lazy or normal) is executed
> with s = s_in2, its output would be {t.a = s_in2.a (inherited from rule
> ), t.b = 'sub'} ?
Rules A and B cannot be lazy because they use rule inheritance, which is
not implemented for lazy rules yet.
>> Moreover, you can definitely not reuse the value of t.b by writing
>> something like:
>>
> [...]
>
> It wasn't my intention to reuse variables, but to have a "use the value
> of the superrule if not set here" policy (just like imperative object
> orientation).
It was not my intention either to imply that you wanted to do this :-).
I was merely mentioning this fact here because it seemed relevant.
Sorry for the confusion.
Regards,
Frédéric Jouault
|
|
|
Goto Forum:
Current Time: Tue Jul 01 06:31:25 EDT 2025
Powered by FUDForum. Page generated in 0.09562 seconds
|