lutaml / lutaml-uml

UML module for LutaML
2 stars 2 forks source link

UML syntax: Package merge #33

Open ronaldtse opened 4 years ago

ronaldtse commented 4 years ago

Generalization VS Package merge

Screen Shot 2020-08-05 at 2 24 48 AM
package R {
  class A {
    y: int
  }
  class C
}

package P {
  class A {
    x: int
  }
  class B
  B -> A#aList[*]
}

R ...> (merge) P

Merging rules (transformation rules)

  1. The merge relationship is converted into a package import relationship, so private elements are not included in the package merge.

  2. A new (empty) classifier is created in the source package (R) for each classifier in the target package (P) that does not exist in the source package. Then a generlization relationship for equelly named classifiers in the target package is defined between all the classifiers in the source package. All features of the superclassifier are redefined in the respective subclassifier.

  3. Generalization relationships between classifiers in the target package are transferred to the corresponding classifiers in the source package.

  4. A subpackage by the same name is created in the source package for each subpackage in the target package, unless it already exists. Subsequently, a package merge relationship is defined between the equally named packages of both the source and the target packages.

  5. Package and element import relationships from the target package are transferred to the source package.

  6. Finally, all elements from the target package that cannot be generalized are copied to the source package and equipped with the same relationships to the other elements.

Screen Shot 2020-08-05 at 2 27 18 AM
package "R(Merge-Result)" {
class P::A { x:int }
class A {
  y: int
  x: int {redefines x}
}

class P::B
class B {
  generalizes P::B
}
class B -> (redefines aList) A

class C
}