[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.m2m] Re: [ATL] How to put model elements in a package that is created in another rule?
|
Hi all,
I already found out how to do this using lazy rules.
Now I have one matched rule and two lazy rules.
Comments on how to do this in a better way are welcome of course.
This is my solution:
rule struct {
from
b : BoxMM!Box
to
m : UML!Model (
name<- b.name
),
ps : UML!Package (
name<-'squares',
namespace<-m,
ownedElement<-BoxMM!Square.allInstances()->collect(e|squares(e))
),
pc : UML!Package (
name <-'circles',
namespace <-m,
ownedElement<-BoxMM!Circle.allInstances()->collect(e|circles(e))
)
}
lazy rule squares {
from
s : BoxMM!Square
to
c : UML!Class (
name<-s.name
)
}
lazy rule circles {
from
s : BoxMM!Circle
to
c : UML!Class (
name<-s.name
)
}
"ATL_Apprentice" <atl_apprentice@xxxxxxxxx> schreef in bericht
news:fv48b2$eg7$1@xxxxxxxxxxxxxxxxxxxx
> Hey all,
>
> I'm stuck with the following situation:
>
> I want to map some model onto a UML model.
>
> The first model is of a box which can contain squares and circles.
>
> Therefore I created a rule:
>
> rule struct {
> from
> b : BoxMM!Box
> to
> m : UML!Model (
> name<- b.name
> ),
> ps : UML!Package (
> name<-'squares',
> namespace<-m
> ),
> pc : UML!Package (
> name <-'circles',
> namespace <-m
> )
> }
>
>
> Now I want to put all the squares into the package squares and all the
> circles into the package circle.
> So I thought it would be easy to create another rule:
>
> rule squares {
> from
> s : BoxMM!Square
> to
> c : UML!Class (
> name<-s.name,
> namespace <-ps <<<< THIS WON'T WORK!!
> Because ps was created in another
> rule.
> )
> }
>
> and a similar rule for circles. How to reference the package 'squares'
> that was created in another rule?
>
> Kind regards
>