A graph index system, electronic device and storage medium based on UML model
By designing a graph indexing system based on UML model, the difficulty of finding UML objects in complex UML modeling is solved, and the expression of UML objects in multiple graphs is achieved quickly and efficiently manages the expression of UML objects in multiple graphs.
Patent Information
- Application Number
- CN202111591177.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2041-12-23
AI Technical Summary
In the complex UML modeling process, it is difficult to find out which graphs appear in through UML objects, resulting in the demand for model indexing technology.
Design a graph indexing system based on UML models, including UML models, index models, drawing models, graph model listeners and index maintenance engines. The graph model listener collects notifications of user modifications, and the index maintenance engine updates the index model to record the UML objects and relevant information about the graph that appear in the graph.
It realizes the function of quickly finding out which graphs UML objects are expressed, improving modeling efficiency and convenience of data management.
Smart Images

Figure CN114417080B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of UML modeling, and in particular relates to a graph index system based on a UML model. Background Art
[0002] At present, the UML language can express the structure and behavior of all objects in the physical world. However, using the UML language to directly build models of physical world objects requires a high level of knowledge from modelers. For complex models, modelers may not be able to build the model. Therefore, graphical modeling came into being, which eliminates the barriers for people to use the UML language for modeling.
[0003] The UML language provides an extension mechanism for UML objects (stereotype objects and constraint objects). At the same time, it also provides an extended description of UML objects (UML annotation objects).
[0004] Eclipse provides a Java build of the UML metamodel. At the same time, it provides an EMF+GMF framework that encapsulates the graphical editing and saving of UML models. The saved models are stored in XML file format. Once the model (UML model, drawing model) changes, a change notification will be sent to the listener.
[0005] For modeling with a relatively high complexity coefficient, the modeling cycle is long, and a modeled object may need to be expressed in multiple places in the graphical interface, and the modeling data also grows exponentially. Therefore, in the design, the UML model is often saved as a file, and the graphic object is stored as a file in units of diagrams. At the same time, in order to improve the efficiency of loading models by tool software, the UML model object is automatically loaded into the memory when the tool is opened, and the drawing object is only loaded when the diagram is opened. Since there is a one-to-many relationship between UML objects and drawing objects, it is very simple to search for UML objects through graphical elements. It can be achieved by adding a reference to the UML model object to the saved graphic object. However, according to the design described above, it is impossible to directly implement which diagrams appear through UML objects. Model indexing technology is designed to solve this type of search problem. Summary of the invention
[0006] In order to solve the above technical problems, the present invention proposes a technical solution of a graph index system, an electronic device and a storage medium based on a UML model to solve the above technical problems.
[0007] The first aspect of the present invention discloses a graph index system based on a UML model, the system comprising:
[0008] UML model, index model, drawing model, drawing model listener and index maintenance engine;
[0009] The UML model records the semantic objects to be expressed by the system;
[0010] The index model stores and records the relevant information of which uml objects and diagrams appear in the diagram;
[0011] The drawing model records the graphic elements drawn by the user in the drawing and issues corresponding modification notifications in response to the user's modification;
[0012] The graph model listener collects notifications of user modifications in the graph;
[0013] The index maintenance engine updates the index model according to the modification notifications collected by the graph model listener.
[0014] According to the system of the first aspect of the present invention, the uml model uses emf in Eclipse as a framework, and the uml model is converted into a file for storage.
[0015] According to the system of the first aspect of the present invention, the drawing model records the graphic elements drawn by the user in the diagram, including: position, size, background color, font color, font size, components and shape; the drawing model also records the mapping relationship between the graphic elements and the UML model.
[0016] According to the system of the first aspect of the present invention, the notification specifically includes: notification type, changed subject, new value, old value and a graph where the changed subject is located.
[0017] According to the system of the first aspect of the present invention, the index model stores and records which uml objects and related information of the graph appear in the graph, and has four attributes, specifically including:
[0018] type: a single-valued attribute, which indicates the type of graph to be indexed by the graph index model;
[0019] elements: a multi-valued attribute that stores the unique identifier of the uml object used in the diagram, that is, each uml semantic object has a unique identifier generated by UUID;
[0020] objects: a multi-valued attribute that stores references to uml objects used in the diagram;
[0021] diagramBinary: A single-valued property that indicates the file in which the current diagram is stored.
[0022] According to the system of the first aspect of the present invention, the index model is associated with the annotation of the UML object through the annotation technology provided by UML.
[0023] According to the system of the first aspect of the present invention, the notification of the modification made by the user in the graph collected by the graph model listener specifically includes: the type of notification and the subject of the notification;
[0024] The type of notification is the type of modification, including: addition and deletion;
[0025] The subject of the notification is the drawing model.
[0026] According to the system of the first aspect of the present invention, the index maintenance engine mainly maintains the index model in the annotation of the uml object, that is, performs index maintenance on the notification of modification of the notification type of addition and deletion, and the specific method includes:
[0027] When a new drawing element is added to the diagram, the index maintenance method includes:
[0028] Obtain the notification delivered by the graph model listener, and obtain the index model corresponding to the graph modified by the user through the notification;
[0029] Get the drawing model of the notification, then extract the corresponding newly added UML object from it, and determine whether the index model has a reference or unique identifier of the newly added UML object:
[0030] If it does not exist, the unique identifier of the newly added uml object is added to the elements field of the index model, and the reference of the newly added uml object is added to the objects field of the index model;
[0031] If it exists, keep the index unchanged;
[0032] When drawing elements are deleted from a diagram, index maintenance methods include:
[0033] Obtain the notification delivered by the graph model listener, and obtain the index model corresponding to the graph modified by the user through the notification;
[0034] Get the drawing model of the notification, then take out the corresponding deleted uml object from it, and get the diagram where the notification body is located;
[0035] Take out the drawing elements that still exist after being deleted from the diagram, and take out the corresponding UML objects to form a set, and determine whether the set contains the deleted UML objects:
[0036] If not, the unique identifier of the deleted uml object needs to be removed from the field elements in the index model, and the reference to the deleted uml object needs to be removed from the field objects in the index model;
[0037] If included, keep the index unchanged.
[0038] A second aspect of the present invention provides an electronic device, comprising a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method in a graph index system based on a UML model as described in the first aspect of the present invention is executed.
[0039] The third aspect of the present invention provides a storage medium, which stores a computer program that can be executed by one or more processors and can be used to implement a method in a graph index system based on a UML model as described in the first aspect of the present invention.
[0040] The solution proposed by the present invention can quickly find out in which diagrams the UML object is expressed through the diagram index. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 A structural diagram of a graph index system based on a UML model according to an embodiment of the present invention;
[0043] Figure 2 is a schematic diagram of an index model according to an embodiment of the present invention;
[0044] Figure 3 The figure is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0046] The first aspect of the present invention discloses a graph index system based on a UML model. Figure 1 is a structural diagram of a graph index system based on a UML model according to an embodiment of the present invention, specifically as follows Figure 1 As shown, the system comprises:
[0047] UML model, index model, drawing model, drawing model listener and index maintenance engine;
[0048] The UML model records the semantic objects to be expressed by the system;
[0049] The index model stores and records the relevant information of which uml objects and diagrams appear in the diagram;
[0050] The drawing model records the graphic elements drawn by the user in the drawing and issues corresponding modification notifications in response to the user's modification;
[0051] The graph model listener collects notifications of user modifications in the graph;
[0052] The index maintenance engine updates the index model according to the modification notifications collected by the graph model listener.
[0053] In some embodiments, the uml model is based on the emf framework in Eclipse, and the uml model is converted into a file for storage, wherein Eclipse is an open source, Java-based, extensible development platform.
[0054] Specifically, the uml model is an implementation of the uml language standard specification, which records the complete semantics to be expressed by the system; at the same time, the uml model is associated with the index model by using the uml annotation technology. The Eclipse emf framework perfectly implements the technology of converting the uml model into a file for saving. Similarly, the index model can also be converted into a file for saving.
[0055] In some embodiments, the drawing model records the graphic elements drawn by the user in the diagram including: position, size, background color, font color, font size, components and shape and other related information; the drawing model also records the mapping relationship between the graphic elements and the UML model.
[0056] In some embodiments, when a user adds, deletes, or modifies a graphic element, the drawing model will issue a corresponding notification, which specifically includes: notification type, subject of the change, new value, old value, and the diagram where the subject of the change is located.
[0057] In some embodiments, Figure 2 As shown, the index model, namely Figure 2 The DiagramIndex in the diagram records which uml objects and diagram-related information appear in the diagram. It has four properties, including:
[0058] type: a single-valued attribute, which indicates the type of graph to be indexed by the graph index model;
[0059] elements: a multi-valued attribute that stores the unique identifier of the uml object used in the diagram, that is, each uml semantic object has a unique identifier generated by UUID;
[0060] objects: a multi-valued attribute that stores references to uml objects used in the diagram;
[0061] diagramBinary: A single-valued property that indicates the file in which the current diagram is stored.
[0062] In some embodiments, when a user creates a new diagram under a certain uml object, a corresponding index model will be created, and the index model is associated with the annotation of the uml object through the annotation technology provided by uml. At the same time, the diagram storage path location is assigned to streamId, and type is assigned to the type of the created diagram, which specifically includes: class diagram, object diagram, component diagram, deployment diagram, use case diagram, sequence diagram, collaboration diagram, state diagram, and activity diagram.
[0063] In some embodiments, the notification of the modification made by the user in the graph collected by the graph model listener specifically includes: the type of notification and the subject of the notification;
[0064] The type of notification is the type of modification, including: addition and deletion;
[0065] The subject of the notification is the drawing model.
[0066] Specifically, the graph model listener mainly listens to notifications issued by the drawing model, and the notification features listened to mainly include the type of notification and the subject of the notification. The type of notification is the type of modification, including: addition and deletion; the subject of the notification is the drawing model. When the corresponding notification is adapted, the index maintenance engine is started, the corresponding notification is passed to the index maintenance engine, and the index model of the corresponding graph is automatically maintained according to the content of the notification.
[0067] In some embodiments, the index maintenance engine mainly maintains the index model in the annotation of the uml object, that is, performs index maintenance on the notification of modification of the notification type of addition and deletion, and the specific method includes:
[0068] When a new drawing element is added to the diagram, the index maintenance method includes:
[0069] Obtain the notification delivered by the graph model listener, and obtain the index model corresponding to the graph modified by the user through the notification;
[0070] Get the drawing model of the notification, then extract the corresponding newly added UML object from it, and determine whether the index model has a reference or unique identifier of the newly added UML object:
[0071] If it does not exist, the unique identifier of the newly added uml object is added to the elements field of the index model, and the reference of the newly added uml object is added to the objects field of the index model;
[0072] If it exists, keep the index unchanged;
[0073] When drawing elements are deleted from a diagram, index maintenance methods include:
[0074] Obtain the notification delivered by the graph model listener, and obtain the index model corresponding to the graph modified by the user through the notification;
[0075] Get the drawing model of the notification, then take out the corresponding deleted uml object from it, and get the diagram where the notification body is located;
[0076] Take out the drawing elements that still exist after being deleted from the diagram, and take out the corresponding UML objects to form a set, and determine whether the set contains the deleted UML objects:
[0077] If not, the unique identifier of the deleted uml object needs to be removed from the field elements in the index model, and the reference to the deleted uml object needs to be removed from the field objects in the index model;
[0078] If included, keep the index unchanged.
[0079] In summary, the technical solutions of various aspects of the present invention have the following advantages compared with the prior art: through the graph index, it is possible to quickly find out in which graphs the UML object is expressed.
[0080] The second aspect of the present invention discloses an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a drawing indexing method based on a UML model disclosed in any one of the first aspects of the present invention are implemented.
[0081] Figure 3 is a structural diagram of an electronic device according to an embodiment of the present invention, such as Figure 3As shown, the electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covered on the display screen, or a button, a trackball or a touch pad set on the housing of the electronic device, or an external keyboard, touch pad or mouse, etc.
[0082] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a structural diagram of the part related to the technical solution of the present disclosure, and does not constitute a limitation on the electronic device to which the technical solution of the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0083] The third aspect of the present invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any one of the steps in the drawing indexing method based on the UML model disclosed in the first aspect of the present invention are implemented.
[0084] Please note that the technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification. The above embodiments only express several implementation methods of the present application, and their descriptions are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, without departing from the concept of the present application, several variations and improvements can be made, which all belong to the scope of protection of the present application. Therefore, the scope of protection of the patent in this application shall be based on the attached claims.
Claims
1. A graph index system based on the UML model, characterized in that: The system comprises: UML model, index model, drawing model, drawing model listener and index maintenance engine; The UML model records the semantic objects to be expressed by the system; The index model stores and records the relevant information of which uml objects and diagrams appear in the diagram; The drawing model records the graphic elements drawn by the user in the drawing and issues corresponding modification notifications in response to the user's modification; The graph model listener collects notifications of user modifications in the graph; The index maintenance engine updates the index model according to the modification notifications collected by the graph model listener; The index model stores and records the related information of which uml objects and diagrams appear in the diagram, and has four attributes, including: type: a single-valued attribute, which indicates the type of graph to be indexed by the graph index model; elements: a multi-valued attribute that stores the unique identifier of the uml object used in the diagram, that is, each uml semantic object has a unique identifier generated by UUID; objects: a multi-valued attribute that stores references to uml objects used in the diagram; diagramBinary: a single-valued property, which file the current diagram is stored in; The index maintenance engine mainly maintains the index model in the annotation of the uml object, that is, performs index maintenance on the notification of modification of the notification type of addition and deletion. The specific method includes: When a new drawing element is added to the diagram, the index maintenance method includes: Obtain the notification delivered by the graph model listener, and obtain the index model corresponding to the graph modified by the user through the notification; Get the drawing model of the notification, then extract the corresponding newly added UML object from it, and determine whether the index model has a reference or unique identifier of the newly added UML object: If it does not exist, the unique identifier of the newly added uml object is added to the elements field of the index model, and the reference of the newly added uml object is added to the objects field of the index model; If it exists, keep the index unchanged; When drawing elements are deleted from a diagram, index maintenance methods include: Obtain the notification delivered by the graph model listener, and obtain the index model corresponding to the graph modified by the user through the notification; Get the drawing model of the notification, then take out the corresponding deleted uml object from it, and get the diagram where the notification body is located; Take out the drawing elements that still exist after being deleted from the diagram, and take out the corresponding UML objects to form a set, and determine whether the set contains the deleted UML objects: If not, the unique identifier of the deleted uml object needs to be removed from the field elements in the index model, and the reference to the deleted uml object needs to be removed from the field objects in the index model; If included, keep the index unchanged.
2. According to the UML model-based graph index system of claim 1, it is characterized in that: The uml model uses the emf in Eclipse as a framework, and the uml model is converted into a file for storage.
3. According to the UML model-based graph index system of claim 1, it is characterized in that: The drawing model records the graphic elements drawn by the user in the diagram, including: position, size, background color, font color, font size, components and shape; the drawing model also records the mapping relationship between the graphic elements and the UML model.
4. A graph index system based on a UML model according to claim 2, characterized in that: The notification specifically includes: notification type, changed subject, new value, old value and the graph where the changed subject is located.
5. A graph index system based on a UML model according to claim 4, characterized in that: The index model is associated with the annotation of the uml object through the annotation technology provided by uml.
6. A graph index system based on a UML model according to claim 4, characterized in that: The graph model listener collects notifications of modifications made by the user in the graph, specifically including: the type of notification and the subject of the notification; The type of notification is the type of modification, including: addition and deletion; The subject of the notification is the drawing model.
7. An electronic device, characterized in that: It comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method in a graph index system based on a UML model as claimed in any one of claims 1 to 6 is executed.
8. A storage medium, characterized in that: The computer program stored in the storage medium can be executed by one or more processors and can be used to implement the method in a graph index system based on a UML model as described in any one of claims 1 to 6.
Citation Information
Patent Citations
UML (Unified Modeling Language) model querying method based on structure matching
CN103049503A
UML (unified model language) model query method based on class attribute guidance
CN103324736A