CVL to Clafer transformation Tom Wijsman 22 Januari 2015 Overview - - PowerPoint PPT Presentation

cvl to clafer transformation
SMART_READER_LITE
LIVE PREVIEW

CVL to Clafer transformation Tom Wijsman 22 Januari 2015 Overview - - PowerPoint PPT Presentation

CVL to Clafer transformation Tom Wijsman 22 Januari 2015 Overview 1. CVL to Clafer transformation steps Identify common features for both languages 1. Create abstract and concrete visual syntax for CVL in AToMPM 2. Export metamodel and


slide-1
SLIDE 1

CVL to Clafer transformation

Tom Wijsman

22 Januari 2015

slide-2
SLIDE 2

Overview

  • 1. CVL to Clafer transformation steps

1.

Identify common features for both languages

2.

Create abstract and concrete visual syntax for CVL in AToMPM

3.

Export metamodel and models from AToMPM to metaDepth

4.

Transform (ETL) from CVL to Clafer in metaDepth

5.

Generate (EGL) from Clafer in metaDepth to concise Clafer

  • 2. Example
  • 3. Verification
  • 4. Conclusion
  • 5. Future work

2

slide-3
SLIDE 3

CVL to Clafer transformation steps

Chapter 1

3

slide-4
SLIDE 4

Step 1: Identify common features for both

CVL Clafer Variability Specification Class/Feature Type Variability Choice Feature Variability Variable Type Definition Optional VSpec “?” behind the Class/Feature Type Type of Variable “: Type” behind the Class/Feature Type Group Cardinality “xor” (1..1), “or” (1..*) or “x..y” (xy) before the Class/Feature Type Children of a VSpec Indented one level deeper than the parent The constraints are custom made and not part of these languages. 4

slide-5
SLIDE 5

Step 2: Create abstract and concrete visual syntax

5

slide-6
SLIDE 6

Step 2: Create abstract and concrete visual syntax

6

slide-7
SLIDE 7

Step 2: Create abstract and concrete visual syntax

Example Example : Type : Type CVL: Clafer: 7

slide-8
SLIDE 8

Step 2: Create abstract and concrete visual syntax

Example Example? CVL: Clafer: 8

slide-9
SLIDE 9

Step 2: Create abstract and concrete visual syntax

xor Example …

  • r Example

… x..y Example … CVL: Clafer: 9

slide-10
SLIDE 10

Step 2: Create abstract and concrete visual syntax

[ x OPERATION y ] [ x && y && !z ] Custom CVL: Custom Clafer: 10

slide-11
SLIDE 11

Step 2: Create abstract and concrete visual syntax

[ lhs OPERATION rhs ] Custom CVL: Custom Clafer: Custom Clafer: x !x Custom CVL: 11

slide-12
SLIDE 12

Step 3: Export metamodel to metaDepth

Model CVLMM { Node Link { src : Node; dst : Node; } Node Root {} Node VSpec {} Node Variable : VSpec { Name:String = "Name"; Type:String = "Type"; } Node Choice : VSpec { Name:String = "Name"; } Node GroupCardinality { min:String = "0"; max:String = "*"; } Node Constraint {} Node ComparisonConstraint : Constraint{ Operator:String = "="; } Node ChoiceConstraint : Constraint {} Node VSpecToRoot : Link {} Node Parent : Link{} Node MandatoryChildOf : Link {} Node OptionalChildOf : Link {} Node GroupCardinalityToVSpec : Link {} Node LHS : Link {} Node RHS : Link {} Node And : Link {} Node AndNot : Link {} }

12

slide-13
SLIDE 13

Step 4: Transform from CVL to Clafer in metaDepth

Model ClaferMM { Node Link { src : Node; dst : Node; } Node Root {} Node Clafer { Name:String = ""; Optional:boolean = false; Type:String = ""; CardType:String = ""; IsRootElement:boolean = false; } Node Constraint { Constraint:String = ""; } Node ClaferToRoot : Link {} Node ClaferToParent : Link {} Node ConstraintToClafer : Link {} }

  • Enumerate all root VSpecs
  • Recursively enumerate their children
  • Recursively enumerate group cardinalities too
  • For each VSpec, create a Clafer clafer
  • For each link between VSpecs, create a Clafer link
  • For each CVL Constraint, create a Clafer constraint
  • Set the Clafer elements’ parameters accordingly

13

slide-14
SLIDE 14

Step 5: Generate the concise Clafer representation

[% for (c in Clafer.all.select(x | x.IsRootElement = true)) { %] [%=c.printClafer() %] [%=c.enumChildren() %][% } %] [% @template

  • peration Clafer enumChildren() {

for (cp in ClaferToParent.all.select(x | x.dst = self)) { %][%=cp.src.printClafer() %] [%=cp.src.enumChildren() %] [% } for (cc in ConstraintToClafer.all.select(x | x.dst = self)) { %][ [%=cc.src.Constraint %] ][%="\n" %][% } } @template

  • peration Clafer printClafer() {

%][%=self.printCardType() %][%=self.Name %][%=self.printType() %][%=self.printOptional() %][% }

  • Enumerate the root clafers
  • Recursively enumerate the

child clafers and constraints

  • For each clafer, print parameters

14

slide-15
SLIDE 15

Example

Chapter 2

15

slide-16
SLIDE 16

Example (CVL)

16

slide-17
SLIDE 17

Example (Clafer)

RPGGame Story xor Players Singleplayer Name : string? Multiplayer Min : integer Max : integer [ Min <= Max ] 1..2 Enemies Villain Dragon Difficulty : real

  • r Environment?

Door Goal Key Trap [ Key && Door && !Trap ]

17

slide-18
SLIDE 18

Verification

Chapter 3

18

slide-19
SLIDE 19

Verification

19

slide-20
SLIDE 20

Conclusion

Chapter 4

20

slide-21
SLIDE 21

Conclusion

A common subset of features between CVL and Clafer exists that is large enough for a successful transformation of a large set of CVL models to Clafer.

21

slide-22
SLIDE 22

Future work

Chapter 5

22

slide-23
SLIDE 23

Future work

  • Study similarities and difference of instantiation of CVL

and Clafer, transforming CVL’s variation points to concepts (constraints) or methods (IG manipulation) in Clafer.

  • Study CVL constraints (OCL based) and Clafer constraints

(Alloy based) with a comparison in order to create a more complete transformation for constraints. These suggestions can be considered projects on their own.

23

slide-24
SLIDE 24

Thank you for your attention!

Comments and questions are welcome.