caise 2014 an adapter-based approach for m2t transformations
TRANSCRIPT
![Page 1: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/1.jpg)
An Adapter-Based Approach to Co-evolve Generated SQL in M2T
Transformations
Jokin García1, Oscar Díaz1 and Jordi Cabot2
Onekin1
University of the Basque Country, SpainAtlanMod2
Ecole des Mines, Nantes (France)
Thessaloniki - 19th of june, 2014CAiSE
![Page 2: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/2.jpg)
2
Index
Problem statement Case study Solution Evaluation Conclusions, future work
![Page 3: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/3.jpg)
3
Problem statement: context Software components on top of platforms
Dependencies
Platform evolution is a common situation. DB
API
APIApplication
![Page 4: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/4.jpg)
4
Problem statement: context Perpetual beta state of platforms. External dependency
![Page 5: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/5.jpg)
5
Problem statement: contextDomain model M2T Transformation Code
Model refs.(Dynamic)
Embedded platform code(Static)
Transformation code
![Page 6: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/6.jpg)
6
Problem statement: problem Different versions of the platform leave the code and M2T
transformation outdated.
DB DB’Δ
Code
M2T
?
![Page 7: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/7.jpg)
7
Problem statement: solution Adapter to adapt generated code to new platform
MediaWiki
MediaWiki’
Δ
Code
M2T
Adapter
Code
![Page 8: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/8.jpg)
8
Case study: MediaWiki DB in Wikiwhirl
![Page 9: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/9.jpg)
9
Case study: MediaWiki Used by Wikipedia and more than 40.000 wikis In 4,5 years: 171 schema upgrades
![Page 10: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/10.jpg)
10
Case study: MediaWiki DB in Wikiwhirl
Platform-dependent concepts
Refs to domain model
![Page 11: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/11.jpg)
11
Solution Synchronize the generated code with platform
Using adapters at runtime
MediaWiki’
M2T
Adapter
CodeINSERT INTO categorylinks (cl_from, cl_to, cl_sortkey, cl_timestamp, cl_type, cl_sortkey_prefix, cl_collation) VALUES (@pageId, ‘Softwareproject’, ‘House_Testing’, (DATE_FORMAT(CURRENT_TIMESTAMP(), ‘%Y%m%d%k%i%s’), ‘page’, ‘’, ‘0’);
print("INSERT into categorylinks (cl_from, cl_to, cl_sortkey, cl_timestamp) VALUES (@pageId, '" + categoryTitle + "','" + pageTitle)
New columns “cl_type”, “cl_sortkey_prefix” and“cl_collation”
![Page 12: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/12.jpg)
12
Process outline
Code (MediaWiki DB)
New MediaWiki schema
Old MediaWiki schema
Domainmodel
Differencemodel
New schema model
Old schema model
![Page 13: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/13.jpg)
13
Process outline
Code (MediaWiki DB)
New MediaWiki schema
Old MediaWiki schema
Domainmodel
Differencemodel
New schema model
Old schema model
Don't worry: all in one click
![Page 14: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/14.jpg)
14
Process: Differences between platforms: DB schema
![Page 15: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/15.jpg)
15
Process: Schema Modification Operators (SMO)
SMO % of usage
Change type
Adaptation
Create table 8.9 NBC New comment in the transformation on the existence of this table in the new version
Drop table 3.3 BRC Delete statement associated to the table
Rename table 1.1 BRC Update name
Copy table 2.2 NBC (None)
Add column 38.7 NBC/ BRC
For insert statements: if the attribute is Not Null, add the new column in the statement with a default value (from the DB if there is available or according to the type if there is not)
Drop column 26.4 BRC Delete the column and the value in the statement
Rename column 16 BRC Update name
Copy column 0.4 BRC Like add column case
Move column 1.5 BRC Like drop column + add column cases
![Page 16: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/16.jpg)
16
Process: Adaptation Plaform-specific, schema-independent Replace all “println” instructions with “printSQL” Import “printSQL” library ZQL extension For each printSQL invocation:
Iterate over the changes reported in the Difference model Checks if any of the changes impacts the current statement. Needed information to adapt the statement is retrieved and
added to a list of parameters: the statement, affected table, column, …
A function that adapts the statement is called and new statement is printed.
![Page 17: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/17.jpg)
17
Process: Adaptation output
Added columns
Delete tables
Delete columns
![Page 18: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/18.jpg)
18
Roles Producer
Injector for target platform Implement adapter as a library for transformation
Consumer Import adapter library in the transformation Execute the batch
![Page 19: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/19.jpg)
19
Evaluation Manual Cost = D + P * #Impacts
D: Detection time P: Propagation time
Assisted Cost = C + V * #Impacts C: Configuration time V: Verification time
![Page 20: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/20.jpg)
20
Evaluation
![Page 21: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/21.jpg)
21
Dump changes from code to transformation
Assist manual propagation Record generation with change to be done and where (line and column
in the transformation)
M2T transformation
M2T transformation’HOT
print(“select * from …”) printSQL(“select * from …”, line, column)
RECORD:#Added columns cl_type, cl_sortkey_prefix and cl_collation#transformation line: 12, column: 11INSERT INTO categorylinks (cl_from, cl_to, cl_sortkey, cl_timestamp, cl_type, cl_sortkey_prefix, cl_collation) VALUES (@pageId, ‘Softwareproject’, ‘House_Testing’, (DATE_FORMAT(CURRENT_TIMESTAMP(), ‘%Y%m%d%k%i%s’), ‘page’, ‘’, ‘0’);
![Page 22: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/22.jpg)
22
Conclusions Mechanism to adapt code generated by M2T transformations
to platform evolution Apply in a specific case study Premises: platform instability and transformation coupling
![Page 23: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/23.jpg)
23
Issues and future work Generalization: other platforms Methodology for adapter development
![Page 24: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/24.jpg)
24
Questions
[email protected] http://www.onekin.org
Implementation: www.onekin.org/downloads/public/Batch_MofscriptAdaptation.rar
Screencasts: www.onekin.org/downloads/public/screencasts/MOFScript/
![Page 25: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/25.jpg)
25
Process: Adaptation
1- Iterate over the changes reported in the Difference model
2- check that the deleted column's table corresponds with the table name of the statement
3- the statement, the table name and the removed column are added to a list of parameters
4- outputs an SQL statement without the removed column, using a function with the list of parameters that modifies the expression
![Page 26: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/26.jpg)
26
Generate traceability model
Domainmodel
Traceabilitymodel
MOFScript + Adapter
printSQL(statement l,ine, column, print_type) <Transformation: line, column >-><Code: line, column>
Differencemodel
![Page 27: CAiSE 2014 An adapter-based approach for M2T transformations](https://reader036.vdocuments.net/reader036/viewer/2022070520/58f0c3621a28abad048b460b/html5/thumbnails/27.jpg)
27
Visualize traceability model
Traceabilitymodel
HandyMOF