Reuse elements of another model in a MIM model
A MIM model often reuses elements of another party’s model, such as GeoObject from NEN 3610 or a datatype from ISO 19107. In MIM, such elements sit in an Extern package: a package that represents the other model. This guide shows how to fill an Extern from a model on ModelDesk and how to work with it afterwards.
Connected and unconnected packages
Section titled “Connected and unconnected packages”An Extern is in one of two states. Both are valid, and the model never warns about either.
- Unconnected: the package holds its own copies of the other model’s elements, the way Enterprise Architect and other tools write it. You can edit every copy, and the package is exported as it is. An Extern you create under Somewhere else, one from a MIM-XML import, or one that a mapping produced (such as UML to MIM from an Enterprise Architect file) starts unconnected. An Extern from a MIM-LD import is unconnected too; it holds copies of the elements the file describes and points at the elements the file only names.
- Connected: the package is linked to a model on ModelDesk and holds that model’s elements as they are in the version your model uses. You cannot edit them, because they belong to the other model.
Connecting pays off when the other model changes. When you move to a newer version of it, the elements in the package follow, and every attribute type, supertype or relation that points at them points at the new version. Your exports still write the full package that other tools expect; see Export a model with Extern packages.
To connect a package that already holds copies, see Connect an imported package.
Prerequisites
Section titled “Prerequisites”- A MIM model you can edit, and an active seat for MIM.
- The other model is a model on ModelDesk in your organization that your model may use, such as another MIM model.
Create an Extern for a model on ModelDesk
Section titled “Create an Extern for a model on ModelDesk”- Create an element at the top of your model, as in Create or import your first model, and choose the Extern type. The dialog asks Where is the model?
- Keep On ModelDesk (“Use its elements. You pick the version.”). To type in the elements yourself instead, choose Somewhere else (“Add the elements yourself.”), which gives the ordinary form and an unconnected package.
- Under Model, pick the model. Models your model already uses are listed first, under Used by this model.
- Under Which version to use, keep the latest published version or pick another. For a model your model already uses, this field instead says which version is in use (“Uses v2.0, as this model already does.”), and the package uses that version too. For a model your model reaches only through another model, it says “Already used through …, at the version they bring.”: your model then starts using it directly, at that same version.
- Check the Name, which is the model’s name, and the Location, which is filled in from where the model is published in the public catalog, else from where the model says it is found. Both stay editable. The location is the package’s locatie.
- Select Create.
The package appears in the tree, empty. If your model did not use the other model yet, that comes first, as a change of its own in your draft, and the package follows as the next change. Both can be undone and committed like your other edits; see Work in a draft and commit.
Pick an element of another model in a field
Section titled “Pick an element of another model in a field”You do not have to create the Extern first. A field that points at an element, such as an attribute’s type or an objecttype’s supertype, offers From another model… below its picker.
- In the element’s form, select From another model… under the field. The From another model dialog opens.
- Pick the Model and, for a model your model does not use yet, the version under Which version to use.
- Pick the Element. The list holds only elements the field accepts.
- Select Use. If your model did not use the other model yet, that goes into your draft now, as a change of its own. The element appears in the field.
- Select Save changes.
On saving, ModelDesk puts the element in an Extern for you:
- in the package that already holds it, if there is one;
- else in the first package connected to that model;
- else in a new package connected to that model, created at the top of your model.
The same happens wherever you point at an element of another model, for example when you connect elements on a diagram: the pickers there offer From another model… too. Built-in datatypes are not put in a package.
Add an element to a connected package
Section titled “Add an element to a connected package”The + on a connected package opens Select existing element. Its Element list offers only elements of the model the package is connected to. Pick one and select Link. You cannot create new elements in a connected package.
Move an element between packages
Section titled “Move an element between packages”When several packages are connected to the same model, you can move an element from one to another: drag it onto the other package, cut and paste it, or right-click it and choose Move to “…” with the name of the package. An element can only move between packages connected to the same model, and a connected package takes no elements of your own model.
Elements nothing uses
Section titled “Elements nothing uses”When nothing in your model points at an element of a connected package any more, the element stays in the package and its row in the tree is marked unused (“Nothing in this model uses it”). Remove it when you no longer want it in the package.
Why an element cannot be removed from a package
Section titled “Why an element cannot be removed from a package”If something in your model still points at the element, removing it from the package is refused. The dialog says ““GeoObject” is still used, so it stays in the package:” and lists what uses it. Point those uses elsewhere, or remove them, then remove the element. A connected package cannot be deleted either while it is the only package holding an element that is still used.
Disconnect a package
Section titled “Disconnect a package”Disconnecting turns the package back into an unconnected one, for example when you want to change the elements yourself.
- Right-click the package in the tree, or in its form open More actions, and choose Disconnect.
- The dialog says how many elements become copies you can edit, for example “12 elements become copies you can edit. This model keeps using “NEN 3610”.” Under References left out, it lists references the copies cannot keep, with the reason, such as “Points into a model this one doesn’t use”.
- Select Disconnect.
Each element becomes a copy as it is in the version your model uses, and everything that pointed at the element now points at the copy.
Move to another version of the other model
Section titled “Move to another version of the other model”You change the version your model uses in Model settings, under Dependencies; see Manage model settings. When the new version lacks elements that a connected package holds, ModelDesk warns before anything changes, in a dialog titled An element is not in this version or Some elements are not in this version. It lists each element with its package and what uses it. An element whose attribute or other part your model uses, and which the new version no longer has, is listed too, with “Its part “…” is gone.” Under References left out, the dialog names references the copies cannot keep, with the reason. Select Keep it as a copy or Keep them as copies to go ahead: each missing element stays in its package as an editable copy of the version you used until now, and its uses keep pointing at it. Cancel changes nothing.
Stop using the other model
Section titled “Stop using the other model”You cannot remove the other model in Model settings while a package is connected to it. Remove dependency opens Packages are connected to this model, which says “These packages are connected to “NEN 3610”. Disconnect them first.” and names the packages. A package in the model you have open has Disconnect beside it; a long list ends with “and 3 more”. Disconnect them, then remove the model.
Export a model with Extern packages
Section titled “Export a model with Extern packages”Exports write a connected package in full, the way other tools expect it, and an unconnected package as it is:
- MIM-XML writes every element of the package in full.
- MIM-LD writes every element of a connected package in full, under the element’s own identifier, so the package matches the model it represents. An unconnected package is written as it is.
- XMI, through a mapping from MIM to UML (see Transform a model to another standard), writes every element of a connected package in full, with its attributes.
When two packages hold the same element, it is written once, under the first of them in the tree.
When an attribute type, supertype or relation points at an element of another model that no package holds, an export through a mapping leaves that reference out and says so in the Export log of the Export model dialog. The entry names the element, what it points at and the reference, and ends “…is left out of the result. Add the element to a package that represents that model.” To fix it, put the element in a package: take the offer in Model settings (see Manage model settings), or add it with the + on a package connected to that model. Commit the change, because an export uses main as it is committed.
If this goes wrong
Section titled “If this goes wrong”- The dialog does not ask Where is the model? The model’s MIM version does not support connected packages yet, or you are creating a type other than Extern.
- The model you want is not in the list. Only models of your organization that your model may use are offered. A model of another standard is offered only when MIM allows it.
- The package’s menu has no Connect to a model… or Disconnect. You can only read this model, or the package is not an Extern.
- “This model uses “NEN 3610” only through another model.” The models your model uses changed while the dialog was open. Close it and try again, or select Make direct on that model’s row in Model settings first; see Manage model settings.
- ““NEN 3610” is of a kind this model can’t use.” or ““NEN 3610” no longer exists, or you no longer have access to it.” Pick another model.
- “This package is connected already.” or “This package is not connected any more.” The package changed after the dialog opened. Close it and open it again from the package.
- “This model now uses “NEN 3610”, but the rest was not saved: …” The first change went into your draft, the package or element did not. Read the reason, then try again; the model is not added twice.
- “A member can only move to another package connected to the same model.” You dropped an element on a package connected to another model, or on an unconnected package.
- “This package only takes elements of the model it is connected to.” You pasted or dropped an element of your own model, or of another model, on a connected package.
Related pages
Section titled “Related pages”- Connect an imported package: connect a package that holds copies.
- Manage model settings: the models your model uses, and their versions.
- Models, elements & properties: how a model uses elements of another.
- Export a model: MIM-XML and MIM-LD exports.