An Autodiagram in MDriven Designer lets you inspect a class and all of its surrounding model relationships without manually maintaining a diagram; it is for anyone who needs to verify what the model contains.
What an Autodiagram shows
An Autodiagram is generated from the model. When you select a class, it shows that class and its surroundings completely, including its associations and the connected classes.
Use an Autodiagram to answer questions such as: What is connected to this class? and Did I remove the association from the model, or only from a diagram?
For example, if Car is associated with BrandOfCar, the Autodiagram for Car shows that association even if a manually composed diagram does not currently display it.
Autodiagram versus a diagram
A regular diagram is a curated view of the model. You decide which classes and which features to show. An Autodiagram is a generated model view centered on the selected class.
| View | What it contains | Typical use |
|---|---|---|
| Autodiagram | The selected class and its surrounding model relationships. | Inspect the actual model structure and confirm that associations exist. |
| Diagram | Only the model elements you have explicitly added to that diagram, with the features chosen for display. | Communicate a focused part of the model without showing every related element. |
You can have multiple regular diagrams, and a class can appear on any number of them. Removing a class from one diagram does not remove the class from the model. See MDrivenStart:MDrivenStart Diagrams for working with regular diagrams.
Open an Autodiagram
- Find the class in the Tree.
- Double-click the class to open its Autodiagram.
- Select different classes in the Autodiagram to inspect each class and its relationships.
- Use the back and forward arrows next to the play button in the top toolbar to return to earlier diagram views.
For a guided exercise, see Training:Bootcamp:Chapter 2.
Understand removal and deletion
The Delete key changes the current diagram view. It does not delete the selected class, association, or attribute from the model. This is intentional: you can make a regular diagram focused without losing model information.
Use Ctrl+Delete when you intend to delete the selected model element itself.
| Action | Result | How to verify |
|---|---|---|
| Select an association or class on a diagram and press Delete | Removes it from that diagram only. | Open the class from the Tree and inspect its Autodiagram. The model element remains. |
| Select an association, class, or other model element and press Ctrl+Delete | Deletes the model element. Deleting a class also deletes its attributes and associations. | Check the Tree and the Autodiagram; the deleted element is no longer present. |
Restore an association removed from a diagram
If you removed an association from a regular diagram with Delete, restore its visual representation without changing the model:
- Right-click the class on the diagram.
- Choose Introduce&Remove.
- Select Re-introduce removed associations.
The association returns because it was still present in the model.
Restore a class on a diagram
If you removed a class from a diagram, find the class in the Tree and drag it onto the diagram surface. Its associations can reappear with it.
Control which class features a regular diagram displays
A regular diagram can hide an attribute or another feature while the feature remains in the model. The Autodiagram continues to show model features, so it is useful for confirming that a hidden feature was not deleted.
For example, create two attributes on Class1. If you select attribute1 on a regular diagram and press Delete, that attribute disappears from that diagram's class display, while the Autodiagram still shows both attributes.
To show a hidden feature again:
- Right-click the class on the regular diagram.
- Choose Features/Pick Shown features.
- Find the feature, such as
attribute1. - Move it back to the shown features.
- Close the dialog.
Use Ctrl+Z to undo and Ctrl+Y to redo diagram changes while editing.
Read self-associations
A self-association is an association from a class back to the same class. For example, an Employee class may be associated with another Employee as that employee's manager.
In an Autodiagram, a class with a self-association appears three times. This is the generated layout used to make the association to the same class readable.
To create a self-association on a diagram:
- Select the association tool.
- Click and hold on the class, for example
Class1. - Release over empty diagram space to create a via point.
- Click in another empty position to add another via point.
- Move back over
Class1and click to complete the association. - Open the class Autodiagram and confirm that the self-association is shown.
Use Autodiagrams while modeling
Use this workflow whenever a diagram and the model appear to disagree:
- Open the class Autodiagram from the Tree.
- Confirm whether the class, association, or feature exists in the model.
- If it exists but is absent from a regular diagram, add the class again or use Introduce&Remove or Features/Pick Shown features to restore the required visual element.
- If it should no longer exist anywhere, select it and use Ctrl+Delete.
- Save the model with Ctrl+S.
An Autodiagram is a model-inspection view. Keep regular diagrams focused on the information that readers need, and use the Autodiagram to confirm the complete local structure.
