Jump to: navigation, search

Difference between revisions of "EMF Compare/UML Compare"

(Class diagram)
(UML2 engine)
(43 intermediate revisions by one other user not shown)
Line 114: Line 114:
 
* First we have to provide our own IMatchScopeProvider implementation (or GenericMatchScopeProvider subclass) to also provide our own IMatchScope implementation to ignore EObject in the direct contents of the resources corresponding to stereotype applications. This test will be implemented in the isInScope() method of the IMatchScope.
 
* First we have to provide our own IMatchScopeProvider implementation (or GenericMatchScopeProvider subclass) to also provide our own IMatchScope implementation to ignore EObject in the direct contents of the resources corresponding to stereotype applications. This test will be implemented in the isInScope() method of the IMatchScope.
 
* Second, we have to extend the internal contents of the base EObject with the stereotype application EObject in order to match base EObject with all their properties (including the ones from the applied stereotypes).
 
* Second, we have to extend the internal contents of the base EObject with the stereotype application EObject in order to match base EObject with all their properties (including the ones from the applied stereotypes).
 +
 +
{| border="1"
 +
|-
 +
! Diff type !! Detection !! Label/Image Provider !! Merger
 +
|-
 +
| Stereotype application addition ||style="background:#709989;" | Done ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| Stereotype application removal ||style="background:#709989;" | Done ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| Stereotype attribute update ||style="background:#709989;" | Done ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| Stereotype attribute addition ||style="background:#709989;" | Done ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| Stereotype attribute removal ||style="background:#709989;" | Done ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| Stereotype reference addition ||style="background:#709989;" | Done ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| Stereotype reference removal ||style="background:#709989;" | Done ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| Stereotype reference order change ||style="background:#709989;" | Done ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| Stereotype reference update ||style="background:#709989;" | Done ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|}
  
 
= UML Extensions =
 
= UML Extensions =
 +
 +
The following tables list if elements from all papyrus supported diagrams need to be handled by an specific extension in the UML Comparison engine.
 +
 +
* <span style="color:#ffffff; background:#709989;">No, means there is no need to implement an extension</span>
 +
* <span style="background:#FFEC6D;">?, means it is still unknown if it needs an extension (because we did not find a way to create the element from the Papyrus editor)</span>
 +
* <span style="background:#CC6A73;">TODO, means it needs to be implemented as an extension</span>
 +
* <span style="color:#ffffff; background:#709989;">Done, means it has been implemented as an extension</span>
  
 
== Class diagram ==
 
== Class diagram ==
Line 127: Line 157:
 
| ClassifierTemplateParameter ||style="background:#709989;" | No ||style="background:#709989;" | No
 
| ClassifierTemplateParameter ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
| Comment ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
+
| Comment ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
 
| Component ||style="background:#709989;" | No ||style="background:#709989;" | No
 
| Component ||style="background:#709989;" | No ||style="background:#709989;" | No
Line 137: Line 167:
 
| DurationObservation ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 
| DurationObservation ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 
|-
 
|-
| Enumeration ||style="background:#FFEC6D;" | No ||style="background:#FFEC6D;" | No
+
| Enumeration ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
 
| EnumerationLiteral ||style="background:#709989;" | No ||style="background:#709989;" | No
 
| EnumerationLiteral ||style="background:#709989;" | No ||style="background:#709989;" | No
Line 147: Line 177:
 
| PrimitiveType ||style="background:#709989;" | No ||style="background:#709989;" | No
 
| PrimitiveType ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
| Model ||style="background:#FFEC6D;" | No ||style="background:#FFEC6D;" | No
+
| Model ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
| Operation ||style="background:#FFEC6D;" | No ||style="background:#FFEC6D;" | No
+
| Operation ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
 
| OperationTemplateParameter ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 
| OperationTemplateParameter ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
Line 155: Line 185:
 
| Package ||style="background:#709989;" | No ||style="background:#709989;" | No
 
| Package ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
| Property ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
+
| Property ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
 
| Reception ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 
| Reception ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
Line 181: Line 211:
 
! Removal
 
! Removal
 
|-
 
|-
| Abstraction ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| Abstraction ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| Association ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| Association ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| AssociationBranch ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| AssociationBranch ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| AssociationClass ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| AssociationClass ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| ContainmentLink ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| ContainmentLink ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| Dependency ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| Dependency ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| DependencyBranch ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| DependencyBranch ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
 
| ElementImport ||style="background:#709989;" | No ||style="background:#709989;" | No
 
| ElementImport ||style="background:#709989;" | No ||style="background:#709989;" | No
Line 199: Line 229:
 
| Generalization ||style="background:#709989;" | No ||style="background:#709989;" | No
 
| Generalization ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
| GeneralizationSet ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| GeneralizationSet ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
 
| InstanceSpecificationLink ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 
| InstanceSpecificationLink ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 
|-
 
|-
| InterfaceRealization ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| InterfaceRealization ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| Link ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
+
| Link ||style="background:#709989;" | No ||style="background:#709989;" | No
 
|-
 
|-
 
| PackageImport ||style="background:#709989;" | No ||style="background:#709989;" | No
 
| PackageImport ||style="background:#709989;" | No ||style="background:#709989;" | No
Line 215: Line 245:
 
| cf. profile support
 
| cf. profile support
 
|-
 
|-
| Realization ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| Realization ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| Substitution ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| Substitution ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| Usage ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| Usage ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
| TemplateBinding ||style="background:#709989;" | No ||style="background:#709989;" | No
+
| TemplateBinding ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|}
 
|}
  
Line 237: Line 267:
 
! Edges !! Addition !! Removal
 
! Edges !! Addition !! Removal
 
|-
 
|-
| Dependency ||style="background:#CC6A73;" | TODO ||style="background:#CC6A73;" | TODO
+
| Dependency ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|-
 
|-
 
| PackageImport ||style="background:#709989;" | No ||style="background:#709989;" | No
 
| PackageImport ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|}
 +
 +
== Composite diagram ==
 +
 +
{| border="1"
 +
|-
 +
! Nodes !! Addition !! Removal
 +
|-
 +
| Port ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Collaboration ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| CollaborationRole ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| CollaborationUse ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| InformationItem ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Parameter ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Activity ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Interaction ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ProtocolStateMachine ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| StateMachine ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| FunctionBehavior ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| OpaqueBehavior ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|}
 +
 +
{| border="1"
 +
|-
 +
! Edges !! Addition !! Removal
 +
|-
 +
| Connector ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| RoleBinding ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 +
|-
 +
| Representation ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| InformationFlow ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|}
 +
 +
== Use case diagram ==
 +
 +
{| border="1"
 +
|-
 +
! Nodes !! Addition !! Removal
 +
|-
 +
| Subject ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Actor ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| UseCase ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|}
 +
 +
{| border="1"
 +
|-
 +
! Edges !! Addition !! Removal
 +
|-
 +
| Include ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Extend ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| ConstrinedElement ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|}
 +
 +
== Sequence diagram ==
 +
 +
{| border="1"
 +
|-
 +
! Nodes !! Addition !! Removal
 +
|-
 +
| Lifeline ||style="background:#709989;" | No || style="background:#709989;" | No
 +
|-
 +
| ActionExecutionSpecification ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| BehaviorExecutionSpecification ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| InteractionUse ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| CombinedFragment ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| InteractionOperand ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Continuation ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 +
|-
 +
| StateInvariant ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| CoRegion ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| TimeConstraint ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| DurationConstraint ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| DestructionEvent ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|}
 +
 +
{| border="1"
 +
|-
 +
! Edges !! Addition !! Removal
 +
|-
 +
| MessageSync ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| MessageAsync ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| MessageReply ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| MessageCreate ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| MessageDelete ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| MessageLost ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| MessageFound ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 +
|-
 +
| GeneralOrdering ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 +
|-
 +
| CommentLink ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ConstraintLink ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|}
 +
 +
== Activity diagram ==
 +
 +
{| border="1"
 +
|-
 +
! Nodes !! Addition !! Removal
 +
|-
 +
| InitialNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ActivityNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| FlowFinal ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| DecisionNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| MergeNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| JoinNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ForkNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ActivityParameterNode ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 +
|-
 +
| DataStoreNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| OpaqueAction ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| CallBehaviorAction ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 +
|-
 +
| CallOperationAction ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 +
|-
 +
| SendObjectAction ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| SendSignalAction ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 +
|-
 +
| AcceptEventAction ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 +
|-
 +
| ValueSpecificationAction ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ReadSelfAction ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| InterruptibleActivityRegion ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| StructuredActivityNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ConditionalNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ExpensionRegion ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| LoopNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| SequenceNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| OutputPin ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| InputPin ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ActionInputPin ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ValuePin ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| InputExpansionNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| OutputExpansionNode ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| LocalPreconditionConstraint ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| LocalPreconditionIntervalConstraint ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| LocalPreconditionDurationConstraint ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| LocalPostconditionConstraint ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| LocalPostconditionIntervalConstraint ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| LocalPostconditionDurationConstraint ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| LocalPostconditionTimeConstraint ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Activity ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|}
 +
 +
{| border="1"
 +
|-
 +
! Edges !! Addition !! Removal
 +
|-
 +
| ControlFlow ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ObjectFlow ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ExceptionHandler ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Link ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|}
 +
 +
 +
== State diagram ==
 +
 +
{| border="1"
 +
|-
 +
! Nodes !! Addition !! Removal
 +
|-
 +
| Region ||style="background:#FFEC6D;" | ? ||style="background:#709989;" | No
 +
|-
 +
| State ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Initial ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| FinalState ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ShallowHistory ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| DeepHistory ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Fork ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Join ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Choice ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Junction ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| EntryPoint ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ExitPoint ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| Terminate ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|-
 +
| ConnectionPointReference ||style="background:#FFEC6D;" | ? ||style="background:#FFEC6D;" | ?
 +
|}
 +
 +
{| border="1"
 +
|-
 +
! Edges !! Addition !! Removal
 +
|-
 +
| Transition ||style="background:#709989;" | No ||style="background:#709989;" | No
 +
|}
 +
 +
== Communication diagram ==
 +
 +
{| border="1"
 +
|-
 +
! Nodes !! Addition !! Removal
 +
|}
 +
 +
{| border="1"
 +
|-
 +
! Edges !! Addition !! Removal
 +
|-
 +
| Message ||style="background:#709989;" | Done ||style="background:#709989;" | Done
 
|}
 
|}
  
 
= Merger =
 
= Merger =
  
= Testing support =
+
Ther merger of extensions are traditionnaly provided by the AbstractDiffExtension#provideMerger() method. But, as we said in section [#Builtin_extension_mechanism],
 +
this a poor subsitute compare the the IMergerProvider extension point.
 +
 
 +
If we choose to do that, we have to change the behavior of the API method
 +
MergeFactory#createMerger(DiffElement)
 +
to avoid the specific handling of DiffExtension.
 +
 
 +
'''TODO: check if it needs to be in v2.0 or can be in 1.2'''
 +
 
 +
= Example screenshots of the UML2 comparison engine against generic one =
 +
 
 +
== UML Association ==
 +
 
 +
=== Generic engine ===
 +
 
 +
[[Image:Association-generic.png]]
 +
 
 +
=== UML2 engine ===
 +
 
 +
[[Image:Association-uml2.png]]
 +
 
 +
== UML Stereotype application ==
 +
 
 +
=== Generic engine ===
 +
 
 +
[[Image:StereotypeApplication-generic.png]]
 +
 
 +
=== UML2 engine ===
 +
 
 +
[[Image:StereotypeApplication-uml2.png]]
 +
 
 +
== UML Stereotype reference (tagged value) change ==
 +
 
 +
=== Generic engine ===
 +
 
 +
[[Image:StereotypeReference-generic.png]]
 +
 
 +
=== UML2 engine ===
 +
 
 +
[[Image:StereotypeReference-uml2.png]]
 +
 
 +
== UML message (sequence diagram) ==
 +
 
 +
=== Generic engine ===
 +
 
 +
[[Image:Message-generic.png]]
 +
 
 +
=== UML2 engine ===
 +
 
 +
[[Image:Message-uml2.png]]
 +
 
 +
[[Category:Modeling]] [[Category:EMF Compare]]

Revision as of 02:50, 18 October 2012

The primary goal of this section is to provide technical specification of the UML Comparison engine. This engine will provide support of UML specific concepts and operations.

Overview

There are two ways of implementing UML Compare engine:

  • Use the provided extension mechanism and override the visit() method to implement UML specific difference semantic
  • Implement our own Diff/Match Engine (or override Generic Diff/Mathc engine if suited) to implement specific diff detection.

The first one should be simpler as it uses a builtin mechanism of EMFcompare but with less ability to get out of the border of what it had been designed for while the second one would let us define whatever we want but with an increased implementation complexity.

We now detail the two options, their pros and cons, and finally conclude and propose a solution.

Builtin extension mechanism

The extension mechanism is not working in essence. The mechanism work as follow:

  • In your extending Ecore, you define a subclass of the EClasses AbstractDiffExtension and DiffElement (or any of its subclasses).
  • You generate the code of this Ecore, and implement the visit(DiffModel), getText(), getImage(), provideMerger() methods.
  • When the DiffService.doDiff() is called, diff is realized by the best suited diff engine within the registered ones.
  • Once the diff is over, for each registered AbstractDiffExtension, the visit() method is called.

There are two problems:

  • AbstractDiffExtension are instantiated only once. How can we assume we will only get one difference of that kind in the model? That's dumb and not working.
  • Even if AbstractDiffExtension is to instantied the correct number of time, the visit() method is taking the whole diff model as input. It has to be browsed for each extension. It will not scale.

The good parts of this mechanism come from AbstractDiffExtension#hideElements reference and its opposite DiffElement#isHiddenBy. It provides a neat solution to hide differences created by generic engines as it taken into account by the GUI.

The AbstractDiffExtension#provideMerger() are also a good idea as it let us provide our own merger to the framework. But it is best to provide the mergers through the IMergerProvider extension point.

The AbstractDiffExtension#getText(), AbstractDiffExtension#getImage() are bad idea. Why does EMF compare not use the edit framework and its providers to display labels and images? Even for extension, it can work!

Implements specific Diff/Match engine

The GenericXXXEngine (where XXX is Match or Diff) implementations provide useful base implementation of EMF model comparison. Then we will use it as our direct superclass.

The core algorithm is quite well splitted into several method and some of them are protected to allow subclassing. We can change the reference/attribute checker to avoid the comparison of certain features. The main point is that we are able to make some post processing by browsing the DiffModel only once! It will scale much more than the extension mechanism.

Conclusion

We will use the best of the two worlds: extension mechanism for out of the box UI support of diff extension and subclass of diff and match engine to provide working and scalable post processing of the DiffModel.

AbstractDiffExtension specific behavior should be remove from the core except the GUI hidding one. Moreover, the AbstractDiffExtension#visit(), AbstractDiffExtension#getImage(), AbstractDiffExtension#getText() and AbstractDiffExtension#provideMerger() methods should be make deprecated in EMF Compare 1.2 and removed from 2.0.

UML Compare match engine

There is only one need that force us to subclass the match engine: to ignore EObject storing stereotypesproperties. This is detailled in section #Profile / Stereotype support.

UML Compare diff engine

The subclass Generic Diff Engine will do two things:

  • Ignore references that are of no need for accurate comparison
  • Add post processing of the DiffModel to add UML extensions and hide other generic DiffElements.

Subset references

GenericDiffEngine of EMF Compare ignore by default the following EReferences kinds (via the ReferencesCheck class):

  • containment,
  • container,
  • derived,
  • transient.

Actually, it ignores containment references because it already checks the contents of EObject via reflective eContents() method. Then, checking containment references would lead to duplicate differences. In UML2, there is the notion of subset references. Some of them are not derived (they are not automatically deduced from the superset) and subsets a containment references. With EMF, an EObject can be referenced by only one containment reference. Then the subset references of containment one are not declared as is. Thus, GenericDiffEngine checks them against differences and it leads to duplication. To avoid this situation, we have to ignore those references.

As the "subset" information is only available in the uml.ecore file (in EAnnotation) and that this information is not persisted in the generated code, we have to store this information somewhere. We propose a property file with a set a key/value pair (fully qualified name of the reference: <containingEClass.name>.<reference.name>=true). We reproduce here the file with the selected references:

TemplateParameterSubstitution.actual=true
Action.input=true
Association.memberEnd=true
ActivityGroup.subgroup=true
Classifier.attribute=true
ActivityGroup.containedNode=true
Element.ownedElement=true
StructuredClassifier.role=true
Namespace.member=true
TemplateParameter.parameteredElement=true
Action.output=true
ActivityGroup.containedEdge=true
NamedElement.clientDependency=true
Classifier.feature=true
TemplateParameter.default=true
Namespace.ownedMember=true
TemplateSignature.parameter=true

We will implement a subclass of ReferencesCheck to ignore references described in this file.

Infrastucture to support UML extensions

EMF Compare extension mechanism does not scale well. We propose here a new set of APIs to extend EMF Compare.

DiffExtensionInfra.png

This infrascture is called just after the end of the normal processing of the doDiffTwoWay/doDiffThreeWay. Those methods will be overriden, then call their super() and finally branch our post processing infrastructure.

First, the diff extension factory registry is initialized and returns a Set of IDiffExtensionFactory. At each step of a whole DiffModel browsing each factory are asked if they handle the given DiffElement. If true, it is asked to create an AbstractDiffExtension and also asked for the parent DiffElement of the just created AbstractDiffElement. The newly created element is then added to its parent. The create() method has to handle the hidding of concerned DiffElement.

For each AbstractDiffExtension, a Factory is implemented and the pair of method handles/create gives the semantic of creation of this extension. The handles method should return quickly to minimize the overhead of the extension in case it is not relevant for the current case.

With this infrastructure, we are able to provide a scalable system to extend the GenericDiffEngine for UML difference computation.

Profile / Stereotype support

There are two issues to properly support UML profiles in UML compare engine:

  • Ignore the EObjects that store the stereotypes properties from the match engine in the object matching phase but instead include their properties in the "base" EObject during their matching.
  • Compute the differences of stereotypes application properties and attached them to their base objects.

The second one is simply addressed by the compare extension mechanism. We will define specific extension to handle properties diff on stereotype application and to attached them to their base EObject.

The first one forced us to subclass the GenericMatchEngine. We have two things to do:

  • First we have to provide our own IMatchScopeProvider implementation (or GenericMatchScopeProvider subclass) to also provide our own IMatchScope implementation to ignore EObject in the direct contents of the resources corresponding to stereotype applications. This test will be implemented in the isInScope() method of the IMatchScope.
  • Second, we have to extend the internal contents of the base EObject with the stereotype application EObject in order to match base EObject with all their properties (including the ones from the applied stereotypes).
Diff type Detection Label/Image Provider Merger
Stereotype application addition Done Done Done
Stereotype application removal Done Done Done
Stereotype attribute update Done Done Done
Stereotype attribute addition Done Done Done
Stereotype attribute removal Done Done Done
Stereotype reference addition Done Done Done
Stereotype reference removal Done Done Done
Stereotype reference order change Done Done Done
Stereotype reference update Done Done Done

UML Extensions

The following tables list if elements from all papyrus supported diagrams need to be handled by an specific extension in the UML Comparison engine.

  • No, means there is no need to implement an extension
  • ?, means it is still unknown if it needs an extension (because we did not find a way to create the element from the Papyrus editor)
  • TODO, means it needs to be implemented as an extension
  • Done, means it has been implemented as an extension

Class diagram

Nodes Addition Removal
Class No No
ClassifierTemplateParameter No No
Comment No No
Component No No
Constraint  ?  ?
DataType No No
DurationObservation  ?  ?
Enumeration No No
EnumerationLiteral No No
Interface No No
InstanceSpecification No No
PrimitiveType No No
Model No No
Operation No No
OperationTemplateParameter  ?  ?
Package No No
Property No No
Reception  ?  ?
RedefinableTemplateSignature  ?  ?
Signal  ?  ?
Slot  ?  ?
TemplateParameter  ?  ?
TemplateSignature  ?  ?
TimeObservation  ?  ?
ConnectableElementTemplateParameter  ?  ?


Edges Addition Removal
Abstraction Done Done
Association Done Done
AssociationBranch Done Done
AssociationClass Done Done
ContainmentLink Done Done
Dependency Done Done
DependencyBranch Done Done
ElementImport No No
Generalization No No
GeneralizationSet Done Done
InstanceSpecificationLink  ?  ?
InterfaceRealization Done Done
Link No No
PackageImport No No
PackageMerge No No
ProfileApplication cf. profile support cf. profile support
Realization Done Done
Substitution Done Done
Usage Done Done
TemplateBinding Done Done

Package diagram

Nodes Addition Removal
Package No No
Edges Addition Removal
Dependency Done Done
PackageImport No No

Composite diagram

Nodes Addition Removal
Port No No
Collaboration No No
CollaborationRole No No
CollaborationUse No No
InformationItem No No
Parameter No No
Activity No No
Interaction No No
ProtocolStateMachine No No
StateMachine No No
FunctionBehavior No No
OpaqueBehavior No No
Edges Addition Removal
Connector No No
RoleBinding  ?  ?
Representation No No
InformationFlow No No

Use case diagram

Nodes Addition Removal
Subject No No
Actor No No
UseCase No No
Edges Addition Removal
Include No No
Extend Done Done
ConstrinedElement No No

Sequence diagram

Nodes Addition Removal
Lifeline No No
ActionExecutionSpecification Done Done
BehaviorExecutionSpecification Done Done
InteractionUse No No
CombinedFragment No No
InteractionOperand No No
Continuation  ?  ?
StateInvariant No No
CoRegion No No
TimeConstraint Done Done
DurationConstraint Done Done
DestructionEvent Done Done
Edges Addition Removal
MessageSync Done Done
MessageAsync Done Done
MessageReply Done Done
MessageCreate Done Done
MessageDelete Done Done
MessageLost Done Done
MessageFound Done Done
GeneralOrdering  ?  ?
CommentLink No No
ConstraintLink No No

Activity diagram

Nodes Addition Removal
InitialNode No No
ActivityNode No No
FlowFinal No No
DecisionNode No No
MergeNode No No
JoinNode No No
ForkNode No No
ActivityParameterNode  ?  ?
DataStoreNode No No
OpaqueAction No No
CallBehaviorAction  ?  ?
CallOperationAction  ?  ?
SendObjectAction No No
SendSignalAction  ?  ?
AcceptEventAction  ?  ?
ValueSpecificationAction No No
ReadSelfAction No No
InterruptibleActivityRegion No No
StructuredActivityNode No No
ConditionalNode No No
ExpensionRegion No No
LoopNode No No
SequenceNode No No
OutputPin No No
InputPin No No
ActionInputPin No No
ValuePin No No
InputExpansionNode No No
OutputExpansionNode No No
LocalPreconditionConstraint No No
LocalPreconditionIntervalConstraint No No
LocalPreconditionDurationConstraint No No
LocalPostconditionConstraint No No
LocalPostconditionIntervalConstraint No No
LocalPostconditionDurationConstraint No No
LocalPostconditionTimeConstraint No No
Activity No No
Edges Addition Removal
ControlFlow No No
ObjectFlow No No
ExceptionHandler No No
Link No No


State diagram

Nodes Addition Removal
Region  ? No
State No No
Initial No No
FinalState No No
ShallowHistory No No
DeepHistory No No
Fork No No
Join No No
Choice No No
Junction No No
EntryPoint No No
ExitPoint No No
Terminate No No
ConnectionPointReference  ?  ?
Edges Addition Removal
Transition No No

Communication diagram

Nodes Addition Removal
Edges Addition Removal
Message Done Done

Merger

Ther merger of extensions are traditionnaly provided by the AbstractDiffExtension#provideMerger() method. But, as we said in section [#Builtin_extension_mechanism], this a poor subsitute compare the the IMergerProvider extension point.

If we choose to do that, we have to change the behavior of the API method

MergeFactory#createMerger(DiffElement)

to avoid the specific handling of DiffExtension.

TODO: check if it needs to be in v2.0 or can be in 1.2

Example screenshots of the UML2 comparison engine against generic one

UML Association

Generic engine

Association-generic.png

UML2 engine

Association-uml2.png

UML Stereotype application

Generic engine

StereotypeApplication-generic.png

UML2 engine

StereotypeApplication-uml2.png

UML Stereotype reference (tagged value) change

Generic engine

StereotypeReference-generic.png

UML2 engine

StereotypeReference-uml2.png

UML message (sequence diagram)

Generic engine

Message-generic.png

UML2 engine

Message-uml2.png