Application scenarios describe that the user completes a series of behavior activities to achieve some system functions, including the interaction between the user and system objects. Sequence diagrams which belong to the unified modeling language (UML) can be drawn to describe the interactive sequence among system objects, so natural language and sequence diagrams are usually used to make clear all kinds of functions of application scenarios when communicating with users during requirement analysis. It is simple and intuitive, which is easy to communicate and exchange, but due to different understandings on the problem, these descriptions are ambiguous, and not directly reflect changes on objects’ states during the interaction. Therefore, in the system design stage, modeling the dynamic behavior using state diagrams can preferably reflect the implementation process of the system functions and the changes of the objects’ dynamic behavior in their survival period with time and input, in order to ensure the reliability of system.Object Constraint Language (OCL) can add constraints on messages of sequence diagrams, in order to solve problems when converting sequence diagrams to object state diagrams. This paper,based on object elements and message transmission mechanism of the sequence diagram, defines attribute vectors of objects and adds constraints for messages before and after, then designs algorithm for conversion from sequence diagrams to object state diagrams, which are combined to the final state graph of application scene.This paper firstly describes the current research literature both at home and abroad of the mapping between application scenarios and state diagrams, and then, based on the OCL expression of object constraints, in the study of conversion of UML sequence diagrams to state diagrams, using model formalized definitions as input and output, to judgment the changes of object states with the object attribute vector values, puts forward specific conversion method, and designs automatic switching platform, finally, through the analysis of an example to verify the rationality of the working process.This paper, taking an interactive SMS for enterprise as an example, firstly designs use case diagram and sequence diagrams of the system based on application scenario description.Then according to the sequence diagrams, using the method proposed in this paper, the use of automatic switching platform will turn them into state diagrams.finally, the overall state diagram will be converted to a Petri network to evaluate the performance. The example confirmed the feasibility and correctness of the conversion method.The achievement and innovation of this paper are that the formal definitions of models are used as the input and output of the algorithm, design conversion method by adding OCL constraints, and ensure the validity of the method from the theory and practical example. These OCL constraints ensure consistency of models before and after transformation. The example also proves that this method is of practical value to the actual work in the design and development of software, which can effectively improve the accuracy and reliability of the system. |