Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Problem with comparison
Problem with comparison [message #1755014] Sun, 26 February 2017 17:41 Go to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi,

this if condition return false but When I debug "ve.refImmediateComposite()" and "thisModule.aux" both of them return "IN1!<unnamed>". Would any one help me in this regard?
if (ve.refImmediateComposite() = thisModule.aux)


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: Problem with comparison [message #1755022 is a reply to message #1755014] Mon, 27 February 2017 05:52 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

IN!<unnamed> is just a string representation of model elements without a "name" property. It doesn't imply equality.

Cheers,
Dennis
Re: Problem with comparison [message #1755053 is a reply to message #1755022] Mon, 27 February 2017 15:59 Go to previous messageGo to next message
louis andia. is currently offline louis andia.Friend
Messages: 47
Registered: November 2016
Member
If you put your element as a parameter in debug() (e.g debug(ve.refImmediateComposite())), you will see his id (e.g org.eclipse.emf.ecore.impl.DynamicEObjectImpl@33b8de76...).
"if (ve.refImmediateComposite() = thisModule.aux)" will be equal only if they have the same id.
Re: Problem with comparison [message #1755526 is a reply to message #1755053] Sat, 04 March 2017 20:36 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Thanks all.

Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: Problem with comparison [message #1755540 is a reply to message #1755526] Sun, 05 March 2017 11:09 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
I have also another question, if I write the below code, I have the error "org.eclipse.m2m.atl.engine.emfvm.VMException: Feature method does not exist on PropertyCallExpression".
helper context MM_ETL!Expression def : collectWithFeatureFollowing() : Boolean =
if ((self.oclIsTypeOf(MM_ETL!PropertyCallExpression) or thisModule.isAHelper(self)) and not self.oclIsKindOf(MM_ETL!FOLMethodCallExpression).oclIsUndefined())
then if (self.method.name = 'collect')

if I change the code to the below code, I have the error "org.eclipse.m2m.atl.engine.emfvm.VMException: java.lang.Boolean does not have properties".
helper context MM_ETL!Expression def : collectWithFeatureFollowing() : Boolean =
if ((self.oclIsTypeOf(MM_ETL!PropertyCallExpression) or thisModule.isAHelper(self)) and not self.oclIsKindOf(MM_ETL!FOLMethodCallExpression).oclIsUndefined())
if (self.oclIsKindOf(MM_ETL!FOLMethodCallExpression).method.name = 'collect')


what can I do to access method?


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: Problem with comparison [message #1755659 is a reply to message #1755540] Mon, 06 March 2017 16:19 Go to previous messageGo to next message
louis andia. is currently offline louis andia.Friend
Messages: 47
Registered: November 2016
Member
It's look like PropertyCallExpression don't have attribute named "method" and yours if don't return any boolean.

You wanted to write something like that?
if ((self.oclIsTypeOf(MM_ETL!PropertyCallExpression) or thisModule.isAHelper(self)) and not self.oclIsKindOf(MM_ETL!FOLMethodCallExpression).oclIsUndefined())
then (self.oclIsKindOf(MM_ETL!FOLMethodCallExpression).method.name = 'collect')
else false endif 
Re: Problem with comparison [message #1755701 is a reply to message #1755659] Mon, 06 March 2017 21:22 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
louis andia. wrote on Mon, 06 March 2017 16:19
It's look like PropertyCallExpression don't have attribute named "method" and yours if don't return any boolean.


Yes, "PropertyCallExpression" doesn't have the attribute named "method". I want to navigate from self to "FOLMethodCallExpression" class which has a "method" feature. "FOLMethodCallExpression" is a sub-class of sub-class of self.

louis andia. wrote on Mon, 06 March 2017 16:19

You wanted to write something like that?
if ((self.oclIsTypeOf(MM_ETL!PropertyCallExpression) or thisModule.isAHelper(self)) and not self.oclIsKindOf(MM_ETL!FOLMethodCallExpression).oclIsUndefined())
then (self.oclIsKindOf(MM_ETL!FOLMethodCallExpression).method.name = 'collect')
else false endif 


No, the code I write above is a part of my code. It returns boolean value.


Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Mon, 06 March 2017 21:23]

Report message to a moderator

Re: Problem with comparison [message #1755758 is a reply to message #1755701] Tue, 07 March 2017 15:37 Go to previous messageGo to next message
louis andia. is currently offline louis andia.Friend
Messages: 47
Registered: November 2016
Member
Ok.

not self.oclIsKindOf(MM_ETL!FOLMethodCallExpression).oclIsUndefined()

I think it will always be true, because self.oclIsKindOf(MM_ETL!FOLMethodCallExpression) should always be true or false so will always be defined.
Replace that with:
self.oclIsKindOf(MM_ETL!FOLMethodCallExpression)

and the first problem must not happen again.

Sorry for my previous answer, i didn't noticed you tried to cast with oclIsKindOf method. This method doesn't do that, it's like oclIsTypeOf but match even if it's a subclass.
Re: Problem with comparison [message #1755771 is a reply to message #1755758] Tue, 07 March 2017 19:26 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Many thanks for your kind help. my problem was solved.

Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: Problem with comparison [message #1755782 is a reply to message #1755758] Wed, 08 March 2017 07:12 Go to previous message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi,

I have also another question, the below if condition always return false.
if (MM_ETL!TransformationRule -> allInstances() -> exists (l|l.lazy=true and l.source.resolvedType.elementName.oclIsKindOf(MM_Src!EStructuralFeature.allInstances() -> select (s|s.name=a.target.collectAllContainedElements()->last().name)-> collect (s|s.eType)->first())))


I think because the below part of it returns "IN_trg!className"
MM_Src!EStructuralFeature.allInstances() -> select (s|s.name=a.target.collectAllContainedElements()->last().name

and the below code returns "className"
MM_ETL!TransformationRule -> allInstances() -> collect (l|l.source.resolvedType.elementName)

I want if the "className" of second part I show is the same as "className" of the first part or one of its subtypes, the if condition returns true. would you please help me in this regard?


Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Wed, 08 March 2017 08:14]

Report message to a moderator

Previous Topic:BPMN2UML transformation
Next Topic:Running ATL transformation on UML model outside of Eclipse
Goto Forum:
  


Current Time: Fri Apr 19 20:50:06 GMT 2024

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

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

Back to the top