6.3 Model integration and reuse
One of the most powerful features of MetaEdit+ is that you can
integrate metamodels and design information based on them. Basically, the
integration features allow you to link and reuse data across
different languages, maintaining a flow of information between different
languages.
By linking we mean that you can link object elements to
other graphs. Linking of objects to graphs is accomplished by using either
decomposition structures or explosion. An example of decomposition can be found
from the Watch example in which a state in a WatchApplication model can be
decomposed into a subdiagram. Also, most of the class diagrams found in
MetaEdit+ support decomposition of objects and their relationships into new
graphs.
Another important feature is
reuse
. You can reuse
either:
 | whole
objects,
or |
 | properties. |
Reuse
of an object means that you can use the same design information stored in the
object in other graphs, even if they are in different projects. In line with the
principles of reuse, if you change the specifications of the reused object in
one graph, it automatically updates changes to other graphs even if they were
originally made with a different modeling language.
To test reuse of objects:
1) | Open
a graph with any tool (i.e. Diagram Editor, Matrix Editor, Table
Editor) |
2) | Select
the Add Existing...
command. |
3) | Select
any object from the dialog that opens.
|
Reuse of properties allows a more
detailed reuse option: you do not need to reuse whole objects but you can
instead just reuse some of the object’s properties. For example, a message
name in an object diagram can be shared as the method name of another
object.
To try out reuse of properties:
1) | Open
a dialog for any existing object or relationship in any
tool. |
2) | Move
the cursor to the field to be reused (text
field). |
3) | Open
a pop-up menu by pressing the right mouse button and select Share
Property....
|
4) | Select
any text specification to be shared from the dialog that
appears. |
After property sharing the
object refers to the shared property and therefore any changes to the property
will affect that property in every place where it is
used.
Property sharing
A particular property can be shared between two or more
non-properties, meaning that changes to the property via one non-property are
also reflected in the other non-properties. Therefore the property is basically
defined only once and several properties refer to the same value. For this to be
possible, the property in each of them which is to be common must have the same
property type, and the data type of that property type must be string, number,
or text.
This can be used in e.g. class diagrams, so that a
‘Superclass’ string property in one class can be shared with the
‘Class name’ string property in the superclass. Thus if the
‘Class name’ of the superclass is changed, this will also be
reflected in the ‘superclass’ property of the subclass. (Another,
better way of achieving the same result would be to have Superclass property
with a Non-property data type of Class: that way the whole superclass can be
linked, not just its name).
The property sharing can be accessed through property
dialogs by clicking the property field and selecting
Share Property...
from the pop-up menu (see Section
3.3.1 to see how property sharing can be
accessed). Note that if you change the property value in one place all other
non-properties that have that property will show the changed value as
well.
To remove property sharing, select the shared field and
choose Remove Sharing from the pop-up menu. Therefore, by making both
commands one after another you can copy property values from other
non-properties, and remove the sharing so changes to one no longer affect the
other.