🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Rename a class in your model using the model debugger
This page was created by Wikiadmin on 2026-07-29. Last edited by Wikiadmin on 2026-07-29.

You can rename a class and update many references to its old name by using EAL in the model debugger; this how-to is for MDriven Designer users maintaining an existing model.

Use this procedure when a manual class rename leaves references in association-end names, actions, or ViewModels. The model debugger works on the model's own meta-model, so you can search and change model metadata with OCL and EAL expressions. For the background and debugger access, see Documentation:Using the model debugger to change the model itself.

Before you start

This is a text replacement procedure. It replaces every occurrence of the old text in the selected metadata property; it does not decide whether each occurrence was intended to refer to the class.

For example, this page changes CalendarView to ViewSetting. Replace both example strings in every expression with the names in your own rename.

The expressions below cover common locations, not every possible place where a class name can occur. Run them in small groups and validate after each group. Model validation shows unresolved references and other model errors that remain after the rename; see Documentation:Check model error.

Rename the class and validate

  1. In MDriven Designer, rename the class manually. For example, rename CalendarView to ViewSetting.
  2. Run model validation by selecting the green check mark at the top of the model design window.
  3. Review the validation errors. They identify references that still use the old class name.
  4. Right-click a diagram background and select Extras then Open Model Debugger....
  5. In the model debugger, add an expression as an Action, paste one expression from the sections below, and execute it. The debugger can execute the expression against the model itself.
  6. Close the model debugger and run model validation again.
  7. Continue with the next relevant expression until the model validates. Inspect each remaining error and either update it manually or adapt a search-and-replace expression for the metadata type involved.

Update association-end names

Association ends are the named ends of links between classes. Run this expression when an association-end name contains the old class name.

AssociationEnd.allInstances->select(a|a.Name.Contains('CalendarView'))->collect(a|a.Name := a.Name.Replace('CalendarView', 'ViewSetting'))

For example, an association end named CalendarViewItems becomes ViewSettingItems.

Update attribute names

Run this expression when attribute names include the old class name.

Attribute.allInstances->select(a|a.Name.Contains('CalendarView'))->collect(a|a.Name := a.Name.Replace('CalendarView', 'ViewSetting'))

For example, an attribute named CalendarViewTitle becomes ViewSettingTitle.

Update action expressions

Actions can contain the old class name in the expression they execute or in the expression that identifies the ViewModel root object. Run the applicable expressions below.

ExecuteExpression

AbstractAction.allInstances->select(aa|aa.ExecuteExpression.Contains('CalendarView'))->collect(aa|aa.ExecuteExpression := aa.ExecuteExpression.Replace('CalendarView', 'ViewSetting'))

ViewModelRootObjectExpression

AbstractAction.allInstances->select(aa|aa.ViewModelRootObjectExpression.Contains('CalendarView'))->collect(aa|aa.ViewModelRootObjectExpression := aa.ViewModelRootObjectExpression.Replace('CalendarView', 'ViewSetting'))

For example, an action expression that refers to CalendarView is changed to refer to ViewSetting. Validate immediately after changing action expressions so that invalid OCL references are visible.

Update ViewModel metadata

In the model meta-model, a ViewModel is represented by Span. Use the following expressions to update ViewModel names, variables, and columns.

ViewModel names

Span.allInstances->select(s|s.Name.Contains('CalendarView'))->collect(s|s.Name := s.Name.Replace('CalendarView', 'ViewSetting'))

For example, CalendarViewEdit becomes ViewSettingEdit.

ViewModel variables

SpanVariable.allInstances->select(sv|sv.Name.Contains('CalendarView'))->collect(sv|sv.Name := sv.Name.Replace('CalendarView', 'ViewSetting'))

Column expressions

Column.allInstances->select(c|c.Expression.Contains('CalendarView'))->collect(c|c.Expression := c.Expression.Replace('CalendarView', 'ViewSetting'))

Column names

Column.allInstances->select(c|c.Name.Contains('CalendarView'))->collect(c|c.Name := c.Name.Replace('CalendarView', 'ViewSetting'))

Finish the rename

When the model validates, inspect the renamed class, its links, relevant actions, and affected ViewModels. Then save the model as usual.

If validation still reports old references, use the error to identify the remaining metadata location. The model debugger lets you inspect and alter model elements directly; use the same staged approach rather than applying an unreviewed replacement across unrelated metadata.

Related model-debugger tasks

Use the model debugger for other metadata maintenance tasks as well. For example, add or remove tagged values with EAL. If validation identifies an orphaned action, follow Documentation:Action must have a name.

See also