Incremental validation of models in a MDE ... - Semantic Scholar

1 downloads 0 Views 287KB Size Report
(iv) Experimentation and validation of our approach by the development of a .... Figure 4 presents the link between our validation process, ArgoUML and Racer.
Incremental validation of models in a MDE approach applied to the modeling of complex data structures 1

Ludovic Menet , Myriam Lamolle1, Chan Leduc1 1

Laboratoire d’Informatique Avancée de Saint Denis (LIASD) IUT of Montreuil, University of Paris 8 140 rue de la nouvelle France, 93100 Montreuil, France {l.menet, m.lamolle, c.leduc}@iut.univ-paris8.fr

Abstract. In this paper, we propose an incremental validation method in the scope of a Model Driven Engineering (MDE) approach used to develop XML Schema models. The suggested MDE approach is based on an abstraction layer thanks to UML class diagrams, and on a series of transformations allowing the definition of XML Schema models. Our method of validation aims at minimizing model errors and optimizing the process of model checking. So, we introduce the notion of “contexts of validation” allowing the check of the data model sub-parts. We also use the first-order logic to specify the constraints that the models have to verify. A validation of our approach is presented through an application that we developed. Keywords: MDE, Meta-model, UML, UML Profile, XML Schema, Validation, Validation contexts.

1 Introduction We can acknowledge that XML [12] has become the standard for exchanging information over the Internet. XML Schema [13] has been defined to describe the structure of an XML document in a more precise way than a simple Document Type Definition (DTD). The use of XML seems to be adapted to the definition of models but it implies an extensive knowledge of this language. A lot of softwares such as Altova XML Spy [1] have been developed to model graphically XML Schema models as trees. These softwares allow optimizing the modeling of XML schemas but each of them proposes a different formalism of representation, thus creating some confusion during the modeling of these schemas. A Model Driven Engineering (MDE) approach appears to be a solution to the difficulties encountered during the modeling of such data structures. The objective of a MDE approach is to move the complexity of an application implementation to the specification of this one. It is then an issue of making an abstraction of the programming language using an abstract modeling process focused on the use of several standards such as MOF [9], OCL [10], UML

[11] and XMI [5]. In this way, the works that we have previously lead for integrating a MDE approach were of two types: modeling [8] and transformation of models [6]. In addition, structural consistency and validation processes are important aspects during the definition of data models. The classical approaches of models validation are focused on checking the whole of a model. In these approaches, when a model is updated, it is necessary to validate the entire model in order to check whether the modification has implied some incoherence in the model’s structure. In the case of small models these approaches are suitable; however, in industrials contexts with larger models, they do not. The main cause of this issue is that the informations provided by previous validation processes are not used by the later checking procedures. In this paper we propose the introduction of an incremental validation approach for optimizing the validation of data models. For this purpose we proceed in several steps: (i) Formalization of the UML class diagram meta-model to allow the expression of validation rules, (ii) Definition of validation contexts focused on a graph representation, (iii) Definition of the incremental validation algorithm, (iv) Experimentation and validation of our approach by the development of a specific application. In the second part of this paper, we will formalize the notion of meta-model as a mathematical object, which allows us defining rules and constraints as logical expressions of the first-order logic. Section 3 describes our incremental validation approach founded on the notion of validation contexts, and also presents an application of it. Section 4 presents our conclusions and future perspectives of this work.

2. Meta-models formalization The validation of models is an important step during the modeling process. The first step of our approach consists in formalizing the notion of meta-model. The formalization as a mathematical object will allow us expressing rules and constraints, and performing inferences on a model. In this section we focus on this formalization and we will apply it on the UML class diagram meta-model.

2.1. Definitions We formalize the notion of meta-model as being a set of classes, attributes, references. We use this notion for defining a meta-model (MM) as an 8-uplet that we can describe in the following way: MM = {MC, P, R, T, MetaClass, PropType, RefType, Super} where: − MC is the finite set of the meta-classes of the meta-model, − P is the finite set of the properties (attributes) of the meta-model,

− R is the finite set of the references (associations) of the meta-model, − T is the finite set of primitives types used in the meta-model, − MetaClass is the function that returns the meta-class of each property and reference, − PropType is the function that associates to each property its primitive type, − RefType is the function that associates to each reference its type of meta-class, − PropValue is the function that associates to each property of a meta-class a value, − RefValue is the function that associates to each reference of a meta-class a value, − Super ⊂ MCxMC is the inheritance relation between the meta-classes of the metamodel. This relation is binary, not reflexive and not symmetric. According to these definitions we can formalize the UML class diagram metamodel.

2.2. Formalization of the concept of class diagram Figure 1 presents the simplified UML class diagram meta-model.

Fig. 1. UML class diagram meta-model. In this work, we exclude from the meta-model notions of interface and operations. These concepts cannot be represented with XML Schema, and have therefore to be excluded when defining a XML Schema model via our UML profile. Barbier and Henderson-Sellers in [3] showed the unsuitability of this meta-modeling using attributes, mainly because of the OCL constraints lacks associated with these attributes (OCL language is an UML sub-set). However Henderson-Sellers [4] precises that the use of OCL in these conditions is not adequate: it only compensates temporarily for the inconsistencies of the language. Yet OCL should be used to express additional constraints rather than as a short-term solution. Moreover very few

tools supporting at times partially OCL, we decided to preserve this meta-modeling, and to focus on rules and constraints expressed as formulas of the first-order logic. From the definitions presented in 2.1, we can formalize the meta-model of UML class diagrams as follows: MC = {Classifier, Class, Attribute, AssociationEnd, Association, Stereotype, Multiplicity} P = {name, lowerBound, upperBound, aggregation} R = {type, ownerClass, attributs, mult, ends, ownerAssociation, superClass, stereotypes} T = {String, Integer} MetaClass(name) = {Classifier} MetaClass(lowerBound) = {Multiplicity} MetaClass(upperBound) = {Multiplicity} MetaClass(aggregation) = {AssociationEnd} PropType(name) = {String} PropType(aggregation) = {String} PropType(lowerBound) = {Integer} PropType(upperBound) = {Integer} MetaClass(type) = {Attribute}, RefType(type) = {Class} MetaClass(owerClass) = {Attribute}, RefType(ownerClass) = {Class} MetaClass(attributes) = {Class}, RefType(attributes) = {Attribute} MetaClass(mult) = {AssociationEnd}, RefType(mult) = {Multiplicity} MetaClass(ends) = {Association}, RefType(ends) = {AssociationEnd} MetaClass(ownerAssociation) = {AssociationEnd}, RefType(ownerAssociation) = {Association} MetaClass(superClass) = {Class}, RefType(superClass) = {Class} MetaClass(stereotypes) = {Classifier}, RefType(stereotypes) = {Stereotype} Super = {(Class, Classifier), (Attribute, Classifier), (Stereotype, Classifier), (Association, Classifier)} This formalization allows us expressing constraints as formulas of the first-order logic. For example, we want to define a constraint specifying that the ComplexType stereotype has to uniquely be defined on elements having as meta-class, the meta-class Class. This rule is expressed as an equation: ∃ y, x ((Class (y, “Stereotype”) ∩ Ref (x, “stereotype”, y) ∩ Prop(y, “name”, “ComplexType”) ) ⇒ Class (x, “Class”)) With: − Class(me, mc) is the predicate such as Class(me, mc) ⇔ MetaClass(me) = mc, − Prop(me, p, val) is the predicate such as Prop(me, p, val) ⇔ PropValue(me, p) = val, − Ref(me, r, val) is the predicate such as Ref(me, r, val) ⇔ RefValue(me, r) = val.

3. Incremental validation of models focused on graphs Classical approaches of model validation consist in verifying the complete consistency of a model. When a model is modified, it is necessary to validate over the whole model to check whether the modification made may have lead to an inconsistency in the model structure. In this section, we propose to introduce an incremental validation approach to reduce the checking cost by verifying just the part of model involved by the modification. In an incremental validation approach, two issues are met: (i) What rules have to be checked for each action on the model? (ii) Which parts of the model have to be checked? The solution to the first question is to consider that, for a given action, a series of rules must be verified. In that matter, a classification of the rules to verify will allow us indicating which rules to validate when a specific action occurs, and not verifying the ones that are not involved by this action. Concerning the second point, we introduce the notion of contexts, which permit, for a given model, knowing the parts of the model that could satisfy or not a rule of validation. Using this mechanism of contexts, we optimize validation process by considering that only the modifications affecting a type of context can involve its verification. Based on these principles, we will set up an incremental validation algorithm.

3.1 Representation of models as graphs Because of their structure adapted to traversal algorithms and of their easy updatability, we chose to represent a model as an oriented graph. The use of a graph allows the partitioning of a model and making inference on its entirety or on its subparts. For this, we have to transform the class diagrams in graphs. Figure 2 shows the graph meta-model that we defined to represent a diagram of UML class.

Fig. 2. Meta-model of the graph data structure.

The transformation process of a class diagram to a graph must be as simple as possible. So, we define the meta-model so that it would be similar to the meta-model of UML class diagrams.

3.2. Classification of actions and rules of consistency In the scope of the definition process of data models, we define possible types of actions and categories of consistency rules. We name events the set of possible actions/elements combinations. For example, the modification of a class or of a property, the deletion of a reference, etc., represent events. This typology of actions is used to specify which are the triggering events of a set of rules to check. We define 4 sets of rules, which permit the classification of consitency rules: − RC is the set of rules defined in a model, − RCCL is the set of rules defined and applied on an element of Class type, − RCProp is the set of rules defined and applied on an element of Property type, − RCRef is the set of rules defined and applied on an element of Reference type. With RC = RCCL ∩ RCProp∩ RCRef We use this classification of consistency rules and the graph representation to define the notions of validation contexts.

3.3. Validation contexts Our aim is to determine which sub-parts must be checked when an event is triggered in the model. For this, we define the notion of validation context as a set of elements (sub-graphs) to validate linked to a type of event. Hence we define 3 types of validation contexts: − Class context, represents the set of elements depending on an event on a Class, − Property context, represents the set of elements depending on an event on a Property, − Reference context, represents the set of elements depending on an event on a Reference type. For example, Figure 3 shows the notion of validation context from a graph corresponding to a class diagram representing a publications database.

Fig. 3. Example of validation contexts representation.

In this example, the validation context of the class Author is composed of the class Author, its stereotypes, attributes and associations. The validation context of the association authors is composed of the authors association, its cardinalities, and the two associated classes, i.e. Root and Author. The validation context of the attribute title_id is composed of the attribute title_id and its stereotypes. So, we define an incremental validation algorithm based on the notions of events and of validation contexts. When an event is triggered, the incremental validation algorithm process runs as follows: (i) Get the contexts associated with the event, (ii) Get the rules of consistency associated with the event, (iii) Validate the contexts depending on this event.

3.4. Application of our incremental validation approach In order to apply our approach, we developed a modeling, which allows defining XML Schema models. This tool is based on the CASE (Computer Aided Software Environment) ArgoUML [2]. ArgoUML is an open source UML modeling software. Based on ArgoUML, we developed a module including the UML profile, and import and export functions of XML Schema models. The import function allows generating a UML class diagram from a XML Schema model. The export function allows generating the XML Schema code of a class diagram defined with our UML profile. The validation process of the UML diagrams is also extended in order to integrate our method of incremental validation. Figure 4 shows our incremental validation process that we have introduced in ArgoUML.

Fig. 4. Incremental validation process.

Figure 4 presents the link between our validation process, ArgoUML and Racer. We chose the inference engine Racer [14] because it has excellent performances on reasoning, and it defines a Java API, which allows exploiting it through an external application (i.e. ArgoUML in our case). In our validation process, we apply the algorithm that we defined in the previous part. When an event occurs on a model, the validation engine that we created is in charge, in the background, to deal automatically with this event and to validate it. The validation of this event is performed by generating its dependent contexts, and applying rules on the composing elements of these contexts. The set of contexts and rules is transmitted through a Java API to

Racer, which is in charge of “reasoning” on the model’s parts to validate. The results of the inference process performed by Racer are returned to ArgoUML. We deal with the messages sent by Racer to generate a validation report formulating the possible errors resulting from the event on the model.

3.5. Experimental results In this section, we propose to experiment our incremental validation approach on a model of large scale (about 5000 nodes). In order for the results to be representative, we choose to compare the performances of our incremental validation approach with a classical non-incremental validation. The comparison criteria that we held are: the time for a first validation of a model, the time for a complete revalidation, and the time for a revalidation after completing an insertion, deletion, or modification action on a model (Figure 5). We choose not to consider the aspects associated with themes of memory occupation insofar as these aspects can strongly vary from one machine to another.

Fig.5. Experimental results.

When using our approach, our study shows that validation times are drastically reduced, and this for any event produced. In the case of a second validation without modification of the model, our approach reuses the information resulting from the first validation, which allows us to obtain a time reduction in the order of a tenth of the necessary time for a classical validation method. Similarly, when a simple event (insertion or modification) occurs on the model, the following validations are about five to ten times faster. Indeed, our validation algorithm allows detecting which part of the model to validate, so that only these parts are subjects to validate again.

4. Conclusion Previously, we introduced the use of a MDE approach to define XML Schema models ([8] and [6]). This approach allowed obtaining an abstraction layer through an UML profile dedicated to the XML Schema semantic. To move from an abstract level to a concrete level, we defined mappings and put them into practice via an application that we developed. We proposed in this paper an incremental approach to validate models, in order to complete our MDE method. This approach based on notions of validation contexts and events optimizes processes of validation on large models. Our method does not provide an automatic correction of potential errors raised in the validation process, as the user has to manually correct errors that are detected during each event. To improve our method of validation, it would be interesting to focus our work on approaches to calculate sets of corrective modifications, which will allow correcting on an automatic manner the detected errors, or to propose adequate corrections.

5. References 1. Altova XMLSpy. http://www.altova.com/xmlspy 2. ArgoUML, http://argouml.tigris.org/ 3. Barbier F., Henderson-Sellers B., «The whole-part relationship in object modelling: A definition in cOlOr ». Information and Software Technology, 43(1). pp. 19-39, 2001. 4. Henderson-Sellers B., « Some Problems with the UML V1.3 Metamodel ». 34th Annual Hawaii International Conference on System Sciences, 3-6 janvier, Maui, Hawaii, 2001. 5. Iyengar S., Brodsky A., « XML Metadata Interchange (XMI) Proposal to the OMG Object Analysis & Design Task ». Object Management Group. http://www.omg.org. 6. Lamolle M., Menet L., « Towards a Bidirectional Transformation of UML and XML Models ». Proceedings of the 2008 International Conference on E-Learning, E-Business, Enterprise Information System and E-Government, EEE 2008. 14-17 juillet, 2008, Las Vegas, Nevada, USA. 7. Menet L., Lamolle M., « Meta-modelling “object”: expression of semantic constraints in complex data structure », Proceedings of ERIMA07’. pp. 104-108, Biarritz, France, 2007. 8. Menet L., Lamolle M., « Designing XML Pivot Models for Master Data Integration via UML Profile ». ICEIS 2008, International Conference on Enterprise Information Systems, Volume DISI. Barcelone, Spain, 12-16 juin 2008. pp. 461-464. 9. MetaObject Facility, http://www.omg.org/mof/ 10. OMG. Response to the UML 2.0 OCL. http://www.omg.org/docs/ad/02-05-09.pdf ,2002. 11. Unified Modeling Language, http://www.uml.org 12. Extendible Markup Language (XML) 1.0. W3C XML Working Group. http://www.w3/org/TR/REC-xml (2000) 13. W3C. XML-Schema Part 1: Structures 2nd Ed. 2004 http://www.w3.org/TR/xmlschema-1 (2004) 14. Haarslev V., Möller R., « Description of the racer system and its applications », in Proceedings of the International Workshop on Description Logics (DL-2001), Stanford, Californie, pp. 132-141, August 2001.