Domain model consistency evaluation method based on semantic analysis and related device
Through the method based on semantic analysis, the problems of low efficiency and strong subjectivity of traditional model consistency evaluation are solved, and automated and objective model consistency evaluation is realized, which can accurately evaluate the semantic and functional logic consistency of model elements and improve the evaluation efficiency. Efficiency and accuracy.
Patent Information
- Application Number
- CN202411303591.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-10-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional model consistency assessment methods are inefficient and highly subjective, making it difficult to ensure the consistency and objectivity of the results, and it is especially difficult to evaluate functional logical consistency.
Using a method based on semantic analysis, by determining the element matching pairs between the target domain model and the standard domain model under the target structure representation, calculate the element matching degree, and evaluate the model consistency based on the matching degree, using the semantic analysis module and consistency evaluation module to achieve Automated, objective assessment.
It achieves automated, objective and efficient model consistency assessment, can accurately assess the semantic consistency and functional logic consistency of model elements, improves assessment efficiency and accuracy, and provides detailed assessment reports and improvement suggestions.
Smart Images

Figure CN118819475A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software engineering technology, and in particular to a domain model consistency assessment method based on semantic analysis and related devices. Background Art
[0002] The domain model is an important component of software engineering. It abstractly represents the concepts, relationships, and rules of a specific domain. The quality of the domain model directly affects the understandability, maintainability, and scalability of the software system. In order to ensure the quality of the domain model, it is necessary to perform a consistency assessment on it, that is, to assess the degree of consistency between it and the predefined standard domain model.
[0003] Traditional model consistency assessment methods mainly rely on manual review and evaluation, which have the following problems: 1) Inefficiency: It consumes a lot of manpower and is inefficient, especially when facing large and complex domain models; 2) It is highly subjective and it is difficult to ensure consistency: Manual review relies on the experience and knowledge level of the reviewers, which is highly subjective and difficult to ensure the consistency and objectivity of the evaluation results. In particular, the standards and understandings of different reviewers may differ, resulting in inconsistent evaluation results; 3) It is difficult to evaluate functional logic consistency: Manual review mainly focuses on the name and structure of model elements, and it is difficult to deeply evaluate whether the functional logic of model elements is consistent.
[0004] Therefore, how to achieve automated, objective and efficient model consistency assessment has become an urgent problem that needs to be solved at this stage. Summary of the invention
[0005] In view of the above problems, this application provides a domain model consistency assessment method based on semantic analysis and related devices to achieve the purpose of automatically, objectively and efficiently assessing the consistency between the domain model and the standard domain model. The specific scheme is as follows:
[0006] In a first aspect, the present application provides a domain model consistency evaluation method based on semantic analysis, and the domain model consistency evaluation method based on semantic analysis includes:
[0007] Determine, by semantic analysis, an element matching pair between the target domain model and the standard domain model under the target structure representation, wherein the element matching pair includes a first model element of the target domain model and a second model element of the standard domain model, and there is a semantic matching relationship between the first model element and the second model element;
[0008] Calculating the matching degree of the element matching pair using the first model element and the second model element;
[0009] Based on the matching degree between the target structure representation and the element matching pair, the consistency between the target domain model and the standard domain model is evaluated.
[0010] In a possible implementation, determining the element matching pairs between the target domain model and the standard domain model under the target structure representation through semantic analysis includes:
[0011] Retrieving a standard library, wherein the first type of diagram of the standard domain model is pre-imported into the standard library;
[0012] Obtaining a second type of graph of the target domain model by parsing;
[0013] Semantic analysis is performed on the model elements of the first class diagram and the second class diagram under the target structure representation to obtain the element matching pairs with semantic matching.
[0014] In a possible implementation, calculating the matching degree of the element matching pair by using the first model element and the second model element includes:
[0015] converting the first model element into a first vector representation, and converting the second model element into a second vector representation;
[0016] Calculating a similarity between the first vector representation and the second vector representation;
[0017] The similarity is used as the matching degree of the element matching pair.
[0018] In a possible implementation, the target structure representation includes an entity structure representation and a relationship structure representation, and the element matching pair includes a first element matching pair under the entity structure representation and a second element matching pair under the relationship structure representation;
[0019] The evaluating the consistency between the target domain model and the standard domain model based on the matching degree between the target structure representation and the element matching pair includes:
[0020] Calculating entity matching degrees of different entity classes according to the matching degrees of the first element matching pairs and the preset weights of the entity structure representation; calculating the total entity matching degree using the entity matching degrees and the preset weights of the different entity classes;
[0021] Calculating the relationship matching degrees of different relationship classes according to the matching degrees of the second element matching pairs and the preset weights of the relationship structure representation; calculating the total relationship matching degree using the relationship matching degrees and the preset weights of the different relationship classes;
[0022] Calculating a total matching degree based on the total entity matching degree and the total relationship matching degree;
[0023] The total matching degree is taken as the consistency degree between the target domain model and the standard domain model.
[0024] In a possible implementation, the entity structure representation includes one or more of an entity, an attribute, and a method, and the relationship structure representation includes one or more of a relationship, a relationship type, and a quantity constraint.
[0025] In a possible implementation, the domain model consistency assessment method based on semantic analysis further includes:
[0026] An evaluation report is generated based on the consistency evaluation results of the target domain model.
[0027] A second aspect of the present application provides a domain model consistency assessment device based on semantic analysis, and the domain model consistency assessment device based on semantic analysis includes:
[0028] A semantic analysis module, used to determine, through semantic analysis, an element matching pair between a target domain model and a standard domain model under a target structure representation, wherein the element matching pair includes a first model element of the target domain model and a second model element of the standard domain model, and a semantic matching relationship exists between the first model element and the second model element;
[0029] The consistency evaluation module is used to calculate the matching degree of the element matching pair by using the first model element and the second model element; and evaluate the consistency of the target domain model with the standard domain model based on the matching degree of the target structure representation and the element matching pair.
[0030] The third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the domain model consistency assessment method based on semantic analysis according to the above-mentioned first aspect or any implementation of the first aspect.
[0031] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0032] The memory is used to store computer programs;
[0033] The processor is used to execute the computer program so that the electronic device can implement the domain model consistency assessment method based on semantic analysis according to the above-mentioned first aspect or any implementation manner of the first aspect.
[0034] In a fifth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the domain model consistency assessment method based on semantic analysis according to the above-mentioned first aspect or any implementation method of the first aspect.
[0035] By means of the above technical scheme, the present application provides a domain model consistency evaluation method based on semantic analysis and related devices, which determine the element matching pairs of the target domain model and the standard domain model under the target structure representation through semantic analysis, wherein the element matching pairs include the first model element of the target domain model and the second model element of the standard domain model that have a semantic matching relationship; the matching degree of the element matching pairs is calculated using the first model element and the second model element; and the consistency of the target domain model and the standard domain model is evaluated based on the target structure representation and the matching degree of the element matching pairs. The present application uses semantic analysis to compare the consistency of the target domain model to be evaluated with the standard domain model. Since it focuses more on the semantic understanding of the model elements, it can more accurately evaluate the consistency of the model, thereby realizing automated, objective and efficient model consistency evaluation. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0037] Figure 1 A flowchart of a domain model consistency assessment method based on semantic analysis provided for an implementation example of this application;
[0038] Figure 2 A partial flow chart of a domain model consistency assessment method based on semantic analysis provided in an embodiment of the present application;
[0039] Figure 3 An example of a class diagram of a standard domain model provided in an embodiment of the present application;
[0040] Figure 4 An example of a class diagram of a target domain model provided in an embodiment of the present application;
[0041] Figure 5 A schematic diagram of another part of the flow chart of a domain model consistency assessment method based on semantic analysis provided in an embodiment of the present application;
[0042] Figure 6 A schematic diagram of another part of the flow chart of a domain model consistency assessment method based on semantic analysis provided in an embodiment of the present application;
[0043] Figure 7 A schematic diagram of the structure of a domain model consistency assessment device based on semantic analysis provided in an embodiment of the present application;
[0044] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0046] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0047] The terms "first", "second" etc. in the specification of the application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable in appropriate circumstances, and this is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0048] To facilitate understanding of this application, the following describes the relevant concepts involved in this application:
[0049] Domain Model: An abstract representation of concepts, relationships, and rules in a specific domain, typically used in software design and development.
[0050] Semantic Analysis: Technology for extracting meaning and semantic information from text, such as word sense disambiguation, relation extraction, semantic role labeling, etc.
[0051] Word Embedding: A technique for mapping words or phrases into a vector space that can capture the semantic similarity between words.
[0052] Consistency Evaluation: Evaluate the degree of consistency between two or more models, such as structural consistency, semantic consistency, etc.
[0053] In recent years, semantic analysis technology has developed rapidly, providing new ideas for model consistency assessment. Semantic analysis technology can help understand the meaning of model elements. However, most of the existing model consistency assessment methods lack support for semantic analysis and are unable to meet the growing demand for complex domain model assessment. Therefore, a new model consistency assessment method is needed that can effectively utilize semantic analysis and improve the accuracy and reliability of the assessment.
[0054] To solve the above problems, the present application embodiment provides a domain model consistency evaluation method based on semantic analysis. The domain model consistency evaluation method based on semantic analysis of the present application embodiment is described in detail below with reference to the accompanying drawings.
[0055] See also Figure 1 , Figure 1 A flowchart of a domain model consistency assessment method based on semantic analysis is provided for the implementation example of this application. Figure 1 As shown, a domain model consistency assessment method based on semantic analysis provided in an embodiment of the present application may include steps S10 to S30, and these steps are described in detail below.
[0056] S10, determining the element matching pairs of the target domain model and the standard domain model under the target structure representation through semantic analysis, wherein the element matching pairs include a first model element of the target domain model and a second model element of the standard domain model, and there is a semantic matching relationship between the first model element and the second model element.
[0057] In the embodiment of the present application, the target domain model is the domain model to be evaluated, which can be obtained by the user inputting a model file. The model elements of the target domain model and the standard domain model under the target structure representation are semantically analyzed to determine element matching pairs having a semantic matching relationship.
[0058] Specifically, the model structures of the target domain model and the standard domain model are divided into entity classes and relationship classes, and entity classes are divided into entities, attributes, and methods, etc., and relationship classifications are divided into relationships, relationship types, and quantity constraints, etc. In this regard, the target structure representation can be an entity structure representation and a relationship structure representation, where the entity structure representation includes one or more of entities, attributes, and methods, and the relationship structure representation includes one or more of relationships, relationship types, and quantity constraints.
[0059] In one possible implementation, standard domain model definitions and evaluation rules for user input can be managed through a standard library. Figure 2 , Figure 2 A partial flow chart of a domain model consistency assessment method based on semantic analysis provided in an embodiment of the present application. Figure 2 As shown, an embodiment of the present application provides a domain model consistency assessment method based on semantic analysis, wherein step S10 "determines element matching pairs between the target domain model and the standard domain model under the target structure representation through semantic analysis" may include steps S101 to S103, and these steps are described in detail below.
[0060] S101, calling a standard library, into which a first type of diagram of a standard domain model is pre-imported.
[0061] S102, obtaining a second type of graph of the target domain model through parsing.
[0062] S103, performing semantic analysis on the model elements of the first type of graph and the second type of graph under the target structure representation to obtain semantically matched element matching pairs.
[0063] In the embodiment of the present application, different standard libraries can be established for different fields, such as establishing a model for the telecommunications operator field based on TMForum SID, or establishing standard libraries for different fields such as the medical industry and the tourism industry. Through the standard library, users can store and manage the standard domain models therein, such as managing their entities, relationships, attributes, methods, descriptions (such as entity descriptions, relationship descriptions, attribute descriptions, method descriptions), logical relationships, etc., and the standard domain models can be displayed in the form of class diagrams in the standard library.
[0064] See also Figure 3 , Figure 3 This is an example of a class diagram of a standard domain model provided in an embodiment of the present application. Figure 3As shown in the figure, the first class diagram corresponding to the standard domain model is the PlantUML class diagram, which contains three entity classes, "Customer", "Order" and "Product", and two relationship classes, "Customer - places - Order" and "Order - contains -Product". The entity class is illustrated by "Customer", and its entity description is: "Represents a customer of the e-commerce platform". The entity description can be in English, such as: "Represents a customer of the e-commerce platform", and the corresponding attributes are divided into "CustomerID: String", "Name: String", "Email: String", "Address: String", "Phone: String", and the corresponding methods are divided into "PlaceOrder(): Order", "TrackOrder(): OrderStatus", and "ViewProfile()"; the relationship class is illustrated by "Customer - places -Order", which means "customer places an order", and the relationship description is: "Represents the relationship between a customer and his purchase orders", and the relationship description can be in English, such as: "Represents the relationship between a customer and their purchase orders", the relationship type is an association relationship, and the quantity constraint is "the quantity constraint from customer to order is 0 to many, and the quantity constraint from order to customer is 1".
[0065] Of course, the attributes of the entity class in the standard domain model can also have attribute descriptions, and the methods can also have method descriptions. For example, the attribute description of the attribute "CustomerID: String" is "CustomerID: Unique identifier for the customer", and the attribute description can be in English, such as "CustomerID: Unique identifier for the customer". For example, the method description of the method "PlaceOrder(): Order" is: "Creates a new order for the customer", and the method description can be in English, such as "Creates a new order for the customer". After the parsing is completed, it can be converted into unified structured data to facilitate subsequent semantic analysis and matching calculation evaluation.
[0066] In addition, for the model file input by the user, the second type of diagram corresponding to the target domain model can be obtained by parsing the model file. When parsing the model file, a parsing tool including but not limited to a PlantUML parser can be used, and the type of model file includes but is not limited to a PlantUML file (it can also be a model design file in other formats).
[0067] See also Figure 4 , Figure 4 This is an example of a class diagram of a target domain model provided in an embodiment of the present application. Figure 4 As shown in the figure, the second type of diagram corresponding to the target domain model is the PlantUML class diagram, which contains three entity classes, "Shopper", "Purchase", and "Goods", and two relationship classes, "Shopper - makes - Purchase" and "Purchase - contains -Goods". The entity class is illustrated by "Shopper", and its entity description is "represents a customer who makes purchases on the platform". The entity description can be in English, such as "Represents a customer who makes purchases on the platform", and the corresponding attributes are "ShopperID: String", "FullName: String", "Email: String", "shippingAddress: String", "ContactNumber: String", and the corresponding methods are "CreateOrder(): Order", "ViewOrderStatus(): OrderStatus", and "ManageProfile()". The relationship class is illustrated by "Shopper - makes - Purchase", and its relationship description is "represents the relationship between a customer and his order", the association type is an association relationship, and the quantity constraint is "the quantity constraint from customer to order is 1 to 0, and the quantity constraint from order to customer is many".
[0068] Based on this, for the first type of graph and the second type of graph, semantic analysis can be performed on their model elements under the target structure representation, and semantically matching element matching pairs can be determined based on the semantic analysis results.
[0069] Taking the target structure representation as an entity structure representation, the model elements of entities, attributes and methods in the first type of diagram and the second type of diagram can be extracted, and semantically matching element matching pairs can be obtained through semantic analysis. The element matching pairs include entity matching pairs, relationship matching pairs, attribute matching pairs and method matching pairs. Taking the model elements as entities, keyword extraction is performed on the entity name "Customer" and its entity description "Represents acustomer of the e-commerce platform" of the entity class "Customer" in the first type of diagram, and the corresponding keywords "Customer", "e-commerce", and "platform" are obtained. After semantic analysis, it can be inferred that "represents a customer of the e-commerce platform". In addition, keyword extraction is performed on the entity name "Shopper" and its entity description "Represents a customer who makes purchases on the platform" of the entity class "Shopper" in the second type of diagram, and the corresponding keywords "customer", ""purchases", and "platform" are obtained. After semantic analysis, it can be inferred that "represents a customer who makes purchases on the platform". Therefore, after inference matching, it can be considered that "Customer" and "Shopper" are an entity matching pair. Similarly, for other entity classes, attributes, methods, etc. in the first and second types of diagrams, semantic analysis and matching can be performed in the same way to obtain all element matching pairs.
[0070] S20, using the first model element and the second model element, calculating the matching degree of the element matching pair.
[0071] In the embodiment of the present application, for the first model element and the second model element in the element matching pair, the degree of matching between the two, that is, the matching degree, can be calculated according to the semantics of the two.
[0072] In a possible implementation, a similarity metric can be used to calculate the matching degree of element matching pairs. Figure 5 , Figure 5 Another partial flow chart of a domain model consistency evaluation method based on semantic analysis provided in an embodiment of the present application. Figure 5 As shown, an embodiment of the present application provides a domain model consistency evaluation method based on semantic analysis, wherein step S20 "using the first model element and the second model element to calculate the matching degree of the element matching pair" may include steps S201 to S203, and these steps are described in detail below.
[0073] S201, converting a first model element into a first vector representation, and converting a second model element into a second vector representation.
[0074] S202, calculating the similarity between the first vector representation and the second vector representation.
[0075] S203: Use the similarity as the matching degree of the element matching pair.
[0076] In the embodiment of the present application, a word embedding technology (including but not limited to models such as Word2Vec, GloVe, or BERT) can be used to convert the text information corresponding to the first model element and the second model element into a vector representation for subsequent similarity calculation. Specifically, the first model element can be converted into a first vector representation, and the second model element can be converted into a second vector representation.
[0077] Furthermore, a vector similarity measurement method (including but not limited to cosine similarity) is used to calculate the similarity between the first vector representation and the second vector representation, which is used as the matching degree of the element matching pair.
[0078] For ease of understanding, the target structure is represented as the entity structure. After semantic analysis and inference matching, the entity classes "Shopper" and "Customer", "Purchase" and "Order", and "Goods" and "Product" can be used as three entity matching pairs. Taking the entity matching pair "Shopper" and "Customer" as an example, the attributes "ShopperID: String" and "CustomerID: String", "FullName: String" and "Name: String", "Email: String" and "Email: String", "shippingAddress: String" and "Address: String", "ContactNumber: String" and "Phone: String" are used as five attribute matching pairs, and the methods "CreateOrder(): Order" and "PlaceOrder(): Order", "ViewOrderStatus(): OrderStatus" and "TrackOrder(): OrderStatus", and "ManageProfile()" and "ViewProfile()" are used as three method matching pairs.
[0079] The entity matching pair is further illustrated by taking "Shopper" and "Customer" as an example. On the one hand, the matching degree between the entity names "Shopper" and "Customer" (hereinafter referred to as matching degree 1) is obtained by converting the vector representation and similarity calculation; on the other hand, the matching degree between the entity descriptions "Represents acustomer who makes purchases on the platform" and "Represents a customer of thee-commerce platform" (hereinafter referred to as matching degree 2) can also be obtained by converting the vector representation and similarity calculation.
[0080] For the attribute matching pairs under the entity matching pair "Shopper" and "Customer", "ShopperID: String" and "CustomerID: String" are used as examples. The matching degree between the attribute names "ShopperID: String" and "CustomerID: String" is obtained by converting the vector representation and similarity calculation. The matching degrees of all attribute matching pairs are averaged to obtain the average attribute matching degree (hereinafter referred to as matching degree 3).
[0081] For the method matching pairs under the entity matching pairs "Shopper" and "Customer", take "CreateOrder(): Order" and "PlaceOrder(): Order" as an example. The matching degree between the method names "CreateOrder(): Order" and "PlaceOrder(): Order" is obtained by converting the vector representation and similarity calculation. The matching degrees of all method matching pairs are averaged to obtain the average method matching degree (hereinafter referred to as matching degree 4).
[0082] Of course, when the target structure is represented as a relational structure, similarly, the relationship classes "Shopper - makes- Purchase" and "Customer - places - Order", and "Purchase - contains - Goods" and "Order - contains - Product" can be used as two relationship matching pairs.
[0083] For ease of understanding, the relationship matching pair "Shopper - makes - Purchase" and "Customer - places - Order" are used as examples for illustration. By converting vector representation and similarity calculation, matching can be performed in three aspects: relationship name, relationship type, and data constraint. Specifically, it includes the matching degree between the relationship names "Shopper - makes - Purchase" and "Customer - places - Order" (hereinafter referred to as matching degree 5), the matching degree between the relationship types "association relationship" and "association relationship" (hereinafter referred to as matching degree 6), and the matching degree between the data constraints "the quantity constraint from customer to order is 1 to 0, and the quantity constraint from order to customer is many" (expressed as "1 - 0..*") and "the quantity constraint from customer to order is 0 to many, and the quantity constraint from order to customer is 1" (expressed as "0..* - 1") (hereinafter referred to as matching degree 7).
[0084] S30, based on the matching degree between the target structure representation and the element matching pairs, evaluating the consistency between the target domain model and the standard domain model.
[0085] In an embodiment of the present application, the degree of matching between the target domain model and the standard domain model can be calculated based on the weight relationship between the dimensions in the target structure representation and the matching degree of the element matching pairs, so as to evaluate the consistency between the target domain model and the standard domain model. The higher the matching pairs, the higher the consistency.
[0086] In a possible implementation, the target structure representation includes an entity structure representation and a relationship structure representation, and the element matching pair includes a first element matching pair under the entity structure representation and a second element matching pair under the relationship structure representation. Figure 6 , Figure 6 Another partial flow chart of a domain model consistency evaluation method based on semantic analysis provided in an embodiment of the present application. Figure 6 As shown, an embodiment of the present application provides a domain model consistency evaluation method based on semantic analysis, wherein step S30 "evaluating the consistency of the target domain model with the standard domain model based on the matching degree of the target structure representation and the element matching pairs" can adopt steps S301 to S304, and these steps are described in detail below.
[0087] S301, calculating entity matching degrees of different entity classes according to matching degrees of first element matching pairs and weights represented by preset entity structures; calculating total entity matching degrees using entity matching degrees and respective preset weights of different entity classes.
[0088] S302, calculating the relationship matching degrees of different relationship classes according to the matching degrees of the second element matching pairs and the weights represented by the preset relationship structures; and calculating the total relationship matching degree using the relationship matching degrees and the preset weights of the different relationship classes.
[0089] S303: Calculate the total matching degree based on the total entity matching degree and the total relationship matching degree.
[0090] S304: The total matching degree is used as the consistency degree between the target domain model and the standard domain model.
[0091] In an embodiment of the present application, the entity structure representation includes one or more of an entity name, an entity description, attributes, and methods, and the relationship structure representation includes one or more of a relationship name, a relationship type, and a quantity constraint.
[0092] In actual applications, users can define evaluation rules in the standard library. The evaluation rules can include entity-level weights (for example, the weight ratio of "Customer", "Order" and "Product" is 0.5:0.25:0.25), relationship-level weights (for example, the weight ratio of "Customer - places - Order" and "Order - contains - Product" is 0.5:0.5), and model-level weights (for example, the weight ratio of entity class and relationship class is 0.6:0.4) to evaluate the overall consistency.
[0093] In addition, the evaluation rules can also include naming consistency rules. For example, if the business meanings of two model elements are exactly the same, but the names are not defined in the standard library, 0.1 points will be deducted; for another example, if the target domain model lacks an attribute defined in the standard library, 0.1 points will be deducted.
[0094] The following example uses entity structure representation including entity name, entity description, attributes and methods, and relationship structure representation including relationship name, relationship type and quantity constraint to illustrate.
[0095] Taking the entity matching pair "Shopper" and "Customer" as an example, the entity matching degree of this entity class (hereinafter referred to as matching degree 8) = matching degree 1 × weight of entity name + matching degree 2 × weight of entity description + matching degree 3 × weight of attribute + matching degree 4 × weight of method. Similarly, the entity matching degree of the entity matching pairs "Purchase" and "Order" (hereinafter referred to as matching degree 9) and "Goods" and "Product" (hereinafter referred to as matching degree 10) can be calculated. It should be noted that the weight of the entity name, the weight of the entity description, the weight of the attribute and the weight of the method can be set in advance in the standard library, and the sum of the superposition is 1.
[0096] In addition, due to the problem of inconsistent names, the matching degree 8, matching degree 9 and matching degree 10 are deducted by 0.1 respectively, and the entity class "Goods" also has the problem of missing attributes, which deducts another 0.1. Accordingly, the total entity matching degree = (matching degree 8-0.1)×0.5+(matching degree 9-0.1)×0.25+(matching degree 10-0.1-0.1)×0.25.
[0097] The relationship matching pair "Shopper - makes - Purchase" and "Customer - places -Order" are used as examples. The relationship matching degree of this relationship class (hereinafter referred to as matching degree 11) = matching degree 5 × weight of relationship name + matching degree 6 × weight of relationship type + matching degree 7 × weight of quantity constraint. Similarly, the relationship matching degree of the relationship matching pair "Purchase - contains - Goods" and "Order - contains - Product" (hereinafter referred to as matching degree 12) can be calculated. It should be noted that the weight of the relationship name, the weight of the relationship type and the weight of the quantity constraint can be set in advance in the standard library, and the sum of the superposition is 1. Accordingly, the total relationship matching degree = matching degree 11 × 0.5 + matching degree 12 × 0.5.
[0098] Based on this, the total matching degree = total entity matching degree × 0.6 + total relationship matching degree × 0.4. The total matching degree is taken as the consistency degree between the target domain model and the standard domain model.
[0099] In a possible implementation, in order to facilitate users to query the consistency evaluation results in a timely manner, an evaluation report can also be output. A domain model consistency evaluation method provided in an embodiment of the present application also includes the following steps:
[0100] Generate an assessment report based on the consistency assessment results of the target domain model.
[0101] In an embodiment of the present application, the evaluation report may include a detailed list of matching results, descriptions of inconsistent items and improvement suggestions, and an overall consistency score of the target domain model.
[0102] For ease of understanding, continue with Figure 4 The target domain model shown in the figure is used as an example. Assume that the consistency level of the target domain model in the consistency evaluation result is 0.809. After analyzing it, the following content can be output in the evaluation report:
[0103] The overall consistency between the target domain model and the standard domain model is high.
[0104] The entity classes "Shopper" and "Purchase" have a high degree of match with the standard domain model;
[0105] The entity class "Goods" lacks the "Inventory" attribute, and its name is inconsistent with the standard domain model, resulting in a low match.
[0106] The quantity constraint of the relationship class "Shopper - makes - Purchase" is inconsistent with the standard domain model, resulting in a slight decrease in its matching degree.
[0107] All entity names are inconsistent with the standard domain model and need to be modified.
[0108] Improvement suggestions: Add an "Inventory" attribute to the entity class "Goods" and define its data type and semantic information; modify the quantity constraint of the relationship class "Shopper - makes - Purchase" to be consistent with the standard domain model, and change the entity names of the entity classes "Shopper", "Purchase", and "Goods" to "Customer", "Order", and "Product" respectively to be consistent with the standard domain model.
[0109] Based on the above description, the domain model consistency assessment method based on semantic analysis provided in the embodiment of the present application has the following advantages:
[0110] 1) Automated evaluation. This application implements automated model consistency evaluation, avoiding the inefficiency and subjectivity of traditional manual review, and significantly improving evaluation efficiency and objectivity.
[0111] 2) Semantic understanding. This application uses semantic analysis technology to understand the meaning of model elements, rather than relying solely on string comparison, so as to more accurately evaluate the semantic consistency of the model.
[0112] 3) Functional logic consistency assessment: This application can assess whether the functional logic of model elements is consistent, such as whether the functions of methods are equivalent and whether the constraints of relationships are reasonable, making up for the shortcomings of traditional methods.
[0113] 4) Refined evaluation. This application supports custom evaluation rules, indicators, and weights, and can perform personalized evaluations based on different needs, such as deducting points for inconsistent naming, adjusting the weights of entities and relationships, etc.
[0114] 5) Improve model quality. This application can identify inconsistencies in the model and provide improvement suggestions to help users improve the quality and maintainability of the model.
[0115] The above introduces a domain model consistency assessment method based on semantic analysis provided in an embodiment of the present application. The following will introduce a device for executing the above-mentioned domain model consistency assessment method based on semantic analysis.
[0116] See also Figure 7 , Figure 7 A schematic diagram of the structure of a domain model consistency assessment device based on semantic analysis provided in an embodiment of the present application. Figure 7 As shown, a domain model consistency assessment device based on semantic analysis provided in an embodiment of the present application includes:
[0117] A semantic analysis module 10 is used to determine an element matching pair of a target domain model and a standard domain model under a target structure representation through semantic analysis, wherein the element matching pair includes a first model element of the target domain model and a second model element of the standard domain model, and there is a semantic matching relationship between the first model element and the second model element;
[0118] The consistency evaluation module 20 is used to calculate the matching degree of the element matching pair using the first model element and the second model element; and evaluate the consistency of the target domain model with the standard domain model based on the target structure representation and the matching degree of the element matching pair.
[0119] In a possible implementation, the semantic analysis module 10 is specifically used to:
[0120] The standard library is retrieved, into which the first type of diagram of the standard domain model is pre-imported; the second type of diagram of the target domain model is obtained through parsing; the model elements of the first type of diagram and the second type of diagram under the target structure representation are semantically analyzed to obtain semantically matching element matching pairs.
[0121] In a possible implementation, the consistency evaluation module 20 for calculating the matching degree of an element matching pair using the first model element and the second model element is specifically configured to:
[0122] The first model element is converted into a first vector representation, and the second model element is converted into a second vector representation; the similarity between the first vector representation and the second vector representation is calculated; and the similarity is used as the matching degree of the element matching pair.
[0123] In a possible implementation, the target structure representation includes an entity structure representation and a relationship structure representation, and the element matching pair includes a first element matching pair under the entity structure representation and a second element matching pair under the relationship structure representation;
[0124] The consistency assessment module 20 is used to assess the consistency between the target domain model and the standard domain model based on the matching degree of the target structure representation and the element matching pair, and is specifically used to:
[0125] According to the matching degree of the first element matching pair and the weight represented by the preset entity structure, the entity matching degree of different entity classes is calculated; the total entity matching degree is calculated by using the entity matching degree and the preset weights of different entity classes; according to the matching degree of the second element matching pair and the weight represented by the preset relationship structure, the relationship matching degree of different relationship classes is calculated; the total relationship matching degree is calculated by using the relationship matching degree and the preset weights of different relationship classes; the total matching degree is calculated based on the total entity matching degree and the total relationship matching degree; the total matching degree is used as the consistency degree between the target domain model and the standard domain model.
[0126] In a possible implementation, the entity structure representation includes one or more of an entity, an attribute, and a method, and the relationship structure representation includes one or more of a relationship, a relationship type, and a quantity constraint.
[0127] In a possible implementation, the consistency evaluation module 20 is further configured to:
[0128] Generate an assessment report based on the consistency assessment results of the target domain model.
[0129] It should be noted that the detailed functions of each module in the embodiment of the present application can be found in the corresponding public part of the above-mentioned domain model consistency assessment method embodiment based on semantic analysis, and will not be repeated here.
[0130] The present application also provides an electronic device in an embodiment. Figure 8 , Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, notebook computers, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 8 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0131] like Figure 8 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 803. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0132] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a memory card, a hard disk, etc.; and communication devices 809. The communication device 809 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0133] An embodiment of the present application also provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any domain model consistency assessment method based on semantic analysis provided in the embodiment of the present application.
[0134] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When one or more computer programs are executed by an electronic device, the electronic device can implement any domain model consistency assessment method based on semantic analysis provided in an embodiment of the present application.
[0135] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0136] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0137] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0138] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A domain model consistency assessment method based on semantic analysis, characterized in that: The domain model consistency evaluation method based on semantic analysis includes: Determine, by semantic analysis, an element matching pair between the target domain model and the standard domain model under the target structure representation, wherein the element matching pair includes a first model element of the target domain model and a second model element of the standard domain model, and there is a semantic matching relationship between the first model element and the second model element; Calculating the matching degree of the element matching pair using the first model element and the second model element; Based on the matching degree between the target structure representation and the element matching pair, the consistency between the target domain model and the standard domain model is evaluated.
2. The domain model consistency assessment method based on semantic analysis according to claim 1 is characterized in that: The determining of element matching pairs between the target domain model and the standard domain model under the target structure representation through semantic analysis includes: Retrieving a standard library, wherein the first type of diagram of the standard domain model is pre-imported into the standard library; Obtaining a second type of graph of the target domain model by parsing; Semantic analysis is performed on the model elements of the first class diagram and the second class diagram under the target structure representation to obtain the element matching pairs with semantic matching.
3. The domain model consistency assessment method based on semantic analysis according to claim 1 is characterized in that: The calculating the matching degree of the element matching pair by using the first model element and the second model element includes: converting the first model element into a first vector representation, and converting the second model element into a second vector representation; Calculating a similarity between the first vector representation and the second vector representation; The similarity is used as the matching degree of the element matching pair.
4. The domain model consistency assessment method based on semantic analysis according to claim 1 is characterized in that: The target structure representation includes an entity structure representation and a relationship structure representation, and the element matching pair includes a first element matching pair under the entity structure representation and a second element matching pair under the relationship structure representation; The evaluating the consistency between the target domain model and the standard domain model based on the matching degree between the target structure representation and the element matching pair includes: Calculating entity matching degrees of different entity classes according to the matching degrees of the first element matching pairs and the preset weights of the entity structure representation; calculating the total entity matching degree using the entity matching degrees and the preset weights of the different entity classes; Calculating the relationship matching degrees of different relationship classes according to the matching degrees of the second element matching pairs and the preset weights of the relationship structure representation; calculating the total relationship matching degree using the relationship matching degrees and the preset weights of the different relationship classes; Calculating a total matching degree based on the total entity matching degree and the total relationship matching degree; The total matching degree is taken as the consistency degree between the target domain model and the standard domain model.
5. The domain model consistency assessment method based on semantic analysis according to claim 4 is characterized in that: The entity structure representation includes one or more of entity, attribute and method, and the relationship structure representation includes one or more of relationship, relationship type and quantity constraint.
6. The domain model consistency assessment method based on semantic analysis according to claim 1 is characterized in that: The domain model consistency assessment method based on semantic analysis also includes: An evaluation report is generated based on the consistency evaluation results of the target domain model.
7. A domain model consistency assessment device based on semantic analysis, characterized in that: The domain model consistency assessment device based on semantic analysis includes: A semantic analysis module, used to determine, through semantic analysis, an element matching pair between a target domain model and a standard domain model under a target structure representation, wherein the element matching pair includes a first model element of the target domain model and a second model element of the standard domain model, and a semantic matching relationship exists between the first model element and the second model element; The consistency evaluation module is used to calculate the matching degree of the element matching pair by using the first model element and the second model element; and evaluate the consistency of the target domain model with the standard domain model based on the matching degree of the target structure representation and the element matching pair.
8. A computer program product, characterized in that It includes computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the domain model consistency assessment method based on semantic analysis as described in any one of claims 1 to 6.
9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the domain model consistency assessment method based on semantic analysis as described in any one of claims 1 to 6.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the domain model consistency assessment method based on semantic analysis as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Business process model consistency measurement method under semantic constraints
CN104134112A
Class graph-based domain model quality detection method, device and equipment
CN118642969A
Comparing models
US8296257B1
