Ontology-Based Verification of UML Class/OCL Model

Software models describe structures, relationships and features of the software. Modern software development methodologies such as MDE (Model Driven Engineering) use models as core elements. In MDE, the code is automatically generated from the model and model errors can implicitly shift into the code, which are difficult to find and fix. Model verification is a promising solution to this problem. However, coverage of all facets of model verification is a painful job and existing formal/semi-formal verification methods are greatly inspired by mathematics and difficult to understand by the software practitioners. This work considers particularly UML Class/OCL (Unified Modeling Language Class/Object Constraint Language) model and presents an ontology-based verification method. In the proposed method, a class diagram is transformed into ontology specified in OWL (Web Ontology Language) and constraints into SPARQL NAF (Negation as Failure) queries. This work tries to demonstrate that the proposed approach can efficiently cover all aspects of UML Class/OCL model verification.


INTRODUCTION
cost of errors correction in later phases is higher than earlier phases [2]. On the other side, modern software are becoming more and more complex and large. They require a lot of human efforts and time, and software development companies want to release software as early as possible [3]. Therefore, new software development methodologies have been introduced for accelerating the software development. MDE is one of them in which software models are considered as a nucleus of software development.
UML is a graphical modeling language and it is commonly used in MDE [4]. It is used in software specification, analysis, design, documentation, and even for code generation [5]. UML offers a number of models for dealing with various aspects of software [6][7]. The class model is an important part of UML and describes the system through concepts, relationships, and constraints [8]. OCL is combined with a class model for specifying the integrity constraints and business rules. However, MDE approach is not also free from error risks. In MDE, models are created in the initial stages of software development and in the initial stages, software development team does not fully aware of the business domain and their constraints.
Therefore, models can develop with errors, and these errors can implicitly shift into the code [9]. A promising solution to this problem is model verification.
Model verification is also a solution to the problems which are faced by testing such as model verification checks the correctness of model and makes sure that the model is bug-free. Model is created during the early phases of software development, therefore, error checking is economical in the early phases [10]. Current UML Class/OCL models verification methods are sound and provide great efforts to check the correctness.
However, they are based on formal/semi-formal methods, therefore, their notation extremely inspired by mathematics [11]. They are entirely different from the UML class model and difficult to understand by the software practitioners. They also have some limitations such as support of various basic data types (string and date), graphical constraints (xor and dependency relationships) and support of logical consequences. On the other side, ontology and UML class model have many similar elements and both are used for modeling real-world concepts [12].
This work presents an ontology-based verification method, particularly for UML Class/OCL model. Currently, the proposed method supports OCL invariants and does not support OCL operations. However, in this work, ontology as the target notation is motivated by the fact that the current ontology reasoners support reasoning over thousands of ontological items within a reasonable time [13], and all the verification facets mentioned in existing benchmarks can be easily achieved through the ontology-based method. In the proposed approach class diagram is transformed into ontology specified in OWL-DL and OCL constraints into SPARQL NAF queries.
The rest of the paper is organized as follows. Section 2 discusses the background and related work. Section 3 describes the proposed solution. Section 4 presents an example of ontology-based verification and results. Finally, section 5 and 6 present our conclusions and points out future works.

Ontology
Ontology is the concept of metaphysics, which is using by the philosopher from mid of sixteen century for categorization and representation of real-world entities.
Ontology has many elements (e.g. classes, relations,

UML Class/OCL Model Verification
Verification of UML Class/OCL model through formal/ semi-formal notation discussed in many works. UML only provides graphical elements for representing software components without any formal foundation [23].   Verification method should support the intensive arithmetic computation on integer and real numbers.

Translation of Classes
In

Constraints Consistency
According to the section 2.3, the first requirement is constraints consistency. In the proposed method, local and global constraints can be easily represented and verified by ASK NAF queries. Table 2 shows the representation of local constraints PaperLenght which presented in [29] through ASK NAF query. The representation of global constraint illustrated in Table 3, where the constraint involves two classes.

Intensive Arithmetic Computation
The Constraints with massive arithmetic computations can be easily specified through SPARQL ASK. Table 3 shows the example of intensive arithmetic constraint and equivalent SPARQL ASK query.

Intensive use of String
The most important requirement for the new UML Class/ OCL model verification method is support of string because existing methods rarely support the constraints which have string operations. However, Ontology supports string data types and SPARQL has many builtin string functions e.g. Substr, Strlen, Ucase. Table 4 shows the SPARQL ASK query for constraint mentioned in [29] which has string computation.

Logical Consequences
Support of logical consequences is a very vital requirement for new verification methods. Since this requirement is also not supported by most of the existing methods. In ontology, SPARQL CONSTRUCT queries are used for specifying the inference rules and generate the new dataset. Therefore, they can be used for performing logical consequences on UML Class/OCL model. Table 5 shows the SPARQL CONSTRUCT for bigamy logical consequence which described in [29].

Large Number of Instances
Ontology is used for making formal models of real-world entities and ontology reasoner can perform reasoning over the large models. Modern reasoning and a rule engine can process thousands of ontological items within a reasonable time [13]. Next section demonstrates through a real-life example that the proposed solution can also achieve this requirement efficiently.

UML CLASS/OCL MODEL VERIFICATION EXAMPLE
This section illustrates the whole formalization and presents how the proposed method effectively verifies the UML Class/OCL model. Fig. 2 shows a UML Class The company model also has OCL constraints which specified in Table 6 Table 7 shows the complete translation of    (?na,1,1)

CONCLUSION
UML Class/OCL model is an important part of UML. It serves as a graphical notation for representing real-world entities without any formal verification mechanism.
Numerous formal and semi-formal methods have been used for verification of UML Class/OCL model. This

FUTURE WORK
The future work will cover more elements (xor constraints and dependency relationships) of the UML class diagram which have not yet been covered by any existing method and will focus on scalability problem. Furthermore, the tool will be extended with the support the automatic transformation of UML Class/OCL model into the ontology and SPARQL NAF queries.