Abstract
To tackle the problems such as the imperfection and inconsistency in software requirements in traditional Computation Independent Model (CIM) modelling, the low degree of automation as well as the imperfection in the description of Platform Independent Model (PIM) in CIM-to-PIM transforming, in this article, we propose a Business-Process-based CIM modelling method and a CIM-to-PIM transformation approach. Business Process Model is used to express CIM, and UML’s Sequence Diagram, State Chart Diagram as well as Class Diagram are used to express PIM. Firstly, the users’ requirements are obtained through business process models. We extract use cases from business processes and create use case specifications. A verification mechanism is also added for the use case specification. Secondly, we transform CIMs into PIMs automatically with use case specifications as the inputs as well as combining with use case based thinking, responsibility based thinking and affinity analysis. Finally, by comparing with the methods in other studies, we conclude that methods proposed in this article can ensure model integrity and increase the degree of model transformation automation.
Introduction
In July 2001, OMG (Object Management Group) formally promulgated the Model Driven Architecture (MDA), which drove the software development by the establishment of CIM, PIM, and PSM, as well as the conversion between those models. In the following 10 years or so for MDA’s development, researchers put much emphasis on PIM, PSM and the transformation from PIM to PSM. CIM-to-PIM, as the first transformation step of MDA, somehow, attracted less attention. As a result, it not only affects the automatic generation of MDA code, but also results in several problems, such as the loss of information in the process of model transformation, requirement inconsistency between the user and the system, and even the code is unable to be executed. For all these reasons, how to build a complete and reliable CIM model, and convert CIM into PIM is of great importance.
The rest of this paper is organised as follows. Section 2 introduces related work and points out the shortcomings of the existing work and the research content of our paper. Section 3 gives the PIM model and a presentation of a proposal for CIM-to-PIM transformation. Section 4 takes a library management system as an example to apply the above modelling as well as the transformation method. In Section 5, we discuss advantages of this paper in contrast with the existing studies in the literature. Finally, Section 6 concludes this paper.
Literature review
At present, there are four aspects in the research of CIM-to-PIM transformation.
Model transformation approach based on use case descriptions parser – Li [20, 21] proposed 13 kinds of syntactic rules to describe use case event flow. He also provided an approach to parsing sentences described by these syntactic rules to extract different elements (that are used in model transformation) from the flow of events. The elements are sender, receiver, action, etc. Basing on Li’s work, Xin et al. [4, 5, 6], proposed using use case diagrams to describe CIM; using activity diagrams, sequence diagrams and state diagrams to describe PIM; and eventually transforming PIM into CIM. Chen et al. [60] proposed a relationship oriented approach to transforming use case specification into class diagrams. In the PIM layer, class diagram can reflect the structure of the PIM layer, which is the static information of the PIM layer, but cannot express the behaviour information of the PIM layer, which is the dynamic information. This will lead to the incompleteness of the PIM. Model transformation approach based on meta-model – generating systems capable of running from the business requirements faces one big problem, i.e., how to construct an effective CIM and automatically transform CIMs into PIMs. In order to solve these problems, Kherraf et al. [22] and Cao et al. [23], proposed an approach to transforming from CIM to PIM based on patterns and archetypes. They used use case diagram and activity diagram to construct CIM, used component diagram to construct PIM, and used patterns and archetypes to simplify the transformation from CIM to PIM. Yin [24] proposed an approach to transforming from CIM to PIM based on ICEMDA. Firstly, meta-models of CIM and PIM were created. Then, mapping rules between the CIM meta-model and the PIM meta-model were constructed. Finally, she found out corresponding mapping rules developed for converting CIMs to PIMs. The BO model refers to entity information used for the systems, collected through user’s requirement. Data model is divided into two abstract levels of BO-R and E-R. BO-R describes dependencies between BO in PIM, and E-R describes the association and constraint between the entities. Cao et al. [25] proposed an approach to transformating from CIM to PIM based on SOA. They separated model transformation from realisation technology and platforms. The approach mainly includes the following two parts. The first part gives a service-oriented way to model the requirement. The second part gives a model refinement mechanism and a set of refinement rules. The refinement mechanism and rules can transform the requirement model to a set of loosely coupled services and can match these services to their suitable components and interfaces. Model transformation approaches based on feature and component – Wei et al. [9] proposed a feature-oriented component-based approach to the CIM-to-PIM transformation. In this approach, using feature model represents the CIM requirement, and the CIM includes a set of features as well as their relationships, using component as the key element of PIM. One important characteristic of this approach is that it provides a method to decompose the Model transformation approach based on QVT – Rodríguez et al. [26, 27] proposed an approach to transforming from CIM to PIM based on QVT. QVT (Query/View/Transformation) [28] was proposed by OMG, which is an important member of OMG meta-model family. In this approach, activity diagram is used to describe CIM; use case diagram and class diagram of analysis level are used to describe PIM. At last, certain QVT rules and model refinement rules are used to transform CIM into PIM.
Having analysed above studies we found that there are problems in the transformation from CIM to PIM:
For the integrity part, semantic of PIM is not complete as it only contains static model or dynamic model after the transformation. A low degree of automation, over-reliance on the designer’s experience no matter generating static model based on class diagram or dynamic model. Only few approaches automate the process partially. Furthermore, the generated class model is not enough to support the attributes, operations, and inheritance relationship of classes.
Accordingly, the research contents of this paper are as follows:
To establish PIM models correctly and completely, and To Automate transformations from CIMs to PIMs. And during the transformation attributes, operations, and inheritance relationship of classes are well supported.
Proposed method of automatic transformation from CIM to PIM
CIM modelling
CIM is the first step of model transformation of MDA, whose integrity directly affects the follow-on models and their transformations. In [60], we proposed a Business-Process-based CIM modelling approach, where Business-Process-based model is able to separate the analysis from the implementation of the system. It can also help dynamically analyse the business process from the perspective of the user and reduce the gap between the users’ original needs and the final system. In order to ensure the integrity of CIM, we use Business-Process-based models to dynamically describe the business process of the system, and the use use-case models to describe each business function of the Business-Process-based model in details. Firstly, the user’s requirements is obtained through business process models. We extract use cases from business processes and create use case specification. A verification mechanism is added for the use case specification.
CIM is used to describe the system requirements, and therefore a model such as a Use Case diagram that can express the system clearly and directly is needed. But relying simply on the use case diagram (consists of actor, use case, and the association between them) cannot give a detailed description for the specific function of the system. Therefore, use case specification is also needed. Currently, natural language is used to describe the use case specification. Unfortunately, information used for model transformation is hardly to be drawn from the natural language because of the language’s defect. Therefore the description of use case specification needs normalised constraints. Li [20, 21] proposed 13 basic English sentence patterns that can satisfy the need of the description of use case specification, as shown in Table 1.
Basic English sentence structures
Basic English sentence structures
Thomas et al. also proposed that these 13 basic English sentence patterns can describe the use case specification completely. So, we choose the above sentence patterns as the normalisation mechanism of the use case specification. Transformation from CIM to PIM can be automated by standardising the use case specification and extracting information from it.
There are different PIM modelling methods presently. Most of them use UML as the descriptive language of PIM meta-model for two reasons. One is that UML has become relatively mature after many years’ development, and it is widely used in the process of software engineering modelling. The other is that UML2.0 provides a good support to MDA.
In the previous article [60], we used Class Diagram to present PIM models. However, a class model can only express the static information of PIM, and cannot express the dynamic information, which will result in missing information about PIM. Therefore, in this study, we add dynamic information to PIM. In UML 2.0, the dynamic behaviour view includes the state machine diagram, activity diagram and interaction diagram. The State Machine View describes the dynamic behaviour of the object time by modelling the lifetime of each class’s object. A state machine is a narrow, deep view of behaviour, a compact view of a single object, through which it is difficult to understand the overall function of a system. Interactive views provide a more global view of object behaviour. In interactive view, Sequence Diagram is selected in this paper. Active view is a special form of state machine for computing and workflow modeling. In this paper, State Diagram is already used at the PIM, so activity diagram is no longer used. To sum up, in the PIM layer, we use three kinds of diagrams in UML to do the modelling, which are Class Diagram, Sequence Diagram and State Diagram. Class Diagram belongs to the static model and Sequence Diagram and State Diagram belong to dynamic models. The combination of static model and dynamic model makes the PIM more complete. The transformation process from CIM to PIM is shown in Fig. 1.
Transformation from use case models to class diagrams
Li et al. [21, 23, 26, 31] proposed a number of Class Diagram based model transformation methods. Use Case driven method is the common choice while transforming from a Use Case Diagram to a Class Diagram. Firstly, robust analysis is used to add attributes for the initial class diagrams. Then sequence diagram is used to add methods for the class diagram. However, in this way, only separate classes can be generated. Relationships between classes like inheritance and dependency cannot be generated automatically. Now transformations to class diagram are lack of support for the relationships between classes, which will reduce the integrity and consistency of the model, and increase the risk of the system. Therefore, in the previous article [60], we proposed a relationship oriented model transformation method.
Transformation process from CIM to PIM.
In the first place, we parse the use case specification event flow to generate a “Function-Argument” matrix. Secondly, the affinity analysis [32] is carried out to obtain the entity class. Thirdly, affinity analysis is used again to obtain business class. At last, we refine the aggregated classes and add relationships between the classes.
In existing studies, the transformation into a Class Diagram depends on experienced people. Only a few parts implemented semi-automation. Furthermore, the generated class model is not enough to support the attributes, operations, and inheritance relationship of classes. In our previous paper [60], a relationship oriented automatic transformation approach which describes how Use Case specification event flow is transformed to Class Diagram is proposed. On the basis of the use case description template and the use case description semi-formal language function-argument matrix is extracted depends on relationship oriented thinking and class model is automatically aggregated by affinity analysis automation algorithm. In addition, during the transformation attributes, operations, and inheritance relationship of classes are well supported.
Xin [6] and Jiang [7] discussed that using Sequence Diagram (which is used to describe the dynamic interaction between objects) to represent the PIM. The sequence diagram is the dynamic representation of a system, and it also shows how objects communicate over times. Sequence Diagram expresses dynamically how a system implements business functions by the dynamic message interactions between objects, so that the model can describe the system more precise. Sequence Diagram consists of object, message, and other basic elements. “Message” is marked by the sender and the receiver of the message. They parse each event flow of the use case event flow to obtain message sequence of the sequence diagram, then assemble the message sequences in a specific pattern. Finally, the system’s Sequence Diagram is generated.
Transformation approach
We parse the use case specification event flow that has been normalised by the sentence patterns provided. The rules of transformation from use case event flow to sequence diagram is obtained by analysing the generated class diagrams as well as 13 English sentence patterns, as shown in Table 2. After resolving each event flow according to the rules, we can get message tuple consists of sender, receiver, message and message type. Message type includes calling message, returning message, etc. After obtaining the message tuple we need to adjust them according to the generated class. At last, sequence diagram is generated from message tuples.
Sequence diagram event flow resolution rules
Sequence diagram event flow resolution rules
We loop read each use case specification event flow, if an event starts with a “[” then read the value of the event flow sentence number and query for transformation rule table based on the value. Use case event flow is parsed to obtain sender, receiver, message, message type and other elements used by sequence diagram of the message tuple. We process the obtained message tuple by considering the following situations:
If the sender itself is a class name and the “sendMessage” is included in the class, then the message tuple does not need to be changed; If the sender is not a class name and only one class includes “sendMessage”, then the sender will be replaced with the name of the class which includes the “sendMessage”; If the sender is not a class name and the “sendMessage” is included in some same classes, the sender will be replaced with the name of the class which includes the “sendMessage” according to “responsibility driven” thought.
The processed message tuple is put into the message sequence. We use message sequence input and generate the final sequence diagram according to the message sequences in the queue. As shown in Algorithm 1. When generating a sequence diagram, we should pay attention to the layout, location and other factors of the object, lifeline, activation, message and other basic components.
Transformation from use case model to state diagrams
Xin [6] discussed that in the process of transformation from use case model to State Diagram the most important point is to consider how to parse the use case event flow, in order to ensure the one-to-one mapping between the functional requirements of the system described in the use case specification and the elements of the State Diagram such as state, transition and condition decision.
Transformation approach
We need to transform each use case in the use case diagram into state diagram like the transformation from use case model to Sequence Diagram.
Firstly, the use case specification event flow is parsed. We make rules of transformation from use case model to state diagram by analysing the basic elements of state diagrams and the 13 English sentence patterns, as shown in Table 3. In the process of executing this operation, the flow direction of the decision branch path in different environment should be considered since the state diagram is different from the sequence diagram.
State diagram event parsing rules
State diagram event parsing rules
We loop read each use case specification event flow, if an event flow starts with “[” then obtain the value of the event flow sentence number and query for transformation rule table based on the value, as shown in Table 3. We extract state element from the event flow and put the element into the state List. If the event flow is “If”, “Else”, or “EndIf”, these conditional statements will be put into the state list directly.
A new state diagram is generate based on the state list. We paint the states in order on the state diagram, new a stack if conditional statement (If) exists, push “If” and other states after “If” onto the stack. When the top element of the stack is “EndIf”, we get the position (pos) of the nearest “If” to “EndIf”, pop the states between the top and the pos off the stack, and then paint these states in order on the state diagram, as shown in Algorithm 2. When generating State Diagrams, we should pay attention to the layout if the elements on the state diagram to prevent dislocation of the elements.
Level0 business process modelling.
In [6], there may be a bias in the order of States. In our study during the transformation process, the stack is used to ensure the correctness of the order of States, especially when the selection structure is encountered.
Use case diagram of Borrow Management.
CIM modelling
In the scheme of this paper, the business process model and the use case model are used to represent CIM. Therefore, the method is very suitable for the software systems based on business processes. A library management system is a typical and common business based system, which mainly deals with the book lending related business. Based on the above reasons, we take a simplified library management system as an example and analyse the above modelling as well as transformation method. First of all, the Level 0 business process modelling, the simplified library management system contains of “Borrow Management”, “Book Management” and “Reader Management”, as shown in Fig. 2.
In this paper, we dig deep into the “Borrow Management” activity only for the principle is similar. The main business of the business module is: (1) When readers search books by the system, there are two ways to choose: one is searching by book title and the other is by book author; (2) When readers find the book they want to borrow, they need to turn the book over to the librarian and hand borrowing procedure; (3) When the readers return the books, the librarian need to review the time limit of the books. If the time is overdue, readers should pay a fine. The Use Case Diagram of Borrow Management is shown in Fig. 3. The use case specification of Borrow Management is shown in Table 4. Each event of the use case specification is written according to the thirteen English sentences patterns used to describe use cases. The number of the subordinate sentence pattern is added before the sentence. So, it is convenient for the use case event flow analysis. Using these use case specification as input, the automatic transformation from CIM to PIM is carried out.
Use case specification of Borrow Management
Use case specification of Borrow Management
We transform CIM into PIM using use case specification as input according to the transformation rule mentioned in Section 3. The transformation from use case specification to class model has been shown in our previous work [60]. In this paper, we will show how use case specification is transformed into Sequence Diagrams and State Diagrams.
Transformation from use case specification to sequence diagram
Sequence diagram message sequence of “Borrow Book”
Sequence diagram message sequence of “Borrow Book”
State list of “Borrow Book”
Sequence diagram of “Borrow Book”.
State diagram of “Search By Author”.
Code structure.
Program interface screenshots.
When a use case model is transformed into a Sequence Diagram, the first case is to loop read use case event stream and get the number of sentences for each event. Then, transformation rule function is called with the number of sentences and the sentence after tagging as parameters. This function extracts the corresponding basic elements from the sentence according to the different sentence numbers, and the specific internal execution algorithm is shown in Algorithm 1. So far, the event flow analysis step of transformation from use case specification to sequence diagram has been completed, and the obtained message sequence is shown in Table 5. The sequence diagram of “Borrow Book” is shown in Fig. 4.
When the use case model is transformed into a state diagram, the event stream parsing function is called to process the event stream. Firstly, we loop read each event, mark the word and get the sentence number, but the conditional identification words such as If, Else and EndIf do not need to be marked.
Then, the generating sequence function is called with the input of the sentence number and the marked event. According to the rules of transformation from use case specification to State Diagram, the feature words that can be mapped to the basic elements in the State Diagram are extracted from the event stream, and the list of States is formed. The conditional identifier is directly added to the list of states without processing. Similarly, in the case of “Borrow Book”, its status list is shown in Table 6. The state diagram of “Search By Author” is shown in Fig. 5.
Implementation of a model transformation tool
The code structure of model transformation tool is shown in Fig. 6. “Src” directory stores the core code of the program, including the classes of transformation from use case model to class diagram as well as the transformation of sequence diagram and state diagram, the helper classes and graphical user interface classes. The open source speech tagging tool kit released by the Stanford NLP (Natural Language Processing) Group is used to parse the use case specification event flow. The tool kit is placed in “lib” directory and “models” directory stores the models that have been trained and are used by the tool kit. “UseCaseSpec” directory stores the use case specifications used as the input of the program.
Program interface screenshots are shown in Fig. 7. The Class Diagram of the system exists in the form of XMI document which is of good portability and can be opened in any model tools support XMI. This measure has a good foundation for code automation generation.
Conclusions
Compared with the related studies, the advantages of our paper are as follows. A relationship oriented CIM-to-PIM automatic transformation approach is proposed. Class Diagram and Sequence Diagram are used to describe PIM. The class diagram describes the static part of the PIM, and the Sequence Diagram and State Diagram describe the dynamic part. The combination of class diagram, sequence diagram and state diagram ensures the integrity of the PIM model. In addition, a relationship oriented automatic transformation approach which describes how use case specification event flow is transformed to class diagram is illustrated. On the basis of the use case description templates and the use case description semi-formal language function-argument matrix is extracted depends on relationship oriented thinking and class model is automatically aggregated by affinity analysis automation algorithm. In addition, during the transformation attributes, operations, and inheritance relationship of classes are well supported.
The comparison of our work with related styudies in CIM-to-PIM transformation is shown in Table 7.
Comparison of our work with related ones in CIM-to-PIM transformation
In this article, we proposed a relationship-oriented transformation approach from CIM to PIM, attempting to resolve the problems such as the low degree of automation and the non-support for relationships between classes.
We plan to continue this work in the future. Firstly, CIM modeling method discussed in this paper involves the conversion of CIM’s internal models. The transformation from business process models to the Use Case model is performed manually. We will pay more attention to this part by improving the CIM-to-CIM conversion method in order to eliminate the risk brought by the artificial intervention. Secondly, the approach we proposed does not yet support describing the Use Case specification in Chinese. In the process of software development, it is difficult for the developers in the Chinese language system to describe the use cases in English. At present, there are several studies of Chinese sentence analysis which includes the analysis of Chinese grammar and semantics, the Chinese word segmentation, etc. These studies will be referenced in the future.
Footnotes
Acknowledgments
The authors would like to thank the anonymous reviewers for their valuable comments and suggestions. This work is partially supported by research and application demonstration of training service support technology for primary and secondary school teachers which belongs to Project of National Science and Technology Supporting Plan (2014BAH22F00).
Authors’ Bios
