On Translating OCL into Graph Transformation Systems Najet ZOUBEIR Institut Supérieur d’Informatique MOSIC Research Unit Tunisia najetzoubeir@gmail.com Adel KHALFALLAH Institut Supérieur d’Informatique MOSIC Research Unit Tunisia adel.khalfallah@fst.rnu.tn Samir BENAHMED Faculté des Sciences de Tunis MOSIC Research Unit Tunisia samir.benahmed@fst.rnu.tn ABSTRACT With the emergence of the Unified Modeling Language UML in software engineering, defining constraints on models, writ- ten with the Object Constraint Language OCL, has become a necessary task, that strengthens the rigor and accuracy of models. However, in the definition of the semantics of UML models using graph formalism, the transformation of OCL constraints to graphs is still not precisely defined and does not provide an integrated semantics of OCL within graph transformation systems. In this paper, we propose an approach for extracting graph constraints from OCL con- straints. Our contribution is divided into three parts: In the first part, we will introduce graph constraint patterns, as the translation into graphs of a subset of OCL expressions. These patterns are validated with experimental examples using the GROOVE toolset. In the second part, we will explicit the relation between OCL and UML models within our graph transformation systems. The third part will be devoted to the representation of our tool OCL2Graph, as an extension of GROOVE, allowing to transform OCL con- straints to graphs, and to introduce them into existent graph grammars, according to the graph patterns we defined. 1. INTRODUCTION Extracting knowledge from UML diagrams, and transform- ing it into a different formalism, generally more formal, has been the focus of many works. These works aim to ex- tend the scope of such languages to more critical domains. Among these formalisms, graph transformation systems have known a fair success representing the UML diagram seman- tics [6, 8, 10, 11, 9], since this formalism is formal, universal and easily understood. With the emergence of the use of UML in software engineer- ing, and the need to refine these models using OCL con- straints, it was necessary to study the knowledge extraction from OCL constraints, and its transformation into other for- malisms, just like UML models. The resulting form of OCL constraints should have an integrated semantics within the transformed UML models semantics. In the next section, we will present an overview of the ex- isting works on the extraction of knowledge from OCL con- straints, and its transformation into other formalisms, espe- cially graph transformation systems. 2. OVERVIEW OF KNOWLEDGE EXTRAC- TION FROM OCL The extraction of knowledge from OCL constraints was stud- ied in many works. For example, the work in [4] propose an approach for transforming UML class diagrams to spec- ifications written in Semantics of Business Vocabulary and Business Rules (SBVR). The proposed approach takes into consideration the OCL constraints defined on the UML class diagrams. Works in [1, 15, 5, 14, 3] study the translation of OCL constraints into graph transformation systems. In gen- eral, the purpose of these works is to provide a semantics of OCL constraints using graphs. The work in [1] defines the notion of conditions on attributes in DMM graphs, with- out considering the OCL syntax, since it does not directly manipulate UML diagrams. In fact, the author considers conditions on graph nodes as an additional refinement of the matching in graph transformation rules. He uses the GROOVE toolset [7] for the representation and manipula- tion of graphs and constraints. Rutle et al. in [15] propose constraint aware model transformations based on the dia- gram predicate framework (DPF), which is a generic graph- based specification framework. The authors propose to de- fine constraints in the transformation rules specified by a joined modeling language, used to join the source modeling language to the target modeling language. The constraints are written in First-Order Logic (FOL), and represented in diagrams by diagrammatic signatures. Although this ap- proach is based on the formal meta-modeling framework DPF, we consider that the proposed constraint semantics (1) is not well integrated with models, since it uses a differ- ent notation (FOL), and (2) is restricted to the meta-level, because constraints are used only to control which structure to create in the target model, and which constraints to add to the created structure. The work of Dang et al. in [5] propose to integrate OCL constraints with Triple Graph Grammars (TGG), and real- ize this approach by a tool as an extension of USE (UML based Specification Environment). OCL conditions are used in meta-models in order to precisely represent well-formed models, and in models as their properties. However, OCL