Book a Demo

Author Topic: Model transformation between MDG technologies  (Read 8287 times)

JoaoMoreira

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Model transformation between MDG technologies
« on: June 22, 2016, 01:32:50 am »
Hi,

I'm new on model transformation in EA and I have some questions:

1) Is there a full documentation of the language for transformations (used in the Transformation Editor)?

2) Is it possible to transform the elements from a diagram which follows a language I created (as MDG technology) to another language I created? 
For example, I created the languages TestUML1 and TestUML2 as two MDG technologies (separated). Now I want to be able to transform a set of stereotypes from TestUML1 (lets say Stereo1, Stereo2, Stereo3) to one stereotype of TestUML2 (StereoX). Therefore, I'd like to be able to automatically generate a diagram of TestUML2 from a diagram of TestUML1. Example:
I have one TestUML1 diagram with 3 classes, each set as a different stereotype: Class1 (<<Stereo1>>), Class2 (<<Stereo2>>), Class3 (<<Stereo3>>). The output of my transformation would be a TestUML2 diagram with 3 classes of the same stereotype: Class1 (<<StereoX>>), Class2 (<<StereoX>>), Class3 (<<StereoX>>).

Thanks.

Regards,

Joao Moreira


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Model transformation between MDG technologies
« Reply #1 on: June 22, 2016, 01:53:58 am »
The transformation language is just documented in EA's help. Good luck with that.

You are not transforming diagrams. You transform models - or parts of a model. In that respect you can transform anything to anything. However, if you RE some code, there's not much point in transforming that as a transformation shall always go from a higher to a lower abstraction and not between two identical abstraction levels (or even vice versa).

q.

JoaoMoreira

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Model transformation between MDG technologies
« Reply #2 on: June 22, 2016, 02:44:38 am »
Hi,

Thanks for the response!

1) Where exactly in the EA's help? You mean:
http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/software_engineering/codetemplatesyntax.html

Only that? I'm struggling with a basic concatenation for the the package name (File transformation type), I'd like to generate the package with the name as "Text text text " + sourcePackageName. Something like this:

Package
{
  name="SML elements from OntoUML: " + packageName
  namespaceroot="true"
%list="Namespace" @separator="\n\n" @indent="  "%
}

Obs: This code is resulting in a syntax error.


2) Thanks for the advice, but I would say that a transformation in the same abstraction level can be useful when the purposes of the languages are different. As Brambilla mentions in his book (chapter 8), exogenous transformations are not only usable for vertical transformations, but also for horizontal transformations. This is part of my PhD project: to automatically generate the elements from a context model in OntoUML (an ontological language) to define types of situations as complex rules in SML (Situation Modeling Language). If you have interest, please refer to these papers:
https://www.researchgate.net/publication/280641167_Developing_Situation-Aware_Applications_for_Disaster_Management_with_a_Distributed_Rule-Based_Platform
https://www.researchgate.net/publication/289251035_Towards_ontology-driven_situation-aware_disaster_management

So, TestUML1 refers to OntoUML and TestUML2 refers to SML MDG technologies. How can I define that the package to be generated is a SML package? Should I set it in the File transformation type within the Package element? How?

Thanks again.

Best,

Joao

PS: Is there an implemented example of a full transformation between two MDG technologies? This would ramp up my learning curve in MDE transformation in EA...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Model transformation between MDG technologies
« Reply #3 on: June 22, 2016, 04:45:10 am »
1) Basically that's it
2) We could start to argue. Transformation on the same level does not do anything. A transformation can only reduce abstractness and give the model a more concrete face. Anyhow, you should start by making a new transformation created from an existing one and stepwise modifying it. That way even I managed once to create a new transformation (honestly, I do not use it any longer and prefer using the API to achieve my goals).

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Model transformation between MDG technologies
« Reply #4 on: June 22, 2016, 09:03:07 am »
The template language by default everything is plain text.

The quote escapes below are my personal convention because although not strictly necessary make it clearer to me in non trivial examples.

Code: [Select]
Package
{
  name=%qt%SML elements from OntoUML: %packageName%%qt%
  namespaceroot="true"
%list="Namespace" @separator="\n\n" @indent="  "%
}

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Model transformation between MDG technologies
« Reply #5 on: June 22, 2016, 04:24:53 pm »
The better help page to start from is in fact writingtransformations.html.

The syntax is similar to the code template framework's, as is the basic execution structure (where you write templates that are called by the execution engine, but you have little control over the engine itself), but there's a bit more to model transformations.

/Uffe
My theories are always correct, just apply them to the right reality.

JoaoMoreira

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Model transformation between MDG technologies
« Reply #6 on: June 23, 2016, 04:36:04 am »
#Simon M:
Thanks for the code snipet, a nice first step! :) I think I got it now, resembles a little with ATL.

#Uffe:
Thanks for the link for the code template framework, it is helping a lot. The "MDA Transformations User Guide" is a good source too. This example also helped me:
https://dev.e-taxonomy.eu/trac/wiki/EnterpriseArchitect

#qwerty:
About (2), I know that in practice the majority of transformations are built for code generation and I respect your opinion, but I disagree with you and it is not what MDE theory says. One can transform UML to BPMN (e.g. class properties to data objects) or from Archimate to UML (e.g. business information level class to UML class), for example.

Briefely explaining my project:
OntoUML serves to define the context information, i.e. the elements to be perceived ("data objetcs"). E.g. patient, health unit, treatment.
SML serves to define the comprehension of situations, i.e. a situation identification mechanism. E.g. a fever situation reflects the rule of a patient having his body temperature greater than 37, where the patient class with the body temperature attribute is created in SML by the transformation from OntoUML.
After a validation and verification method (with http://www.menthor.net/) the code can be generated by other transformations, in different "flavors": (i) an adaptation of DRL (Drools Rule Language) with CEP extension and (ii) EPL (Event Processing Language) of Java ESPER. There are numerous theories and theses behind this project, the initial metamodels and transformations were built in EMF with ECore and ATL.
If you are interested in discussing that, I'd be glad to try to show that transformation in the same level does do something. But I don't think here in the forum is the appropriate place, I rather via Skype (id joao.luiz.rebelo.moreira) or Linkedin (https://br.linkedin.com/in/joão-luiz-rebelo-moreira-a5548418).

- Anyway, thanks for your suggestion! By following the existing transformations (e.g. WSDL and C#), I could advance. However, there is still an issue regarding the package stereotype in the File template. I wrote as:

Code: [Select]
Package
{
  name=%qt%Participants from OntoUML package: %packageName%%qt%
  stereotype="SML"

  %list="Namespace" @separator="\n\n" @indent=""%

}

The idea is to set the first diagram within the package as a SML diagram, showing the toolbox of SML. But, it creates a UML package diagram (when I open the diagram, the toolbox of UML package appears). In WSDL transformation, it uses stereotype="WSDLnamespace" and the diagram is generated as WSDL (when I open the diagram, the toolbox of WSDL appears). According to EA help, "The Stereotype elements use the Profile name as their namespace.", so I imagine that stereotype="SML" would be the correct way (it is the name of my profile).

- What is the API you mentioned? Sorry if it is a stupid question, I'm starting now with transformations in EA.

- In the transformation editor, how to delete trasnformation types that I created as tests?

Cheers!

Joao

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Model transformation between MDG technologies
« Reply #7 on: June 23, 2016, 06:14:00 am »
Maybe we could start a discussion on LinkedIn (UML Lovers or EA; though I rarely use LinkedIn once it cut me off from updates) or we can use this thread once your original issue has sufficient clarification. This is still a forum, so a place to talk...

q.

JoaoMoreira

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Model transformation between MDG technologies
« Reply #8 on: June 27, 2016, 10:35:52 pm »
Thanks for the response. I'd like to clarify these items:

1- There is still an issue regarding the package stereotype in the File template. I wrote as:

Code: [Select]
Package
{
  name=%qt%Participants from OntoUML package: %packageName%%qt%
  stereotype="SML"

  %list="Namespace" @separator="\n\n" @indent=""%

}

The idea is to set the first diagram within the package as a SML diagram, showing the toolbox of SML. But, it creates a UML package diagram (when I open the diagram, the toolbox of UML package appears). In WSDL transformation, it uses stereotype="WSDLnamespace" and the diagram is generated as WSDL (when I open the diagram, the toolbox of WSDL appears). According to EA help, "The Stereotype elements use the Profile name as their namespace.", so I imagine that stereotype="SML" would be the correct way (it is the name of my profile).

2- Is there an API for model transformations in EA? 

3- In the transformation editor, how to delete trasnformation types that I created as tests?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Model transformation between MDG technologies
« Reply #9 on: June 28, 2016, 02:57:02 am »
1- can't answer that
2- Yes. Look into ProjectInterface.Transform* methods
3- There's a Delete button bottom right of the edit window

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Model transformation between MDG technologies
« Reply #10 on: June 28, 2016, 09:29:39 am »
1. The transform engine doesn't allow you to define diagrams at all. There are a handle of built-in profiles that show a toolbox based on the package stereotype instead of a diagram type. But this isn't intended as a method for new profiles.
2. As already mentioned, you can call a transformation. You can also call an add-in from a template (search for EXEC_ADD_IN) You can't act on the generated package, there are no hooks for an add-in there.
3. To delete an entire transform you have to delete all the templates.