Stereotype attribute using ATL [message #1707965] |
Thu, 10 September 2015 19:03  |
Eclipse User |
|
|
|
Hey,
Could someone help me with the code for deriving the Stereotype Attributes name and properties. I have a message which is related to a lifeline. The lifeline is linked to a schedulable resource which is further allocated a hardware processor.
I am using Eclipse Luna and UML 5.0
In the code i am trying to pick the schedulableResource linked to the lifeline and the then the hardware processor allocated to it. But i am not able to do it....
Any help would be appreciated....
Code:
helper context UML!Element def: hasStereotype(stereotype : String) : Boolean =
self.getAppliedStereotypes() -> collect(st | st.name) -> includes(stereotype);
helper context UML!Lifeline def: getLifelineHost (): String =
if (self.hasStereotype('PaRunTInstance'))
then
self.getValue(self.getAppliedStereotype('PaRunTInstance'),'host')
else
''
endif;
rule MessageToConnector
{
from
m: UML!Message
using
{
mosr:UML!MessageOccurrenceSpecification = m.receiveEvent;
llr: UML!Lifeline = mosr.covered.first();
}
to
c : QNModel!Connector
(
name<- llr.getLifelineHost()
)
do
{
'ruleMessageToConnectorStarts'.println();
'receiver lifeline'.println();
llr.name.println();
}
}
It gives me the following error:
org.eclipse.m2m.atl.engine.emfvm.VMException: Operation not found: IN!User.getValue(org.eclipse.m2m.atl.engine.emfvm.lib.OclUndefined,java.lang.String)
at getLifelineHost#11(UML2QN.atl[20:7-20:72])
local variables: self=IN!User
at __applyMessageToConnector#20(UML2QN.atl[94:11-94:32])
local variables: self=UML2QN : ASMModule, link=TransientLink {rule = MessageToConnector, sourceElements = {m = org.eclipse.uml2.uml.internal.impl.MessageImpl@4eee2a3c (name: think time, visibility: <unset>) (messageSort: asynchCall)}, targetElements = {c = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@109a492c (eClass: org.eclipse.emf.ecore.impl.EClassImpl@d060492 (name: Connector) (instanceClassName: null) (abstract: false, interface: false))}, variables = {mosr = org.eclipse.uml2.uml.internal.impl.MessageOccurrenceSpecificationImpl@25da6960 (name: MessageRecv, visibility: <unset>), llr = org.eclipse.uml2.uml.internal.impl.LifelineImpl@688a9461 (name: User, visibility: <unset>)}}, m=IN!think time, c=OUT!<unnamed>, mosr=IN!MessageRecv, llr=IN!User
at __exec__#38(UML2QN.atl)
local variables: self=UML2QN : ASMModule, e=TransientLink {rule = MessageToConnector, sourceElements = {m = org.eclipse.uml2.uml.internal.impl.MessageImpl@4eee2a3c (name: think time, visibility: <unset>) (messageSort: asynchCall)}, targetElements = {c = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@109a492c (eClass: org.eclipse.emf.ecore.impl.EClassImpl@d060492 (name: Connector) (instanceClassName: null) (abstract: false, interface: false))}, variables = {mosr = org.eclipse.uml2.uml.internal.impl.MessageOccurrenceSpecificationImpl@25da6960 (name: MessageRecv, visibility: <unset>), llr = org.eclipse.uml2.uml.internal.impl.LifelineImpl@688a9461 (name: User, visibility: <unset>)}}
at main#24(UML2QN.atl)
local variables: self=UML2QN : ASMModule
|
|
|
Re: Stereotype attribute using ATL [message #1711678 is a reply to message #1707965] |
Mon, 19 October 2015 04:40  |
Eclipse User |
|
|
|
Hi,
As the error indicates your getValue call is passing in an OclUndefined i.e. you have not retrieved the stereotype correctly in the method self.getAppliedStereotype('PaRunTInstance'). To get the stereotype correctly you should prefix the Stereotype name with the profile name i.e. PROFILE_NAME::STEREOTYPE_NAME
Regards,
Ronan
|
|
|
Powered by
FUDForum. Page generated in 0.04531 seconds