A method, device and equipment for detecting domain model quality based on class diagram

By parsing and semantically analyzing class diagram text, identifying abstract parent classes and adjusting inheritance relationships, and detecting class diagram matching, it solves the problem of domain model quality detection, improves detection efficiency and accuracy, and is suitable for large-scale complex class diagrams.

CN118642969BActive Publication Date: 2024-10-25HANGZHOU ZHONGBO SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411108193.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-10-25
Estimated Expiration
2044-08-13

AI Technical Summary

Technical Problem

Existing technology is difficult to effectively detect and evaluate the quality of domain models based on class diagrams, resulting in poor model quality during software development and affecting system performance and maintainability.

Method used

By obtaining the class diagram text, parsing it into structured data, performing semantic analysis, identifying the same class elements, applying preconfigured rules to extract potential abstract parent classes, adjusting the inheritance relationship, generating the expected class diagram, and detecting the class diagram to be detected and the expected class The matching degree of the graph determines the quality score.

Benefits of technology

It improves the objectivity and accuracy of quality inspection, reduces manual interference, saves costs, realizes quality inspection of large-scale complex class diagrams, and improves inspection efficiency and consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118642969B_ABST
    Figure CN118642969B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device and equipment for quality detection of a domain model based on a class diagram, and relates to the field of computer technology. The present application uses the class diagram text representing the domain model as the basis for quality detection, and improves the objectivity of quality detection to a certain extent; then semantic analysis is performed on the structured class diagram data obtained by parsing, and the classes with the same class elements in the class diagram to be detected and the same class elements therein are identified, and the problem of insufficient abstraction in the class diagram to be detected is determined, which provides a basis for improving the accuracy of quality detection; on this basis, pre-configured rules are applied to identify and extract potential abstract parent classes and adjust the class diagram inheritance relationship, and generate an expected class diagram with a higher degree of abstraction; finally, by detecting the matching degree between the class diagram to be detected and the expected class diagram, the quality score of the class diagram to be detected is determined, and the automated quality detection task of the domain model based on the class diagram is realized, and the objectivity, consistency and detection efficiency of the quality detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device and equipment for detecting quality of a domain model based on a class diagram. Background Art

[0002] Object Oriented Analysis and Design (OOAD) is a software development method based on the concept of objects. In a system built on OOAD (referred to as an object-oriented system), an object is an instance of a class, containing data (attributes) and behavior (methods); a class is the blueprint of an object, defining the characteristics and behavior of the object.

[0003] When developing software based on OOAD, the core principles that need to be followed are the abstract principle and the inheritance principle. Specifically, abstraction refers to identifying and extracting the common features of different objects and encapsulating them in abstract classes or interfaces; inheritance refers to the inheritance of properties and methods of parent classes by subclasses. Based on abstraction and combined with the inheritance principle, it is easy to reuse and expand code, thereby building a maintainable, extensible and reusable software system.

[0004] The domain model, as an abstract representation of the problem domain to be solved by the system, can capture the key concepts, entities and their relationships in the problem domain. Therefore, establishing a domain model is the basis of software development, and the quality of the model has a great impact on the software development process and the performance of the developed object-oriented system.

[0005] Currently, domain modeling can be achieved through class diagrams, which are UML (Unified Modeling Language) diagrams used to visually describe classes, interfaces, and relationships between them in object-oriented systems, such as inheritance, association, and dependency. Based on this, how to detect the model quality of domain models based on class diagrams has become a technical problem that technicians in this field need to solve urgently. Summary of the invention

[0006] In view of the above problems, the present application provides a method, apparatus and device for detecting quality of a domain model based on a class diagram to implement the task of detecting model quality of a domain model based on a class diagram.

[0007] The specific plan is as follows:

[0008] The first aspect of the present application provides a domain model quality detection method based on a class diagram, comprising:

[0009] Obtaining a class diagram text of a class diagram to be detected, wherein the class diagram to be detected is used to represent a domain model of an object-oriented system;

[0010] Parsing the class diagram text into structured class diagram data, wherein the structured class diagram data includes: a class list, a property list, a method list, and a relationship list;

[0011] Performing semantic analysis on the structured class graph data to obtain analysis results; the analysis results include: a first similarity matrix for representing the same class element information of different classes;

[0012] Processing the analysis results according to preconfigured rules, determining potential abstract parent classes, extracting parent classes and adjusting inheritance relationships, and generating an expected class diagram corresponding to the class diagram to be detected; wherein the preconfigured rules include preconfigured abstract rules and inheritance rules, the abstract rules include: when the number of identical class elements possessed by different classes is greater than or equal to a preset number, there is a potential abstract parent class; the inheritance rules include: there is an inheritance relationship between an abstract parent class and a corresponding child class;

[0013] The matching degree between the class diagram to be detected and the expected class diagram is detected, and a quality score of the class diagram to be detected is determined, wherein the quality score is positively correlated with the matching degree.

[0014] A second aspect of the present application provides a domain model quality detection device based on a class diagram, comprising:

[0015] A class diagram text acquisition unit, used to acquire the class diagram text of the class diagram to be detected, wherein the class diagram to be detected is used to represent the domain model of the object-oriented system;

[0016] A class diagram parsing unit, used for parsing the class diagram text into structured class diagram data, wherein the structured class diagram data includes: a class list, a property list, a method list and a relationship list;

[0017] A semantic analysis unit, used to perform semantic analysis on the structured class graph data to obtain an analysis result; the analysis result includes: a first similarity matrix for representing the same class element information of different classes;

[0018] A quality detection unit is used to process the analysis results according to preconfigured rules, determine potential abstract parent classes, extract parent classes and adjust inheritance relationships, and generate an expected class diagram corresponding to the class diagram to be detected; wherein the preconfigured rules include preconfigured abstract rules and inheritance rules, and the abstract rules include: when the number of identical class elements possessed by different classes is greater than or equal to a preset number, there is a potential abstract parent class; the inheritance rules include: there is an inheritance relationship between an abstract parent class and a corresponding subclass; and, detect the degree of matching between the class diagram to be detected and the expected class diagram, and determine the quality score of the class diagram to be detected, wherein the quality score is positively correlated with the degree of matching.

[0019] A third aspect of the present application provides a domain model quality detection device based on a class diagram, comprising at least one processor and a memory connected to the processor, wherein:

[0020] The memory is used to store computer programs;

[0021] The processor is used to execute the computer program to implement the domain model quality detection method based on class diagram described in the first aspect.

[0022] By means of the above technical scheme, the present application uses the class diagram text as the basis for quality inspection, which improves the objectivity of quality inspection to a certain extent; then, by means of the semantic understanding ability of natural language processing technology, semantic analysis is performed to identify the classes with the same class elements and the same class elements in the class diagram to be inspected, and the problem of insufficient abstraction in the class diagram to be inspected is determined, which provides a basis for improving the accuracy of quality inspection; on this basis, the pre-configured rules are applied to identify and extract potential abstract parent classes, and the class diagram inheritance relationship is adjusted to generate the expected class diagram with a higher degree of abstraction, and finally, by detecting the matching degree between the class diagram to be inspected and the expected class diagram, the quality score of the class diagram to be inspected is determined, and the quality inspection task of the domain model based on the class diagram is realized. Moreover, the quality inspection process can be realized automatically without human participation, thereby avoiding the interference of subjective factors to a certain extent, improving the objectivity and consistency of quality inspection, saving labor costs, and improving the efficiency of quality inspection; in addition, by means of the semantic understanding ability and automated process of natural language processing technology, the present application can be applied to the quality inspection task of large-scale complex class diagrams. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] 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 for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0024] Figure 1 A flow chart of a domain model quality detection method based on a class diagram provided in this application;

[0025] Figure 2 A schematic diagram of the structure of a domain model quality detection device based on a class diagram provided in this application;

[0026] Figure 3 A schematic diagram of a domain model quality detection process is shown;

[0027] Figure 4 A schematic diagram of the structure of a domain model quality detection device based on a class diagram provided in this application. DETAILED DESCRIPTION

[0028] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation mode 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. It is known to those skilled in the art 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.

[0029] The present application provides a method, apparatus and device for detecting quality of a domain model based on a class diagram, which can be applied to solving the task of detecting quality of a domain model based on a class diagram.

[0030] Figure 1 A flow chart of a domain model quality detection method based on a class diagram provided in this application. Figure 1 As shown, the method may include the following steps:

[0031] Step S101: Obtain the class diagram text of the class diagram to be detected.

[0032] The class diagram to be tested is used to represent the domain model of the object-oriented system, and the class diagram text is a text representation of the class diagram to be tested, which aims to represent the structure of the class diagram in an objective and standardized text form.

[0033] Exemplarily, the class diagram text may be in PlantUML format or other class diagram formats. Specifically, the text representation of the class diagram to be detected created by the UML modeling tool PlantUML is a class diagram text in PlantUML format; other class diagram formats, such as the standard UML format, correspond to other UML modeling tools.

[0034] Step S102: Parse the class diagram text into structured class diagram data.

[0035] The above-mentioned parsing process can be implemented using technologies such as PlantUML parsing library, UML parsing library or regular expression. Specifically, the PlantUML parsing library can be used to parse the class diagram text in PlantUML format, the UML parsing library can be used to parse the class diagram text in standard UML format, and the pre-written regular expression or parsing program can be used to parse the class diagram text in any format.

[0036] Wherein, the structured class diagram data may include: a class list, an attribute list, a method list and a relationship list. Specifically, the class list may include: information such as the name, attribute and method of each class in the class diagram to be detected; the attribute list may include: information such as the name and type of each attribute involved in the class diagram to be detected; the method list may include: information such as the name, parameter list, return type, etc. of each method included in the class diagram to be detected; the relationship list may include: the relationship between classes in the class diagram to be detected, such as inheritance relationship, association relationship, etc.; in addition, when the class diagram to be detected contains annotations, the structured class diagram data also includes annotation information, such as annotation content corresponding to elements such as classes, attributes, methods or relationships between classes in the class diagram to be detected.

[0037] Step S103: perform semantic analysis on the structured class diagram data to obtain analysis results.

[0038] It should be noted that in the field of Natural Language Processing (NLP), semantic analysis technology can be used to study how to understand the meaning of text. Based on this, this embodiment can use semantic analysis technology to analyze identifiers in the class diagram to be detected, such as class names, attribute names, semantic information in method names, such as part of speech, word meaning, semantic role, etc., as well as semantic information in annotations, so as to identify hidden semantic relationships in the text, such as similarity, etc., so as to better understand the class diagram.

[0039] In one possible implementation, natural language processing techniques, such as lexical analysis, syntactic analysis, named entity recognition, word vector models, etc., can be used to extract and analyze semantic information to achieve the above-mentioned semantic analysis tasks; in addition, a large language model (LLM) can also be used for semantic analysis.

[0040] The analysis result may include: a first similarity matrix for representing the same class element information of different classes. Exemplarily, the first similarity matrix may be represented as: similarity information of every two classes in the class diagram to be detected, the similarity information is the information of the same class elements of the corresponding two classes, and the class elements include the attributes and methods of the class. In addition, in the first similarity matrix, if there is an inheritance relationship between two classes, the same class element information of the two classes may not include the class element information of the parent class in this inheritance relationship.

[0041] Step S104: Process the analysis results according to preconfigured rules, determine potential abstract parent classes, extract parent classes and adjust inheritance relationships, and generate an expected class diagram corresponding to the class diagram to be detected.

[0042] The preconfigured rules may include: preconfigured abstract rules and inheritance rules.

[0043] Specifically, the abstract rule includes: when the number of identical class elements in different classes is greater than or equal to a preset number, there is a potential abstract parent class; the preset number is a pre-set positive integer, and optionally, the preset number can be 2; based on the analysis results of the abstract rule processing, a combination of at least two classes with more than the preset number of identical class elements can be determined to determine the potential abstract parent class. It should be noted that the class element of the potential abstract parent class corresponding to a certain combination is the identical class element possessed by each class in the combination (referred to as the class element to be extracted corresponding to the combination). The inheritance rule may include: there is an inheritance relationship between the abstract parent class and the corresponding child class.

[0044] It should be noted that if it is determined that there is a potential abstract parent class, it indicates that at least two classes in the class diagram to be detected have a certain number of common elements, and there is an insufficient degree of abstraction in the class diagram to be detected; based on this, the abstraction rule and inheritance rule can be applied to modify the class diagram to be detected, specifically including extracting the parent class and modifying the inheritance relationship to improve the abstraction level of the class diagram, thereby generating the expected class diagram. In addition, if the class elements to be extracted corresponding to a certain combination are all class elements of a class in the class diagram to be detected, that is, the potential abstract parent class corresponding to the combination is a class in the class diagram to be detected, then extracting the parent class can mean: using the class in the class diagram to be detected as the parent class corresponding to the combination, that is, there is no need to create a new parent class; otherwise, extracting the class elements to be extracted corresponding to the combination into a new parent class; and then applying the inheritance rule to adjust the inheritance relationship based on the extracted parent class.

[0045] Step S105: Detect the matching degree between the class diagram to be detected and the expected class diagram, and determine the quality score of the class diagram to be detected.

[0046] Since the abstraction level of the expected class diagram is not less than that of the class diagram to be detected, by detecting the matching level between the class diagram to be detected and the expected class diagram, the gap between the current abstraction level and the expected abstraction level of the domain model corresponding to the class diagram to be detected can be determined, and the quality score of the class diagram to be detected can be determined accordingly, and the quality score is positively correlated with the matching level. Specifically, the higher the matching level and the smaller the gap between the current abstraction level and the expected abstraction level, the higher the quality score of the class diagram to be detected.

[0047] Based on the above content, this embodiment uses the class diagram text as the basis for class diagram quality detection. Since the class diagram text does not contain subjective factors and is a direct text representation of the class diagram structure, it improves the objectivity of quality detection to a certain extent; then, semantic analysis is performed by using the semantic understanding ability of natural language processing technology to identify classes with the same class elements in the class diagram to be detected and the same class elements therein, thereby characterizing the similarity between classes. On this basis, pre-configured rules are applied to identify and extract parent classes, and the class diagram inheritance relationship is adjusted to generate an expected class diagram with a higher degree of abstraction. Finally, the quality score of the class diagram to be detected is determined by detecting the degree of matching between the class diagram to be detected and the expected class diagram, thereby realizing the quality detection task of the domain model represented by the class diagram.

[0048] Moreover, the quality inspection scheme provided by this embodiment can be automatically implemented without human intervention, thereby avoiding to a certain extent the interference of subjective factors such as the experience, knowledge level, and preferences of the inspectors in the inspection results, improving the objectivity, consistency and accuracy of the quality inspection results, saving labor costs and time costs, and improving the efficiency of quality inspection; in addition, through the semantic understanding capabilities and automated processes of natural language processing technology, this embodiment can be applied to the quality inspection tasks of large-scale and complex class diagrams.

[0049] In one or more embodiments provided in the present application, the pre-configured rules may further include: class element exclusion rules; the class element exclusion rules include: excluding pre-specified common class elements during the quality detection process.

[0050] It should be noted that there may be attributes common to all classes in the class diagram, such as creation time, effective time, expiration time, etc., which can be called public attributes; there may also be methods common to all classes in the class diagram, such as get method, set scheme, toString method, etc., which can be called public methods; public attributes and public methods can be collectively referred to as public class elements. If public class elements also participate in the judgment of potential abstract parent classes, it may lead to the subsequent extraction of parent classes that only include public class elements, that is, meaningless and unnecessary abstract parent classes, resulting in meaningless and unnecessary revisions to the class diagram to be tested. Therefore, pre-specified public class elements can be excluded when conducting quality inspections.

[0051] In addition, the common class elements specified in the class element exclusion rule can be set according to the industry and field in which the class diagram to be detected is located, and can include at least one class element. The included class elements can be attributes or methods, or attributes and schemes, which are not limited in this application.

[0052] On the basis of the above, the processing of the analysis results according to the pre-configured rules to determine the potential abstract parent class may include the following steps AB:

[0053] Step A: applying the class element exclusion rule to exclude the common class elements in the first similarity matrix to obtain a second similarity matrix.

[0054] The second similarity matrix may include information on the same class elements possessed by every two classes in the class graph to be detected, except for the common class elements specified in the class element exclusion rule.

[0055] Step B: applying the abstract rule to search for different classes having the same class elements greater than or equal to the preset number from the second similarity matrix, and determining potential abstract parent classes.

[0056] Specifically, the number of identical class elements possessed by the first and second classes can be determined. If the number is greater than or equal to a preset number, the combination of the first and second classes and the identical class element information corresponding to the combination are recorded, wherein the first class is any class in the class diagram to be detected, and the second class is a class other than the first class in the class diagram to be detected; after traversing every two classes in the class diagram to be detected, the recorded combinations corresponding to the identical class element information are merged, and then the potential abstract parent class is determined based on the recorded combination (including at least two classes) and the corresponding identical class element information.

[0057] The above scheme identifies and excludes common class elements in the first similarity matrix according to the preconfigured class element exclusion rules, avoiding the interference of repeated elements in the judgment of the abstraction level of the class diagram; on this basis, the abstract principle is applied to determine the potential abstract parent class, thereby determining the problem of insufficient abstraction in the class diagram to be detected, providing a basis for subsequent correction of the model, improving the class diagram quality of the expected class diagram, and thus improving the accuracy of quality detection of the class diagram to be detected.

[0058] In one or more embodiments provided in the present application, the analysis result may further include: an inheritance relationship list.

[0059] Among them, the inheritance relationship list may include information for indicating the existing inheritance relationship in the class diagram to be detected, and the existing inheritance relationship refers to the inheritance relationship already included in the class diagram to be detected. Taking an existing inheritance relationship as an example, the information for indicating the existing inheritance relationship may include: class element information of the class that is in the inherited position in the existing inheritance relationship, and class element information of the class that is in the inheriting position in the existing inheritance relationship.

[0060] The inheritance rules may also include: constraints on the inheritance relationship, and the constraints on the inheritance relationship may include: a subclass inherits all properties and methods of a parent class, a subclass can overload methods of a parent class, and the like.

[0061] On this basis, processing the analysis results according to the preconfigured rules may also include:

[0062] Apply the inheritance rule to detect whether each existing inheritance relationship indicated by the inheritance relationship list satisfies the constraint conditions of the inheritance relationship. When an existing inheritance relationship that does not satisfy the constraint conditions of the inheritance relationship is detected, output prompt information indicating the existing inheritance relationship that does not satisfy the constraint conditions of the inheritance relationship.

[0063] The above scheme determines the similarity information and inheritance relationship information in the class diagram to be detected through semantic analysis, which provides a basis for improving the accuracy of class diagram quality detection. Then, according to the pre-configured inheritance rules, it detects whether the existing inheritance relationship meets the constraints of the inheritance relationship, that is, whether the subclass in the existing inheritance relationship correctly inherits the properties and methods of the parent class, whether the subclass can overload the method of the parent class, etc., to achieve the task of analyzing and judging the rationality of the inheritance relationship in the class diagram to be detected. In one possible implementation, it can be determined whether the existing inheritance relationship meets the constraints of the inheritance relationship by detecting whether the subclass in an existing inheritance relationship contains class elements that are repeated with the class elements of the parent class. If it does, it indicates that the constraints of the inheritance relationship are not met.

[0064] In addition, the above-mentioned pre-configured rules can be configured by the user to the execution device of the domain model quality detection method based on the class diagram, so that the domain model quality detection solution provided by this embodiment can be applicable to implementing quality detection tasks of different domain models.

[0065] In one or more embodiments provided in the present application, the inheritance relationship list may further include information for indicating potential inheritance relationships in the class diagram to be detected.

[0066] Among them, the potential inheritance relationship refers to the inheritance relationship implicit in the class diagram to be detected. Specifically, if the same class elements possessed by two classes are all class elements of one of the two classes, that is, all the attributes and methods of one class are a subset of the attributes and methods of the other class, then there is a potential inheritance relationship between the two classes.

[0067] Based on the above, extract the parent class and adjust the inheritance relationship, which can include:

[0068] According to the potential inheritance relationship indicated by the inheritance relationship list and the determined potential abstract parent class, the parent class is extracted and the inheritance relationship is adjusted.

[0069] The potential inheritance relationship in the class diagram to be detected can be directly determined by the inheritance relationship list, and the inheritance relationship can be directly adjusted based on this, thus realizing the analysis and detection task of the inheritance hierarchy of the class diagram to be detected. In addition, when extracting the parent class and adjusting the inheritance relationship, the adjustment can be made based on the potential inheritance relationship first, so as to generate the expected class diagram with fewer correction steps.

[0070] Next, the matching degree detection process between the class diagram to be detected and the expected class diagram is exemplified.

[0071] In one or more embodiments provided in the present application, detecting the degree of matching between the class diagram to be detected and the expected class diagram may include: performing at least one of the following steps CE, specifically:

[0072] Step C: detecting the matching degree between the abstract class in the class diagram to be detected and the abstract class in the expected class diagram as the abstract class matching degree.

[0073] The abstract class matching degree may refer to the matching degree of the number of abstract classes. In addition, other feature matching degrees may also be used to represent the matching degree of the abstract classes.

[0074] Step D: Detect the matching degree between the inheritance hierarchy structure in the class diagram to be detected and the inheritance hierarchy structure in the expected class diagram as the inheritance hierarchy matching degree.

[0075] In a possible implementation, after generating the expected class diagram, it can also include: generating an inheritance hierarchy of the class diagram to be detected and the expected class diagram, which can specifically include existing inheritance relationships in the class diagram, and each existing inheritance relationship can be represented as a parent class and a corresponding child class, and inheritance hierarchy matching detection is performed accordingly.

[0076] Step E: detecting the matching degree between the class elements in the class diagram to be detected and the class elements in the expected class diagram as the class element matching degree.

[0077] The class element matching degree may refer to the attribute matching degree and / or the method matching degree.

[0078] In a possible implementation, step C, detecting the degree of matching between the abstract class in the class diagram to be detected and the abstract class in the expected class diagram, as the abstract class matching degree, may include:

[0079] Step C1, counting the number of abstract classes in the class diagram to be detected as the first number.

[0080] Step C2: Count the number of abstract classes in the expected class diagram as the second number.

[0081] Step C3: Calculate the ratio of the first number to the second number as the abstract class matching degree.

[0082] Exemplarily, the abstract class matching degree can be expressed as: ACC=Na÷Ne, wherein Na represents the number of abstract classes in the class diagram to be detected, ie, the first number, and Ne represents the number of abstract classes in the expected class diagram, ie, the second number.

[0083] In a possible implementation, step D, detecting the degree of matching between the inheritance hierarchy structure in the class diagram to be detected and the inheritance hierarchy structure in the expected class diagram, as the inheritance hierarchy matching degree, may include:

[0084] Step D1: Establish a first inheritance hierarchy according to the inheritance relationship of the classes in the class diagram to be detected.

[0085] Step D2: Establish a second inheritance hierarchy according to the inheritance relationship of the classes in the expected class diagram.

[0086] Step D3: Determine the actual edit distance and the maximum edit distance between the first inheritance hierarchy and the second inheritance hierarchy.

[0087] It should be noted that the established inheritance hierarchy can be expressed as: a string consisting of the identifiers of each class that has an inheritance relationship in the class diagram. On this basis, the actual edit distance (i.e., Levenshtein distance) can refer to the minimum number of edit operations required to convert one string into another string; the maximum edit distance can refer to the maximum possible Levenshtein distance, specifically the sum of the number of nodes in the first inheritance hierarchy and the second inheritance hierarchy. Exemplarily, assuming that the inheritance relationship of the classes in the class diagram to be detected is: Class B and Class F inherit Class A, Class D inherits Class F, and the inheritance relationship of the classes in the expected class diagram is: Class B and Class C inherit Class A, Class D and Class E inherit Class C, the string corresponding to the first inheritance hierarchy can be expressed as ABFD, and the string corresponding to the second inheritance hierarchy can be expressed as ABCDE, then the actual edit distance Ld=2, based on the first inheritance hierarchy, the corresponding edit operations include: replacing F with C, and adding D; the maximum edit distance Max(Ld)=len("ABCDE")+len("ABFD")=5+4=9.

[0088] Step D4: Calculate the ratio of the actual edit distance to the maximum edit distance as a first value.

[0089] Step D5: Calculate the difference between the second value and the first value as the inheritance hierarchy matching degree.

[0090] The second value is equal to 1. Exemplarily, the inheritance hierarchy matching degree can be expressed as: IHC=1-Ld÷Max(Ld), wherein Ld represents the actual edit distance, and Max(Ld) represents the maximum edit distance.

[0091] In a possible implementation, step E, detecting the degree of matching between the class element in the to-be-detected class diagram and the class element in the expected class diagram as the class element matching degree, may include:

[0092] Step E1: Calculate the class element similarity corresponding to each specified class.

[0093] The designated class is a class in the class diagram to be detected, and the class element similarity corresponding to the designated class is the similarity between the class element of the designated class and the class element of the class corresponding to the designated class in the expected class diagram.

[0094] It should be noted that the classes in the class diagram to be detected and the expected class diagram do not necessarily correspond one to one, so step E1 calculates the corresponding class element similarity when there are corresponding classes in the class diagram to be detected and the expected class diagram. In addition, the correspondence between the classes in the class diagram to be detected and the expected class diagram can also be determined based on the class element similarity, such as calculating the class element similarity of the specified class in the class diagram to be detected and each class in the expected class diagram in turn, and determining the class in the expected class diagram with the highest value as the class corresponding to the specified class.

[0095] Step E2: Determine the class element matching degree according to the class element similarity corresponding to each specified class.

[0096] Specifically, the class element similarity may include: attribute similarity and method similarity, and the determined class element matching degree may be the average value of the class element similarities corresponding to each specified class. In addition, different weights may be set for different attributes and methods, that is, the determined class element matching degree may also be the weighted average value of the class element similarities corresponding to each specified class.

[0097] Exemplarily, the class element similarity can be expressed as: AMC=∑[Sim(Aa,Ae)+Sim(Ma,Me)]÷Nm, wherein Aa represents the attribute list of the specified class in the class diagram to be detected, Ae represents the attribute list of the class corresponding to the specified class in the expected class diagram, Ma represents the method list of the specified class in the class diagram to be detected, Me represents the method list of the class corresponding to the specified class in the expected class diagram, Sim() represents the similarity of the two lists, such as Jaccard similarity or other similarity indicators, and Nm represents the number of classes in the expected class diagram.

[0098] In one or more embodiments provided in the present application, when the matching degree includes at least two of the abstract class matching degree, the inheritance hierarchy matching degree, and the class element matching degree, determining the quality score of the class diagram to be detected may include:

[0099] The matching degrees are weighted and summed according to pre-configured weights to obtain a quality score of the class graph to be detected.

[0100] Among them, the pre-configured weights of various matching degrees can be configured by the user to the execution device of the domain model quality detection method based on the class diagram according to the industry, expert experience, or the experience of the historical detection process, so as to achieve different abstraction level detection goals. In addition, the indicator type of the detected matching degree can also be set by the user.

[0101] Exemplarily, if the matching degree includes abstract class matching, inheritance hierarchy matching and class element matching, the quality score can be expressed as Score = W_acc×ACC + W_ihc×IHC + W_amc×AMC, wherein W_acc, W_ihc, and W_amc respectively represent the pre-configured weights corresponding to the abstract class matching, inheritance hierarchy matching and class element matching, and satisfy W_acc+W_ihc+W_amc=1.

[0102] The above scheme is based on multiple matching degree indicators, realizes the task of multi-angle detection of class diagram abstraction degree, enriches the dimension of quality score, provides more comprehensive matching degree indicator value, and improves the accuracy of quality detection to a certain extent. And through pre-configured rules and pre-configured weights, the configurability of this scheme is improved, which provides a basis for realizing quality detection tasks of models in different fields.

[0103] In one or more embodiments provided in the present application, after determining the quality score of the class graph to be detected, the following may also be included:

[0104] The quality score and a modification instruction for the class graph to be detected are output.

[0105] In one possible implementation, the output modification instructions may be modification suggestions for the class diagram to be tested expressed in text, such as information indicating the introduction of an abstract parent class, adjustment of inheritance relationships, etc.; the output modification instructions may also be an expected class diagram, that is, a preferred reference design for the class diagram to be tested.

[0106] Next, taking a domain model as an example, the class diagram-based domain model quality detection process provided by this application is explained. Assume that the pre-configured rules include: class element exclusion rules, abstract rules and inheritance rules; among which, the common class elements to be excluded specified by the class element exclusion rules include: common attributes createTime, effectiveTime and expiryTime; the abstract rules include: when the number of the same class elements possessed by different classes is greater than or equal to 2, there is a potential abstract parent class; assume that the pre-configured weights include: the weight of the abstract class matching, the weight of the inheritance hierarchy matching and the weight of the class element matching, and the weight of the abstract class matching is 0.4, the weight of the inheritance hierarchy matching is 0.4, and the weight of the class element matching is 0.2. On this basis, the domain model quality detection process provided by this application can include:

[0107] The first step is to obtain the class diagram text of the class diagram to be detected (used to represent the domain model), specifically the class diagram text in plantUML format, which can be expressed as:

[0108] @startuml

[0109] class Dog {

[0110] - name: string

[0111] - breed: string

[0112] - createTime: date

[0113] - effectiveTime: date

[0114] - expiryTime: date

[0115] + eat(): void

[0116] + sleep(): void

[0117] + bark(): void

[0118] }

[0119] class Cat {

[0120] - name: string

[0121] -color: string

[0122] - createTime: date

[0123] - effectiveTime: date

[0124] - expiryTime: date

[0125] + eat(): void

[0126] + sleep(): void

[0127] + meow(): void

[0128] }

[0129] @enduml

[0130] The second step is to parse the above class diagram text, and the obtained structured class diagram data can be expressed as: [

[0132] {

[0133] "className": "Dog",

[0134] "attributes": [

[0135] {"name": "name", "type": "string", "visibility": "private"},

[0136] {"name": "breed", "type": "string", "visibility": "private"},

[0137] {"name": "createTime", "type": "date", "visibility": "private"},

[0138] {"name": "effectiveTime", "type": "date", "visibility": "private"},

[0139] {"name": "expiryTime", "type": "date", "visibility": "private"}

[0140] ],

[0141] "methods": [

[0142] {"name": "eat", "returnType": "void", "visibility": "public"},

[0143] {"name": "sleep", "returnType": "void", "visibility": "public"},

[0144] {"name": "bark", "returnType": "void", "visibility": "public"}

[0145] ],

[0146] "relationships": []

[0147] },

[0148] {

[0149] "className": "Cat",

[0150] "attributes": [

[0151] {"name": "name", "type": "string", "visibility": "private"},

[0152] {"name": "color", "type": "string", "visibility": "private"},

[0153] {"name": "createTime", "type": "date", "visibility": "private"},

[0154] {"name": "effectiveTime", "type": "date", "visibility": "private"},

[0155] {"name": "expiryTime", "type": "date", "visibility": "private"}

[0156] ],

[0157] "methods": [

[0158] {"name": "eat", "returnType": "void", "visibility": "public"},

[0159] {"name": "sleep", "returnType": "void", "visibility": "public"},

[0160] {"name": "meow", "returnType": "void", "visibility": "public"}

[0161] ],

[0162] "relationships": []

[0163] } ]

[0165] The third step is to perform semantic analysis on the structured class diagram data and apply pre-configured rules to process it. It is determined that the Dog and Cat classes have the same attributes (name) and methods (eat(), sleep()), which meet the abstract rules and have potential abstract parent classes. Based on this, the abstract parent class Animal is introduced, and the common attributes and methods of the corresponding subclasses are extracted into the parent class to generate the expected class diagram corresponding to the class diagram to be detected.

[0166] The fourth step is to detect the matching degree between the class diagram to be detected and the expected class diagram, which specifically includes calculating the abstract class matching degree ACC, the inheritance hierarchy matching degree IHC and the class element matching degree AMC.

[0167] For the abstract class matching degree ACC, the class diagram to be detected has no abstract class, that is, Na = 0, and the expected class diagram has 1 abstract class, that is, Ne = 1, then ACC = Na ÷ Ne = 0 ÷ 1 = 0; for the inheritance hierarchy matching degree IHC, the class diagram to be detected has no inheritance relationship, that is, the first inheritance hierarchy can include independent Dog and Cat classes, and the inheritance relationship in the expected class diagram is that the Dog class and the Cat class inherit the Animal class, then the actual edit distance is the number of nodes in the expected class diagram, that is, Ld = 3, and the maximum edit distance is the class to be detected. The number of nodes in the graph plus the number of nodes in the expected class graph minus the number of common nodes, that is, Max(Ld)=2+3-2=3, then IHC=1-3÷3=0; for the class element matching degree AMC, the Dog class and the Cat class in the class graph to be detected are completely matched with the corresponding classes in the expected class graph, then the class element similarities Sim(Aa, Ae) and Sim(Ma, Me) corresponding to the Dog class and the Cat class are both equal to 1, and the number of classes in the expected class graph is 3, then AMC=(1+1+1+1)÷3=4 / 3.

[0168] Step 5: The matching degree is weighted and summed according to the pre-configured weight to obtain the quality score of the class graph to be detected, which can be expressed as: Score = 0.4 × 0 + 0.4 × 0 + 0.2 × 1.33 = 0.26.

[0169] Step 6: Output a quality score of 0.26 and modification instructions, including: introducing the abstract parent class Animal, extracting name, eat() and sleep() into the parent class, and adjusting the Dog class and Cat class to inherit from the Animal class, so as to improve the abstraction level and model quality of the class diagram to be tested. The output expected class diagram can be expressed as:

[0170] @startuml

[0171] abstract class Animal {

[0172] - name: string

[0173] - createTime: date

[0174] - effectiveTime: date

[0175] - expiryTime: date

[0176] + eat(): void

[0177] + sleep(): void

[0178] }

[0179] class Dog extends Animal {

[0180] - breed: string

[0181] + bark(): void

[0182] }

[0183] class Cat extends Animal {

[0184] -color: string

[0185] + meow(): void

[0186] }

[0187] @enduml

[0188] The above scheme generates structured class diagram data by automatically parsing the class diagram text, which can facilitate the subsequent use of natural language processing technology to analyze the semantic information of class names, attribute names, method names and annotations, identify the similarity and inheritance relationship between classes, generate the first similarity matrix and inheritance relationship list, and more accurately detect the abstraction level of the class diagram; then apply the pre-configured rules to automatically process the analysis results obtained by semantic analysis, generate the corresponding expected class diagram, and then detect and calculate the index values ​​of abstract class matching, inheritance hierarchy matching and class element matching, and determine the quality score of the class diagram to be detected in combination with the preset weights, thereby realizing automated quality detection tasks and improving detection efficiency. In addition, by outputting modification instructions for the class diagram to be detected, it provides a basis for users to modify the model and improve the abstraction level and model quality of the domain model.

[0189] The following is a description of a domain model quality detection device based on a class diagram provided in an embodiment of the present application. The domain model quality detection device based on a class diagram described below and the domain model quality detection method based on a class diagram described above can be referenced to each other.

[0190] Figure 2 Schematic diagram of the structure of a domain model quality detection device based on a class diagram disclosed in an embodiment of the present application. Figure 2 As shown, the device may include:

[0191] A class diagram text acquisition unit 11 is used to acquire a class diagram text of a class diagram to be detected, wherein the class diagram to be detected is used to represent a domain model of an object-oriented system;

[0192] A class diagram parsing unit 12, used for parsing the class diagram text into structured class diagram data, wherein the structured class diagram data includes: a class list, a property list, a method list and a relationship list;

[0193] The semantic analysis unit 13 is used to perform semantic analysis on the structured class graph data to obtain analysis results; the analysis results include: a first similarity matrix for representing the same class element information of different classes;

[0194] The quality detection unit 14 is used to process the analysis results according to preconfigured rules, determine potential abstract parent classes, extract parent classes and adjust inheritance relationships, and generate an expected class diagram corresponding to the class diagram to be detected; wherein the preconfigured rules include preconfigured abstract rules and inheritance rules, and the abstract rules include: when the number of identical class elements possessed by different classes is greater than or equal to a preset number, there is a potential abstract parent class; the inheritance rules include: there is an inheritance relationship between an abstract parent class and a corresponding subclass; and, detect the degree of matching between the class diagram to be detected and the expected class diagram, and determine the quality score of the class diagram to be detected, wherein the quality score is positively correlated with the degree of matching.

[0195] In one or more embodiments provided in the present application, the pre-configured rules further include: class element exclusion rules, and the class element exclusion rules include: excluding pre-specified common class elements during the quality detection process.

[0196] On the basis of the above, the quality detection unit 14 processes the analysis result according to the preconfigured rules to determine the potential abstract parent class, which may include:

[0197] Applying the class element exclusion rule to exclude the common class elements in the first similarity matrix to obtain a second similarity matrix;

[0198] The abstract rule is applied to search the second similarity matrix for different classes having the same class elements greater than or equal to the preset number, and determine potential abstract parent classes.

[0199] In one or more embodiments provided in the present application, the analysis result further includes: an inheritance relationship list, the inheritance relationship list includes information for indicating existing inheritance relationships in the class diagram to be detected; the inheritance rule further includes: constraints on the inheritance relationship.

[0200] On the basis of the above, the process of the quality detection unit 14 processing the analysis result according to the preconfigured rules may also include:

[0201] Apply the inheritance rule to detect whether each existing inheritance relationship indicated by the inheritance relationship list satisfies the constraint conditions of the inheritance relationship. When an existing inheritance relationship that does not satisfy the constraint conditions of the inheritance relationship is detected, output prompt information indicating the existing inheritance relationship that does not satisfy the constraint conditions of the inheritance relationship.

[0202] In one or more embodiments provided in the present application, the inheritance relationship list also includes information for indicating potential inheritance relationships in the class diagram to be detected.

[0203] Based on the above, the process of extracting the parent class and adjusting the inheritance relationship by the quality detection unit 14 may include:

[0204] According to the potential inheritance relationship indicated by the inheritance relationship list and the determined potential abstract parent class, the parent class is extracted and the inheritance relationship is adjusted.

[0205] In one or more embodiments provided in the present application, the process in which the quality detection unit 14 detects the matching degree between the class diagram to be detected and the expected class diagram may include:

[0206] Do at least one of the following:

[0207] Detecting the matching degree between the abstract class in the class diagram to be detected and the abstract class in the expected class diagram as the abstract class matching degree;

[0208] Detecting the matching degree between the inheritance hierarchy structure in the class diagram to be detected and the inheritance hierarchy structure in the expected class diagram as the inheritance hierarchy matching degree;

[0209] The matching degree between the class element in the to-be-detected class diagram and the class element in the expected class diagram is detected as the class element matching degree.

[0210] In one or more embodiments provided in the present application, the quality detection unit 14 detects the matching degree between the abstract class in the class diagram to be detected and the abstract class in the expected class diagram as the process of abstract class matching, which may include:

[0211] Counting the number of abstract classes in the class diagram to be detected as a first number;

[0212] Counting the number of abstract classes in the expected class diagram as a second number;

[0213] The ratio of the first number to the second number is calculated as the abstract class matching degree.

[0214] In one or more embodiments provided in the present application, the quality detection unit 14 detects the matching degree between the inheritance hierarchy structure in the class diagram to be detected and the inheritance hierarchy structure in the expected class diagram, as a process of inheritance hierarchy matching, which may include:

[0215] Establishing a first inheritance hierarchy according to the inheritance relationship of the classes in the class diagram to be detected;

[0216] Establishing a second inheritance hierarchy according to the inheritance relationship of the classes in the expected class diagram;

[0217] Determining an actual edit distance and a maximum edit distance between the first inheritance level and the second inheritance level; the maximum edit distance being the sum of the number of nodes in the first inheritance level and the number of nodes in the second inheritance level;

[0218] Calculating a ratio of the actual edit distance to the maximum edit distance as a first value;

[0219] A difference between a second value and the first value is calculated as the inheritance hierarchy matching degree; wherein the second value is equal to 1.

[0220] In one or more embodiments provided in the present application, the quality detection unit 14 detects the matching degree between the class element in the to-be-detected class diagram and the class element in the expected class diagram as a process of class element matching, which may include:

[0221] Calculating the class element similarity corresponding to each specified class, wherein the specified class is a class in the class diagram to be detected, and the class element similarity corresponding to the specified class is the similarity between the class element of the specified class and the class element of the class corresponding to the specified class in the expected class diagram;

[0222] The class element matching degree is determined according to the class element similarities corresponding to the respective specified classes.

[0223] In one or more embodiments provided in the present application, the process of the quality detection unit 14 determining the quality score of the class graph to be detected may include:

[0224] When the matching degree includes at least two of the abstract class matching degree, the inheritance hierarchy matching degree and the class element matching degree, the matching degrees are weighted and summed according to preconfigured weights to obtain a quality score of the class diagram to be detected.

[0225] In one or more embodiments provided in the present application, the quality detection unit 14 is further configured to: after determining the quality score of the class graph to be detected, output the quality score and a modification indication of the class graph to be detected.

[0226] In one or more embodiments provided in the present application, the device also includes a user configuration unit, which is used to: receive pre-configured rules configured by the user, such as abstract rules, inheritance rules, and class element exclusion rules; and receive a matching degree indicator set by the user and a corresponding pre-configured weight. In addition, it can also be used to receive user configuration items such as a calculation formula for the matching degree indicator set by the user.

[0227] Based on the above, Figure 3 This example illustrates a schematic diagram of the domain model quality detection process. Figure 3 As shown, first, the user configuration unit receives user configuration items such as class element exclusion rules, abstract rules, inheritance rules, matching degree indicators and their formulas and weights configured by the user; then the class diagram text acquisition unit acquires the class diagram text of the class diagram to be detected from the user, and the class diagram parsing unit parses the class diagram text to obtain structured class diagram data, which may specifically include a class list, an attribute list, a method list and a relationship list; then the semantic analysis unit analyzes the semantic information of the class name, attribute name, method name, annotation, etc., and generates an analysis result; on this basis, the quality detection unit acquires the user configuration items from the user configuration unit, applies the pre-configured rules to process the analysis results to generate the expected class diagram, calculates ACC, IHC and AMC based on the pre-configured matching degree indicators and their formulas, and obtains the quality score of the class diagram to be detected based on the pre-configured weight calculation, and finally the quality detection unit outputs the quality score and modification instructions for the class diagram to be detected to the user.

[0228] The domain model quality detection device based on class diagram provided in the embodiment of the present application can be applied to domain model quality detection equipment based on class diagram, such as terminals with data processing capabilities: mobile phones, computers, servers, etc. Optionally, Figure 4 The hardware structure diagram of the domain model quality detection device based on the class diagram is shown. Figure 4 ,The hardware structure of the domain model quality detection device based on the class diagram may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4;

[0229] In the embodiment of the present application, the number of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 is at least one, and the processor 1, the communication interface 2, and the memory 3 communicate with each other through the communication bus 4;

[0230] The processor 1 may be a central processing unit CPU, or an application-specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention, etc.;

[0231] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), etc., such as at least one disk memory;

[0232] The memory is used to store a computer program, and the processor is used to execute the computer program, so that the class diagram-based domain model quality detection device can implement any of the above-mentioned class diagram-based domain model quality detection methods.

[0233] A storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the class diagram-based domain model quality detection methods provided in the embodiment of the present application.

[0234] 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 of the class diagram-based domain model quality detection methods provided in the embodiments of the present application.

[0235] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0236] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.

[0237] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A domain model quality detection method based on class diagram, characterized in that: include: Obtaining a class diagram text of a class diagram to be detected, wherein the class diagram to be detected is used to represent a domain model of an object-oriented system; Parsing the class diagram text into structured class diagram data, wherein the structured class diagram data includes: a class list, a property list, a method list, and a relationship list; Performing semantic analysis on the structured class graph data to obtain analysis results; the analysis results include: a first similarity matrix for representing the same class element information of different classes; Processing the analysis results according to preconfigured rules, determining potential abstract parent classes, extracting parent classes and adjusting inheritance relationships, and generating an expected class diagram corresponding to the class diagram to be detected; wherein the preconfigured rules include preconfigured abstract rules and inheritance rules, the abstract rules include: when the number of identical class elements possessed by different classes is greater than or equal to a preset number, there is a potential abstract parent class; the inheritance rules include: there is an inheritance relationship between an abstract parent class and a corresponding child class; The matching degree between the class diagram to be detected and the expected class diagram is detected, and a quality score of the class diagram to be detected is determined, wherein the quality score is positively correlated with the matching degree.

2. The domain model quality detection method based on class diagram according to claim 1 is characterized in that: The pre-configured rules also include: class element exclusion rules, the class element exclusion rules include: excluding pre-specified common class elements during the quality detection process; Processing the analysis result according to the preconfigured rules to determine the potential abstract parent class includes: Applying the class element exclusion rule to exclude the common class elements in the first similarity matrix to obtain a second similarity matrix; The abstract rule is applied to search the second similarity matrix for different classes having the same class elements greater than or equal to the preset number, and determine potential abstract parent classes.

3. The domain model quality detection method based on class diagram according to claim 2 is characterized in that: The analysis result further includes: an inheritance relationship list, the inheritance relationship list including information indicating existing inheritance relationships in the class diagram to be detected; The inheritance rules also include: constraints on inheritance relations; The processing of the analysis result according to the preconfigured rules further includes: Apply the inheritance rule to detect whether each existing inheritance relationship indicated by the inheritance relationship list satisfies the constraint conditions of the inheritance relationship. When an existing inheritance relationship that does not satisfy the constraint conditions of the inheritance relationship is detected, output prompt information indicating the existing inheritance relationship that does not satisfy the constraint conditions of the inheritance relationship.

4. The method for detecting domain model quality based on class diagram according to claim 3, characterized in that: The inheritance relationship list also includes information for indicating potential inheritance relationships in the class diagram to be detected; The extracting of the parent class and adjusting the inheritance relationship include: According to the potential inheritance relationship indicated by the inheritance relationship list and the determined potential abstract parent class, the parent class is extracted and the inheritance relationship is adjusted.

5. The method for detecting domain model quality based on class diagram according to any one of claims 1 to 4, characterized in that: Detecting the matching degree between the class diagram to be detected and the expected class diagram includes: Do at least one of the following: Detecting the matching degree between the abstract class in the class diagram to be detected and the abstract class in the expected class diagram as the abstract class matching degree; Detecting the matching degree between the inheritance hierarchy structure in the class diagram to be detected and the inheritance hierarchy structure in the expected class diagram as the inheritance hierarchy matching degree; The matching degree between the class element in the to-be-detected class diagram and the class element in the expected class diagram is detected as the class element matching degree.

6. The method for detecting domain model quality based on class diagram according to claim 5, characterized in that: Detecting the degree of matching between the abstract class in the class diagram to be detected and the abstract class in the expected class diagram as the abstract class matching degree includes: Counting the number of abstract classes in the class diagram to be detected as a first number; Counting the number of abstract classes in the expected class diagram as a second number; Calculating a ratio of the first number to the second number as the abstract class matching degree; Detecting the matching degree between the inheritance hierarchy structure in the class diagram to be detected and the inheritance hierarchy structure in the expected class diagram as the inheritance hierarchy matching degree, including: Establishing a first inheritance hierarchy according to the inheritance relationship of the classes in the class diagram to be detected; Establishing a second inheritance hierarchy according to the inheritance relationship of the classes in the expected class diagram; Determining an actual edit distance and a maximum edit distance between the first inheritance level and the second inheritance level; the maximum edit distance being the sum of the number of nodes in the first inheritance level and the number of nodes in the second inheritance level; Calculating a ratio of the actual edit distance to the maximum edit distance as a first value; Calculate the difference between a second value and the first value as the inheritance hierarchy matching degree; the second value is equal to 1; Detecting the degree of matching between the class element in the class diagram to be detected and the class element in the expected class diagram as the class element matching degree includes: Calculating the class element similarity corresponding to each specified class, wherein the specified class is a class in the class diagram to be detected, and the class element similarity corresponding to the specified class is the similarity between the class element of the specified class and the class element of the class corresponding to the specified class in the expected class diagram; The class element matching degree is determined according to the class element similarities corresponding to the respective specified classes.

7. The method for detecting domain model quality based on class diagram according to claim 5, characterized in that: When the matching degree includes at least two of an abstract class matching degree, an inheritance hierarchy matching degree, and a class element matching degree, determining a quality score of the class diagram to be detected includes: The matching degrees are weighted and summed according to pre-configured weights to obtain a quality score of the class graph to be detected.

8. The method for detecting domain model quality based on class diagram according to any one of claims 1 to 4, characterized in that: After determining the quality score of the class graph to be detected, the method further includes: The quality score and a modification instruction for the class graph to be detected are output.

9. A domain model quality detection device based on class diagram, characterized in that: include: A class diagram text acquisition unit, used to acquire the class diagram text of the class diagram to be detected, wherein the class diagram to be detected is used to represent the domain model of the object-oriented system; A class diagram parsing unit, used for parsing the class diagram text into structured class diagram data, wherein the structured class diagram data includes: a class list, a property list, a method list and a relationship list; A semantic analysis unit, used to perform semantic analysis on the structured class graph data to obtain an analysis result; the analysis result includes: a first similarity matrix for representing the same class element information of different classes; A quality detection unit is used to process the analysis results according to preconfigured rules, determine potential abstract parent classes, extract parent classes and adjust inheritance relationships, and generate an expected class diagram corresponding to the class diagram to be detected; wherein the preconfigured rules include preconfigured abstract rules and inheritance rules, and the abstract rules include: when the number of identical class elements possessed by different classes is greater than or equal to a preset number, there is a potential abstract parent class; the inheritance rules include: there is an inheritance relationship between an abstract parent class and a corresponding subclass; and, detect the degree of matching between the class diagram to be detected and the expected class diagram, and determine the quality score of the class diagram to be detected, wherein the quality score is positively correlated with the degree of matching.

10. A domain model quality detection device based on class diagram, 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 class diagram-based domain model quality detection device can implement the class diagram-based domain model quality detection method according to any one of claims 1 to 8.