Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Stereotype attribute using ATL(problem in extracting stereotype attribute using ATL)
Stereotype attribute using ATL [message #1707965] Thu, 10 September 2015 23:03 Go to next message
Karishma Karishma is currently offline Karishma KarishmaFriend
Messages: 4
Registered: September 2015
Junior Member
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 08:40 Go to previous message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
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
Previous Topic:Get the Attribute name of a Class in ATL
Next Topic:Saving modification of a Map in a function
Goto Forum:
  


Current Time: Fri Apr 26 03:35:03 GMT 2024

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

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

Back to the top