Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Issue with string comparison in helper...
Issue with string comparison in helper... [message #1817672] Wed, 27 November 2019 16:51 Go to next message
Olivier Hurez-Martin is currently offline Olivier Hurez-MartinFriend
Messages: 20
Registered: May 2019
Junior Member
Hello,

Using ATL 4.1.0 installed on Eclipse 2019-09.

I found out that the following helpers always return false, regardless of whether the qualified name of the UML type received from context equals the constant string hardcoded in the helper (as verified using debug statements, which also prove the helper is triggered, while traces in the caller show the returned value is always false):


-- Check for high level SysML UML stereotypes

helper context UML!Element def: isSysMLBlockStereotyped() : Boolean = 
	self.getAppliedStereotypes()->exists(s | let qn : String = s.getQualifiedName() in (qn.debug('STEREOTYPE') = 'SysML::Blocks::Block'));
	--self.getAppliedStereotypes()->exists(s | s.getQualifiedName() = 'SysML::Blocks::Block');

helper context UML!Element def: isSysMLConstraintBlockStereotyped() : Boolean =
	self.getAppliedStereotypes()->exists(s | s.getQualifiedName() = 'SysML::Constraints::ConstraintBlock');

helper context UML!Element def: isSysMLPortStereotyped() : Boolean =
	self.getAppliedStereotypes()->exists(s |
		let qn : String = s.getQualifiedName() in (
			(qn = 'SysML::PortAndFlows::FlowPort') or
			(qn = 'SysML::DeprecatedElements::FlowPort') or
			(qn = 'SysML::PortAndFlows::FullPort') or
			(qn = 'SysML::PortAndFlows::ProxyPort'))
	);

helper context UML!DataType def: isValueTypeStereotyped() : Boolean = 
	self.getAppliedStereotypes()->exists(s | s.getQualifiedName() = 'SysML::Blocks::ValueType');



Isn't this a valid way to test for stereotypes with ATL?

Thanks,

-- OHM.

Re: Issue with string comparison in helper... [message #1817682 is a reply to message #1817672] Wed, 27 November 2019 19:52 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

I've check for applied stereotypes like this before:

helper context UML2!"uml::Classifier" def : isObservable : Boolean =
	not self.getAppliedStereotype('Observer::Observable').oclIsUndefined();


(See https://github.com/dwagelaar/UML2CaseStudies/blob/master/uml2cs-transformations/transformations/UML2Observer.atl#L26)


Cheers,
Dennis
Re: Issue with string comparison in helper... [message #1817824 is a reply to message #1817682] Fri, 29 November 2019 18:18 Go to previous message
Olivier Hurez-Martin is currently offline Olivier Hurez-MartinFriend
Messages: 20
Registered: May 2019
Junior Member
That worked... Thank you Dennis!

Out of curiosity: any idea why the expressions in the original post won't work?

Thanks,

-- Olivier.

Previous Topic: executon of atl with java program :Problem with =loading BPMN resource
Next Topic:Need help with programmatic ATL module loading...
Goto Forum:
  


Current Time: Sat Nov 11 08:18:17 GMT 2023

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

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

Back to the top