Download presentation
Presentation is loading. Please wait.
Published byLyric Way Modified over 10 years ago
1
Jose E. Rivera, Antonio Vallecillo Universidad de Málaga, Spain TOOLS Europe 2008, Zurich
2
TOOLS Europe 2008(2)June 30, 2008 Model-Driven Software Development (MDSD) ● Models are the key artifacts ● Most of the efforts are currently on the definition of models, metamodels and transformations between them ● Other model operations (e.g., model subtyping, model difference) are required in MDSD practices Model difference ● An essential operation in several software development processes: Version and change management Software evolution Model/data integration etc.
3
TOOLS Europe 2008(3)June 30, 2008 Previous approaches: ● Edit scripts and coloring techniques: Do not produce models as results Do not fulfill other interesting properties (composability…) ● Based on text, data structures or models Usually restricted to a specific metamodel (UML) Our approach: ● Model-based: Differences are models, conforming to a metamodel ● Metamodel independent ● Self-contained, compact, composable, applicable to models conforming to different metamodel ● Implementation available integrated in EclipseMAUDELING
4
TOOLS Europe 2008(4)June 30, 2008 1) Matching ● Finding different objects from the two models that represent the same element ● The result is a model: 2) Differencing ● Makes use of matching models to detect modified elements ● The result is a model: Benefits: Self-contained Compact Independent of the metamodel of the source models
5
TOOLS Europe 2008(5)June 30, 2008 Option 1: Using object persistent identifiers Matching process is simple and robust But not always feasible! Option 2: Using structural similarities Allows comparing models… that do not use persistent object identifiers conforming to different metamodels that have evolved independently Harder to define and implement You need an algorithm to identify the matches
6
TOOLS Europe 2008(6)June 30, 2008 Compares objects independently of their depth in the containment tree ● Implies more comparisons ●...but brings very interesting advantages: Moved elements through different levels can be detected; Example of refactorization-> adding packages Failing to identify a match does not condition other potential matches below in the tree hierarchy Implemented in MaudeMAUDELING
7
TOOLS Europe 2008(7)June 30, 2008 Comparing two objects: ● Class rate: ● Name rate:
8
TOOLS Europe 2008(8)June 30, 2008 Structural rate depends on the type of the feature ● Boolean attributes and enumerations match (with rate = 1.0) if they have the same value (otherwise rate = 0.0) ● String attribute values distances are calculated using the Levenshtein distance ● Numerical attribute values match rate is computed with a relative distance function (1-|n-m|/|n+m|) limited to [0..1] ● References are matched recursively, i.e., objects referenced are compared using the same match operation but without taking into account their own references (to avoid cycles) If the upper cardinality is greater than 1 (i.e., if its value is a collection), the average rate is calculated If a structural feature is defined only in one of the objects, a penalty is applied to the final sfRate
9
TOOLS Europe 2008(9)June 30, 2008 If (Rate > Threshold) the two objects potentially match Initially considered (although it is fully configurable): wc = 0.5; wsf = 0.25; wn = 0.0; Threshold = 0.66 nameRate is used in models in which the attribute name is considered as an identifier. ● If the name rate is omitted (wn=0.0), potential matches are harder: features should be more strongly related At the end of the process, only those objects that together obtain the biggest rate are kept
10
TOOLS Europe 2008(10)June 30, 2008 Formal notation and system ● High-level language and a high-performance interpreter and compiler of the OBJ algebraic specification family ● Supports membership equational and rewriting logic specification and programming ● Maude specifications are executable Supported by a toolkit ● Executing the specifications, model-checking, theorem proving, termination and confluence, etc. Highly efficient and integrated with Eclipse
11
TOOLS Europe 2008(11)June 30, 2008 Maude supports OO specifications and computations ● Classes: class C | a1 : S1, …., an : Sn ● Objects: ● Messages: msg m : S1 … Sn -> Msg. ● A configuration is a multiset of objects and messages that evolves by rewriting rules Models are represented as configuration of objects Nodes Nodes’ attributes Nodes’ Edges Objects Objects’ attributes Multigraph Maude Configuration of objects
12
TOOLS Europe 2008(12)June 30, 2008 Object-oriented modules (i.e., specifications) ● They contain the classes to which the Maude objects belong ● Models conform to metamodels by construction ● Used to instantiate models, to add behavior… Metamodels are models too! ● They can be represented as Configuration of objects The classes of such objects will be the ones that specify the meta-metamodels (for example Ecore) Used to operate and reason about them
13
TOOLS Europe 2008(13)June 30, 2008 (omod SimpleStateMachines is pr STRING. class State | name : String, stateMachine : Oid, incoming : Set{Oid}, outgoing : Set{Oid}. class StateMachine | initialState : Maybe{Oid}, containedState : Set{Oid}. class Transition | name : String, target : Oid, src : Oid. endom) Simple State Machine example membership axioms Conforms to +
14
TOOLS Europe 2008(14)June 30, 2008 op modelDiff : Configuration Configuration -> DiffModel. Possible situations : ● The element appears in both models and has not been modified ● The element appears in both models but has been modified; ceq modelDiff( CONF1> CONF2, MATCHM) = modelDiff(CONF1, CONF2, MATCHM) if match(O1, O2, MATCHM). ceq modelDiff( CONF1, CONF2, MATCHM) = modelDiff(CONF1,CONF2,MATCHM) if match(O1, O2, MATCHM) /\ (not(ATTS1 == ATTS2) or not(C1 == C2)).
15
TOOLS Europe 2008(15)June 30, 2008 ● The element only appears in the minuend model; ● The element only appears in the subtrahend model. ● Both the minuend and subtrahend models are empty: eq modelDiff( CONF1, CONF2, MATCHM ) = modelDiff(CONF1, CONF2, MATCHM) [owise]. eq modelDiff( CONF1, CONF2, MATCHM ) = modelDiff(CONF1, CONF2, MATCHM) [owise]. eq modelDiff( none, none, MATCHMODEL ) = none.
16
TOOLS Europe 2008(16)June 30, 2008 (Minuend Model) (Subtrahend Model) Tr2 (Difference Model)
17
TOOLS Europe 2008(17)June 30, 2008 Operation do ● do ( Ms, Md ) = Mm. ● Applies to a model all the changes specified in a difference model Operation undo ● undo ( Mm, Md ) = Ms. ● Reverts all the changes specified in a difference model Sequential composition of differences ● Very useful to, e.g., optimize the process of applying successive modifications to the same model undo(do(Ms, Md), Md) = Ms. do(undo(Mm, Md), Md) = Mm.
18
TOOLS Europe 2008(18)June 30, 2008 op do : Configuration DiffModel -> Configuration. eq do ( MODEL, CONF ) = do ( MODEL, CONF ). ceq do ( MODEL, CONF ) = do ( MODEL, CONF ) if O = originalId(OLDO). ceq do ( MODEL, CONF ) = do(MODEL, CONF) if O = originalId(OLDO). eq do ( MODEL, none ) = MODEL.
19
TOOLS Europe 2008(19)June 30, 2008 Model difference definition ● Independent of the metamodel of the source models ● Can be fully integrated into other MDSD processes ● Self-contained and compact ● Applicable to models conforming to different metamodel ● Suitable for composing deltas and implementing further operations on them ● Results are very encouraging Tool support: ● All the difference operations implemented in Maude ● Integrated in EclipseMAUDELING
20
TOOLS Europe 2008(20)June 30, 2008 Make Maude completely transparent to the user Conflict detection and resolution of concurrent modifications Improving the matching algorithm ● More complex heuristics ● More customizable parameters Make model operations available via Web services
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.