Ontology and automatic code generation on modeling and simulation Youcef Gheraibia Abdelhabib Bourouis Computing Department Computing Department University Md Messadia University of Larbi Ben M'Hidi Souk Ahras, 41000, Algeria Oum El Bouaghi, 4000, Algeria youcef.gheraibia@gmail.com habib.bourouis@univ-batna.dz Abstract— In this paper we present a new approach for using describing discrete events simulation models according to the semantic web technologies in modeling and simulation. In recent process approach. years ontologies have been used popularly in many fields to represent and structure their concepts. This work is an attempt Today, technology developing and ambitions of researchers to create a specific ontology for the process oriented discrete are increasing. One of these ambitions is the automatic code event simulation domain. The ontology instances represent the generation from a conceptual model, which is not something model instances. This instance described in XML format and easy. It allows avoiding several error sources, save the time, then transformed to another form that is used to generate the simulation code via XSLT rules. The code is generated according and verifying the transition from conceptual model to the to the open source library Japrosim. The objective of this work is executable model with formal methods. With the definition of to enhance interoperability and automation of the transition from transformation rules, the passage from an XPISM instance to the ontology to the code execution. executable simulation code (especially Java) became possible, these rules are written using XSLT (extensible Stylesheet Keywords-component; Ontology, Semantic Web, modeling and Language Transformation), which is a declarative language. simulation, code generation, interoperability. By carefully examining the course of our work, we build the I. INTRODUCTION domain ontology, the construction of the scheme XPISM and The web of today is basically syntactic and the finally defining the XSLT rules to build the conceptual model interpretation of the resources content is available only to and executable code generation, it will be obvious to see the humans, the machine addresses only document structure. interest of this work, which aims to enhance interoperability, Generally there is no rigid method for classifying semantic define a standard vocabulary to represent concepts of content of Web documents. This is one of the reasons of the simulation model, and full automate of the process of development of semantic web. The Semantic Web is an modeling and simulation. extension of the syntactic web, we add semantics layer, its In the next section, we present the motivation and use of objectives to make the semantic content of Web resources ontologies in modeling and simulation. Section 3 presents the accessible by the software agents through a set of languages, related work on the use of ontologies in process-oriented meta-data and formal knowledge representation tools. One of discrete event simulation. Section 4 is devoted to develop the rich knowledge representation tools is the ontology, which PIDESO ontology. Section 5 deals with devolved XML is a set of concepts based on the meaning of an information schema XPISM. In Section 6, we present the whole passage field [9]. from domain ontology to exactable model and in section 7 a conclusion is given which focus on the path from the domain The use of ontologies is now become widespread because ontology to simulation executable. many fields have used this technology like medicine, architecture, geography and computing [6]. The simulation is II. ONTOLOGIES IN SIMULATION. one of the computing fields that can make a successful Simulation knowledge representation approaches require exploitation of ontologies, especially during the first stages of the handling of highly structured knowledge, including a simulation project that is the formulation of the problem and ontologies. Ontologies are useful in the process of modeling, develop the conceptual model. simulation and analysis cycle, particularly in the problem analysis and in the conceptual model development [12]. One XML (eXtensible Markup Language) is a computer of the motivations for modeling and simulation is the language that allows structuring of information and promotes decomposition of the model of the whole system into smaller the exchange of information on the Internet. It ensures high components and easy manipulated to distribute the interoperability in the exchange of models [4]. This benefit development effort of the model to different working groups, has motivated to define an XML dialect (noted XPISM) for and also in communication between deferent groups work [10]. Ontologies play an important role in the development process of the conceptual model. This occurs mainly in two The model structure and logic refer to the characterization of ways; capture the needs and the formulation of the conceptual the relationship between activities in the model. An activity model [15]. represents the dynamic behavior that occurs when objects interact one over the other. Ontologies play a key role in A. Identifying needs eliminating the ambiguity of interpretation of information The simulation model is often designed to achieve a set of contained in the description of the system to correctly modeling objectives or respond to a set of questions. The understand the logical flow of objects and the decision logic in ambiguity of natural language is always a problem but real-world process. ontologies can help to facilitate the different tasks as described III. Similar works below [11]:  Provide a mechanism to interpret and understand the A. PIMODES description of the problem. The Process Interaction Modeling Ontology for Discrete  Assist the designer to capture the user requirements Event Simulation (PIMODES) [7], is a general ontology for (the information necessary and sufficient for the the domain of process-oriented discrete event simulation, it is model set). using ontologies to formalize a representation language for B. Conceptual model formulation process-oriented discrete event simulation models. This The process of constructing the conceptual model includes the formalization is intended to lead to a formal specification of following activities: acquisition and analysis system concepts for the automatic interpretation of these concepts. description, identification and classification of goals in PIMODES proposes a set of classes for models modeling, determining the roles of system objects, boundaries representation, each model must be identified with a single and level of abstraction and the determining the model identifier and a clear description (annotation), the structure of structure and logic of it, [11], [10]. the model represented by a set of processes, a set of activities and a graph of traffic control of entities [7]. PIMODES offers 1) Acquire and analyze the system description : a strong structure and a clear chain of concepts but the Ontologies can facilitate the identification of inconsistency management of activities in the same level as the process, and incompleteness in a description of a system. For example, causes increased complexity in synchronizing the activities of ontologies can be used to interpret the descriptive information the control graph. on system objects. Flowchart Nodes and Arcs Node Arc 2) Identify and classify targets modeling : #N1 #C1 Node Arc #C3 Node C2 An important step in developing the conceptual model is to Node Arc # #N3 #N4 #N2 determine the specific goals of the simulation study based on control flow "the application of decision data" provided by the domain relationship represented by expert. This process of reasoning uses knowledge of the report control flow relationship and stresses in the system description (these are interpreted represented by control flow using domain ontologies). Activity #A1 relationship represented by control flow relationship 3) Determine the roles of objects, boundaries and level of takes place at Activity #A2 represented by abstraction: takes place at Activity #A3 The following tasks are performed once the specific aims of takes place at the analysis were established. Location Activity #A4 takes place at  Establish the boundaries of the model: the first #L1 Location activity in the development of the conceptual model #L2 is to choose the part of the system under study. Location  Establish the level of abstraction: A simple rule for #L3 determining the appropriate level of abstraction is to "include only those elements of a system that is able Figure 1. Activities control graph of PIMODES [PER 07] to meet the objectives and content and the level of abstraction as up ". B. PIMODEL  Identify the roles of objects in the model: this step is The Demo (The Discrete Event Modeling Ontology) [13], is to determine the model objects (resource, entity …), an ontology for domain of discrete event simulation. OWL and the role of each object, for example queue 'x' is (OWL: Ontology Web Language) has been used to define the activity therein '. more than 60 classes and several properties associated with them. This ontology consists of four main parts: Concept 4) Determine the model structure and logic Model, DeModel, Model Component Model and Mechanism. DeModel is also divided into four parts representing the simulation approaches, State Oriented Model, Activity Model Oriented, Event-Oriented Model and Process Oriented Model  Attributes Feature [13]. PIModel is the DEMO class that focuses on process-  Feature Type oriented simulation models. Models can be represented with OWL instances that can undergo treatment to achieve the  Resource automatic programmed model.  Variable C. Automatic generation of simulation code  Arc Automated code generation is a difficult task that falls within the agile development movement. The generation of the  Node code is done automatically from a set of information (model, meta-data ...). In the simulation, the model can be  Transition programmed directly from the encoded conceptual model  Connecting Activities using translation rules (type: IF THEN) with high-level language or languages of the simulation. These rules are  Creation of entities Activities written in software which does not facilitate their maintenance  Change of activities in the event of changes in the target language. At this level there is a lack of interoperability is a low reuse [3].  Queue Activity  Duration of activity IV. Process Interaction Discrete Event Simulation Ontology (PIDESO)  Manage resource Process interaction discrete event simulation ontology (PIDESO), it’s an ontology specific to represents the concepts B. Ontologization of process-oriented discrete event simulation domain. It This step leads to a semi-formal. This partial formalization consists of a set of classes organized in different levels in a facilitates its subsequent representation in a formal language hierarchy very clear to help designers to build their models and fully operational. Here is a diagram used to specify each without ambiguity and in a formal framework provided by class of the ontology. Figure 1 shows the classes in the OWL. A model is a set of processes where each is a set of ontology PIDESO and semantic links between different activities and controlled by a control graph [1]. PIDESO plays concepts [8]. an important role in the exchange of simulation models by Defined by providing a standard vocabulary for communication and reuse. Project Model description The construction of ontology PIDESO passes through three stages, Conceptualization, Operationalization and ontologization [7], [12]. contain * A. Conceptualization This step allows reaching an informal model, semantically ambiguous and therefore usually expressed in natural Contains language. This step is done to identify concepts and Variable Process * Activity relationships between these concepts from raw data, these concepts to describe informally cognitive entities of Contains Resource * Contains simulation domain. The ontology in this research is divided into two levels. The first one is to identify the major elements Activity Type of the system: model, processes, activities (general view) and Entity the graphs of control. The second level is to represent the Manage resource elements of characterization of first-level classes such as the types of each activity, the components of graph control, Attributes additional information on the model ... etc. Queue Controlled by  First level: Exit  Model  Process Arc Contain *  Graph Activity Transition Activity graph  Activities Node  Second level:  Project Description Figure 2. Ontology classes diagram (PIDESO) C. Operationalization represented by an XML schema by limiting the principles of Operationalization aims to have a formal structure of discrete event simulation, process-oriented. Each class of concepts and relations between them, represented as a web XPISM is associated with a class of ontology (PIDESO). The language OWL classes using an ontology editor Protégé-2000 OWL ontology instances are transformed into another form [13]. In the knowledge model of Protégé-2000 ontologies for code generation according to the scheme XPISM. This consist of a hierarchy of classes that have properties (slots), intermediate representation simplifies the transformation of which may themselves have certain properties (facets). The the conceptual model into a model program, provides a clear edition of these three types of objects is with a GUI, without structure of the model concepts. need to express what was specified in an operational target language, it is enough to fill out the forms corresponding that we want to specify. Figure 3. Ontology classes representation with Protégé-2000 Figure 4. XPISM Schema V. Extensible Process Interaction Simulation Model VI. Automatic generation of Java code from the ontology (XPISM schema) instance An XML document is well formed if it adheres to XML A. From PODESO instance to XPISM instance syntax rules that are explicitly designed to make documents easily interpreted by a computer, and an XML document is Process-oriented discrete event simulation models can be valid if it adheres to the rules described in a document as an described as instances of OWL (Ontology instance). The idea Associate DTD or schema. is to change the shape of the model (OWL instances) to We have defined an XML dialect to describe process-oriented another more appropriate form (XPISM instance). This new discrete event simulation models, named XPISM (extensible description of the model (XPISM pending) is an intermediate process interaction simulation model). It describes the representation for the executable model. An XSLT stylesheet simulation models in a hierarchy. The model consists of a containing the transformation rules allows instances of classes project description (sets the name of analyst / designer / in ontology elements XPISM by an XSLT processor. XSLT author, title of project, etc ....) And the whole model process rules are based on a locator called XPath to identify nodes in components such as activities, resources associated with each the source document (OWL instance) and build a result activity, variables, attributes associated with such entities and document (instance XPISM). This transformation is the graph of activities [14]. A simulation model for discrete independent of all simulation languages or programming that event oriented process consists of a set of entities that flow ensures and strengthens interoperability and facilitates reuse. through the system. Entities arrive according to a probability B. From XPISM instance of java code distribution and perform activities that are supported by Generating java code contains a main class containing a resources and managed queues [5]. These model elements are main () method that initializes the variables of the simulation model reflects its original state (number of replications, the instance PIDESO and this instance will be transformed into simulation time ... etc.). It also launches the first arrivals in the another form more appropriate XPISM noted. Also, it is easy simulation, then it call the start method (start ()) that initializes to obtain a conceptual model based on domain ontology. A set the coordinator and the simulation begins. After initialization of rules defined XSLT transforms this model into an of the first arrivals of each process, must be defined for each executable Java code based on the framework JAPROSIM. body that represents its life cycle in the system. Each process The interest of our approach is summarized in three main contains its own resources, variables, queues… etc points. First, the introduction of semantics in the simulation models, automatic generation of executable model, and the automation of the first steps of a simulation project. The result is certainly a gain in productivity, security development, enhanced interoperability and ease of maintenance and updating. To this is added clarity of approach and is now more rigorous. We envision in the future work, to use the results to extend the code generation part to other simulation languages, given that the approach is independent of any simulation languages and simulation tools. And it is possible to provide new Figure 5. Generated simulation code ontologies for other approaches to discrete event simulation, especially for events. C. XPISM instance to java code REFERENCES Models of discrete event simulation can be described as an [1] Bachimont B, “Engagement sémantique et engagement ontologique: instance of the schema XPISM well organized according to conception et réalisation d’ontologies en ingénierie des connaissances”. the process approach (a model contains several processes each Eyrolles, 2000. process has several activities etc ....). An XSLT stylesheet [2] Bourouis A et Belattar B, “JAPROSIM: A Java framework for Process contains the transformation rules allow instances XPISM Interaction Discrete Event Simulation: JOURNAL OF OBJECT TECHNOLOGY Vol. 7, No. 1, pp. 103-119, Janry-February 2008 , (conceptual model) to a java code. These rules are executed http//www.jot.fm/issues/issue_2008_01/article3/ via an XSLT processor. [3] Bourouis A et Belattar B, “Using XML IN SIMULATION MODELING D. Experiment of the result automatique code generation for XML based models" CARI 2008 MAROC , pp. 101-109. JAPROSIM, (JAva PRocess Oriented SIMulation) [2], [4] Charlet, P. Laublet & C. Reynaud. “Web sémantique”. Octobre 2003. Java is a framework for building discrete event simulators [5] Fishwick P, “Handbook of Dynamic System Modeling “, Chapman & oriented process. The code generated by our application is Hall/CRC, New York 2004. directly executable on the machine using the java library [6] T.R. Gruber, “Toward principles for the design of ontologies used for JAPROSIM. Figure 5 shows an example of experimentation knowledge sharing”. International Journal of Human Computer Studies. 1995. using JAPROSIM. [7] Lacy L, “Interchanging Discrete Event Simulation Models using PIMODES and SRML”. Proceedings of the Fall 2006 Simulation Interoperability Workshop. [8] M.Leclere, F. Trichet & F. Furst, “Operationalising domain ontologies: towards an ontological level for the SG family”, in Foundations and Applications of Conceptual Structure, contributions to the International Conference on Conceptual Structures. 2002. [9] T. Berners-Lee, J. Hendler & O. Lassila. “The Semantic Web”. Scientific American. 2001. [10] Miller A et Fishzick,” ontolgies for modeling and simulation: issues and approaches”, Proceedings of the 2004 Winter Simulation Conference, pp. 259- 364. [11] Miller A, Silver G, et Lacy L,” ontology based representation of simulation models following the processes interaction world of view “Proceedings of the 2006 Winter Simulation Conference,p 1168-1176. [12] Natalya F. Noy et Deborah L. McGuinness, ” Ontology Development 101: A Guide to Creating Your First Ontology”. Stanford University, Stanford, CA, 94305, 2005. Figure 6. Experimentation of generated code [13] N. Noy & D. McGuinness “Ontology Development 101: A Guide to Creating Your First Ontology”, Stanford Medical Informatics Report, SMI-2001-0880. 2001. VII. CONCLUSIONS [14] R. Studer, V. Benjamins & D. Fensel. “Knowledge Engineering: PIDESO is a complete and comprehensive ontology for Principles and Methods”. In Data and Knowledge Engineering. 25, the process interaction discrete event simulation domain. It 1998. allows analysts and designers to improve their models with a [15] M.Uschold & M.Grüninger, “ONTOLOGIES: Principles, Methods and Applications”. Knowledge Engineering Review. 1996. semantic dimension. Models can be represented with an