Home » Archived » M2M (model-to-model transformation) » [ATL] How to set up the dependency owner or namespace by ATL
[ATL] How to set up the dependency owner or namespace by ATL [message #481676] |
Sun, 23 August 2009 07:47 |
micromilua Messages: 20 Registered: July 2009 |
Junior Member |
|
|
When I do this transformation. The Dependency isn't in the Model
See the Picture
I try two method , but I can't transformation successly.
Method1:
--namespace<-t,
Method2:
-owner<-thisModule.Global_UmlModel,
My ATL code is as below:
Firsly, I assign the Model to "thisModule.Global_UmlModel " Variable
=====================================================
rule Model {
from s : UML2!"uml::Model" (thisModule.inElements->includes(s))
to t : UML2!"uml::Model" mapsTo s (
name <- s.name),
do {
thisModule.Global_UmlModel <- t ;
}
=====================================================
And , I want to set up the dependency owner or namespace
=====================================================
rule Class {
from s : UML2!"uml::Class" (
if thisModule.inElements->includes(s) then
s.oclIsTypeOf(UML2!"uml::Class")
else false endif)
to t : UML2!"uml::Class" (
name <- s.name,
package <- s.package),
addDependency: UML2!"uml::Dependency" mapsTo s (
name<-'Dependency',
--namespace<-t,
--owner<-thisModule.Global_UmlModel,
supplier<-(UML2!Class.allInstances()->select(st | st.name = 'Mediator').first()),
client<-t)
}
Thanks a lot
micromilua
|
|
|
Re: [ATL] How to set up the dependency owner or namespace by ATL [message #481779 is a reply to message #481676] |
Mon, 24 August 2009 09:56 |
Freddy Allilaire Messages: 130 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------080706000107070303010508
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Hi Micromilua,
Don't you have any way to retrieve the corresponding source "uml Model"
from rule "Model" in rule "Class"?
e.g.:
rule Class {
from s : UML2!"uml::Class" (
if thisModule.inElements->includes(s) then
s.oclIsTypeOf(UML2!"uml::Class")
else false endif)
to t : UML2!"uml::Class" (
name <- s.name,
package <- s.package),
addDependency: UML2!"uml::Dependency" mapsTo s (
name<-'Dependency',
--namespace<-t,
owner<- UML2!Model.allInstances()->select(e |
thisModule.inElements->includes(e))->any()
supplier<-(UML2!Class.allInstances()->select(st | st.name =
'Mediator').first()),
client<-t)
If I don't miss any points, I think this kind of solution would be
better and should work.
Regards,
Freddy.
micromilua a écrit :
> When I do this transformation. The Dependency isn't in the Model
> See the Picture
>
>
>
>
> I try two method , but I can't transformation successly.
>
> Method1:
> --namespace<-t,
> Method2:
> -owner<-thisModule.Global_UmlModel,
>
> My ATL code is as below:
>
> Firsly, I assign the Model to "thisModule.Global_UmlModel " Variable
> =====================================================
>
> rule Model {
> from s : UML2!"uml::Model" (thisModule.inElements->includes(s))
> to t : UML2!"uml::Model" mapsTo s (
> name <- s.name),
>
>
> do {
> thisModule.Global_UmlModel <- t ;
> }
>
> =====================================================
>
> And , I want to set up the dependency owner or namespace
> =====================================================
> rule Class {
> from s : UML2!"uml::Class" (
> if thisModule.inElements->includes(s) then
> s.oclIsTypeOf(UML2!"uml::Class")
> else false endif)
>
> to t : UML2!"uml::Class" (
> name <- s.name,
> package <- s.package),
> addDependency: UML2!"uml::Dependency" mapsTo s (
> name<-'Dependency',
> --namespace<-t,
> --owner<-thisModule.Global_UmlModel,
> supplier<-(UML2!Class.allInstances()->select(st | st.name =
> 'Mediator').first()),
> client<-t)
> }
>
>
> Thanks a lot
> micromilua
--------------080706000107070303010508
Content-Type: text/x-vcard; charset=utf-8;
name="freddy_allilaire.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="freddy_allilaire.vcf"
YmVnaW46dmNhcmQNCmZuOkZyZWRkeSBBbGxpbGFpcmUNCm46QWxsaWxhaXJl O0ZyZWRkeQ0K
b3JnOk9CRU8NCmFkcjo7OzIgcnVlIFJvYmVydCBTY2h1bWFubjtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6ZnJlZGR5LmFsbGlsYWlyZUBvYmVvLmZy DQp0aXRsZTpS
JkQgRW5naW5lZXINCnVybDp3d3cub2Jlby5mcg0KdmVyc2lvbjoyLjENCmVu ZDp2Y2FyZA0K
DQo=
--------------080706000107070303010508--
|
|
| |
Re: [ATL] How to set up the dependency owner or namespace by ATL [message #482849 is a reply to message #481779] |
Fri, 28 August 2009 10:52 |
micromilua Messages: 20 Registered: July 2009 |
Junior Member |
|
|
Hi Freddy
the ATL compiler report the question
Could not find operation any on Sequence(OclAny) having supertypes: [Collection(OclAny)]
at A.__applyClass(1 : NTransientLink;) : ??(mediator.atl)
local variables = {t=OUT!Alarm, s=<unnamed>!Alarm, link=TransientLink {rule = 'Class', sourceElements = {s = <unnamed>!Alarm}, targetElements = {addDependency = OUT!Dependency, t = OUT!Alarm}, variables = {}}, self=mediator : ASMModule, null=OUT!mediator_test, addDependency=OUT!Dependency}
local stack = [OUT!Dependency, OUT!Dependency, mediator : ASMModule]
I am trying other solution~ If I have better solution ,
I will reply soon.
Thanks
micromilua
|
|
|
Goto Forum:
Current Time: Mon Jan 13 21:37:32 GMT 2025
Powered by FUDForum. Page generated in 0.02287 seconds
|