Skip to main content



      Home
Home » Modeling » ATL » Issue with string comparison in helper...
Issue with string comparison in helper... [message #1817672] Wed, 27 November 2019 11:51 Go to next message
Eclipse UserFriend
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 14:52 Go to previous messageGo to next message
Eclipse UserFriend
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)
Re: Issue with string comparison in helper... [message #1817824 is a reply to message #1817682] Fri, 29 November 2019 13:18 Go to previous message
Eclipse UserFriend
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: Sun Jul 27 18:36:37 EDT 2025

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

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

Back to the top