*Definition 1. Ontology model triples: UmlOnt (C, R, G).*

PSM based on the UML class diagram can be represented by a triple: UmlOnt(C, R, G). C is the class node set, and it is an ontology class definition of the concept in PSM. R is the relation node set, and it is the definition of the relations among ontology class. G is the relation set of C and R, which describes the relations among the nodes in C and R set.

#### *Definition 2. Relation Matrix (RM)*

Relation matrix is a n order square matrix, including elements *aij* in total of n \* n, which

looks like 11 12 1 21 22 2 1 2 ... ... ... ... ... ... ... *n n n n nn aa a aa a aa a* , denoted as A = ( ) *aij nn* ( i,j = 1, 2, 3, ……, n ) is used to

describe the relations between the class nodes and relation nodes in the PSM. And *aij* indicates whether there is relation between class node *i* and class node *j,* as well as the type of relation node.

#### *Definition 3. Connected subgraph*

Given a directed graph, which can be divided to several connected subgraphs {G1, G2, …, Gn}, these subgraphs meet the following conditions:


#### *Definition 4. Model Transformation Automaton (MTA)*

Model transformation automaton is a quintuple: MTA = (Q, Σ, δ, q0, F), including:


Telecommunications Service Domain Ontology:

Fig. 19. Model to code transformation process.

*2.2.5.2.3 Model transformation module* 

transformation.

Semantic Interoperation Foundation of Intelligent Integrated Services 203

UML class graph: class node and relation node. Relation node connects class node and distinguishes them by direction, which is very similar to the directed graph. Hence directed graph is adopted to represent UML class graph. Usually matrix is used to represent the graph, and the values in matrix represent the type of relation. In ontology model class graph, there may be several independent subgraphs, which satisfy the description in definition 2. Therefore, it is necessary to handle the relation matrix to produce N independent sub relation matrices. This method can reduce the order or relation matrix and thereby reduce store space of the model, which also improves the efficiency of model

Model transformation module includes model transformation automaton and model transformation regulation table. In the process of states transition, the automaton performs transformation from PSM to OWL according to the corresponding transformation regulations. In this module, the automaton is separated with the model transformation regulations. Therefore, the changes of model transform regulation will not influence the running of automaton, and it is convenient to perform daily maintenance and update of the engine.

The model transformation automaton is a quintuple, and all information of this quintuple are included in the model transform transitional model, namely in the UML ontology

• F: The set of terminate states. F is included by Q. Any q∈F, q is called a terminate state of MTA.

According to the definitions given above, the transformation engine from PSM to formal file encoded by OWL can be described as: The model transformation engine firstly scans the PSM class graph, and the scanning result generates the ontology model triples UmlOnt(C, R, G). C is the set of all nodes in UML class graph, R is the set of all relations in UML class graph, G represents the structure relationship of the ontology class graph, which can be regarded as N connected subgraphs divided from a directed graph and these subgraphs correspond to N relation matrices {RM1, RM2, …, RMn }. One nonzero number *aij* represents the relation type between the class node i and j, and these relations are all included in R.

When the transformation engine finishes scanning, it input the scan result to the model transformation automaton. In this MTA, the nonempty finite set of states corresponds to C in the ontology model triples; the input events table corresponds to R in the ontology model triples; the transfer function corresponds to G in the ontology model triples; q0 and F are elements in C. In the procedure of state transforming, the corresponding operations of model transformation are also performed in MTA. When the automaton arrives at the terminal, the transformation finishes.

## **2.2.5.2 The implementation mechanism of model to code transformation engine**

In order to realize the model to code transformation according to the above mentioned theory, we design a model transformation engine based on Eclipse Plugin technology. In MDA, XML Metadata Interchange (XMI) (OMG, 2005b) is an Object Management Group (OMG) standard for exchanging metadata information via Extensible Markup Language (XML). As the most of MDA tools use XMI as an interchange format for UML models, the model transformation engine is responsible for scanning PSM encoded by XMI and then transforming PSM into ontology file encoded by OWL. The process of model to code transformation is indicated in Figure 19.

#### *2.2.5.2.1 Model scanning module*

When building ontology model, different modeling tool means different element label and different label structure in the model description file. Therefore, this chapter proposed a transitional model convert method, which adopts same data structure when describes different model format, i.e. the triples in *Definition 1*. This allows the model transformation is no longer constrained by the model structure. It thereby improves the versatility of transformation engine and is convenient to be maintained and updated.

The model scanning module in transformation engine scans the UML class graph encoded by XMI, and the scan result will generate two list sets in the transitional model. It is used to store the class nodes and relation nodes of UML graph, which corresponds to the C and R set in the UML ontology model triples.

#### *2.2.5.2.2 Building relation matrix module*

The function of relation matrix building module is used to generate the relation matrix of PSM, i.e. the G set in UML ontology model triples. There are mainly two kinds of nodes in

• F: The set of terminate states. F is included by Q. Any q∈F, q is called a terminate state

According to the definitions given above, the transformation engine from PSM to formal file encoded by OWL can be described as: The model transformation engine firstly scans the PSM class graph, and the scanning result generates the ontology model triples UmlOnt(C, R, G). C is the set of all nodes in UML class graph, R is the set of all relations in UML class graph, G represents the structure relationship of the ontology class graph, which can be regarded as N connected subgraphs divided from a directed graph and these subgraphs correspond to N relation matrices {RM1, RM2, …, RMn }. One nonzero number *aij* represents the relation type between the class node i and j, and these relations are all

When the transformation engine finishes scanning, it input the scan result to the model transformation automaton. In this MTA, the nonempty finite set of states corresponds to C in the ontology model triples; the input events table corresponds to R in the ontology model triples; the transfer function corresponds to G in the ontology model triples; q0 and F are elements in C. In the procedure of state transforming, the corresponding operations of model transformation are also performed in MTA. When the automaton arrives at the

In order to realize the model to code transformation according to the above mentioned theory, we design a model transformation engine based on Eclipse Plugin technology. In MDA, XML Metadata Interchange (XMI) (OMG, 2005b) is an Object Management Group (OMG) standard for exchanging metadata information via Extensible Markup Language (XML). As the most of MDA tools use XMI as an interchange format for UML models, the model transformation engine is responsible for scanning PSM encoded by XMI and then transforming PSM into ontology file encoded by OWL. The process of model to code

When building ontology model, different modeling tool means different element label and different label structure in the model description file. Therefore, this chapter proposed a transitional model convert method, which adopts same data structure when describes different model format, i.e. the triples in *Definition 1*. This allows the model transformation is no longer constrained by the model structure. It thereby improves the versatility of

The model scanning module in transformation engine scans the UML class graph encoded by XMI, and the scan result will generate two list sets in the transitional model. It is used to store the class nodes and relation nodes of UML graph, which corresponds to the C and R

The function of relation matrix building module is used to generate the relation matrix of PSM, i.e. the G set in UML ontology model triples. There are mainly two kinds of nodes in

transformation engine and is convenient to be maintained and updated.

**2.2.5.2 The implementation mechanism of model to code transformation engine** 

of MTA.

included in R.

terminal, the transformation finishes.

transformation is indicated in Figure 19.

set in the UML ontology model triples. *2.2.5.2.2 Building relation matrix module* 

*2.2.5.2.1 Model scanning module* 

UML class graph: class node and relation node. Relation node connects class node and distinguishes them by direction, which is very similar to the directed graph. Hence directed graph is adopted to represent UML class graph. Usually matrix is used to represent the graph, and the values in matrix represent the type of relation. In ontology model class graph, there may be several independent subgraphs, which satisfy the description in definition 2. Therefore, it is necessary to handle the relation matrix to produce N independent sub relation matrices. This method can reduce the order or relation matrix and thereby reduce store space of the model, which also improves the efficiency of model transformation.

Fig. 19. Model to code transformation process.

### *2.2.5.2.3 Model transformation module*

Model transformation module includes model transformation automaton and model transformation regulation table. In the process of states transition, the automaton performs transformation from PSM to OWL according to the corresponding transformation regulations. In this module, the automaton is separated with the model transformation regulations. Therefore, the changes of model transform regulation will not influence the running of automaton, and it is convenient to perform daily maintenance and update of the engine.

The model transformation automaton is a quintuple, and all information of this quintuple are included in the model transform transitional model, namely in the UML ontology

Telecommunications Service Domain Ontology:

Fig. 20. A part of formal network ontology encoded by OWL.

Semantic Interoperation Foundation of Intelligent Integrated Services 205

description model triples (C, R, G). The states, input events and transformation function of the automaton correspond to the class nodes, relation nodes and relation matrix set respectively in PSM class graph. The begin state of automaton is the owlClass node or objectProperty/datatypeProperty node in class nodes and the terminate states set includes all class nodes whose out-degree are zero and all nodes have been transformed by the automaton.

The model transformation regulation table defines the transformation regulation from UML Profile for RDF and OWL to OWL language. In the states jump process of model transformation automaton, corresponding regulation is used to perform model transformation. In the process of formulating the transformation regulation, the relations between every label node should be unified, which makes the regulation can be formulated depending on the OWL label structure and the relations between UML model elements. And good regulation is easy to extend in the future.

#### *2.2.5.2.4 Model output module*

Model output module only stores the formalized result of the transformation to the appointed path. And in order to verify the validity of the OWL file transformed, user can import the generate code into protégé tool for verification. Protégé is an ontology editor developed by Stanford University, which represents the OWL structure in graphic interface and makes the verification of OWL code validity more quickly and conveniently.

By using the above mentioned model to code transformation approach, the PSM of Figure 18 is transformed into the corresponding ontology encoded by OWL like Figure 20.
