November 2, 2010
Marina Egea and Carolina Dania
In this talk we present a MySQL code generator for OCL expressions which is based on the use of stored procedures for mapping OCL iterators. Our code generator is defined recursively over the structure of OCL expressions. We discuss the class of OCL expressions covered by our definition (which includes, possibly nested, iterator expressions) as well as some extensions needed to cover the full OCL language. We also discuss the efficiency of the MySQL code produced by our code generator, and compare it with other results on evaluating OCL expressions on medium-large scenarios. Our motivation here is two-fold. On the one hand, our code gen- erator addresses the problem of evaluating OCL expressions on really large scenarios: instead of having to “load” them in memory (a time-consuming, or even impractical task for OCL evaluators), we can (i) store these scenarios in a database, (ii) apply our code generator to the expressions to be evaluated, and (iii) execute the resulting query statements on the database. On the other hand, our code generator provides a key component for any models-to-code development process, where the source models include OCL expressions and the target code evaluates these expressions on relational databases. We have implemented our code generator in the MySQL4OCL tool. A brief demo of this tool will also be shown.