Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Ignore Stereotypes of custom profile
Ignore Stereotypes of custom profile [message #1791269] Wed, 27 June 2018 10:38 Go to next message
Steven Schmock is currently offline Steven SchmockFriend
Messages: 8
Registered: June 2018
Junior Member
Hello everybody,

I'm trying to transform a UML model into an ECORE model. I have a custom profile where I have defined several stereotypes for uml elements. First I tried to get the names of all stereotypes that are applied. But only the sysml stereotype block is displayed and not my custom stereotypes. I tried to follow this instruction https://wiki.eclipse.org/ATL/Howtos#How_can_I_retrieve_tagged_values_from_stereotyped_UML_model_elements.3F, but it does not help. Would someone have a hint?

My ATL Code:

module Uml2EcoreTransformation;

create OUT: Documentation from IN: UML, INPROFILE: CustomStereotypes;

helper context UML!Element def: hasStereotype(stereotype: String): Boolean =
	self.getAppliedStereotypes() -> collect(st | st.name) -> includes(stereotype);

rule CustomList {
	from
		s: UML!Class --(s.hasStereotype('Block'))
	to
		t: Documentation !CustomList (
			name <- s.name + ' ' + s.getAppliedStereotypes() -> collect(e | e.name)
		)
}
]


My output:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:Documentation ="http:///Documentation .ecore">
  <Documentation :CustomList name ="class1 []"/>
  <Documentation :CustomList name ="class2 []"/>
  <Documentation :CustomList name ="class3 []"/>
  <Documentation :CustomList name ="class4 [Block]"/>
  <Documentation :CustomList name ="class5 [Block]"/>
  <Documentation :CustomList name ="class6 [Block]"/>
</xmi:XMI>


Thanks in advance

[Updated on: Wed, 27 June 2018 10:40]

Report message to a moderator

Re: Ignore Stereotypes of custom profile [message #1791324 is a reply to message #1791269] Thu, 28 June 2018 07:02 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 373
Registered: September 2012
Location: Belgium
Senior Member

Your code looks fine (except that loading "INPROFILE: CustomStereotypes;" does nothing useful). Are you sure UML can automatically load your applied profile? If possible, can you share a zipped up example eclipse project?

Cheers,
Dennis
Re: Ignore Stereotypes of custom profile [message #1791868 is a reply to message #1791324] Fri, 06 July 2018 10:49 Go to previous message
Steven Schmock is currently offline Steven SchmockFriend
Messages: 8
Registered: June 2018
Junior Member
Thanks Dennis,

that was the issue. UML could not load the applied profile automatically. I started it programmatically, where my input model has already loaded the applied profile and it works. :)
Previous Topic:Lazy Rules for nested Model elements
Next Topic:Input model element copied many times in target model
Goto Forum:
  


Current Time: Mon Sep 24 08:24:50 GMT 2018

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

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

Back to the top