Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Setting enumeration value to enumeration tagged value
[ATL] Setting enumeration value to enumeration tagged value [message #95148] Thu, 13 November 2008 11:00 Go to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
Hi,
i have some trouble setting an enumeration value in the target model from
an enumeration value in the source model:
the target model is AADL, i have a DataPort class that has a direction
property of type PortDirection (that is an enumeration={in, out, inout}).
I want to set it to the value of the property direction of the stereotype
FlowPort of the MARTE profile that is also an enumeration{in, out, inout}.
i wrote this rule:

unique lazy rule myDataPorts {
from s : UML2!Port
to t : AADL!DataPort (
direction<- s.getTaggedValue('FlowPort','Direction'),
name<- s.name + '_' + s.toString()
)
}

And the Helper :
helper context UML2!Element def : getTaggedValue(stereotypeName : String,
taggedValue : String) : OclAny =
if (self.isStereotypeApplied(stereotypeName)) then
(self.getTaggedValue(stereotypeName,taggedValue))
else ('')
endif;

I get a long execution time with a lot of errors, like if i had an
infinite loop :
....
GRAVE: MUML2!Element;.getTaggedValue(1 : S, 2 : S) : ??#11 43:2-43:49
GRAVE: local variables = {taggedValue='direction',
stereotypeName='FlowPort', self=IN!Data_jtag}
GRAVE: local stack = []
GRAVE: MUML2!Element;.getTaggedValue(1 : S, 2 : S) : ??#11 43:2-43:49
GRAVE: local variables = {taggedValue='direction',
stereotypeName='FlowPort', self=IN!Data_jtag}
GRAVE: local stack = []
GRAVE: MUML2!Element;.getTaggedValue(1 : S, 2 : S) : ??#2 42:5-42:45
GRAVE: local variables = {taggedValue='direction',
stereotypeName='FlowPort', self=IN!Data_jtag}
GRAVE: local stack = []
GRAVE: MUML2!Element;.isStereotypeApplied(1 : S) : ??#11 35:48-35:54
GRAVE: local variables = {s=IN!FlowPort, name='FlowPort',
self=IN!Data_jtag}
GRAVE: local stack = [Sequence {}]
GRAVE: ****** END Stack Trace
INFO: Execution terminated due to error (see launch configuration to allow
continuation after errors).
GRAVE: stack overflow
java.lang.RuntimeException: stack overflow at
org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:195)
....

Can anybody help?!!
Re: [ATL] Setting enumeration value to enumeration tagged value [message #95163 is a reply to message #95148] Thu, 13 November 2008 11:04 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
..even if i write this simple operation, it doesn't work:

rule myGeneralDataPorts {
from s : UML2!Port
to t : AAXL!DataPort (
direction<- #inout,
name<- s.name
)
}
Re: [ATL] Setting enumeration value to enumeration tagged value [message #95209 is a reply to message #95163] Thu, 13 November 2008 11:38 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
i corrected the helper to this:

helper context UML2!Element def: getTaggedValue(stereotypeName :
String,taggedValue : String) : OclAny =
self.getValue(self.getAppliedStereotype(stereotypeName),tagg edValue);

and the call:

unique lazy rule myDataPorts {
from s : UML2!Port
to t : AADL!DataPort (
direction <-

s.getTaggedValue('MARTE::MARTE_DesignModel::GCM::FlowPort',' direction'),
name<- s.name
)

i get this error now:
GRAVE: message: ERROR: cannot convert IN!inout : class
org.eclipse.m2m.atl.drivers.uml24atl.ASMUMLModelElement to EMF.
Re: [ATL] Setting enumeration value to enumeration tagged value [message #95378 is a reply to message #95209] Mon, 17 November 2008 10:14 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
I try to affect a string in the direction property that is an enumeration
(in, out, inout):

unique lazy rule myDataPorts {
from s : UML2!Port
to t : AADL!DataPort (
direction <- 'inout'
name<- s.name
)
}

But i get this error:

GRAVE: message: cannot set feature AAXL!DataPort.direction to value inout

Can anybody help with this!!
I did not find any use case in the M2M!ATL!Use cases repository that uses
enumerations, is there any problem in ATL with enumerations?
Re: [ATL] Setting enumeration value to enumeration tagged value [message #95393 is a reply to message #95378] Mon, 17 November 2008 10:50 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
try
direction <- #inout

Skander a écrit :
> I try to affect a string in the direction property that is an
> enumeration (in, out, inout):
>
> unique lazy rule myDataPorts {
> from s : UML2!Port
> to t : AADL!DataPort (
> direction <- 'inout'
> name<- s.name
> )
> }
>
> But i get this error:
>
> GRAVE: message: cannot set feature AAXL!DataPort.direction to value
> inout
>
> Can anybody help with this!!
> I did not find any use case in the M2M!ATL!Use cases repository that
> uses enumerations, is there any problem in ATL with enumerations?
>
>
>




Re: [ATL] Setting enumeration value to enumeration tagged value [message #95407 is a reply to message #95393] Mon, 17 November 2008 10:51 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
or maybe you have a conflict between inout from UML2 and inout from AADL


Tristan FAURE a écrit :
> try
> direction <- #inout
>
> Skander a écrit :
>> I try to affect a string in the direction property that is an
>> enumeration (in, out, inout):
>>
>> unique lazy rule myDataPorts {
>> from s : UML2!Port
>> to t : AADL!DataPort (
>> direction <- 'inout'
>> name<- s.name
>> ) }
>>
>> But i get this error:
>>
>> GRAVE: message: cannot set feature AAXL!DataPort.direction to
>> value inout
>>
>> Can anybody help with this!!
>> I did not find any use case in the M2M!ATL!Use cases repository that
>> uses enumerations, is there any problem in ATL with enumerations?
>>
>>
>>




Re: [ATL] Setting enumeration value to enumeration tagged value [message #95421 is a reply to message #95393] Mon, 17 November 2008 11:03 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
i tried the #inout but it didn't work!

I also tried this:

direction <- s.getTaggedValue
('MARTE::MARTE_DesignModel::GCM::FlowPort','direction'),

With this helper:

helper context UML2!Element def: getTaggedValue(stereotypeName :
String,taggedValue : String) : OclAny =
self.getValue(self.getAppliedStereotype(stereotypeName),tagg edValue);

But i get this error:

message: ERROR: cannot convert IN!inout : class
org.eclipse.m2m.atl.drivers.uml24atl.ASMUMLModelElement to EMF.
Re: [ATL] Setting enumeration value to enumeration tagged value [message #95450 is a reply to message #95421] Mon, 17 November 2008 11:06 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
When i changed the Model Handler of the UML input model from UML2 to EMF,
the error changed and i get this error:

GRAVE: ****** BEGIN Stack Trace
GRAVE: message: cannot set feature AADL!DataPort.direction to value
org.eclipse.uml2.uml.internal.impl.EnumerationLiteralImpl@1cbf989 (name:
inout, visibility: <unset>)
GRAVE: exception:
GRAVE: org.eclipse.uml2.uml.internal.impl.EnumerationLiteralImpl cannot be
cast to edu.cmu.sei.aadl.model.feature.PortDirection
Re: [ATL] Setting enumeration value to enumeration tagged value [message #95465 is a reply to message #95421] Mon, 17 November 2008 11:08 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
I don't remember the syntax but maybe you should try something like this :

direction <- AADL!#inout

to force ATL to know you want to use the AADL inout

Skander a écrit :
> i tried the #inout but it didn't work!
>
> I also tried this:
>
> direction <- s.getTaggedValue
> ('MARTE::MARTE_DesignModel::GCM::FlowPort','direction'),
>
> With this helper:
>
> helper context UML2!Element def: getTaggedValue(stereotypeName :
> String,taggedValue : String) : OclAny =
> self.getValue(self.getAppliedStereotype(stereotypeName),tagg edValue);
>
> But i get this error:
>
> message: ERROR: cannot convert IN!inout : class
> org.eclipse.m2m.atl.drivers.uml24atl.ASMUMLModelElement to EMF.
>
>




Re: [ATL] Setting enumeration value to enumeration tagged value [message #95480 is a reply to message #95465] Mon, 17 November 2008 11:17 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
I tried this:

direction <- AAXL!PortDirection.inout

I get this error:

GRAVE: message: feature inout does not exist on MOF!EEnum

Here is all the error message:

GRAVE: ****** BEGIN Stack Trace
GRAVE: message: feature inout does not exist on MOF!EEnum
GRAVE: A.main() : ??#24 null
GRAVE: local variables = {self=MarteToAAXL : ASMModule}
GRAVE: local stack = []
GRAVE: A.__exec__() : ??#28 null
GRAVE: local variables = {e=TransientLink {rule = 'myGeneralDataPorts',
sourceElements = {s = IN!Data_inout}, targetElements = {t =
OUT!Data_inout}, variables = {}}, self=MarteToAAXL : ASMModule}
GRAVE: local stack = []
GRAVE: A.__applymyGeneralDataPorts(1 : NTransientLink;) : ??#20
264:18-264:42
GRAVE: local variables = {t=OUT!Data_inout, s=IN!Data_inout,
link=TransientLink {rule = 'myGeneralDataPorts', sourceElements = {s =
IN!Data_inout}, targetElements = {t = OUT!Data_inout}, variables = {}},
self=MarteToAAXL : ASMModule}
GRAVE: local stack = [OUT!Data_inout, OUT!Data_inout, MarteToAAXL :
ASMModule]
GRAVE: ****** END Stack Trace
INFO: Trying to continue execution despite the error.
Re: [ATL] Setting enumeration value to enumeration tagged value [message #95543 is a reply to message #95480] Mon, 17 November 2008 13:23 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
hum I don't know :(
I hope somebody who already had this problem will participate to the
discussion

Skander a écrit :
> I tried this:
>
> direction <- AAXL!PortDirection.inout
>
> I get this error:
>
> GRAVE: message: feature inout does not exist on MOF!EEnum
>
> Here is all the error message:
>
> GRAVE: ****** BEGIN Stack Trace
> GRAVE: message: feature inout does not exist on MOF!EEnum
> GRAVE: A.main() : ??#24 null
> GRAVE: local variables = {self=MarteToAAXL : ASMModule}
> GRAVE: local stack = []
> GRAVE: A.__exec__() : ??#28 null
> GRAVE: local variables = {e=TransientLink {rule =
> 'myGeneralDataPorts', sourceElements = {s = IN!Data_inout},
> targetElements = {t = OUT!Data_inout}, variables = {}}, self=MarteToAAXL
> : ASMModule}
> GRAVE: local stack = []
> GRAVE: A.__applymyGeneralDataPorts(1 : NTransientLink;) : ??#20
> 264:18-264:42
> GRAVE: local variables = {t=OUT!Data_inout, s=IN!Data_inout,
> link=TransientLink {rule = 'myGeneralDataPorts', sourceElements = {s =
> IN!Data_inout}, targetElements = {t = OUT!Data_inout}, variables = {}},
> self=MarteToAAXL : ASMModule}
> GRAVE: local stack = [OUT!Data_inout, OUT!Data_inout, MarteToAAXL :
> ASMModule]
> GRAVE: ****** END Stack Trace
> INFO: Trying to continue execution despite the error.
>




Re: [ATL] Setting enumeration value to enumeration tagged value [message #95572 is a reply to message #95543] Mon, 17 November 2008 15:03 Go to previous messageGo to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
i tried a new atl transformation from aadl to aadl with only one rule:

module AAXL2AAXLPorts; -- Module Template
create OUT : AAXL from In : AAXL;

rule myDataPorts {
from s : AAXL!DataPort
to t : AAXL!DataPort (
name<- s.name ,
direction <- #in
-- also tried : direction <- 'in'
-- also tried : direction <- AAXL!PortDirection.in
)
}

Nothing of all this works, the problem is with AADL.
i'm using the default AADL metamodel that is installed with OSATE.
I'll look if changing the metemodel will resolve the problem!!
Re: [ATL] Setting enumeration value to enumeration tagged value [message #95630 is a reply to message #95572] Mon, 17 November 2008 16:17 Go to previous message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
I figured out that if i write :
direction<- #in or #inout
it doesn't work, but if i write :
direction<- #out
it works, it only works with the #out enumeration literal!!
does anybody have an idea of the problem?!!

> module AAXL2AAXLPorts; -- Module Template
> create OUT : AAXL from In : AAXL;

> rule myDataPorts {
> from s : AAXL!DataPort
> to t : AAXL!DataPort (
> name<- s.name ,
> direction <- #in
> -- also tried : direction <- 'in'
> -- also tried : direction <- AAXL!PortDirection.in
> )
> }
Previous Topic:[ATL] Attribute not being populated in target model
Next Topic:[ATL] #in not accepted lexically in ATL
Goto Forum:
  


Current Time: Thu Apr 25 22:44:59 GMT 2024

Powered by FUDForum. Page generated in 0.03737 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top