Java Reference
In-Depth Information
Map's
title
attribute to the requirement
Model
's
title
attribute, as shown
here:
mapping
mindmap::Map::toRequirementsModel() : requirements::Model {
title :=
self
.title;
}
The left part of the assignment represents the object being instantiated by the
mapping, while the keyword
self
refers to the mappings's context object type.
To run and test this simple transformation, we have at least a couple options. We
can launch a runtime instance of our workbench, create a new project and
instance model for our Mindmap DSL, and invoke the transformation using a
launch configuration on the imported transformation. Or we can create a
dynamic instance of our mindmap and model in our development workspace and
test the transformation without launching. The second approach is easier, so
begin by opening the
mindmap.ecore
model in the default EMF editor, right-
clicking on the root element, and selecting
Create Dynamic Instance
. Save the
instance file as
Mindmap.xmi
in the
/model
folder of our mindmap DSL proj-
ect and enter some test instances. Right now, it's necessary only to set the title of
the
Map
object.
We need a launch configuration to invoke our QVT transformation on the
Mindmap.xmi
instance file. Select the
mindmap2requirements.qvto
file in
the navigator and, from
Run
Open Run Dialog
, create a new
Operational
QVT Interpreter
configuration. Locate our
Mindmap.xmi
file as the
IN
model in
Transformation parameters
, and specify a new model adjacent to the QVT file in
the
/transformations
folder, as shown in the dialog image in Section 6.5.4,
“Launch Configuration.”
From the
Run
menu, execute the transformation and observe the new
requirement model and trace file in the
/transformations
folder. We'd need
to open the created
mindmap.requirements
model in our runtime workbench
to use its generated editor, so for now you can simply open it in a text editor to
confirm that the contents look correct. Another option is to use the
Sample
Reflective Ecore Model Editor
. You can see that our requirements model
title
is set, corresponding to the value specified in your
Mindmap.xmi
model.
Next, we must determine the desired output structure of our requirements
model, given the structure of our input mindmap model. For convenience,
Figures 6-10 and 6-11 show simplified diagrams of each model.
→
Search WWH ::
Custom Search