I’d like to do a model-to-model transformation. The target model would be UML activity diagrams, the source model is a rather obscure model and I’d have to create a meta model first. Both models are quite similar, so I’m sure that there shouldn’t be any huge problems.
However, I was wondering if Visual Paradigm is the right tool for me? Here is what I’d like to do: Provide an input diagram (in the form of a JSON or XML file) and generate an UML activity diagram based on that input. Is that something I can do in VP? If yes, how would I create my meta model for the source model?
You may use XML Importer + Transformation to import your data + convert them to be an Activity diagram. (But we just find a bug when prepare the following sample, and the bug is just fixed, the patch may be available in few days.)
How to do it:
— Preparation —
Prepares an XML to import your data to be VP’s GenericModel and GenericConnector.
Creates a DataTable to define your model type, properties.
And define the transformation schema of your model types.
Creates a dummy Activity Diagram to define the transformation schema of activity diagram.
Connects your 2 transformation schema.
— Operation —
Imports XML to create your meta-model into VP.
Performs transformation from your DataTable to an ActivityDiagram
How to do it (with image description):
— Preparation —
Prepares an XML to import your data to be VP’s GenericModel and GenericConnector.
PS:
Sorry, the above solution is quite complex.
(In fact, I never try to use DataTable to define a ‘relationship’. At least, on this solution, I haven’t try to define the generic connector is connected between which model types. And I am not sure can it be defined in the Data Table…)
On another hand, there is a simply solution that, you prepare an XML to specify the Action, ControlFlow, etc… directly.
In this solution, you don’t need to learn how to use the transformation schema. But you need to learn more details on the XML content of Activity Diagram & its model elements.
Peter, thank you so much. This is amazing, your effort is much appreciated. I’d have never expected such a detailed answer, this helps me A LOT. Thank you!!
The source model uses “sub processes” (those would be “Activity” in an activity diagram) and “activities” (I’ll call them activitiesSRC in order to prevent confusion). Those activitiesSRC are used to clarify what is happening in a sub process, so they are kind of like actions in an activity diagram (I hope you can follow me…).
So what I’ll have to do for the transformation is: IF activitiesSRC are used to define a sub process, transform that sub process into a structured activity node. then, place the activtiesSRC inside the structured activity node as actions. Otherweise, the sub processes will be transformed into actions.
Is it possible to use these kind of If-else statements in VP?
Once again, I’m very thankful for your help, Peter. I tried a few things today in order to figure it out but I wasn’t really successful so far.
if a ActivitiesSRC.isSubProcess
generate a StructuredActivityNode + an Action
else
generate an Action
if yes, you may try the following solution.
But sorry about that, I found a bug when I prepare the follow demo. It is just fixed and you can try it in coming patch. (I may post here if it is released, or it may be ready within these few days.)
How to do it
Same as the above --Preparation-- steps.
Creates a DataTable, to define your model type ActivitiesSRC with isSubProcess & self-relationship properties. the self-relationship is used to define a dummy self-relationship in a Sub-Process ActivitiesSRC.
Prepares the XML to import your ActivitiesSRC
If they are SubProcess, specifies a isSubProcess tagged value in the ActivitiesSRC,
and specifies a <GenericRefValue> to create a self-relationship The following sample contains SubProcess: A, B C, and simple action: D, E, F, G
Creates a dummy Activity Diagram to define the transformation schema of Activity Diagram. And define the transformation of ActivitiesSRC in the DataTable.