Prev | Next |
Model Transformation
One of the great advantages of creating models is the ability to manipulate them to produce outputs, thus saving time and reducing the possibility of errors. Enterprise Architect implements Model Driven Architecture (MDA) transformations using a flexible and fully configurable template system. The templates act as instructions to a machine that takes a model as input and transforms it to a more resolved model as output. The input could be a large and complex model or a single element and one input model could be transformed to a variety of output models.
The transformations are commonly unidirectional and take a Platform Independent Model (PIM) and transform it to one or more Platform Specific Models (PSM). A good example of where this is useful is where a system must be implemented in a number of different relational database systems. A single platform independent conceptual model (the PIM) could be transformed to a number of platform specific models, say Oracle, MySQL and SQLite. As a further productivity boost, once the output models are produced they can also be converted to programming code, database definition language or schemas. Enterprise Architect automatically creates traceability that can be used to visualize how elements in the input model have been transformed to elements in the output model.
Facilities
Ready-built Transformations
The Enterprise Architect installer includes a number of basic built-in transformations, including:
- PIM to:
- C#
- C++
- DDL table elements
- EJB Entity Bean
- EJB Session Bean
- Java
- PHP
- VB.Net
- XSD - Data Model to Entity Relationship diagram (ERD)
- Entity Relationship diagram (ERD) to Data Model
- Sequence diagram to Communication diagram
- Communication diagram to Sequence diagram
- Java model to JUnit test model
- .NET model to NUnit test model
- WSDL interface model to WSDL
Further transformations will become available over time, either built in or as downloadable modules from the Sparx Systems website.
Customized Transformations
You can modify the built-in transformations or define your own, using Enterprise Architect's simple code generation template language. This involves little more than writing templates to create a simple intermediary source file; the system reads the source file and binds that to the new PSM.
Transformation Dependencies
When you execute a transformation, the system creates internal bindings (Transformation Dependencies) between each PSM created and the original PIM. This is essential, providing the ability to forward synchronize from the PIM to the PSM many times, adding or deleting features as you go; for example, adding a new attribute to a PIM Class can be forward synchronized to a new column in the Data Model.
You can observe the Transformation Dependencies for a Package using the Traceability window, to check the impact of changes to a PIM element on the corresponding elements in each generated PSM, or to verify where a change required in a PSM should be initiated in the PIM (and also to reflect back in other PSMs). The Transformation Dependencies are a valuable tool in managing the traceability of your models.
Enterprise Architect does not delete or overwrite any element features that were not originally generated by the transform; therefore, you can add new methods to your elements, and Enterprise Architect does not act on them during the forward generation process.
Example of a Transformation
This diagram highlights how transformations work and how they can significantly boost your productivity.
Notes
Learn more