Refactoring mapping rules in mapping declarations

In an iterative development environment, changes might occur to the input or output metamodels that you specify in a mapping model of a model-to-model transformation. These changes might also affect the input and output objects that you specify in a mapping declaration, and might invalidate the corresponding mapping rules. If this situation occurs, you must refactor the mapping rules in the mapping declaration.

Before you begin

You must have a mapping model open. A mapping model has .mapping as a file name extension. The mapping model must contain at least one mapping declaration, which must contain at least one mapping rule.

About this task

When you open a mapping declaration whose source or target models have changed, the connector for an affected mapping rule does not connect the appropriate attributes of the input and output objects. The Project Explorer view displays an error adornment on the mapping model. Check the Problems view for detailed error information.

To refactor the mapping rules in a mapping declaration:

Procedure

  1. In the mapping editor area, right-click the name of the input or output object. The entire object is highlighted.
  2. Click Refactor > Replace Object.
  3. Specify the refactoring options by completing one of the following steps:
    • To reconnect mapping rules by using the names of the attributes in the input and output objects, click Reconnect existing mappings > Match by name only.
    • To reconnect mapping rules by using the names, type, multiplicity, and containment properties of the attributes in the input and output objects, click Reconnect existing mappings > Match by name, type, multiplicity, and containment.
    • To prevent the mapping editor from reconnecting the existing mapping rules, click Leave existing mappings disconnected. If you select this option, you must manually reconnect the input and output elements.
    • To delete the mapping rules, click Delete existing mappings.
    Note: For more information about the other fields on this page and the remaining pages in the wizard, see the context-sensitive help by pressing F1 when that page is displayed in the product. If you are using the Linux platform, for more information about the other fields on this page and the remaining pages in the wizard, see the context-sensitive help by pressing Shift+F1 when that page is displayed in the product.
  4. From the Element list, select the correct type of input or output object.
  5. Optional: From the Stereotype list, select the correct stereotype to apply to the input or output object.
  6. Click OK.

Results

The mapping rules in the mapping declaration are updated based on the option that you select.

Feedback