Skip to content

Changes

Heiko Klare edited this page Jun 24, 2022 · 2 revisions

Concept of the Change Metamodel

We provide a metamodel for change descriptions. It provides metaclasses for all changes that can be performed in Ecore-based metamodels. The metamodel focusses on atomic changes (those that can be expressed by the modification of a single model value) and also provides some compound changes that are of common interest. In the following, the conceptual contents of the metamodel are depicted.

Atomic Changes

  1. Existence Changes
    • Creation of an EObject
    • Deletion of an EObject
  2. Attribute Changes
    • Single-valued EAttributes
      • Replacement of attribute value
    • Multi-valued EAttributes
      • Insertion of an EAttributeValue
      • Removal of an EAttributeValue
  3. Reference Changes
    • Single-valued EReferences value
      • Replacement of an EReference value
    • Multi-valued EReferences
      • Insertion of an EReference value
      • Removal of an EReference value

Compound Changes

There are some compound changes that are essential as they provide further information about an Ecore change operation

  1. Unset Changes
    • Unsetting an EAttribute
      • Removes the value of the EAttribute or all values if it is multi-valued and sets an unset flag if the EAttribute is unsettable
      • Contains a list of EAttribute removal changes
    • Unsetting an EReference
      • Removes the value of the EReference or all values if it is multi-valued and sets an unset flag if the EReference is unsettable
      • Contains a list of arbitrary changes, as the removal of all references of an EReference can result in a cascade of arbitrary changes as the subtrees of contained elements are removed
  2. Move Changes
    • Moving an element from one EReference to another
    • Contains the EReference removal of the original container and the EReference insertion of the new container
    • There are no existence changes involved
    • Even on single-valued EReferences, the movement is only a removal or insertion, no replacement with another value

Some compound changes group changes that semantically belong together

  1. Create and insert EReference
    • Creation of an EObject and insertion into a multi-valued EReference
  2. Remove and delete EReference
    • Removal of an EReference from a multi-valued EReference and deletion of that EObject
  3. Create and replace and delete EReference
    • Creation of an EObject, replacement of a single-valued EReference with that value and deletion of the old EObject

Implementation of the Change Metamodel

In Vitruv, there are two kinds of changes. First, there is the metamodel for atomic changes with the root type EChange. It is extended by all other types of atomic changes. The VitruviusChange is a base interface for all kinds of composed changes in Vitruv, especially sequences of changes, transactions and so on, and consists of EChanges that describe that change. Next, we give a short overview about all changes types are processed within the Vitruv framework.

  • VitruviusChange: A base interface for all kinds of changes in Vitruv.
  • EChange: The smallest possible modification in a model (e.g., changing a property value). Such changes cannot be subdivided into two changes as they just affect a single value of a model.
  • CompositeChange: Composed of atomic changes.
  • TransactionalChange: Defines one or more EChanges, which have to be performed together. They were recorded together and have to be propagated to models completely or not at all.
  • CompositeContainerChange: A list of VitruviusChanges without transaction semantics.
  • Original Change: Performed by a user. It may trigger a consequential change due to consistency preservation.
  • Consequential Change: Triggered through consistency preservation based on an original change.
  • PropagatedChange: Contains an original and consequential changes.

Change Visualization

Vitruv provides an extension to visualize changes, both the originally performed ones and those performed by consistency preservation, in a table view. The extension can be installed from the updatesite or imported as an extension plugin from the main repository.

The plugin is used to view, store, load and search propagation results of VirtualModels. It is implemented in a separate frame using a tree. It can be started from within Eclipse and as an offline application with no dependency to Eclipse or Vitruv. The offline application is not able to receive new change propagations, its single purpose is to load and visuale saved change propagations. For further information about the plugin and its code, see the javadoc and comments there.

It is possible to toggle change visualization for a virtual model by right-clicking on the virtual model's project in the Eclipse package explorer, project explorer or sirius model explorer. Once activated, all changes are recorded and visualized in separate tabs of the ui if more than one virtual model is observed.

It is also possible to use the plugin in headless mode with no immediate visualization and store the results in a file for later usage. This can be accomplished by creating a ChangeVisualizationDataModel and making it monitor a VirtualModel calling startMonitoringRepositoryChanges(...). Calling saveToFile(File)after all changes have been recorded then persists them to a file. Opening theChangeVisualizationUI` standalone then allows to reload that file.

Change Comparison

Since the standard equals(Object) method only allows whether two changes are identical, not whether they are semantically equal even if they are two different instances, the interface VitruviusChange offers a method changedEObjectEquals(VitruviusChange) which checks whether the affected EObjects of this specific change are equal to the affected EObjects of the other change of the comparison.