Skip to main content



      Home
Home » Modeling » ATL » Problem with comparison
Problem with comparison [message #1755014] Sun, 26 February 2017 12:41 Go to next message
Eclipse UserFriend
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)
Re: Problem with comparison [message #1755022 is a reply to message #1755014] Mon, 27 February 2017 00:52 Go to previous messageGo to next message
Eclipse UserFriend
IN!<unnamed> is just a string representation of model elements without a "name" property. It doesn't imply equality.
Re: Problem with comparison [message #1755053 is a reply to message #1755022] Mon, 27 February 2017 10:59 Go to previous messageGo to next message
Eclipse UserFriend
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 15:36 Go to previous messageGo to next message
Eclipse UserFriend
Thanks all.
Re: Problem with comparison [message #1755540 is a reply to message #1755526] Sun, 05 March 2017 06:09 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: Problem with comparison [message #1755659 is a reply to message #1755540] Mon, 06 March 2017 11:19 Go to previous messageGo to next message
Eclipse UserFriend
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 16:22 Go to previous messageGo to next message
Eclipse UserFriend
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.

[Updated on: Mon, 06 March 2017 16:23] by Moderator

Re: Problem with comparison [message #1755758 is a reply to message #1755701] Tue, 07 March 2017 10:37 Go to previous messageGo to next message
Eclipse UserFriend
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 14:26 Go to previous messageGo to next message
Eclipse UserFriend
Many thanks for your kind help. my problem was solved.
Re: Problem with comparison [message #1755782 is a reply to message #1755758] Wed, 08 March 2017 02:12 Go to previous message
Eclipse UserFriend
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?

[Updated on: Wed, 08 March 2017 03:14] by Moderator

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


Current Time: Wed Jul 23 08:20:29 EDT 2025

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

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

Back to the top