A Graphical Tool for Automatic Generation of OWL Ontologies Aissam BELGHIAT Mustapha BOURAHLA Department of Computer Science Department of Computer Science University of Md Boudiaf, Msila, 28000, Algeria University of Md Boudiaf, Msila, 28000, Algeria Belghiatissam@gmail.com mbourahla@hotmail.com Abstract—The ontologies are became the backbone of the generated tool to OWL ontologies represented in RDF/XML semantic web, the development of these ontologies from scratch is format. a very difficult task. The use of models is useful to deal with such The rest of the paper is organized as follows: In Section 2, problems since it allows visually modeling of the ontologies we present some related works. In Section 3, we present some themselves. In this paper, we propose an approach based on the combined use of Meta-modeling and Graph Grammars to basic notions about UML, OWL. In Section 4, we present automatically generate a visual modeling tool for OWL concepts about model and graph transformation, and then we ontologies. In our approach registered in the MDA architecture, give an overview of the AToM3 tool [1]. In Section 5, we the UML Class diagram formalism is used to define a meta- describe our approach that provides a graphical environment model of class diagrams. The meta-modeling tool ATOM3 is used for automatic generation of OWL ontologies. In Section 6, we to generate a visual modeling tool according to the proposed class illustrate our tool through an example. Finally concluding diagram meta-model. We have also proposed a graph grammar remarks drawn from the work and perspectives for further to automatically generate OWL ontologies of the graphically research are presented in Section 7. specified class diagram models. This allows the user to pass a very important step in the development process of OWL II. RELATED WORKS ontologies. Our environment is illustrated through an example. The idea of our work is not innovating, indeed several Index Terms—UML, Ontology, OWL, ATOM3, MDA. works exist in the literature tackle this subject. In [14] the authors proposed a transformation of UML towards DAML at I. INTRODUCTION the end of the Nineties, by showing similarities and differences between the two languages. In [15] the work of “Converting The ontologies are became the backbone of the semantic UML to OWL Ontologies” proposed a transformation of web, this last provides various languages for representing Ontology UML Profile (OUP) towards an ontology OWL. In ontologies including XML, RDF, DAML, and OWL. OWL [6] the OMG notices the interest of such subject and proposed (Ontology Web Language) is the most widely used of these in its turn the ODM which provides a profile for writing RDF languages because of its high expressive power and the fact and OWL within UML, it also includes partial mappings that it is the W3C standard ontology language for the Semantic between UML and OWL as well as mappings amongst RDF, Web [10]. RDFS, Common Logic and Topic Maps, it should be noted that In the other hand, UML is the unified object oriented several works are carried out like answer to the call of the modeling language which became an important standard OMG and gathered in the ODM that we do not evoke here. In widely used by domain experts for expressing their domain [9], the author presented an implementation of the ODM using knowledge. The development of OWL ontologies from scratch ATL language. In [5], the author used a style sheet is a very difficult task. The use of models is useful to deal with “OWLfromUML.xsl” applied to an XMI file (intermediate such problems since it allows visually modeling of the format of UML model) to generate an ontology OWL DL ontologies themselves. An OWL ontology visualized as UML represented as RDF/XML format. And finally in [16], the diagrams allow us to better describe our ontology to humans, authors proposed a detailed comparison between UML and and most people can understand an UML class diagram at a OWL that carried out in 2008. In the other side Atom3 has glance. In this paper we propose an approach based on the been proven to be a very powerful tool allowing the meta- combined use of Meta-modeling and Graph Grammars to modeling and the transformations between formalisms, in [1] automatically generate a visual modeling tool for OWL and other works we can found treatment of class diagrams, ontologies. We implement these concepts presented above in activity, and other UML diagrams. In these works the Meta ATOM3: A Tool for Multi-formalism and Meta-Modeling [1]. modeling allows visual modeling and graph grammar allows We propose an UML class diagram meta-model and we use the the transformation. meta-modeling tool AToM3 to generate automatically a visual Obviously, the heart of our work is articulated on modeling tool to process UML class diagram models. We also transformation rules and their implementation. In pre-ceding define a graph grammar to translate the models created in the works, the transformation rules are more specific and reflect a general opinion of the author often related to a specific field which he works on (specific transformation). In this paper we propose another vision different from that approached in preceding works either in the proposition of transformation rules, or in theirs implementation, this vision is to propose the transformation rules in a level of abstraction close to the application in order to obtain usable ontologies, because more the selected level of abstraction is close to the application minus ontology is reusable, but more it is usable. Then we propose a graph grammar implementation for these rules. Fig. 1. Model transformation principle. III. OWL FROM UML CLASS DIAGRAM Graph transformation was largely used for the expression UML (Unified Modeling Language) is a language to of model transformation [4]. Particularly transformations of visualize, specify, build and document all the aspects and visual models can be naturally formulated by graph artifacts of a software system [7]. UML defines thirteen transformation, since the graphs are well adapted to describe diagrams; some of them represent the system statically while the fundamental structures of models. others show the functionalism of the system. The class diagram The set of graph transformation rules constitutes what is is considered very important for object oriented modeling; it called the model of graph grammar; each rule of a graph shows the internal structure of a system and makes it possible grammar is composed of a left hand side (LHS) pattern and of to provide an abstract representation of its objects [2]. a right-hand sided (RHS) pattern. OWL (Ontology Web Language), was recommended by the Therefore, the graph transformation is the process to choose W3C in 2004, and its version 2 in 2009, is designed for use by a rule among the graph grammar rules, apply this rule on a applications that need to process the content of information graph pattern that is matched with the LHS pattern to produce instead of just presenting information to humans. OWL1 offers the RHS pattern, and reiterate the process until no rule can be three sub-languages with increasing expression intended for applied [4]. specific communities of developers and users: OWL Lite, OWL DL, and OWL Full [10] whereas OWL2 defines three new profiles: OWL2 EL, OWL2 QL, and OWL2 RL [13]. B. AToM3 UML and OWL have different goals and approaches; AToM3 [1] “A Tool for Multi-formalism and Meta- however they have some overlaps and similarities, especially Modeling” is a visual tool for model transformation, written in for representation of structure (class dia-grams). UML and Python [8] and is carried out on various platforms (Windows, OWL comprise some components which are similar in several Linux, …). It implements various concepts like multi-paradigm regards, like: classes, associations, properties, packages, types, modeling, meta-modeling and graph grammars. It can be also generalization and instances [6]. UML is a notation for used for simulation and code generation. modeling the artifacts of objects oriented software, whereas AToM3 provides visual models those are conform to a OWL is a notation for knowledge representation, but both are specific formalism, and uses the graph grammar to go from a modeling languages. model to another. In the next sections, we will discuss how we use AToM3 to meta-model class diagrams and how to generate OWL models IV. GRAPH TRANSFORMATION by applying a graph grammar. A. Overview V. OUR APPROACH Modeling and model transformation play an essential role Our solution is implemented in AToM3. Our choice is in the MDA “Model Driven Architecture”. MDA recommends quickly related to AToM3 because of the advantages which it the massive use of models in order to allow a flexible and presents like its simplicity, and its availability. In our approach iterative development, thanks to refinements and enrichments we have to profit from the convergence between UML and by successive transformations. OWL especially for representation of structure (class A model transformation is a set of rules that allows passing diagrams), most people can model and understand UML class from a meta-model to another, by defining for each one of diagram at a glance, it is not the case in different elements of the source their equivalents among the elements of representations of ontologies like RDF/XML, Turtle or other the target. These rules are carried out by a transformation representations. We have to benefit of visualizing OWL engine; this last reads the source model which must be conform ontologies as UML class diagram models. to the source meta-model, and applies the rules defined in the For the realization of this application we have to propose model transformation to lead to the target model which will be and to develop a meta-model of class diagram (figure 2), this itself conform to the target meta-model. The principle of model meta-model allows us to edit visually and with simplicity class transformation is illustrated by figure 1: diagrams on AToM3 canvas. In addition to meta-model proposed we develop a graph grammar made up of several Association class rules which allows transforming progressively all what is An association-class is transformed to OWL class (implementation level), modeled on the canvas towards an OWL ontology stored in a named (ac-ssociationclassname). The latter is connected to the left part by a relation named (AG_AC-associationclassname), and to the right part by a disk file (fig.2). The graph grammar is based on transformation relation named (AD_AC-associationclassname). We named also the two new rules; those rules try to transform the class diagram in the roles on the two new association ends (RG_AC- associationclassname) and (RD_AC- associationclassname). After these transformations on the implementation level, always in order to obtain at the end association class we find ourselves on the situation of transformation of usable ontologies. binary associations (which is treated previously). For the ontology, the choice among OWL profiles is made on OWL DL because it places certain constraints on the use of B. Datatypes transformation the structures of OWL such as separation two to two between UML data types are transformed into XML schema (XSD) classes, datatypes, datatype properties, objects properties, data types because OWL uses the majority of the datatypes annotation properties, ontologies properties, individuals, data integrated into XML schema. The calls of these datatypes are values, and integrated vocabulary [11]. That means, for done through datatype URI address reference example, a class cannot be at the same time an individual [12]. http://www.w3.org/2001/XMLSchema [11]. The instances of These constraints enable us to lead to our objective which is an the primitive types used in UML itself include: Boolean, ontology well reflecting what is modeled in a class diagram. Integer, String, and UnlimitedNatural [7]. Table II presents the UML primitive datatypes and their transformations. TABLE II. DATATYPES TRANSFORMATION. UML XSD Integer xsd:integer Boolean xsd:boolean String xsd:string xsd:nonNegativeInteger UnlimitedNatural xsd:positiveInteger C. Meta-model of UML Class diagram To build UML class diagram models in AToM3, we have to define a meta-model for them. Our meta-model is composed Fig. 2. Transformation sequence. of two classes and four associations developed by the meta- formalism (CD_classDiagramsV3), and the constraints are expressed in Python [8] code (fig. 3): A. Transformation rules Our approach is realized according to suggested transformation rules (Table I). We propose a set of rules in particular for classes‟ transformation, enumerations, associations, roles, dependencies, association classes, and almost all the elements of a class diagram. The level of abstraction in those rules is close to the application in order to have usable ontologies. For lack of space, we have presented some of these rules. TABLE I. UML TO OWL TRANSFORMATION RULES. Class An UML class is transformed to an OWL class; the name of the class is preserved. Fig. 3. Class diagram meta-model. Inheritance The specialized class is defined subclass of the generalized class. After we built our meta-model, it remains only its Class Attributes generation. The generated meta-model comprises the set of An attribute is transformed into a property, and the transformation is carried classes modeled in the form of buttons which are ready to be out according to the type of attribute. If the type of the attribute is a primitive employed for a possible modeling of a class diagram. type, the attribute is transformed into datatype property. If the value of the attribute is a class, it is transformed into object property. D. The Proposed Graph grammar To perform the transformation between class diagrams and Bidirectional association OWL ontologies, we have proposed a graph grammar Associations are transformed into object properties. An inverse object property is generated automatically named (Inverse-associationname). composed of an initial action, ten rules, and a final action. For lack of space, we have not presented all the rules. Initial Action: Ontology header TABLE IV. GENERALIZATION TRANSFORMATION. Role: In the initial action of the graph grammar, we created a Condition file with sequential access in order to store generated OWL code. Then we begin by writing the ontology header which is fixed for all our generated ontologies (fig. 4). := Action Fig. 4. Ontology header definition. Rule 1: Class transformation Name: class2class Priority: 1 Rule 3: Binary association transformation Role: This rule transforms an UML class towards an OWL Name: asso2prop class (see Table III). In the condition of the rule we test if the Priority: 3 class is already transformed, if not, in the action of the rule we Role: This rule transform an association of the class diagram reopen the OWL file to add the OWL code of this class. towards an OWL object property, it allows also the TABLE III. CLASS TRANSFORMATION. transformation of roles and cardinalities of this association. Condition TABLE V. ASSOCIATION TRANSFORMATION. Condition := Action := Action Rule 2: Generalization transformation Name: gener2sclass Priority: 2 Role: This rule transforms a generalization by indicating that the specialized class is defined as sub-class of the generalized class (Table IV). Rule 4: Association-class transformation Name: ac2class Priority: 1 Role: This rule allows the promotion of association class to a full class (see Table VI), that reflects what we show in the transformation rules. This class takes as name the name of the LHS class-association preceded by (AC-). Two binary associations are created in the RHS named AG_AC, AD_AC, thus two new roles RG_AC and RD_AC as illustrated in the transformation rules. TABLE VI. ASSOCIATION-CLASS TRANSFORMATION. Condition No condition. Fig. 6. Class diagram of our ontology. We start the execution of our graph grammar; we obtain the intermediate graph (see fig. 7). In parallel, there is an automatic generation of the file which contains OWL code stored on hard := disc (see fig. 9): Action No action Final Action: Definition of the end of ontology Role: In the final action of the graph grammar, we end our ontology, we will have to open our file and to add „‟ (see fig. 5). Fig. 7. Intermediate graph. After the execution of the graph grammar on our example we obtain our ontology generated and stored. We can visualize this ontology by specialized tools such as SWOOP (fig. 8): Fig. 5. End of ontology. VI. EXAMPLE Let us apply our approach on a simple example of development of a small OWL ontology which describes a population; it describes a group of people and their relations of parenting. The population which we wish to describe is made up of humans, and divided into two subclasses Man and Woman. Fig. 8. Ontology Visualisation by SWOOP. Human can have a relationship with another human. A man and a woman can be married. This small ontology can be Figure 9 presents the source RDF/XML of our generated modeled quite simply with the class diagram (fig. 6). ontology. VII. CONCLUSION We saw in this paper how to implement an application which makes a graphical environment for the automatic generation of OWL ontologies based on class diagram models and by using graph transformation in particular the powerful tool AToM3. For the realization of this application we developed a meta-model for UML class diagrams, and a graph grammar composed of several rules which enables us to transform all what is modeled visually in our AToM3 generated environment to an OWL ontology stored in a hard disk file. In future work, we plan to extend the environment to automatically generate OWL/SWRL from UML/OCL models in AToM3. REFERENCES [1] AToM3. Home page: http://atom3.cs.mcgill.ca.2002. [2] Laurent AUDIBERT, “UML2”, http://www.lipn.univpa ris13.fr/audibert/pages/enseignement/cours.htm, 2007. [3] Fowler, Martin, “UML Distilled - Third Edition - A Brief Guide to the Standard Object Modeling Language”, 2003. [4] G. Karsai, A. Agrawal, “Graph Transformations in OMG‟s Model-Driven Architecture”, Lecture Notes in Computer Science, Vol 3062, Springer, juillet 2004. [5] Sebastian Leinhos, http://diplom.ooyoo.de, 2006. [6] OMG, “Ontology Definition Metamodel”, V1.0, http://www.omg.org/spec/ODM/1.0, May 2009. [7] OMG, “OMG Unified Modeling Language, Infrastructure,v2.3”,http://www.omg.org/spec/UML/2.1.2/Infra structure/PDF, May 2010. [8] Python. Home page: http://www.python.org. [9] SIDo Group, “ATL Use Case - ODM Implementation (Bridging UML and OWL)”,http://www.eclipse.org /m2m/atl/usecases/ODMImplementation/, 2007. [10] W3C OWL Working Group, “OWL Web Ontology Language- Overview”, http://www.w3.org/TR/2004/rec-owl-features- 20040210/. Recommendation 10 Feb 2004. [11] W3C OWL Working Group, “OWL Web Ontology Language– Guide”, http://www.w3.org/TR/2004/REC-owl-guide- 20040210. Recommendation 10 February 2004. [12] W3C OWL Working Group, “OWL Web Ontology Language- Reference”,http://www.w3.org/TR/2004/rec-owl-ref-20040210. W3C Recommendation 10 February 2004. [13] W3C OWL Working Group, “OWL 2 Web Ontology Language Document Overview”. http://www.w3 .org/TR/2009/REC-owl2- overview-20091027.W3C Recommendation 27 October 2009. [14] Kenneth Baclawski2 and all “Extending UML to Support Ontology Engineering for the Semantic Web”. [15] Dragan Gašević, Dragan Djurić, Vladan Devedžić, Violeta Damjanović “Converting UML to OWL Ontologies”, 2004. [16] Kilian Kiko, Colin Atkinson, “A Detailed Comparison of UML and OWL”,2008. Fig. 9. Generated OWL ontology.