Abstract
OCL is widely used by model-driven engineering tools with different purposes like writing integrity constraints for meta-models, as a navigation language in model transformation languages or to define transformation specifications. Another scenario is the automatic generation of OCL code by a repair system. These generated expressions tend to be complex and unreadable due to the nature of the generative process. However, to be useful this code should be simple and resemble manually written code as much as possible when a developer must manually maintain it. There exists refactorings approaches for manually written OCL code, but there is no tool targeted to the optimisation of OCL expressions which have been automatically synthesised. Moreover, there is no available catalogue of OCL refactorings which can be integrated seamlessly into a tool. In this work, we contribute a set of refactorings intended to optimise OCL expressions, notably covering cases likely to arise in generated OCL code. We also contribute the implementation of these refactorings, built as a generic transformation catalogue using bentō, a transformation reuse tool for ATL. This makes it possible to specialise the catalogue for any OCL variant based on Ecore. Moreover, we propose a method to verify the correctness of the implemented catalogue based on translation validation and model finding. We describe the design and implementation of the catalogue and evaluate it by optimising a large amount of OCL expressions and proving the correctness of each optimisation execution. We also derive working implementations of the catalogue for ATL, EMF/OCL and SimpleOCL made available in a tool called BeautyOCL.
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-019-00740-1/MediaObjects/10270_2019_740_Fig1_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-019-00740-1/MediaObjects/10270_2019_740_Fig2_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-019-00740-1/MediaObjects/10270_2019_740_Fig3_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-019-00740-1/MediaObjects/10270_2019_740_Fig4_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-019-00740-1/MediaObjects/10270_2019_740_Fig5_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-019-00740-1/MediaObjects/10270_2019_740_Fig6_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-019-00740-1/MediaObjects/10270_2019_740_Fig7_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs10270-019-00740-1/MediaObjects/10270_2019_740_Fig8_HTML.png)
Similar content being viewed by others
Notes
anATLyzer provides a convenient access to USE Validator which enables seamless analysis of ATL/OCL and EMF/OCL expressions.
anATLyzer does provide this analysis, but most OCL tools do not. For these cases, an optimistic approach would enable more aggressive optimisations.
References
Ab Rahim, L., Whittle, J.: Verifying semantic conformance of state machine-to-Java code generators. In: International Conference on Model Driven Engineering Languages and Systems, pp. 166–180. Springer (2010)
Ackermann, J., Turowski, K.: A library of OCL specification patterns for behavioral specification of software components. In: International Conference on Advanced Information Systems Engineering, pp. 255–269. Springer (2006)
Arendt, T., Biermann, E., Jurack, S., Krause, C., Taentzer, G.: Henshin: advanced concepts and tools for in-place EMF model transformations. In: International Conference on Model Driven Engineering Languages and Systems, pp. 121–135. Springer (2010)
Assiri, F.Y., Bieman, J.M.: An assessment of the quality of automated program operator repair. In: 2014 IEEE Seventh International Conference on Software Testing, Verification and Validation, pp. 273–282. IEEE (2014)
Bracha, G., Ungar, D.: Mirrors: Design principles for meta-level facilities of object-oriented programming languages. OOPSLA’04, ACM SIGPLAN Notices 50(8), 35–48 (2015)
Bravenboer, M., Kalleberg, K.T., Vermaas, R., Visser, E.: Stratego/xt 0.17. a language and toolset for program transformation. Sci. Comput. Program. 72(1–2), 52–70 (2008)
Cabot, J., Teniente, E.: Transformation techniques for ocl constraints. Sci. Comput. Program. 68(3), 179–195 (2007)
Cheng, Z., Monahan, R., Power, J.F.: Formalised emftvm bytecode language for sound verification of model transformations. Softw. Syst. Model. 17(4), 1197–1225 (2018)
Correa, A., Werner, C., Barros, M.: An empirical study of the impact of OCL smells and refactorings on the understandability of OCL specifications. In: International Conference on Model Driven Engineering Languages and Systems, pp. 76–90. Springer (2007)
Correa, A., Werner, C.: Refactoring object constraint language specifications. Softw. Syst. Model. 6(2), 113–138 (2007)
Cuadrado, J.S., Guerra, E., de Lara, J.: Static analysis of model transformations. IEEE Trans. Softw. Eng. 17(3), 779–813
Cuadrado, J.S., Guerra, E., de Lara, J., Clarisó, R., Cabot, J.: Translating target to source constraints in model-to-model transformations. In: 2017 ACM/IEEE 20th International Conference on Model Driven Engineering Languages and Systems (MODELS), pp. 12–22. IEEE (2017)
Cuadrado, J.S., Guerra, E., de Lara, J.: Anatlyzer: An advanced IDE for ATL model transformations. In: 40th International Conference on Software Engineering (ICSE). ACM/IEEE (2018)
Cuadrado, J.S., Guerra, E., de Lara, J.: Quick fixing ATL transformations with speculative analysis. Softw. Syst. Model. pp. 1–35 (2016)
Cuadrado, J.S., Guerra, E., de Lara, J.: Reusable model transformation components with bentō. In: International Conference on Theory and Practice of Model Transformations, pp. 59–65. Springer (2015)
Cuadrado, J.S., Guerra, E., de Lara, J.: Reverse engineering of model transformations for reusability. In: International Conference on Theory and Practice of Model Transformations, pp. 186–201. Springer (2014)
Cuadrado, J.S., Jouault, F., Molina, J.G., Bézivin, J.: Optimization patterns for OCL-based model transformations. In: International Conference on Model Driven Engineering Languages and Systems, pp. 273–284. Springer (2008)
Cuadrado, J.S.: Optimising OCL synthesized code. In: European Conference on Modelling Foundations and Applications, pp. 28–45. Springer (2018)
Cuadrado, J.S., Guerra, E., de Lara, J.: A component model for model transformations. IEEE Trans. Softw. Eng. 40(11), 1042–1060 (2014)
de Lara, J., Guerra, E.: From types to type requirements: genericity for model-driven engineering. Softw. Syst. Model. 12(3), 453–474 (2013)
Eclipse Modelling Framework. https://www.eclipse.org/modeling/emf/
Epsilon. http://www.eclipse.org/gmt/epsilon
Fleck, M., Troya, J., Kessentini, M., Wimmer, M., Alkhazi, B.: Model transformation modularization as a many-objective optimization problem. IEEE Trans. Softw. Eng 43(11), 1009–1032 (2017)
Fry, Z.P., Landau, B., Weimer, W.: A human study of patch maintainability. In: Proceedings of the 2012 International Symposium on Software Testing and Analysis, pp. 177–187. ACM (2012)
Giese, M., Larsson, D.: Simplifying transformations of OCL constraints. In: International Conference on Model Driven Engineering Languages and Systems, pp. 309–323. Springer (2005)
Gogolla, M., Hilken, F., Doan, K.H.: Achieving model quality through model validation, verification and exploration. Comput. Lang. Syst. Struct. 54, 474–511 (2018)
Hassam, K., Sadou, S., Le Gloahec, V., Fleurquin, R.: Assistance system for OCL constraints adaptation during metamodel evolution. In: Software Maintenance and Reengineering (CSMR), 2011 15th European Conference on, pp. 151–160. IEEE (2011)
Jouault, F., Allilaire, F., Bézivin, J., Kurtev, I.: ATL: A model transformation tool. Science of computer programming 72(1-2), 31 – 39 (2008). See also http://www.emn.fr/z-info/atlanmod/index.php/Main_Page. Last accessed: Nov. 2010
Kintis, M., Papadakis, M., Jia, Y., Malevris, N., Le Traon, Y., Harman, M.: Detecting trivial mutant equivalences via compiler optimisations. IEEE Trans. Softw. Eng. 44(4), 308–333 (2017)
Kuhlmann, M., Hamann, L., Gogolla, M.: Extensive validation of OCL models by integrating sat solving into use. In: International Conference on Modelling Techniques and Tools for Computer Performance Evaluation, pp. 290–306. Springer (2011)
Kumar, R., Myreen, M.O., Norrish, M., Owens, S.: Cakeml: a verified implementation of ml. In: ACM SIGPLAN Notices, vol. 49, pp. 179–191. ACM (2014)
Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52(7), 107–115 (2009)
Loveman, D.B.: Program improvement by source-to-source transformation. J. ACM 24(1), 121–145 (1977)
Mechtaev, S., Yi, J., Roychoudhury, A.: Directfix: Looking for simple program repairs. In: Proceedings of the 37th International Conference on Software Engineering-Volume 1, pp. 448–458. IEEE Press (2015)
Monperrus, M.: A critical review of automatic patch generation learned from human-written patches: essay on the problem statement and the evaluation of automatic software repair. In: Proceedings of the 36th International Conference on Software Engineering, pp. 234–242. ACM (2014)
Mottu, J.M., Simula, S.S., Cadavid, J., Baudry, B.: Discovering model transformation pre-conditions using automatically generated test models. In: 2015 IEEE 26th International Symposium on Software Reliability Engineering (ISSRE), pp. 88–99. IEEE (2015)
Necula, G.C.: Proof-carrying code. design and implementation. In: Proof and system-reliability, pp. 261–288. Springer (2002)
Necula, G.C.: Translation validation for an optimizing compiler. In: ACM sigplan notices, vol. 35, pp. 83–94. ACM (2000)
OMG: Object Constraint Language (OCL) (2014). http://www.omg.org/spec/OCL/2.4/PDF
Pnueli, A., Shtrichman, O., Siegel, M.: Translation validation: from signal to C. In: Olderog, E.R., Steffen, B. (eds.) Correct System Design. Lecture Notes in Computer Science, vol. 1710, pp. 231–255. Springer, Berlin, Heidelberg (1999)
Pnueli, A., Siegel, M., Singerman, E.: Translation validation. In: International Conference on Tools and Algorithms for the Construction and Analysis of Systems, pp. 151–166. Springer (1998)
Reimann, J., Wilke, C., Demuth, B., Muck, M., Aßmann, U.: Tool supported OCL refactoring catalogue. In: Proceedings of the 12th Workshop on OCL and Textual Modelling, Innsbruck, Austria, September 30, 2012, pp. 7–12 (2012). https://doi.org/10.1145/2428516.2428518
Rose, L., Guerra, E., De Lara, J., Etien, A., Kolovos, D., Paige, R.: Genericity for model management operations. Softw. Syst. Model. 12(1), 201–219 (2013)
Solar-Lezama, A., Tancau, L., Bodik, R., Seshia, S., Saraswat, V.: Combinatorial sketching for finite programs. ACM Sigplan Notices 41(11), 404–415 (2006)
Tibermacine, C., Sadou, S., Dony, C., Fabresse, L.: Component-based specification of software architecture constraints. In: Proceedings of the 14th International ACM Sigsoft Symposium on Component Based Software Engineering, pp. 31–40. ACM (2011)
Tisi, M., Cheng, Z.: Coqtl: An internal DSL for model transformation in COQ. In: International Conference on Theory and Practice of Model Transformations, pp. 142–156. Springer (2018)
Varró, D., Pataricza, A.: Automated formal verification of model transformations. CSDUML pp. 63–78 (2003)
Varró, D., Bergmann, G., Hegedüs, Á., Horváth, Á., Ráth, I., Ujhelyi, Z.: Road to a reactive and incremental model transformation platform: three generations of the viatra framework. Softw. Syst. Model. 15(3), 609–629 (2016)
Wagelaar, D.: Simpleocl. https://github.com/dwagelaar/simpleocl
Wimmer, M., Strommer, M., Kargl, H., Kramler, G.: Towards model transformation generation by-example. In: System Sciences, 2007. HICSS 2007. 40th Annual Hawaii International Conference on, pp. 285b–285b. IEEE (2007)
Wimmer, M., Perez, S.M., Jouault, F., Cabot, J.: A catalogue of refactorings for model-to-model transformations. J. Object Technol. 11(2), 2–1 (2012)
Acknowledgements
Work is funded by project RECOM (Spanish MINECO, TIN2015-73968-JIN, AEI/FEDER/UE) and a Ramón y Cajal 2017 grant (RYC-2017-237) funded by MINECO (Spain) and co-funded by the European Social Fund. I would like to thank the reviewers for their accurate and useful comments, and Javier Bermúdez Ruiz for proofreading the first version of the manuscript.
Author information
Authors and Affiliations
Corresponding author
Additional information
Communicated by Prof. A. Pierantonio, A. Anjorin, S. Trujillo, and H. Espinoza.
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Work funded by project RECOM (Spanish MINECO, TIN2015-73968-JIN, AEI/FEDER/UE) and a Ramón y Cajal 2017 grant (RYC-2017-237) co-funded by MINECO (Spain) and the European Social Fund.
Rights and permissions
About this article
Cite this article
Cuadrado, J.S. A verified catalogue of OCL optimisations. Softw Syst Model 19, 1139–1161 (2020). https://doi.org/10.1007/s10270-019-00740-1
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10270-019-00740-1