A ModelLayer model lets you inspect the structural content of an MDriven modelâsuch as classes, attributes, associations, and state machinesâand is for developers creating model-aware tools, exports, or plugins.
What ModelLayer contains
ModelLayer is a meta-model: its instances describe another model rather than the business data handled by that model. For example, when your application model contains a Customer class with a Name attribute, ModelLayer contains metadata representing that class and attribute.
ModelLayer holds knowledge about:
- Classes
- Attributes
- Associations
- State machines
Use ModelLayer when you need the core structural definition of a model.
ModelLayer and ExtendedModelLayer
A model can also contain design-time information beyond its structural definition. This information is represented by ExtendedModelLayer, which extends ModelLayer.
| Meta-model | Contains | Example use |
|---|---|---|
| ModelLayer | Core model structure: classes, attributes, associations, and state machines. | Find every class with more than three attributes. |
| ExtendedModelLayer | ModelLayer content plus diagrams, ViewModels, report definitions, enterprise architecture information, and other extended design information. | List all ViewModels or inspect diagrams and tagged values. |
For example, an expression that queries classes and their attributes is evaluated against the meta-model:
Class.allinstances->select(c|c.Feature->filterontype(Attribute)->size>3)This expression returns classes that have more than three attribute features.
Use ModelLayer in a plugin
Use MDriven Designer to work with plugins. Open the plugin meta-model from File > Plugins > Open New Meta-model for Plugins. This opens the extended MDriven meta-model, allowing your plugin model to define ViewModels that query the model currently open in MDriven Designer.
For example, you can define a ViewModel that lists ViewModels by name:
Span.allinstances->orderby(name)The ViewModel executes against the ExtendedModelLayer instance that represents the user's current model. This lets you present information such as all constraints, all classes, or elements with a specified tagged value.
Export model information
You can also export model information for documentation and analysis. A MIF (Model Information File) export includes ViewModels, actions, classes and their content, and state machines in a ModelMeta model. The export also analyzes expressions and records what each expression uses, which provides cross-reference information.
For example, a ModelMeta viewer can show a ViewModel, its rendered view, and the model elements it uses. You can follow an attribute or association end to see where it is used elsewhere in the model.
