User interface automatic generation method based on domain concept model and use case model
By combining UML and low-code development platforms, using model-driven engineering methods, and using domain concept models and use case models to automatically generate user interfaces, it solves the problem that traditional low-code platforms cannot fully automatically generate user interfaces and ensure correctness, and achieves the consistency, correctness and integrity of the user interface, reducing development costs and workload.
Patent Information
- Application Number
- CN202411797405.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-18
AI Technical Summary
Traditional low-code development platforms cannot generate user interfaces automatically, and cannot guarantee the correctness and reliability of the user interface, resulting in problems such as inconsistency of requirements, conflicts of consistency, and incomplete functions of the software system.
Combining UML and low-code development platform, a model-driven engineering method is adopted to automatically generate a user interface through domain concept models and use case models. The specific steps include identifying CRUD types from the use case model, reading role permissions and business process information, identifying entity class relationships from the domain concept model, processing class diagram data, and inputting them into the representation model to automatically generate a user interface.
The entire process of automatic user interface generation is realized, ensuring the consistency between system requirements and user interface, ensuring the consistency, correctness and integrity of the generated user interface, and reducing development costs and workload.
Smart Images

Figure CN119645402A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of low-code development platforms, and in particular to a method for automatically generating user interfaces based on a domain concept model and a use case model. Background Art
[0002] The user interface is an indispensable part of the interactive system, and excellent user interface design plays a vital role. However, in the development process of specific fields, the current user interface development methods do not consider the special requirements of the Web environment for user interface expression, and only focus on the demand analysis and design of the internal model of the software. The traditional low-code development platform reduces the requirements for developers, intuitively selects user interface elements by dragging, pulling, and dropping, and does not provide complete theoretical and expression support. The correctness and reliability of the user interface are difficult to guarantee, resulting in the final generated software system having multiple defects such as inconsistent requirements, consistency conflicts, and incomplete functions. At the same time, implementing CRUD (create, read, update, and delete) operations accounts for about 80% of the development work. In order to solve this problem, many scholars at home and abroad have proposed many methods for designing and generating user interfaces and automating CRUD operations.
[0003] Decomposing the user interface into independent model components is more flexible in design, but overly fragmented components are not easy to manage and maintain. Model slicing is used to detect the consistency between models, ensuring the correctness of the model conversion process. However, the standard of model slicing and the rules of consistency detection are not clearly stated in the article. A method of generating a user interface by building a demand model is proposed, but the method of consistency detection between models is not proposed in the article. Other related literatures have not proposed a complete user interface automatic generation method and a consistency detection theory based on strict mathematical definitions.
[0004] An important research branch of software engineering is the Unified Modeling Language (UML), which is a standard modeling language for object-oriented analysis and design established by the International Object Management Organization. Practice has proved that clear and strict formal semantics are conducive to strict modeling of software systems. All resources of UML can be used for model development. Not only can modeling be performed with various simple and intuitive diagrams, but also customized UML profiles can be used to quickly create domain-specific languages and support tools. However, existing UML diagrams are not suitable for modeling user interfaces. Summary of the invention
[0005] The present invention provides a method for automatically generating user interfaces based on a domain concept model and a use case model, which solves the technical problem that traditional low-code platforms cannot fully automatically generate user interfaces and the security problem that correctness cannot be guaranteed.
[0006] The present invention combines UML with a low-code development platform to create a new model similar to the UML interface diagram - a representation model, which is used to build user interface prototypes and interface definitions of related business functions. During the development process, the model-driven engineering (MDE) method was adopted. Model-driven engineering is a series of activities and processes for developing software systems using modeling technology and model conversion methods. It does not depend on the specific implementation platform, abstracts the software system into a higher-level model, and supports verification, testing and modification of single or multiple models. The platform-independent nature of model-driven engineering makes the generated software system more flexible, scalable, reusable and maintainable.
[0007] The embodiment of the present invention discloses a method for automatically generating a user interface based on a domain concept model and a use case model, comprising: identifying a CRUD type corresponding to a use case from a use case model, and determining an interface template type corresponding to the CRUD type corresponding to the use case from a template library; reading role authority and business process information in the use case from the use case model; wherein the role authority is used to generate class diagram data required for each prototype interface, and the business process information is used to determine component functions in the user interface and the jump sequence between interfaces; identifying a relationship type in an entity class from a domain concept model, and processing the class diagram data according to the relationship type in the entity class to obtain entity class data; and automatically generating a user interface by inputting the interface template type, role authority, business process information and entity class data into a representation model.
[0008] Preferably, determining from the template library the interface template type corresponding to the CRUD type corresponding to the use case includes: when the CRUD type corresponding to the use case is a Create type, determining from the template library the interface template type corresponding to the Create type is an Add interface template; when the CRUD type corresponding to the use case is a Delete type, determining from the template library the interface template type corresponding to the Delete type is a Delete interface template; when the CRUD type corresponding to the use case is an Update type, determining from the template library the interface template type corresponding to the Update type is a Modify interface template; when the CRUD type corresponding to the use case is a Read type, determining from the template library the interface template type corresponding to the Read type is a Query interface template.
[0009] Preferably, each interface template consists of an operation container and a result container; wherein, the operation container is used to generate corresponding components from input data according to different types of interfaces to implement add operations and query operations; and the result container is used to display the data returned by the database to implement delete operations and modify operations.
[0010] Preferably, the components generated by the operation container include deterministic components and non-deterministic components; wherein, the deterministic components refer to components that must exist when the template is generated and will not change with external data input or user operation, indicating that the model automatically generates corresponding deterministic components according to the generation rule table of interface type and component type; the non-deterministic components refer to components that change according to input data or user operation, indicating that the model converts different types of input data into different types of non-deterministic components.
[0011] Preferably, according to the dependency relationship between classes, the dependency relationship is divided into independent classes and non-independent classes. When a non-independent class generates a representation model node, all attributes of the non-independent class itself and the class name, all attributes and key attributes of the independent class that has a dependency relationship with the non-independent class are obtained; when an independent class generates a representation model node, only its own class name and all attributes are obtained.
[0012] Preferably, the generated user interface is an HTML page; wherein a secondary menu is defined in the HTML page, and depending on the role, the name of each option in the main menu of the secondary menu is defined as a class name related to a use case associated with the role, and the name of each option in the submenu is defined as the name of a representation model node generated by the class, and the interface content of each representation model node is converted into a submenu interface displayed in the HTML page.
[0013] Preferably, it also includes: in the generated user interface, by defining the appearance style of each UI component in the representation model, automatically generating a corresponding CSS file when generating an HTML file; at the same time, in the generated user interface, by defining the functions of all UI components in the representation model, automatically generating a JS file corresponding to the UI component function when generating an HTML file, and packaging and generating the HTML file, CSS file and JS file.
[0014] Preferably, the method further comprises: in the process of generating the representation model, analyzing the consistency of the model by defining simulation relationships and combination relationships to ensure the consistency between the models.
[0015] Preferably, it also includes: in the process of generating the representation model, obtaining the entity class information and the relationship between the entity classes in the domain concept model, and using the entity class information and the relationship between the entity classes in the domain concept model to detect the consistency of the model to ensure the consistency of the entity class information between the domain concept model and the representation model.
[0016] The embodiments of this specification can achieve at least the following beneficial effects: by taking the domain concept model (UML class diagram) and the use case model (UML use case diagram) as system requirements and combining them with formal methods, an automatic user interface generation algorithm is developed to ensure the consistency between system requirements and the user interface, and the feasibility is verified by examples to ensure the consistency, correctness and completeness of the user interface generation process. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only used for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. In the accompanying drawings: Figure 1 A schematic diagram of the model conversion relationship provided by the present invention; Figure 2 A schematic diagram showing an example of a model instance provided by the present invention; Figure 3 A schematic diagram of an algorithm for automatically generating a user interface provided by the present invention; Figure 4 This is a schematic diagram of an example of adding an interface provided by the present invention; Figure 5 This is a schematic diagram of an example of a deletion interface provided by the present invention; Figure 6 This is a schematic diagram of an example modification interface provided by the present invention; Figure 7 This is a schematic diagram of an example of a query interface provided by the present invention; Figure 8 A schematic diagram of an example of generating a user interface provided by the present invention; Fig. 9 A schematic diagram of an example of a simulation relationship provided by the present invention; Fig.10 A schematic diagram of the simulation of the combination relationship provided by the present invention; Fig.11 A schematic diagram of the entire process of automatically generating a user interface provided by the present invention; Fig.12 A schematic diagram of the design process of the course selection system business process provided by the present invention; Fig.13 Adding an interface schematic diagram to the course schedule in the representation model provided by the present invention; Fig.14 This is a schematic diagram of an example user interface provided by the present invention. DETAILED DESCRIPTION
[0018] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0019] The present invention provides a method for automatically generating a user interface based on a domain concept model and a use case model, comprising: step 1: identifying a CRUD type corresponding to a use case from a use case model, and determining an interface template type corresponding to the CRUD type corresponding to the use case from a template library; step 2: reading role authority and business process information in the use case from the use case model; wherein the role authority is used to generate class diagram data required for each prototype interface, and the business process information is used to determine component functions in the user interface and the jump sequence between interfaces; step 3: identifying a relationship type in an entity class from a domain concept model, and processing the class diagram data according to the relationship type in the entity class to obtain entity class data; and step 4: automatically generating a user interface by inputting the interface template type, role authority, business process information and entity class data into a representation model.
[0020] In an optional embodiment of the present invention, determining from the template library the interface template type corresponding to the CRUD type corresponding to the use case includes: when the CRUD type corresponding to the use case is a Create type, determining from the template library the interface template type corresponding to the Create type is an Add interface template; when the CRUD type corresponding to the use case is a Delete type, determining from the template library the interface template type corresponding to the Delete type is a Delete interface template; when the CRUD type corresponding to the use case is an Update type, determining from the template library the interface template type corresponding to the Update type is a Modify interface template; when the CRUD type corresponding to the use case is a Read type, determining from the template library the interface template type corresponding to the Read type is a Query interface template.
[0021] In an optional embodiment of the present invention, each interface template is composed of an operation container and a result container; wherein the operation container is used to generate corresponding components from input data according to different types of interfaces to implement add operations and query operations; and the result container is used to display the data returned by the database to implement delete operations and modify operations.
[0022] In an optional embodiment of the present invention, the components generated by the operation container include deterministic components and non-deterministic components; wherein the deterministic components refer to components that must exist when the template is generated and will not change with external data input or user operation, indicating that the model automatically generates corresponding deterministic components according to the generation rule table of interface type and component type; the non-deterministic components refer to components that change according to input data or user operation, indicating that the model converts different types of input data into different types of non-deterministic components.
[0023] In an optional embodiment of the present invention, based on the dependency relationship between classes, the dependency relationship is divided into independent classes and non-independent classes. When a non-independent class generates a representation model node, all attributes of the non-independent class itself and the class name, all attributes and key attributes of the independent class that has a dependency relationship with the non-independent class are obtained; when an independent class generates a representation model node, only its own class name and all attributes are obtained.
[0024] In an optional embodiment of the present invention, the generated user interface is an HTML page; wherein a secondary menu is defined in the HTML page, and depending on the role, the name of each option in the main menu of the secondary menu is defined as a class name related to a use case associated with the role, and the name of each option in the submenu is defined as the name of a representation model node generated by the class, and the interface content of each representation model node is converted into a submenu interface displayed in the HTML page.
[0025] In an optional embodiment of the present invention, it also includes: in the generated user interface, by defining the appearance style of each UI component in the representation model, automatically generating a corresponding CSS file when generating an HTML file; at the same time, in the generated user interface, by defining the functions of all UI components in the representation model, automatically generating a JS file corresponding to the UI component function when generating an HTML file, and packaging and generating the HTML file, CSS file and JS file.
[0026] In an optional embodiment of the present invention, the method further includes: in the process of generating the representation model, analyzing the consistency of the model by defining simulation relationships and combination relationships to ensure the consistency between the models.
[0027] In an optional embodiment of the present invention, it also includes: in the process of generating the representation model, obtaining the entity class information and the relationship between the entity classes in the domain concept model, and using the entity class information and the relationship between the entity classes in the domain concept model to detect the consistency of the model to ensure the consistency of the entity class information between the domain concept model and the representation model.
[0028] Combine the following Figure 1-Figure 14 Further explanation of the embodiments of the present invention The present invention proposes a method for automatically generating a user interface based on a model, such as Figure 1 As shown, it includes a domain concept model, a use case model, and a representation model. These three models are closely connected to each other and describe the software system from different angles. At the same time, in order to ensure the consistency between models, all models are converted into a unified structure for analysis and detection. The present invention introduces formal methods into the low-code platform, combines the idea of model-driven engineering to jointly build a software system, so that the generated software system has logical support, ensuring the consistency, correctness, and integrity of the generated software system.
[0029] 1 Unified structure The present invention provides a formal model for formally expressing the UML model - Unified Structure, and then discusses some properties of the model. Dependency Structure is a formal model developed based on the structure. Based on the dependency structure, the Unified Structure performs unified formal modeling on the UML model, analyzes and represents the UML model from the structural layer, and its expression ability and compatibility are stronger than the dependency structure. By modeling and analyzing traceability through the unified structure, various software components in the system are regarded as models, and their components are model elements. This approach helps to use graphics-based tools to analyze and visualize traceability.
[0030] Definition 1: Unified structure ( ) is a tuple ,in: (11) is a finite set of model elements; (12) For inclusion relation, it is a non-reflexive partial order; (13) For dependency; (14) To restrict model elements; (15) For restrictions on reliance; (16) is the set of model element types that satisfy the following conditions: .
[0031] Definition 2 Let and are two unified structures. If , , , and , , then it is called yes The substructure of .
[0032] The concept of model elements in Definition 1 is consistent with that in UML, and it can have different types depending on the viewpoint. The inclusion relationship is a set of non-reflexive partially ordered relationships, used to model parent-child relationships. Partially ordered relationships refer to reflexive, antisymmetric, and transitive binary relationships. The types and number of dependency relationships vary from model to model. Both inclusion and dependency relationships can have additional restrictions added as needed. Definition 2 gives the definition of the inclusion relationship, in which the substructure represents a reference to a part of the diagram, so that it can be referenced multiple times by diagrams of the same type. Obviously, a unified structure can be used to model instances of the representation model. The following describes how to describe the representation model using a unified structure.
[0033] Figure 2 A simple representation model example is shown, which can be represented by a unified structure as ,in: (twenty one)
[0034] (twenty two)
[0035] (twenty three)
[0036] (twenty four)
[0037] (25)
[0038] The symbols have the following meanings: Represents the collection of all elements in the model. Represents the containment relationship between components. Indicates dependency. Representing dependencies restrictions in . Represents a container collection, a container in a collection and container All are unified structures Substructure, container It can be expressed as a unified structure ,in: (31)
[0039]
[0040] (32)
[0041]
[0042] (33)
[0043] (34)
[0044] (35)
[0045] (36)
[0046] (37)
[0047] The symbols have the following meanings: Represents the collection of all elements in the model. Indicates the containment relationship between components, such as Representative components Contains component name . Indicates dependency. Representing dependencies restrictions in . Represents a collection of components. Represents a collection of component names. Represents a collection of buttons.
[0048] container It can be expressed as a unified structure ,in: (41)
[0049] (42)
[0050] (43)
[0051] (44)
[0052] (45)
[0053] (46)
[0054] The symbols have the following meanings: Represents the collection of all elements in the model. Indicates the containment relationship between components, such as Representative form Contains header name . Indicates dependency. Representing dependencies restrictions in . Represents a collection of forms. Represents a header collection.
[0055] 2 User Interface Automatic Generation Algorithm The requirements of the software system are modeled using the domain concept model (UML class diagram) and the use case model (UML use case diagram), where both the domain concept model and the use case model adopt the UML standard. The domain concept model is used to instantiate system data and generate data models to meet the data persistence requirements of the system. The premise of data instantiation is that the corresponding class in the domain concept model must be an entity class. An entity class refers to a class that describes an entity or object in the system, which contains a class name and attributes. The use case model consists of subjects, use cases, participants, and their relationships. Under each subject, users and any other systems that may interact with the subject are represented as participants; a class or group of behaviors of a participant is described as a use case; use cases are used to capture system requirements, that is, the operations that the system should perform in response to the participant's actions. Each use case corresponds to a type in CRUD and contains role permissions and business process information. The domain concept model and the use case model are used together as inputs to the user interface automatic generation algorithm. After processing, a representation model is generated, and then the user interface is automatically generated based on the representation model. The specific process is as follows Figure 3 shown.
[0056] (1) Input data ① First, before generating the representation model, the system will automatically identify the CRUD type corresponding to each use case in the use case model, and then determine the type of interface template from the template library. The Create type corresponds to the add interface template, the Delete type corresponds to the delete interface template, the Update type corresponds to the modify interface template, and the Read type corresponds to the query interface template.
[0057] ② Secondly, the system will automatically read the role permissions and business process information in the use case. The role permissions determine the class diagram data required to generate each prototype interface, while the business process determines the component functions in the user interface and the jump order between interfaces.
[0058] ③Finally, the system will process the class diagram data in the domain concept model and input it into the representation model based on the relationship between entity classes. The concepts of "important attributes", "independent classes" and "non-independent classes" are defined here: Important attributes: In the class diagram, the class name is highly understandable and descriptive, and is the only mandatory information, so the distinction between two different classes is mainly based on the class name. Similarly, in the attributes of a class, an attribute can be distinguished as follows: if the name of the attribute can represent the class to which it belongs, then this attribute is called an important attribute, such as Figure 4 The attribute fullName of the class Trainee.
[0059] Independent class and non-independent class: If a class only has a dependent relationship, then this class is called an independent class, such as Figure 4 On the contrary, if a class has a dependency relationship with other classes, then this class is called a non-independent class, such as Figure 4 Middle class Registration.
[0060] (2) Generate representation model The presentation model generates a user interface prototype based on the domain concept model and the use case model. If the developer has special needs, they can modify or improve the prototype. Therefore, the presentation model node will automatically generate a user interface template based on the interface type, and then identify the processed input data to generate the corresponding component. In order to ensure that the final generated user interface has a clear structure, flexible layout, and is easy to manage the style and behavior of the components, each interface template consists of two containers: Operation container: Generates corresponding components (such as input boxes, drop-down boxes, radio buttons, etc.) from input data according to different types of interfaces, and implements operations such as adding and querying.
[0061] Result container: displays the data returned by the database and implements operations such as deletion and modification. Therefore, different types of components such as forms and buttons are pre-defined in the result container.
[0062] At the same time, in order to improve the reusability of components, optimize the overall performance of the system, and improve testability, the components in the template are divided into deterministic components and non-deterministic components: Deterministic components: components that must exist when the template is generated and will not change with external data input or user operations, such as the existence of an add button in the add interface.
[0063] Non-deterministic components: components that change according to input data or user operations. Different types of data will be converted into different types of components. For example, a String type attribute will be converted into an input box.
[0064] Depending on the interface type, each piece of input data will automatically generate a corresponding component in the template. The generation rules of deterministic components are shown in Table 1:
[0065] In the process of generating the representation model, different generation strategies are adopted for independent classes and dependent classes according to the relationship between entity classes. For a dependent class, when generating a representation model node, not only all its own attributes are automatically obtained, but also the class name, key attributes and all attributes of the independent class with which it has a dependent relationship are obtained. The generation strategy of the dependent class is introduced below: ①Add interface The process of generating an additional interface is as follows Figure 4 As shown. Figure 4 (a) is the input class diagram data; Figure 4 (b) is an interface template automatically generated based on the Registration class: the corresponding components are automatically generated in the template according to different types of input data; Figure 4 (c) is the complete addition interface, where each non-deterministic component is filled with specific data.
[0066] 1) Generate deterministic components: Adding an interface requires implementing operations such as adding, so an "add" button and a "reset" button are generated in the operation container; a form is generated in the result container to display the data returned by the database.
[0067]
[0068] 2) Generate non-deterministic components: The rules for generating non-deterministic components for adding interfaces are given in Table 2. In the operation container, each independent class generates an input box with a prompt button. The text of the input box is the important attributes of the independent class, such as class Trainee and attribute Trainee fullName. All attributes of the independent class are hidden in the prompt button and displayed in a pop-up window after clicking it, such as Figure 4 As shown in (d), the pop-up interface consists of a check box form, a "Select" button, and a "Close" button, where each attribute of the independent class is converted into a header of the form, such as the attribute Trainee fullName.
[0069] Each attribute of a non-independent class should be generated separately in the operation container and converted into different components according to the attribute type. Long type ID attributes should be automatically generated when added, so no components are generated, such as the attribute Registration registrationID; each attribute of int type, String type, Double type and DateTime type generates an input box, such as the attribute Registration date; Enum type attributes generate drop-down boxes, such as the attribute Registration className; Boolean type attributes generate radio buttons, such as the attribute Registrationattended.
[0070] In the result container, all the attributes of the dependent class should be available for query and displayed in the interface, so each attribute corresponds to a table header in the form, such as the attribute Registration attended. In addition, because there is a dependency relationship between the dependent class and the independent class, the independent class should also be reflected in the form, but displaying all the attributes of the independent class will greatly increase the redundancy of the form, so only the key attributes of the independent class are displayed in the form, and each key attribute corresponds to a column header, such as the attribute Trainee fullName.
[0071] ②Delete interface Delete interface example Figure 5 As shown. Figure 5 (a) is the input class diagram data; Figure 5 (b) is the automatically generated deletion interface template; Figure 5 (c) is the complete deletion interface, with each component filled with specific data.
[0072] 1) Generate deterministic components: The deletion interface needs to implement operations such as query and delete, so an input box is generated in the operation container for entering query content, and a "Query" button is generated; a check box form is generated in the result container to display the data returned by the database, and "Delete" and "Reset" buttons are generated.
[0073] 2) Generate non-deterministic components: Each attribute in the dependent class should be queryable, so each attribute corresponds to an option in the generated drop-down box, such as the attribute Registration attended. Each attribute of the dependent class and the key attribute of the independent class corresponds to a table header in the generated result container, such as the attribute Registration attended and the attribute Trainee fullName.
[0074] ③Modify interface Modify the interface example Figure 6 As shown. Figure 6 (a) is the input class diagram data; Figure 6 (b) is the automatically generated modification interface template; Figure 6 (c) is the complete modification interface, with each component filled with specific data.
[0075] 1) Generate deterministic components: The modification interface needs to implement operations such as query and modification, so an input box is generated in the operation container for entering query content, and a "Query" button is generated; an editable form is generated in the result container to display the data returned by the database, and "Modify" and "Cancel" buttons are generated.
[0076] 2) Generate non-deterministic components: Each attribute in the dependent class should be queryable, so each attribute corresponds to an option in the drop-down box in the generated operation container, such as the attribute Registration attended. Each attribute in the dependent class and the key attribute of the independent class corresponds to a header in the generated form, such as the attribute Registrationattended and the attribute Trainee fullName.
[0077] When you click the modify button in the first column of the form, a modification pop-up window will pop up and display the data of the row. The modification pop-up window consists of an input box, a drop-down box, and a button: the ID attribute cannot be modified, so the ID attribute should not be displayed, such as the attribute Registration registrationID; each attribute of the int type, string type, double type, DateTime type, and corresponds to an input box in the modification pop-up window, such as the attribute Registration date; the Enum type attribute corresponds to a drop-down box in the modification pop-up window, such as the attribute Registration className; the Boolean type attribute corresponds to a radio button, such as the attribute Registration attended. Finally, two buttons "Save" and "Reset" should also be generated in the modification pop-up window.
[0078] ④Query interface The query interface example is as follows Figure 7 As shown. Figure 7 (a) is the input class diagram data; Figure 7 (b) is the automatically generated query interface template; Figure 7 (c) is the complete query interface, with each component filled with specific data.
[0079] 1) Generate deterministic components: The query interface needs to implement query operations, so an input box is generated in the operation container for entering query content, and a "Query" button is generated; a form is generated in the result container to display the data returned by the database.
[0080] 2) Generate non-deterministic components: Each attribute in the dependent class should be queryable, so each attribute corresponds to an option in the generated drop-down box, such as the attribute Registration attended. All attributes of the dependent class and the key attributes of the independent class correspond to a table header in the form of the result container, such as the attribute Registration attended and the attribute Trainee fullName.
[0081] The difference between the generation strategy of independent classes and non-independent classes is that independent classes only need to obtain all their own attributes to generate representation models, without obtaining attribute information of other classes. I will not go into details here. If developers have special needs, the interface styles of all representation model nodes can be modified or improved, so that the final generated HTML page is more beautiful and more in line with the user's operation logic.
[0082] (3) Generate user interface source code In order to ensure universality, platform independence, simplicity and high scalability, HTML pages are selected as the final generated user interface. After the presentation model is built, all interfaces in the presentation model can be generated into HTML files with the same interface effect. Figure 8 As shown in the figure, a secondary menu is defined on the left side of the HTML page. The name of each option in the main menu is the class name, and the name of each option in the submenu is the name of the model node generated by the class. The interface content of each model node is converted into a submenu interface and displayed in the HTML page. At the same time, in order to further reduce the difficulty of user operation, a dictionary is pre-defined to translate all the content displayed in the HTML page into Chinese.
[0083] When generating the final user interface, it is incomplete to only generate the HTML file. In order to make the user interface more beautiful and more in line with the user's operation logic, the appearance style and function of each UI component in the presentation model are redefined, and the corresponding CSS file and JS file are automatically packaged and generated when the HTML file is generated.
[0084] 3. Consistency Analysis In order to generate a highly reliable software system, formal methods must be used to ensure the consistency between models throughout the software development process. The definitions of simulation relationships and combination relationships are as follows: Definition 3 and are two unified structures. If there exists a simulation rule that makes the relationship Satisfy all ,in are model elements of the same type, and the following conditions hold: (51) ,in are model elements of the same type, and (52) ,in are model elements of the same type, and is a collection of the same dependency type, then it is called yes and The simulated relationship between Can simulate , expressed as .
[0085] Definition 3 gives the definition of simulation relation, which shows that if there is a simulation relation between two unified structures , we can say that there is a consistency relationship between these two unified structures, that is for are consistent.
[0086] Theorem 1: and are two unified structures, and yes and If there are two unified structures , ,satisfy and ,but Too and The simulation relationship between .
[0087] Certificate Order , , and There are four unified structures, because , from Definition 3, we know that for all All meet the following requirements: and .because and , from Definition 2 we can know: , , , and , ; , , , and , . Then for all and , all satisfy: and From Definition 3, we know that yes and The simulation relationship between .
[0088] Theorem 1 shows that if there is a simulation relationship between two unified structures, then there is still a simulation relationship between their substructures.
[0089] Definition 4 and are two unified structures. If is a non-reflexive partial order set, then and The combination of is defined as ,in , , , and , , then it is called and are composable.
[0090] Definition 4 gives the definition of the combination relationship, that is, two unified structures that meet the combination conditions can be combined into one unified structure.
[0091] Theorem 2: , , , are four unified structures, and , .if and , then it is called .
[0092] Certificate Order , , , It is composed of four unified structures and , .in, , , , , , ; , , , , , . From Definition 4, we know that for all All meet the following requirements: ; . And for all All meet the following requirements: ; From Definition 3, we know that and There is a simulation relationship between .
[0093] Theorem 2 shows that if two unified structures have a simulation relationship before they are combined, they can still satisfy the simulation relationship after they are combined.
[0094] 4. Consistency Check According to the user interface automatic generation algorithm, the use case model and the domain concept model provide key information for the presentation model from the aspects of behavior and data, respectively, so as to generate a user interface that better meets the system requirements. During the generation process of the presentation model, the entity class information and the relationship between entity classes in the domain concept model will be automatically obtained, which can ensure the consistency of entity class information between the domain concept model and the presentation model, and help ensure the correctness and integrity of the software system.
[0095] like Fig. 9 As shown, Fig. 9 In the figure, an independent class Course is represented, which can be represented by a unified structure as , in: (61)
[0096] (62)
[0097] (63)
[0098] (64)
[0099] (65)
[0100] (66)
[0101] (67)
[0102] From Definition 4, we can know that we can detect whether there is a simulation relationship between different models by comparing elements of the same type. Fig. 9 The representation model instance generated by this unified structure has been given in Chapter 1. According to the user interface automatic generation algorithm in Chapter 2, the unified structure middle Elements and unified structure middle By comparing the elements of simulation Similarly, by comparing the unified structure middle Elements and unified structure middle The elements of simulation . From this we can see that there is a simulation relationship between the representation model and the domain concept model, that is, the representation model is consistent with the domain concept model.
[0103] like Fig.10 As shown, Fig.10 A class diagram with dependencies is shown in the figure, which can be represented by a unified structure as ,in: (71)
[0104] (72)
[0105]
[0106] (73)
[0107] (74)
[0108] (75)
[0109] (76)
[0110] (77)
[0111] Fig.10 The generated representation model instance can be represented by a unified structure as ,in: (81)
[0112] (82)
[0113] (83)
[0114] (84)
[0115] (85)
[0116] container and container All are unified structures Substructure, container It can be expressed as a unified structure ,in: (91)
[0117]
[0118] (92)
[0119]
[0120] (93)
[0121] (94)
[0122] (95)
[0123] (96)
[0124] (97)
[0125] container It can be expressed as a unified structure ,in: (101)
[0126]
[0127] (102)
[0128] (103)
[0129] (104)
[0130] (105)
[0131] (106)
[0132]
[0133] Automatically generate algorithms based on the user interface, by comparing the unified structure middle Elements and unified structure middle The elements of simulation Similarly, by comparing the unified structure middle Elements and unified structure middle The elements of simulation Combined with Theorem 2, it can be shown that the representation model still has a simulation relationship with the combined domain concept model, that is, the representation model can still ensure consistency with the combined domain concept model. Therefore, after converting the model into a unified structure and checking the consistency, the correctness of the entire process of automatic user interface generation can be guaranteed.
[0134] The present invention implements a lightweight low-code platform based on NodeJS and GoJS graphics libraries, which can perform UML modeling on information management systems and perform model management and code generation for the entire software development process. Fig.11 As shown, the entire process of automatic user interface generation is realized in the self-developed platform.
[0135] Example A case study will be conducted using a design process that describes the business process of a course selection system. The overall business process consists of a domain concept model and a use case model. Fig.12 As shown in the figure, in the domain concept model, 7 entity classes are defined, and specific attributes are defined in each entity class; in the use case model, 3 roles are defined, and each role has different permissions. As shown in Table 3, through such a design, the interface type of the generated representation model can be determined, and in the final generated user interface, each role can operate different interfaces: Administrator: The administrator has the highest level of authority in the course selection system and can manage all information in the system, that is, in the representation model, an add, delete, modify, and query interface is generated for each entity class in the domain concept model.
[0136] Teacher: Teachers have the functions of modifying personal information and querying personal course schedules in the course selection system, which correspond to the modifying teacher information interface of the entity class Trainer and the querying course schedule information interface of the entity class ScheduledCourse.
[0137] Students: Students have the functions of modifying personal information, selecting courses, paying bills, and querying personal course schedules in the course selection system. These functions correspond to the modifying student information interface of the entity class Trainee, the querying course selection information interface of the entity class Registration, the adding bill information interface of the entity class Bill, and the querying course schedule information interface of the entity class ScheduledCourse.
[0138]
[0139] The use case model and the domain concept model jointly generate the representation model. Fig.13 and Fig.14 An example of a representation model and a final user interface example are shown. Fig.12The use case of course schedule management and a course schedule addition interface automatically generated by the ScheduledCourse class.
[0140] The present invention proposes an automatic user interface generation method based on the UML model, combines the formal method to create a representation model, follows the application, reasoning and verification capabilities of the formal method in the entire software development process, solves the problem that the consistency, correctness and integrity of the traditional low-code platform cannot be guaranteed due to the lack of a clearly defined metamodel as a component, and makes the final generated software system have a strict mathematical foundation. And through the model-driven approach, the conventional operations such as dragging, pulling and dragging when the traditional low-code platform generates the user interface are abandoned, which can not only generate the user interface fully automatically, but also discover and solve potential problems before generation. At the same time, the method has the characteristics of platform independence, making the generated software system more flexible, extensible, reusable and maintainable. On the premise of ensuring software requirements, the amount of code required to implement the software system and the workload of developers are significantly reduced, the development cycle of the system is accelerated, and the development cost is reduced.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be used to modify the technical solutions or to perform equivalent replacements on some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A user interface automatic generation method based on a domain concept model and a use case model, characterized in that: include: Identify the CRUD type corresponding to the use case from the use case model, and determine the interface template type corresponding to the CRUD type corresponding to the use case from the template library; Read the role permissions and business process information in the use case from the use case model; the role permissions are used to generate the class diagram data required for each prototype interface, and the business process information is used to determine the component functions in the user interface and the jump order between interfaces; Identify the relationship type in the entity class from the domain concept model, and process the class diagram data according to the relationship type in the entity class to obtain the entity class data; The user interface is automatically generated by inputting the interface template type, role authority, business process information and entity class data into the representation model.
2. The method according to claim 1, characterized in that The determining of the interface template type corresponding to the CRUD type corresponding to the use case from the template library includes: When the CRUD type corresponding to the use case is a Create type, the interface template type corresponding to the Create type is determined from the template library to be an Add interface template; When the CRUD type corresponding to the use case is a Delete type, the interface template type corresponding to the Delete type is determined from the template library as a Delete interface template; When the CRUD type corresponding to the use case is the Update type, the interface template type corresponding to the Update type is determined from the template library as the modification interface template; When the CRUD type corresponding to the use case is a read type, the interface template type corresponding to the read type is determined from the template library as a query interface template.
3. The method according to claim 1, characterized in that: Each interface template consists of an operation container and a result container; wherein the operation container is used to generate corresponding components from input data according to different types of interfaces to implement add operations and query operations; the result container is used to display the data returned by the database to implement delete operations and modify operations.
4. The method according to claim 3, characterized in that The components generated by the operation container include deterministic components and non-deterministic components; wherein the deterministic components refer to components that must exist when the template is generated and will not change with external data input or user operation, indicating that the model automatically generates corresponding deterministic components according to the generation rule table of interface type and component type; the non-deterministic components refer to components that change according to input data or user operation, indicating that the model converts different types of input data into different types of non-deterministic components.
5. The method according to claim 1, characterized in that According to the dependency relationship between classes, the entity class is divided into independent class and non-independent class. When the non-independent class generates a representation model node, all the attributes of the non-independent class itself and the class name, all the attributes and key attributes of the independent class that has a dependency relationship with the non-independent class are obtained; when the independent class generates a representation model node, only its own class name and all the attributes are obtained.
6. The method according to claim 1, characterized in that The generated user interface is an HTML page; wherein a secondary menu is defined in the HTML page, and depending on the role, the name of each option in the main menu of the secondary menu is defined as the class name related to the use case associated with the role, and the name of each option in the submenu is defined as the name of the representation model node generated by the class, and the interface content of each representation model node is converted into a submenu interface displayed in the HTML page.
7. The method according to claim 6, characterized in that Also includes: In the generated user interface, by defining the appearance style of each UI component in the representation model, the corresponding CSS file is automatically generated when the HTML file is generated. At the same time, in the generated user interface, by defining the functions of all UI components in the representation model, the JS file of the corresponding UI component function is automatically generated when the HTML file is generated, and the HTML file, CSS file and JS file are packaged and generated.
8. The method according to claim 7, characterized in that Also includes: In the process of generating representation models, the consistency of the models is analyzed by defining simulation relationships and combination relationships to ensure the consistency between models.
9. The method according to claim 8, characterized in that Also includes: In the process of generating the representation model, the entity class information and the relationship between the entity classes in the domain concept model are obtained, and the consistency of the model is detected using the entity class information and the relationship between the entity classes in the domain concept model to ensure the consistency of the entity class information between the domain concept model and the representation model.