600 likes | 612 Views
Transformation of Models Containing Uncertainty. Michalis Famelis, Rick Salay , Alessio Di Sandro , Marsha Chechik University of Toronto MODELS 2013, Miami Beach, FL. This is Natalie. Natalie is a modeler . Natalie faces uncertainty in her everyday work. Alternative Designs.
E N D
Transformation of Models Containing Uncertainty Michalis Famelis, Rick Salay, Alessio Di Sandro, Marsha Chechik University of Toronto MODELS 2013, Miami Beach, FL
This is Natalie. Natalie is a modeler. Natalie faces uncertainty in her everyday work.
Alternative Designs Hmm, I don’t know which one, yet.
Conflicting Stakeholder Opinions What do I do until they decide?
Incomplete Information I don’t know everything about this, yet.
Uncertainty in software development Many design alternatives Incomplete information Conflicting stakeholder opinions Uncertainty about the content of the model.
Transformations Like everygood MBE practitioner,Natalie usesa variety of MTs
Transformations Like everygood MBE practitioner,Natalie usesa variety of MTs The transformations assume inputs that don’t contain uncertainty
Transformations Like everygood MBE practitioner,Natalie usesa variety of MTs The transformations assume inputs that don’t contain uncertainty But only too often, Natalie’s models contain uncertainty:
Transforming Models with Uncertainty Natalie should be able to use model transformations
Transforming Models with Uncertainty Natalie should be able to use model transformations
Transforming Models with Uncertainty Natalie should be able to use model transformations Existing transformation techniques do not support this! To apply MTs, Natalie is forced to artificially remove uncertainty
Transforming Models with Uncertainty Natalie should be able to use model transformations Existing transformation techniques do not support this! We need to liftNatalie’s transformations so that they can apply to models with uncertainty
Outline Representing Uncertaintywith Partial Models Reminder: Model Transformations Transforming Partial Models EmpiricalEvaluation ToolSupport
Model Transformations With Graph Rewriting EncapsulateVariablerefactoring: Make fields private and add getter methodsunless they belong to some inner class class2 class1 class1 Example rule: - attribute : type+ getAttribute() :type + attribute : type class1 Right Hand Side NegativeApplication Condition LeftHand Side
Example Input Model class2 class1 class1 SolverException Solver - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 + effect : String
Example Input Model class2 class1 class1 SolverException Solver - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 Match + effect : String
Example Input Model class2 class1 class1 SolverException Solver - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 NAC also matches! ABORT ! + effect : String
Example Input Model 2 class2 class1 class1 SolverException - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 + effect : String
Example Input Model 2 class2 class1 class1 SolverException - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 Match + effect : String
Example Input Model 2 class2 class1 class1 SolverException - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 Delete + effect : String
Example Input Model 2 class2 class1 class1 SolverException - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 effect : String
Example Input Model 2 class2 class1 class1 SolverException - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 Add - effect : String
Example Input Model 2 class2 class1 class1 SolverException - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 Add - effect : String + getEffect() : String
Example Input Model 2 class2 class1 class1 SolverException - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 No more LHS matches. Stop. - effect : String + getEffect() : String
Outline Representing Uncertaintywith Partial Models
Representing Uncertainty Partial Models [ICSE12] • Points of uncertainty (“May elements”) explicated using syntactic annotations Solver SolverException Unsure if it should be an inner class. + effect : String Unsure if we need this field.
Representing Uncertainty Partial Models [ICSE12] • Points of uncertainty (“May elements”) explicated using syntactic annotations Propositional variables: “the element exists” Solver SolverException X + effect : String Y
Representing Uncertainty Solver Solver SolverException Solver SolverException SolverException Solver SolverException SolverException Solver X x=F, y=F x=T, y=F + effect : String + effect : String + effect : String Y x=F, y=T x=T, y=T 4 concretizations: 4 ways to resolve uncertainty.
Representing Uncertainty Partial Models [ICSE12] • Points of uncertainty (“May elements”) explicated using syntactic annotations • Restrictions to the set of concretizations can be captured in the “May formula” Solver SolverException X + effect : String Y X v Y
Representing Uncertainty Solver Solver SolverException Solver SolverException SolverException Solver SolverException SolverException Solver X x=F, y=F x=T, y=F + effect : String + effect : String + effect : String Y X v Y x=F, y=T x=T, y=T
Outline Transforming Partial Models
Transforming Models With Uncertainty Natalie wants to apply the rule to an input with uncertainty
Why Is It Hard? class2 class1 class1 SolverException Solver - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 X Y + effect : String X v Y
Why Is It Hard? class2 class1 class1 SolverException Solver - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 Match??? X Y + effect : String X v Y
Why Is It Hard? class2 class1 class1 SolverException Solver - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 Match??? X Y + effect : String X v Y
Why Is It Hard? class2 class1 class1 SolverException Solver - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 Should we add? Should we delete? X Y + effect : String X v Y
Why Is It Hard? class2 class1 class1 SolverException Solver - attribute : type+ getAttribute() :type + attribute : type LHS NAC RHS class1 Existing transformation techniques cannot be used. X Y + effect : String X v Y
Intuition (And definition of correctness) class2 class1 class1 Solver SolverException - attribute : type+ getAttribute():type + attribute : type LHS NAC RHS X class1 + effect : String ? Y X v Y
Intuition (And definition of correctness) class2 class1 Solver class1 SolverException Solver SolverException Solver SolverException - attribute : type+ getAttribute():type + attribute : type LHS NAC RHS class1 ? + effect : String + effect : String
Intuition (And definition of correctness) class2 class1 Solver Solver class1 Solver SolverException SolverException Solver SolverException Solver SolverException Solver SolverException SolverException - attribute : type+ getAttribute():type + attribute : type LHS NAC RHS class1 + effect : String + effect : String -effect : String +getEffect() : String + effect : String
Intuition (And definition of correctness) class2 class1 Solver class1 SolverException SolverException Solver SolverException SolverException Solver - attribute : type+ getAttribute():type + attribute : type Solver LHS NAC RHS class1 + effect : String X + effect : String Y + - effect : String +getEffect() : String a b ( X∧¬Y ∧ ¬a ∧ ¬b) v(¬X∧ Y ∧ ¬a ∧ b) v ( X∧ Y ∧ a ∧ ¬b)
Intuition (And definition of correctness) class2 class1 class1 Solver SolverException SolverException - attribute : type+ getAttribute():type + attribute : type Solver LHS NAC RHS X class1 + effect : String X Y Y + - effect : String +getEffect() : String a X v Y b ( X∧¬Y ∧ ¬a ∧ ¬b) v(¬X∧ Y ∧ ¬a ∧ b) v ( X∧ Y ∧ a ∧ ¬b)
Technique class2 class1 class1 Solver SolverException - attribute : type+ getAttribute():type + attribute : type LHS NAC RHS class1 X + effect : String Y X v Y
Technique Step 1: Determine applicability class2 class1 class1 Solver SolverException - attribute : type+ getAttribute():type + attribute : type LHS NAC RHS class1 (a) Find Match X + effect : String Y X v Y
Technique Step 1: Determine applicability class2 class1 class1 Solver SolverException - attribute : type+ getAttribute():type + attribute : type LHS NAC RHS class1 (a) Find Match X (b) Make sure the rule applies to at least one concretization(requires solvinga SAT problem) + effect : String Y X v Y
Technique Step 1: Determine applicability Step 2: Transform graph class2 class1 class1 Solver SolverException SolverException - attribute : type+ getAttribute():type + attribute : type Solver LHS NAC RHS class1 X X Copy over unchangedparts + effect : String + effect : String Y Y X v Y
Technique Step 1: Determine applicability Step 2: Transform graph class2 class1 class1 Solver SolverException SolverException - attribute : type+ getAttribute():type + attribute : type Solver LHS NAC RHS class1 X Copy over unchangedparts Perform additions and deletions X + effect : String Y + - effect : String +getEffect() : String a Y b Added and deleted elements become Maybe X v Y
Technique Step 1: Determine applicability Step 2: Transform graph Step 3: Transform formula class2 class1 class1 Solver SolverException SolverException - attribute : type+ getAttribute():type + attribute : type Solver LHS NAC RHS X class1 Constrain Maybe elements to ensure each thatconcretizationis correctly affected. + effect : String X Y Y + - effect : String +getEffect() : String a X v Y b ( X∧¬Y ∧ ¬a ∧ ¬b) v(¬X∧ Y ∧ ¬a ∧ b) v ( X∧ Y ∧ a ∧ ¬b)
Overview Step 1: Determine applicability Step 2: Transform graph Step 3: Transform formula class2 class1 class1 Solver SolverException SolverException - attribute : type+ getAttribute():type + attribute : type Solver LHS NAC RHS X class1 + effect : String X Y Y + - effect : String +getEffect() : String a X v Y b ( X∧¬Y ∧ ¬a ∧ ¬b) v(¬X∧ Y ∧ ¬a ∧ b) v ( X∧ Y ∧ a ∧ ¬b)