Abstract
Mainstream model transformation tools operate on graph structured models which are described by class-based meta-models. In the traditional grammarware space, transformation tools consume and produce tree structured terms, which are described by some kind of algebraic datatype or grammar. In this paper we explore a functional style of model transformation using Rascal, a meta-programming language, that seamlessly integrates functional programming, flexible static typing, and syntax-based analysis and transformation. We represent meta-models as algebraic data types (ADTs), and models as immutable values conforming to those data types. Our main contributions are (a) REFS a simple encoding and API, to deal with cross references among model elements that are represented as ADTs; (b) a mapping from models to ADTs augmented with REFS; (c) evaluation of our encoding by implementing various well-known model transformations on state machines, meta-models, and activity diagrams. Our approach can be seen as a first step towards making existing techniques and tools from the modelware domain available for reuse within Rascal, and opening up Rascal’s transformation capabilities for use in model driven engineering scenarios.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
Recall that an Abstract Data Type is characterized by a set of values (created using constructor functions) and a set of functions that define operations on those values.
- 7.
Also known as named parameters or keyword arguments in other languages.
- 8.
All visualizations are created automatically: for each meta-model we specify a transformation to a standard graph model. The latter is then visualized using Rascal ’s visualization library.
- 9.
The concept of reset events is inspired by Fowler’s example state machine DSL [5].
- 10.
The type parameter of
is technically not needed, but allows declarations of
s document what they are referring to.
- 11.
Source lines of code, not counting empty lines or comments.
- 12.
- 13.
Can be found on Github at http://bit.ly/1puz0tC.
- 14.
An optimization technique that caches the result of expensive computations.
References
Chlipala, A.: Parametric higher-order abstract syntax for mechanized semantics. In: ICFP 2008, pp. 143–156 (2008)
Claessen, K., Sands, D.: Observable sharing for functional circuit description. In: Thiagarajan, P.S., Yap, R.H.C. (eds.) ASIAN 1999. LNCS, vol. 1742, pp. 62–73. Springer, Heidelberg (1999)
Czarnecki, K., Helsen, S.: Feature-based survey of model transformation approaches. IBM Syst. J. 45(3), 621–646 (2006)
Erwig, M.: Inductive graphs and functional graph algorithms. J. Funct. Program. 11(05), 467–492 (2001)
Fowler, M.: Domain Specific Languages, 1st edn. Addison-Wesley Professional, Boston (2010)
George, L., Wider, A., Scheidgen, M.: Type-safe model transformation languages as internal DSLs in scala. In: Hu, Z., de Lara, J. (eds.) ICMT 2012. LNCS, vol. 7307, pp. 160–175. Springer, Heidelberg (2012)
Gill, A.: Type-safe observable sharing in Haskell. In: Haskell 2009, pp. 117–128. ACM (2009)
Goldschmidt, T., Becker, S., Uhl, A.: Classification of concrete textual syntax mapping approaches. In: Schieferdecker, I., Hartman, A. (eds.) ECMDA-FA 2008. LNCS, vol. 5095, pp. 169–184. Springer, Heidelberg (2008)
Horn, T.: Model querying with FunnyQT - (extended abstract). In: ICMT 2013, pp. 56–57 (2013)
Inostroza, P., van der Storm, T., Erdweg, S.: Tracing program transformations with string origins. In: Di Ruscio, D., Varró, D. (eds.) ICMT 2014. LNCS, vol. 8568, pp. 154–169. Springer, Heidelberg (2014)
Jouault, F., Allilaire, F., Bézivin, J., Kurtev, I.: ATL: a model transformation tool. Sci. Comput. Program. 72(1), 31–39 (2008)
Jouault, F., Bézivin, J.: KM3: a DSL for metamodel specification. In: Gorrieri, R., Wehrheim, H. (eds.) FMOODS 2006. LNCS, vol. 4037, pp. 171–185. Springer, Heidelberg (2006)
Klint, P., Lämmel, R., Verhoef, C.: Toward an engineering discipline for grammarware. ACM Trans. Softw. Eng. Methodol. 14(3), 331–380 (2005)
Klint, P., van der Storm, T., Vinju, J.: EASY meta-programming with Rascal. In: Fernandes, J.M., Lämmel, R., Visser, J., Saraiva, J. (eds.) Generative and Transformational Techniques in Software Engineering III. LNCS, vol. 6491, pp. 222–289. Springer, Heidelberg (2011)
Kolovos, D.S., Paige, R.F., Polack, F.A.C.: The Epsilon transformation language. In: Vallecillo, A., Gray, J., Pierantonio, A. (eds.) ICMT 2008. LNCS, vol. 5063, pp. 46–60. Springer, Heidelberg (2008)
Mayerhofer, T., Wimmer, M.: The TTC 2015 model execution case. In: TTC 2015, pp. 2–18 (2015)
Mens, T., Van Gorp, P.: A taxonomy of model transformation. Electron. Notes Theor. Comput. Sci. 152, 125–142 (2006)
Oliveira, B.C., Cook, W.R.: Functional programming with structured graphs. ICFP 47(9), 77–88 (2012)
Rose, L.M., Horn, T., Krikava, F. (eds.): TTC 2015, CEUR Workshop Proceedings, vol. 1524. CEUR-WS.org (2015)
Steinberg, D., Budinsky, F., Merks, E., Paternostro, M.: EMF: Eclipse Modeling Framework. Pearson Education, Upper Saddle River (2008)
Terese. Term Rewriting Systems. Cambridge Tracts in Theoretical Computer Science. Cambridge University Press (2003)
van der Storm, T., Cook, W.R., Loh, A.: The design and implementation of object grammars. Sci. Comput. Program. 96(P4), 460–487 (2014)
Van Deursen, A., Klint, P., Tip, F.: Origin tracking. J. Symbol. Comput. 15(5), 523–545 (1993)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Klint, P., van der Storm, T. (2016). Model Transformation with Immutable Data. In: Van Gorp, P., Engels, G. (eds) Theory and Practice of Model Transformations. ICMT 2016. Lecture Notes in Computer Science(), vol 9765. Springer, Cham. https://doi.org/10.1007/978-3-319-42064-6_2
Download citation
DOI: https://doi.org/10.1007/978-3-319-42064-6_2
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-42063-9
Online ISBN: 978-3-319-42064-6
eBook Packages: Computer ScienceComputer Science (R0)