Knowledge graph and graph neural network-based recalcitrant variant screening method and system
By constructing a two-stage method using knowledge graphs and graph neural networks, and combining target relation path sets and four-dimensional ensemble indicators, we have achieved efficient screening of stubborn variants, solving the problems of inaccurate identification and time consumption in existing technologies, and improving the efficiency and accuracy of variant testing.
Patent Information
- Application Number
- CN202611453800.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-18
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies struggle to effectively screen out stubborn variants closely related to fault reveal capabilities during variant testing, and single-stage screening methods cannot balance efficiency and accuracy. Graph neural networks are also insufficient in identifying stubborn variants.
We construct a target relation path set for variants based on knowledge graphs, perform coarse screening using a four-dimensional ensemble index, and then perform deep embedding representation of the context subgraphs of variants using graph neural networks. Finally, we fuse graph embedding outlier scores and ensemble indexes for precise screening.
It enables accurate identification and screening of stubborn variants, improves the efficiency and accuracy of variant testing, and reduces testing costs.
Smart Images

Figure CN123179233A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of screening for stubborn variants in mutation testing, and more specifically, to a method and system for screening stubborn variants based on knowledge graphs and graph neural networks. Background Technology
[0002] As the core infrastructure of the information industry, computer software deeply penetrates key sectors such as national defense, finance, transportation, and healthcare. Its quality directly affects national information security and the stability of social operations. The consequences of substandard software go far beyond high maintenance costs; it can lead to significant economic losses and security incidents, as numerous historical lessons have repeatedly demonstrated.
[0003] With the continuous expansion of software application scenarios and the rapid increase in system complexity, users' expectations for software reliability are constantly rising. How to effectively ensure software quality at the technical level has become a core direction for ongoing exploration in the field. Software testing, as a key quality assurance activity throughout the entire development process, provides necessary support for reliable software operation through systematic defect detection and risk identification. Given the current limitations of formal verification and other theoretical methods in large-scale engineering deployment, software testing remains the primary practical approach to improving software reliability for the present and for a considerable period to come.
[0004] Mutation testing, which artificially injects defects to assess the fault detection capability of a test case set, is an effective measure of test adequacy. However, this method faces a significant efficiency bottleneck—the sheer number of variants leads to a dramatic increase in testing overhead, hindering its industrial-scale application. To reduce costs, researchers have proposed variant reduction strategies, but most have not adequately considered the persistent variants that testers are concerned with. These variants correspond to critical program logic and are closely related to fault disclosure capabilities. Complex relationships exist between program statements (including between original statements, between original statements and variant statements, and between variant statements), containing key information for distinguishing persistent variants. Existing methods struggle to fully capture these relationships, resulting in insufficient identification accuracy.
[0005] Graph Neural Networks (GNNs), a powerful representation learning technique that has emerged in recent years, can effectively capture complex dependencies between nodes in graph-structured data through message passing mechanisms. In the field of program analysis, GNNs have been successfully applied to tasks such as structural mutation detection and malware variant detection. By learning the structural dependencies between program entities, they can effectively capture deep semantic information that is difficult to uncover using traditional methods. However, in the field of mutation testing, especially for the identification and screening of stubborn variants, there is still a lack of systematic technical solutions for using GNNs to model the structural features of the variant's context subgraph.
[0006] To reduce the cost of variant testing, researchers have conducted extensive work on variant reduction, identification of refractory variants, and the introduction of intelligent methods.
[0007] In the area of variant reduction, existing research has proposed a variant reduction method based on self-organizing map neural networks. This method utilizes weak mutation transformation to obtain a variant killing matrix and then uses a neural network to cluster variants for reduction. Other studies have proposed a variant reduction method based on dominance, which identifies redundant variants by analyzing the dominance relationships between branches and deletes variants corresponding to redundant branches to reduce the size of the set. In the field of regular expression mutation testing, researchers reduce the variant set to control the test size by determining the inclusion relationships between variants and using redundancy elimination strategies for second-order mutations.
[0008] In the identification and handling of persistent mutants, existing research has proposed methods for determining persistent mutants based on mutated statements and related processes for distributed storage parallel programs. These methods first construct evaluation indicators based on the reachability of mutated statements, the attributes of mutated operators, and the correlation between mutated statements and processes and inputs. Then, based on different communication statement types, they propose evaluation indicators for parallel mutants, combining factors such as reachability and propagation, and finally provide a strategy for determining persistent mutants. Building upon this, existing methods address the problem of generating test data for persistent mutants by employing a strategy based on statement dominance and grouping related input variables: first, persistent mutants are initially grouped according to the dominance relationship between mutated statements; then, a correlation matrix between mutated statements and program input variables is established for further grouping; finally, ensemble evolutionary methods are used to generate test data for each group.
[0009] Regarding the introduction of intelligent methods, Graph Neural Networks (GNNs), as a powerful representation learning technique, have been initially applied in the field of software testing. For example, some research has proposed a smart contract mutation testing method based on GNNs. By constructing a code dependency graph and utilizing Graph Attention Networks (GATs) to learn the importance of nodes, mutations are generated for important nodes to improve the efficiency of mutation testing. In the field of program error localization, existing research has explored methods based on multivariate heterogeneous graph representation learning, using GNNs to calculate skepticism. Furthermore, the GraphPrior method introduces mutation analysis into GNN test input priority ranking, evaluating priority by generating mutation models and counting the number of mutations killed by the test input. In the application of knowledge graphs, existing patents have proposed generating mutation schemes based on knowledge graphs to test program modules. This involves obtaining the knowledge subgraph of the target module from the knowledge graph of the software under test and inputting it into the mutation scheme generation model to determine the target mutation scheme.
[0010] The existing solutions mainly have the following problems:
[0011] (1) Variant reduction strategies do not adequately consider stubborn variants. Existing reduction methods focus on reducing the number of variants, but rarely consider retaining stubborn variants that correspond to key program logic and are closely related to fault disclosure capabilities. There are complex relationships between program statements (including between original statements, between original statements and variant statements, and between variant statements), which contain key information for distinguishing stubborn variants, but existing reduction methods are unable to fully capture these deep relationships.
[0012] (2) The application of knowledge graphs in the mutant screening stage is still insufficient. Existing studies have mostly used knowledge graphs in the mutation scheme generation stage, such as generating mutation schemes based on knowledge subgraphs. However, in the mutant screening stage, there is still a lack of systematic solutions on how to use the structured knowledge of knowledge graphs to quickly screen and reduce all mutants.
[0013] (3) There is a gap in the application of graph neural networks in the identification of mutant persistence. Although some works have used graph neural networks to guide mutant generation or test input priority ranking, there is no technical solution to use graph neural networks to model the structural features of mutant context subgraphs in order to achieve accurate identification and screening of mutant persistence.
[0014] (4) Single-stage screening is difficult to balance efficiency and accuracy. Existing methods mostly adopt a single-stage strategy, which makes it difficult to ensure screening efficiency and identification accuracy at the same time on large-scale mutant sets. Dominance-based methods rely on coverage information for judgment and lack the mining of deep semantics of the program; although clustering-based methods can reduce mutants, they are not targeted enough for stubborn mutants.
[0015] In view of this, the present invention is hereby proposed. Summary of the Invention
[0016] In view of this, this invention discloses a method and system for screening stubborn variants based on knowledge graphs and neural networks. This invention utilizes knowledge graphs to obtain a set of target relational paths containing variants, and obtains ensemble indicators based on the target relational path set; it also presents a method for screening stubborn variants based on ensemble indicators. Leveraging the advantages of knowledge graphs in expressing diverse relationships, a knowledge graph for stubborn variant identification is constructed, and complex relationships between statements are structurally modeled. Based on this, candidate stubborn variants are quickly coarsely screened, thereby effectively controlling testing costs while ensuring detection performance. Furthermore, graph neural networks are introduced into the stubborn variant screening process. By deeply embedding the program context subgraph where the candidate variant resides, the semantic structure of the variant is accurately captured, thereby improving the accuracy and robustness of stubborn variant identification. In summary, this scheme achieves accurate screening of stubborn variants from a large number of variants, improving the efficiency and practicality of variant testing.
[0017] Specifically, the present invention is achieved through the following technical solutions:
[0018] In a first aspect, the present invention discloses a method for screening stubborn variants based on knowledge graphs and graph neural networks, comprising the following steps:
[0019] Construct a knowledge graph, and obtain a set of target relationship paths containing variants based on the knowledge graph;
[0020] Based on the target relation path set, a four-dimensional integrated index is constructed, including execution complexity, variable complexity, variant statement type and semantic similarity. Based on the above index, the variants are screened for candidate stubborn variants by traditional stubbornness scoring.
[0021] The candidate stubborn variants are further screened using a graph neural network to obtain a stubborn variant set. The context subgraph of the variants is represented by deep embedding. The graph embedding outlier score is weighted and fused with the four-dimensional ensemble index to obtain a comprehensive stubbornness score. Clustering and threshold screening are performed based on the comprehensive stubbornness score.
[0022] Secondly, this invention discloses a stubborn variant screening system based on knowledge graphs and graph neural networks, comprising:
[0023] Construction module: Used to construct a knowledge graph and obtain a set of target relationship paths containing variants based on the knowledge graph;
[0024] The initial screening module is used to construct a four-dimensional integrated index based on the target relation path set, including execution complexity, variable complexity, variant statement type and semantic similarity, and to screen candidate stubborn variants based on the above index using traditional stubbornness scoring.
[0025] The re-screening module is used to re-screen the candidate stubborn variants based on the graph neural network to obtain a set of stubborn variants, perform deep embedding representation on the context subgraph of the variants, perform weighted fusion of the graph embedding outlier score and the four-dimensional ensemble index to obtain a comprehensive stubbornness score, and perform clustering and threshold screening based on the comprehensive stubbornness score.
[0026] Thirdly, the present invention discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the first aspect of the stubborn variant screening method.
[0027] Fourthly, the present invention discloses a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the first aspect of the stubborn variant screening method.
[0028] Specifically, this invention addresses the problem of screening stubborn variants in mutation testing by providing a two-stage method based on knowledge graphs and graph neural networks. First, a knowledge graph for identifying stubborn variants is constructed. Then, a set of target relational paths containing variants is obtained based on the knowledge graph, and an ensemble index is obtained based on the target relational path set. Finally, stubborn variants are identified based on the ensemble index.
[0029] The technical solution of this invention: a two-stage method for screening stubborn variants based on knowledge graphs and graph neural networks, comprising the following steps:
[0030] Phase 1 (Coarse Screening): Rapid coarse screening of persistent variants based on knowledge graphs
[0031] Given the large number of variants generated in mutation testing (ranging from hundreds to thousands), directly performing deep analysis of all variants using graph neural networks would incur unbearable computational overhead. Therefore, this invention, in its first stage, extracts four-dimensional ensemble metrics (execution complexity, variable complexity, variant statement type, and semantic similarity) based on the constructed knowledge graph and target relation path set, and uses thresholds to achieve rapid coarse screening. This significantly reduces the size of the candidate set while ensuring recall, laying the foundation for the second stage of fine screening.
[0032] The main idea is as follows:
[0033] First, a knowledge graph for identifying stubborn variants is constructed; then, a set of target relational paths containing variants is obtained based on the knowledge graph; next, an integrated index is obtained based on the target relational path set; finally, stubborn variants are coarsely selected based on the integrated index.
[0034] Step 1: A method for constructing a knowledge graph to identify persistent variants.
[0035] This invention primarily studies the problem of screening stubborn variants based on knowledge graphs. Although some researchers have proposed variant reduction strategies, most have not fully considered the stubborn variants that testers are concerned with. These variants correspond to key program logic and are closely related to fault disclosure capabilities. Complex relationships exist between program statements (including between original statements, between original statements and variant statements, and between variant statements), containing key information for distinguishing stubborn variants. However, existing methods struggle to fully capture these relationships, resulting in insufficient identification accuracy. Therefore, this invention fully utilizes the powerful knowledge reasoning capabilities of knowledge graphs, providing a knowledge graph construction method for stubborn variant identification, mainly including information extraction, formatted data generation, and knowledge graph construction.
[0036] First, here is a method for quickly extracting information:
[0037] To quickly extract relevant information, we combine several open-source tools, such as Abstract Syntax Trees (ASTs), CFG generation tools, and regular expression matching techniques, to present a method for rapidly extracting code-related information. This method first uses ASTs to obtain information about the parsed program (or its variants) (functions, statements, and global variables); then, it uses CFG generation tools to obtain vertex and edge information, and then uses this information to extract path information; finally, it uses regular expression matching based on the path information to extract relevant information, and combines this information with that extracted from the ASTs to store it in a JSON file.
[0038] Then, the method for obtaining formatted data is given:
[0039] Based on the extracted information, we use Neo4j, a graph database processing tool, to build a knowledge graph. Before using Neo4j, the extracted information needs to be digitized, that is, to obtain information triples of entity points and edges (relations), such as entity point triples [statement 1, statement type, condition statement] and relation triples [statement 1, control relation, statement 2].
[0040] Finally, the method for constructing knowledge graphs is given:
[0041] Based on the obtained entity point information triple N and edge information triple E, we can store N and E in a graph database. Construct a knowledge graph.
[0042] Step 2: A method for generating target relationship paths based on knowledge graphs.
[0043] Based on the knowledge graph obtained in step 1, this section presents a method for generating target relation paths based on the knowledge graph. A relation path refers to a link (from the starting entity point to the ending entity point) composed of entities and relations in the knowledge graph. First, using... The query retrieves the set of relational paths to be mined; then, based on this set, a greedy algorithm is used to reduce the paths to obtain the target set of relational paths. Below, we provide the specific steps for automatically generating the target set of relational paths.
[0044] First, given initial entity points, use The statement searches for and outputs the initial set of relation paths to be mined. .
[0045] Then, the target relation path set to be mined is reduced and output.
[0046] For reducing and outputting the target relation path set to be mined, considering The generated path set obtained from the query contains some invalid paths, which are of no value to subsequent research and may even cause high time costs. Therefore, it is necessary to reduce the generated paths to be mined. Through analysis of the paths to be mined, we found that some paths have containment relationships, meaning that some paths have sub-paths. The target path we need is the deepest path in the graph (i.e., the last entity point of a path in the graph is no longer used as a new starting point). And through... The set of paths to be mined obtained from a query often contains non-deepest paths, which need to be deleted to reduce the path set. The method for reducing paths is given below.
[0047] The path reduction problem is transformed into a comprehensive knowledge graph problem. Based on the graph... and the path to be explored Use a greedy algorithm to select the smallest subset of paths. To achieve full coverage The entity points and relation edges are identified to achieve the goal of reducing the path set. An important metric used in the path selection process is the graph coverage. (As shown in formula (2-1)), the calculation formula is as follows:
[0048] (1-1)
[0049] in, This indicates the number of entity points and relations in the covered graph. This represents the total number of all entity points and relationships in the graph.
[0050] In the map and the set of paths to be explored Building on that, we will now use a greedy algorithm to obtain the target relation path set.
[0051] Step 3: Method for constructing integrated metrics based on target relationship path sets.
[0052] To accurately screen for stubborn variants, this section extracts key information based on the target relationship path set generated in step 2, and uses this key information as the basis for screening test subjects. Here, we present several important indicators to measure the stubbornness of the variant test subjects.
[0053] Testers discovered during testing that the more conditional statements a relation path contains, the harder it is for the corresponding mutated statement to be infected, and therefore the harder it is to kill the mutant. Conversely, if the number of conditional statements within a relation path is higher, the mutant is easier to kill. Define the execution complexity.
[0054] (1) Execution complexity. Suppose there are variants. Relationship path There are a total of There are [number] entity points, including the number of entity points in the conditional statement. The execution complexity is... The calculation formula is as follows:
[0055] (1-2)
[0056] Considering that the more initial variables testers use in the relational path during testing, the more difficult it becomes to kill the mutant. This is because the input domain becomes larger, making it harder to find data to kill the mutant. Variable complexity is given to measure the difficulty of killing the mutant.
[0057] (2) Variable complexity. Let the program... The total number of inputs is Includes variants Relationship path The number of input variables used is Then the variable complexity The calculation formula is as follows:
[0058] (1-3)
[0059] (3) Types of mutated statements: For any given mutant, different mutated statements exhibit varying degrees of infection during mutation testing. Experience shows that assignment statements have the highest infection rate, followed by conditional statements, and return statements have the lowest. The degree of infectivity for mutated statement types is defined as follows:
[0060] (1-4)
[0061] in, This is the i-th value of the infection degree of the mutated statement type. For , The larger the value, the harder it is for mutant M to be infected.
[0062] (4) Semantic similarity, which is the degree of change between the statements before and after mutation. The greater the change, the easier it is to be killed; the smaller the change, the harder it is to be killed. Jaccard coefficient is used to calculate semantic similarity.
[0063] The Jaccard coefficient is used to compare the similarity and differences between finite sample sets. A higher Jaccard coefficient indicates a higher degree of sample similarity. Consider two statements in the program... and ,but and semantic similarity The calculation formula is as follows:
[0064] (1-5)
[0065] in, For two statements and The common parts of the intersection For two statements and The union of the different parts of the intersection.
[0066] To better screen mutant test subjects, an integrated index for evaluating mutant persistence is presented, combining four indicators:
[0067] Based on the mutation killing criterion, namely the accessibility and necessity criteria, the first two can be reduced to accessibility indicators. The latter two boil down to necessity. For any given mutant Let the execution complexity be... The variable complexity is , variant statement type semantic similarity We can obtain:
[0068] (1-6)
[0069] in, ,and .
[0070] (1-7)
[0071] in, ,and .
[0072] set up To represent the stubbornness of a variant, then The calculation formula is as follows:
[0073] (1-8)
[0074] in As the weight, satisfying Since accessibility and infection conditions are equally important, Obviously Furthermore, the larger the value of this indicator, the more difficult it is to kill the mutant (the more stubborn it is), and conversely, the smaller the value, the easier it is to kill the mutant (the less stubborn it is).
[0075] First stage coarse screening: In order to select the candidate recalcitrant variants required by this invention, we set a coarse screening threshold. ,Bundle Variants that are considered candidate refractory variants are included in the candidate refractory variant set. Otherwise, remove them directly. Removal is possible at this stage. The presence of clearly non-persistent variants significantly reduces the input size for subsequent fine screening.
[0076] Phase Two (Fine Screening): Fine screening of stubborn variants based on graph neural networks and ensemble indicators
[0077] In step 3, a set of candidate stubborn variants is obtained. Building upon the previous method, this section presents a second-stage fine screening method: a method for finely screening stubborn variants based on the fusion of graph neural networks and ensemble metrics. While the four-dimensional ensemble metrics in the first stage can assess the stubbornness of variants from four dimensions—execution complexity, variable complexity, variant statement type, and semantic similarity—they are insufficient to fully capture the complex structural dependencies between variant statements and their control flow and data flow contexts. Therefore, this invention introduces graph neural networks in the second stage to perform deep embedding representation of the variant's context subgraph. The graph embedding outlier score is then weighted and fused with the ensemble metrics from the first stage, thereby supplementing semantic structural information on top of traditional metrics and achieving accurate screening of stubborn variants.
[0078] The main idea is as follows:
[0079] First, based on the four-dimensional ensemble index from the first phase, the conventional refractory score for each variant is calculated. Simultaneously, the context subgraph for each variant is extracted from the knowledge graph constructed in step 1. A graph attention network (GAT) is used to map the subgraph into a low-dimensional embedding vector, and the graph embedding outlier score for each variant is calculated based on the embedding space. Then, the traditional stubbornness score and the graph embedding outlier score are weighted and fused to obtain a comprehensive stubbornness score. Finally, clustering and threshold screening are performed based on the comprehensive stubbornness score to output the final set of stubborn variants. .
[0080] The specific steps are given below.
[0081] Step 1: Extraction of the variant context subgraph.
[0082] For candidate stubborn variant set Each variant in Extract from the knowledge graph constructed in step 1 a sequence of elements centered on the mutated statement with a radius of [missing information]. (Suggested neighborhood subgraphs with k=2 or 3) Specifically, it includes:
[0083] Control flow context: the predecessor and successor nodes of the control flow of the mutated statement, and the corresponding control flow relationship edges;
[0084] Data flow context: Variable definition in mutation statements - using dependency nodes and edges;
[0085] Scope of impact of the mutation: Statement nodes that may be affected by the mutation (determined by the data flow propagation path).
[0086] Each node Assign initial feature vectors This includes node type characteristics (such as statement type, variable type, function type, etc.) and program attribute characteristics (such as whether it is a conditional statement, whether it uses input variables, whether it is an assignment statement, etc.).
[0087] Step 2: Subgraph embedding based on graph attention network.
[0088] Use a Graph Attention Network (GAT) to subgraph Mapped to fixed-dimensional semantic embedding vectors Graph attention networks can adaptively learn the importance weights of neighboring nodes through an attention mechanism, fully capturing the complex dependencies between variant statements and context nodes.
[0089] The calculation of the graph attention layer is as follows:
[0090] (1-9)
[0091] in, For nodes The set of neighboring nodes, For learnable weight matrix, It is a non-linear activation function. For nodes with neighboring nodes The attention coefficient between nodes is calculated based on the correlation between node features:
[0092] (1-10)
[0093] in, This represents a vector concatenation operation. This is a learnable attention parameter vector.
[0094] After graph attention propagation, the global semantic embedding vector of the subgraph is obtained through the average pooling readout function:
[0095] (1-11)
[0096] Step 3: Outlier feature extraction based on embedding space.
[0097] In semantic embedding space In the process, calculate two outlier features for each candidate variant:
[0098] (1) Stubborn prototype similarity Calculate the cosine similarity between the variant embedding vector and the stubborn prototype vector:
[0099] (1-12)
[0100] in, The persistent prototype vector is determined by k-means clustering of the embedding vectors of the candidate variant set, with the cluster centers far from most variants being taken as persistent prototypes.
[0101] (2) Local outlier Calculate the local outlier factor of the variant in the embedding space:
[0102] (1-13)
[0103] in, for In the embedded space nearest neighbor set for The locally achievable density.
[0104] Combining the above two points, we define the outlier score for graph embeddings:
[0105] (1-14)
[0106] in, This is the normalized local outlier factor (its value range is mapped to [0,1]). Weighting coefficients (suggested) ).
[0107] Step 4: Final screening based on combined stubbornness score and stubborn variants.
[0108] The first stage uses the traditional stubbornness score obtained based on the four-dimensional integrated index. (i.e., formula (1-8)) and graph embedding outlier scoring Weighted fusion is performed to obtain the final comprehensive refractory score:
[0109] (1-15)
[0110] in, For the fusion weighting coefficients (recommended) This is used to balance the contributions of traditional ensemble metrics and graph neural network semantic embeddings in the determination of stubbornness.
[0111] Based on the comprehensive persistence score, we present a second-stage refined screening method:
[0112] First, based on the comprehensive persistence score, a comprehensive score vector corresponding to each relation path is obtained, thus forming a set of comprehensive score vectors for all relation paths. Then, k-means clustering is performed on the comprehensive score vector set to obtain the clustering results. (Corresponding one-to-one with the variants); Finally, traverse the classes. Select one class at a time And calculate the class based on formula (1-15) in sequence. The overall refractory score for each variant in the dataset will be greater than or equal to the fine threshold. Variants corresponding to the comprehensive refractory score (suggested value range 0.5) are stored in the final refractory variant set. until no classes remain. Output .
[0113] Furthermore, in order to select the stubborn variants required by this invention, we set a fine threshold. ,Bundle The variants are considered persistent variants; otherwise, they are not persistent variants. This invention allows... .
[0114] In summary, as program size increases, mutation testing requires executing a large number of mutants, making it very expensive. In fact, the biggest impact on mutation testing costs often comes from stubborn mutants that are related to certain critical parts of the program. In-depth study of stubborn mutants can reduce the time cost of analyzing them, thereby improving mutation testing efficiency. Currently, some methods exist for identifying and eliminating stubborn mutants; however, these methods suffer from inaccurate and time-consuming identification, affecting the quality of the identified mutants and potentially misleading testers in subsequent research.
[0115] To address this, this invention designs a two-stage method for screening persistent variants based on knowledge graphs and graph neural networks. The first stage constructs a knowledge graph for identifying persistent variants, obtains a set of target relationship paths containing variants based on the knowledge graph, and uses ensemble indicators for coarse screening based on the target relationship path set. The second stage performs fine screening by fusing graph neural networks and ensemble indicators, ultimately identifying persistent variants. This method demonstrates excellent performance in accurately detecting persistent variants and provides a theoretical framework and methodological guidance for the testing and verification of complex software systems, thereby substantially improving the efficiency of variant testing. The results of this invention are intended to be embedded into actual software testing processes to improve testing efficiency and defect detection capabilities, thereby serving the development of highly reliable software, with a clear application transformation path and considerable expected economic and social benefits. Attached Figure Description
[0116] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0117] Figure 1 This is a schematic diagram of the overall process of the stubborn variant screening method of the present invention;
[0118] Figure 2 A Java program for the three integer intermediate values of the stubborn variant screening method of the present invention;
[0119] Figure 3 The variant of statement 4 in P of the stubborn variant screening method of the present invention;
[0120] Figure 4 This is a knowledge graph diagram of the stubborn variant screening method of the present invention;
[0121] Figure 5 This is a schematic diagram of the structure of a computer device according to the present invention. Detailed Implementation
[0122] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0123] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this invention refers to and includes any or all possible combinations of one or more of the associated listed items.
[0124] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0125] This invention provides a method for screening stubborn variants based on knowledge graphs and graph neural networks, such as... Figure 1 As shown, it includes the following steps:
[0126] Construct a knowledge graph, and obtain a set of target relationship paths containing variants based on the knowledge graph;
[0127] Based on the target relation path set, a four-dimensional integrated index is constructed, including execution complexity, variable complexity, variant statement type and semantic similarity. Based on the above index, the variants are screened for candidate stubborn variants by traditional stubbornness scoring.
[0128] The candidate stubborn variants are further screened using a graph neural network to obtain a stubborn variant set. The context subgraph of the variants is represented by deep embedding. The graph embedding outlier score is weighted and fused with the four-dimensional ensemble index to obtain a comprehensive stubbornness score. Clustering and threshold screening are performed based on the comprehensive stubbornness score.
[0129] Example
[0130] It is a program for finding the middle value of three integers, such as Figure 2 As shown in (a). The input is , The input domain is We choose The fourth statement is mutated, and the mutation operation is implemented. MuCplise was used to generate a variant of statement 4. (like Figure 2 (as shown in (b)). In addition, we will obtain 11 variants. ,like Figure 3 As shown.
[0131] Step 1: A method for constructing a knowledge graph to identify persistent variants.
[0132] To quickly extract relevant information, we combine several open-source tools, such as Abstract Syntax Trees (ASTs), CFG generation tools, and regular expression matching techniques, to present a method for rapidly extracting code-related information. This method first uses ASTs to obtain information about the parsed program (or its variants) (functions, statements, and global variables); then, it uses CFG to automatically generate information about nodes and edges, and then uses this information to obtain path information; finally, it uses regular expression matching based on the path information to extract relevant information, and combines this with the information extracted from the ASTs to store it in a JSON file. The specific steps are as follows:
[0133] Step 1.1: Initialize the parameters, namely J (to store the collection of JSON files), F (to store function information), etc.
[0134] Step 1.2: Use the Abstract Syntax Tree tool to parse the program information and store it in A. {functions, statements, and global variables}, and extract function information and store it in dictionary F.
[0135] Step 1.3: Use the CFG generation tool to obtain node information and node serial numbers, and store them separately. Statement 1, Statement 2, ..., Statement m} and and respectively by and Obtain relevant information, i.e., point information Side information and path information .
[0136] Step 1.4: Traverse the path Use regular expression matching to extract relevant information from each path, and store this information along with the function information in F into a JSON file collection J.
[0137] Based on the above steps, the following can be obtained: Figure 4 The knowledge graph shown.
[0138] Then, the method for obtaining formatted data is given.
[0139] Based on the extracted information, we use Neo4j, a graph database processing tool, to construct a knowledge graph. Before using Neo4j, the extracted information needs to be formatted, i.e., obtaining triples of entity points and edges (relationships), such as entity point triples [statement 1, statement type, conditional statement] and relation triples [statement 1, control relation, statement 2]. This invention provides a method for information formatting, with the specific steps as follows:
[0140] Step 1.5: Initialize the parameters, namely the list N of triples storing entity point information and the list E of triples storing edge information.
[0141] Step 1.6: Iterate through the collection of JSON files Extract the function information from each JSON file sequentially, and construct a triplet information list g_list (including entities and relations) and store it in G, and extract the entity point IDs and relation information list c_list from g_list and store it in C.
[0142] Step 1.7: Make the IDs of the triplet information in G and C unique.
[0143] Step 1.8: Traverse entity point N, check if there is a mutated statement. If there is, add the mutated entity point and the triple of the relationship and store it in N and E. Continue until all entity points have been traversed, and then output N and E.
[0144] Finally, a method for constructing knowledge graphs is presented.
[0145] Based on the obtained entity point information triple N and edge information triple E, we can store N and E in a graph database. The specific steps for constructing a knowledge graph are as follows:
[0146] Step 1.9: Based on the obtained list of entity point information triples N and edge information triples E, traverse the list of entity point information triples N and store it in the graph database. Create all entity points on top.
[0147] Step 1.10: Traverse the edge information ternary list E and store it in the graph database. Create an edge on top.
[0148] Step 1.11: Check for errors and correct them. If no errors are found, output the knowledge graph; otherwise, output the knowledge graph after correction.
[0149] Step 2: A method for generating target relationship paths based on knowledge graphs.
[0150] Based on the knowledge graph obtained in step 1, a method for generating target relationship paths based on the knowledge graph is presented. Here, a relationship path refers to a link (from the starting entity point to the ending entity point) composed of entities and relationships in the knowledge graph. First, using... The query retrieves the set of relational paths to be mined; then, based on this set, a greedy algorithm is used to reduce the paths to obtain the target set of relational paths. Below, we provide the specific steps for automatically generating the target set of relational paths.
[0151] First, given initial entity points, use The statement searches for and outputs the initial set of relation paths to be mined. .
[0152] Then, the target relation path set to be mined is reduced and output.
[0153] For reducing and outputting the target relation path set to be mined, considering The generated path set obtained from the query contains some invalid paths, which are of no value to subsequent research and may even cause high time costs. Therefore, it is necessary to reduce the generated paths to be mined. Analysis of the paths reveals that some paths have inclusion relationships, meaning that some paths contain sub-paths. The target path is the deepest path in the graph (i.e., the last entity point of a path in the graph is no longer used as a new starting point). This is achieved through... The set of paths to be mined obtained from a query often contains non-deepest paths, which need to be deleted to reduce the path set. The method for reducing paths is given below.
[0154] The path reduction problem is transformed into a comprehensive knowledge graph problem. Based on the graph... and the path to be explored Use a greedy algorithm to select the smallest subset of paths. To achieve full coverage The entity points and relation edges are identified to achieve the goal of reducing the path set. An important metric used in the path selection process is the graph coverage. (As shown in formula (1-1)), the calculation formula is as follows:
[0155] (1-1)
[0156] in, This indicates the number of entity points and relations in the covered graph. This represents the total number of all entity points and relationships in the graph.
[0157] In the map and the set of paths to be explored Based on this, the following steps are given for obtaining the target relation path set using a greedy algorithm:
[0158] Step 2.1: Initialize parameter coverage Contractual Path Set .
[0159] Step 2.2: Traverse the set of paths to be mined, calculate the coverage of each path according to formula (1-1), and store the path and the obtained coverage into the cover_list list.
[0160] Step 2.3: Extract the coverage from the list cover_list and store it in the list cover_number_list, and obtain the maximum coverage cover_number.
[0161] Step 2.4: Traverse cover_list to extract the path corresponding to the maximum coverage cover_number and store it. .
[0162] Step 2.5: Calculation coverage And update At this point, it is determined whether the value is less than 1. If the condition is met, the previous steps are repeated until the condition is no longer met, at which point the loop is exited and the target path set is output. Otherwise, the target path set is output directly.
[0163] Based on the knowledge graph obtained in step 2, and following the steps described above, two target relation paths containing the mutated statement 4 can be obtained. ("Mid", "GetMid", "if(a>b){", "if(c>b){", "if(c <a){”, “if(c<++a){”) , ("Mid", "GetMid", "if(a>b){", "if(c>b){", "if(c <a){”, “if(c< a){”) .
[0164] Step 3: Method for constructing integrated metrics based on target relationship path sets.
[0165] To accurately screen for stubborn variants, this section extracts key information based on the target relationship path set generated in step 2, and uses this key information as the basis for screening test subjects. Here, we present several important indicators to measure the stubbornness of the variant test subjects.
[0166] We obtained one target relation path containing the mutated statement 4 in step 3, namely... ("Mid","GetMid", "if(a>b){", "if(c>b){","if(c<a){", "if(c<++a){"), and the construction method of the integrated metric is described in detail.
[0167] The testers found in the testing process that the more conditional statements contained in the relation path where the mutation statement is located, the more difficult it is to infect the mutation statement corresponding to the relation path, and the more difficult it is to kill the mutant corresponding to the mutation statement. On the contrary, it is easier to kill. We give the definition of execution complexity.
[0168] (1) Execution complexity. Let the relation path containing the mutant have a total of entity points, and the number of conditional statement entity points is , then the calculation formula of the execution complexity is as follows:
[0169] (1-2)
[0170] Considering that the more initial program variables used in the relation path during the testing process, the more difficult it is to kill the mutant. This is because the input domain becomes larger, and it is difficult to find data to kill the mutant. We give variable complexity to measure the difficulty of killing mutants.
[0171] Next, we calculate according to formula (1-2) . For example, we first obtain three branch statements ("if(a>b){", "if(c>b){", "if(c<a){") from the 6 statements of the target relation path RP1 containing the mutant . After that, we get .
[0172] (2) Variable complexity. Let the total number of inputs of the program be , and the number of input variables used in the relation path containing the mutant be , then the calculation formula of the variable complexity is as follows:
[0173] (1-3)
[0174] Obtain the variable complexity of according to formula (1-3). When the input of When all values are (a, b, c), we can use formula (3) 2) Obtain .
[0175] (4) Types of Mutated Statements. For any given mutant, we found that different mutated statements are infected to varying degrees during mutation testing. Generally, based on experience, assignment statements have the highest infection rate, followed by conditional statements, and return statements have the lowest. We use... The degree of infection of the mutated statement type is represented by the values in Table 3-1. The definition is as follows:
[0176] (1-4)
[0177] in, This is the i-th value of the infection level of the variant statement type shown in the second row of Table 1. For , The larger the value, the harder it is for mutant M to be infected.
[0178] Table 1. Infection values for different variant statements
[0179]
[0180] According to formula (1-4), we can calculate the infectivity of mutated statement 4 ("if(c<++a)") in Example 1, that is... .
[0181] (4) Semantic similarity, i.e., the degree of change between the statements before and after mutation. The greater the change, the easier it is to be killed; the smaller the change, the harder it is to be killed. To calculate semantic similarity, we use the Jaccard coefficient. The Jaccard coefficient is used to compare the similarity and difference between finite sample sets. The larger the Jaccard coefficient value, the higher the sample similarity. Suppose there are two statements in the program... and ,but and semantic similarity The calculation formula is as follows:
[0182] (1-5)
[0183] in, For two statements and The common parts of the intersection For two statements and The union of the different parts of the intersection.
[0184] Calculated according to formula (1-5) . For the original statement s ("if(c<a)" from P) and the mutant statement s ("if(c< ++a)" from M), we first use CountVector in the Sklearn library to give the character vectors ["(", " ", "<", "a", "c", "f", "i"], and then obtain TF [[1 1 0 1 1 1 1 1], [1 12 1 1 1 1 1]]. Then, use Numpy to obtain and and substitute into formula (1 5), obtain 0.78.
[0185] To better screen stubborn mutants, we comprehensively provide an integrated indicator of mutant stubbornness based on four indicators:
[0186] According to the killing criteria of mutants, namely reachability and necessity criteria, we can summarize the first two into reachability indicators , the latter two are summarized as necessity , for any given mutant , assuming the execution complexity is , variable complexity is , mutation statement type , semantic similarity , we can obtain:
[0187] (1-6)
[0188] Among them, , and .
[0189] Calculated according to formula (1-6) . When and , obtained by formula (1-6) 0.6×0.25 + 0.4×1 0.7.
[0190] (1-7)
[0191] Among them, , and .
[0192] In the above 0.25 and Based on this, we further... According to formula (1-7), it can be calculated , .
[0193] Then, based on formula (1-6), the semantic similarity corresponding to variant M is calculated. .
[0194] Calculate using formula (1-7) When αi 1 / 2 (i When 1, 2), The calculation is as follows: 1 / 2 × 0.78 + 1 / 2 × (0.25) 0.52.
[0195] set up To represent a variant Its stubbornness, The calculation formula is as follows:
[0196] (1-8)
[0197] in As the weight, satisfying Since accessibility and infection conditions are equally important, Obviously Furthermore, the larger the value of this indicator, the more difficult it is to kill the mutant (the more stubborn it is), and conversely, the smaller the value, the easier it is to kill the mutant (the less stubborn it is).
[0198] The following explains how to calculate based on variant M. The specific steps are as follows: (1) Calculate using formula (1-7). Using formulas (1-5) and (1-6), we obtain A(M). 0.7 and I(M) 0.52. After that, when β1 β2 When the value is 0.5, it is calculated using formula (3-6). : .
[0199] Furthermore, in order to select the stubborn variants required by this invention, we set a threshold. ,Bundle The variants are considered persistent variants; otherwise, they are not persistent variants. This invention allows... .
[0200] According to η and Select stubborn variants. For example, when η 1 / 2 and M is considered a stubborn variant.
[0201] Phase Two (Fine Screening): Fine screening of stubborn variants based on graph neural networks and ensemble indicators
[0202] In step 3, a set of candidate stubborn variants is obtained. Building upon the previous method, this section presents a second-stage fine screening method: a method for finely screening stubborn variants based on the fusion of graph neural networks and ensemble metrics. While the four-dimensional ensemble metrics in the first stage can assess the stubbornness of variants from four dimensions—execution complexity, variable complexity, variant statement type, and semantic similarity—they are insufficient to fully capture the complex structural dependencies between variant statements and their control flow and data flow contexts. Therefore, this invention introduces graph neural networks in the second stage to perform deep embedding representation of the variant's context subgraph. The graph embedding outlier score is then weighted and fused with the ensemble metrics from the first stage, thereby supplementing semantic structural information on top of traditional metrics and achieving accurate screening of stubborn variants.
[0203] The main idea is as follows:
[0204] First, based on the four-dimensional ensemble index from the first phase, the conventional refractory score for each variant is calculated. Simultaneously, the context subgraph for each variant is extracted from the knowledge graph constructed in step 1. A graph attention network (GAT) is used to map the subgraph into a low-dimensional embedding vector, and the graph embedding outlier score for each variant is calculated based on the embedding space. Then, the traditional stubbornness score and the graph embedding outlier score are weighted and fused to obtain a comprehensive stubbornness score. Finally, clustering and threshold screening are performed based on the comprehensive stubbornness score to output the final set of stubborn variants. .
[0205] Below we provide the specific steps.
[0206] Step 1: Extraction of the variant context subgraph.
[0207] For candidate stubborn variant set Each variant in Extract from the knowledge graph constructed in step 1 a sequence of elements centered on the mutated statement with a radius of [missing information]. (Suggested neighborhood subgraphs with k=2 or 3) Taking the mutant MM in Example 1 (corresponding to the mutant statement "if(c<++a)") as an example, its context subgraph contains:
[0208] Control flow context: predecessor node "if(c<a){", successor nodes, etc.;
[0209] Data flow context: definition nodes and use nodes of variables a, b, c;
[0210] Mutation influence scope: subsequent conditional judgment nodes affected by the mutated statement.
[0211] Each node is assigned a corresponding initial feature vector according to its type (conditional statement, assignment statement, variable, etc.).
[0212] Step 2: Subgraph embedding based on graph attention network.
[0213] A Graph Attention Network (GAT) is used to map the subgraph into a semantic embedding vector of fixed dimension . The graph attention network can adaptively learn the importance weights of neighbor nodes through the attention mechanism, fully capturing the complex dependencies between the mutated statement and context nodes.
[0214] The calculation of the graph attention layer is as follows:
[0215] (1-9)
[0216] where, is the set of neighbor nodes of node , is the learnable weight matrix, is the nonlinear activation function, is the attention coefficient between node and its neighbor node , calculated based on the correlation between node features:
[0217] (1-10)
[0218] where, represents the vector concatenation operation, is the learnable attention parameter vector.
[0219] After graph attention propagation, the global semantic embedding vector of the subgraph is obtained through the average pooling readout function:
[0220] (1-11)
[0221] In this example, after the context subgraph of mutant M is embedded by the graph attention network, the embedding vector is obtained .
[0222] Step 3: Outlier feature extraction based on embedding space.
[0223] In semantic embedding space In the process, calculate two outlier features for each candidate variant:
[0224] (1) Stubborn prototype similarity Calculate the cosine similarity between the variant embedding vector and the stubborn prototype vector:
[0225] (1-12)
[0226] in, The persistent prototype vector is determined by k-means clustering of the embedding vectors of the candidate variant set, with the cluster centers far from most variants being taken as persistent prototypes.
[0227] In this example, the calculation is as follows: .
[0228] (2) Local outlier Calculate the local outlier factor of the variant in the embedding space:
[0229] (1-13)
[0230] in, for In the embedded space nearest neighbor set for The locally achievable density.
[0231] In this example, after normalization .
[0232] Combining the above two points, we define the outlier score for graph embeddings:
[0233] (1-14)
[0234] in, This is the normalized local outlier factor (its value range is mapped to [0,1]). Weighting coefficients (suggested) ).
[0235] Based on Example 1, take Calculations yielded .
[0236] Step 4: Final screening based on combined stubbornness score and stubborn variants.
[0237] The first stage uses the traditional stubbornness score obtained based on the four-dimensional integrated index. Outlier scoring with graph embedding Weighted fusion is performed to obtain the final comprehensive refractory score:
[0238] (1-15)
[0239] in, The calculation yields:
[0240]
[0241] Based on the comprehensive persistence score, we present a second-stage refined screening method:
[0242] First, based on the comprehensive persistence score, a comprehensive score vector corresponding to each relation path is obtained, thus forming a set of comprehensive score vectors for all relation paths. Then, k-means clustering is performed on the comprehensive score vector set to obtain the clustering results. (Corresponding one-to-one with the variants); Finally, traverse the classes. Select one class at a time And calculate the class based on formula (1-15) in sequence. The overall refractory score for each variant in the dataset will be greater than or equal to the fine threshold. Variants corresponding to the comprehensive refractory score (suggested value range 0.5) are stored in the final refractory variant set. until no classes remain. Output .
[0243] Furthermore, in order to select the stubborn variants required by this invention, we set a fine threshold. ,Bundle The variants are considered persistent variants; otherwise, they are not persistent variants. This invention allows... .
[0244] according to and Select stubborn variants. For example, when and hour, It is considered a stubborn variant.
[0245] In addition to providing the above-mentioned method for screening refractory variants, this invention also provides a screening system corresponding to the aforementioned method, comprising:
[0246] Construction module: Used to construct a knowledge graph and obtain a set of target relationship paths containing variants based on the knowledge graph;
[0247] The initial screening module is used to construct a four-dimensional integrated index based on the target relation path set, including execution complexity, variable complexity, variant statement type and semantic similarity, and to screen candidate stubborn variants based on the above index using traditional stubbornness scoring.
[0248] The re-screening module is used to re-screen the candidate stubborn variants based on the graph neural network to obtain a set of stubborn variants, perform deep embedding representation on the context subgraph of the variants, perform weighted fusion of the graph embedding outlier score and the four-dimensional ensemble index to obtain a comprehensive stubbornness score, and perform clustering and threshold screening based on the comprehensive stubbornness score.
[0249] Figure 5 This is a schematic diagram of the structure of a computer device disclosed in this invention. (Reference) Figure 5 As shown, the computer device includes: an input device 63, an output device 64, a memory 62, and a processor 61; the memory 62 is used to store one or more programs; when the one or more programs are executed by the one or more processors 61, the one or more processors 61 implement the method provided in the above embodiments; wherein the input device 63, the output device 64, the memory 62, and the processor 61 can be connected by a bus or other means.
[0250] The memory 62, as a read / write storage medium for a computing device, can be used to store software programs, computer-executable programs, and program instructions corresponding to a method described in the embodiments of this application. The memory 62 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device. Furthermore, the memory 62 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 62 may further include memory remotely located relative to the processor 61, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0251] The input device 63 can be used to receive input digital or character information, and generate key signal inputs related to user settings and function control of the device; the output device 64 may include display devices such as a display screen.
[0252] The processor 61 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 62.
[0253] This application also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the methods provided in the above embodiments. The storage medium can be any type of memory device or storage device, including: mounting media such as CD-ROM, floppy disk, or magnetic tape; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements; the storage medium may also include other types of memory or combinations thereof; furthermore, the storage medium may reside in a first computer system in which the program is executed, or it may reside in a different second computer system connected to the first computer system via a network (such as the Internet); the second computer system can provide program instructions to the first computer for execution. The storage medium includes two or more storage media that may reside in different locations (e.g., in different computer systems connected via a network). The storage medium may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.
[0254] Finally, it should be noted that although this specification contains many specific implementation details, these should not be construed as limiting the scope of any invention or the scope of the claims, but rather are primarily used to describe the features of specific embodiments of a particular invention. Certain features described in the various embodiments of this specification may also be implemented in combination in a single embodiment. On the other hand, various features described in a single embodiment may also be implemented separately in various embodiments or in any suitable sub-combination. Furthermore, while features may function in certain combinations as described above and even initially claimed in this way, one or more features from a claimed combination may be removed from that combination in some cases, and a claimed combination may refer to a sub-combination or a variation of a sub-combination.
[0255] Similarly, although the operations are depicted in a specific order in the accompanying drawings, this should not be construed as requiring these operations to be performed in the specific order shown or sequentially, or requiring all illustrated operations to be performed to achieve the desired result. In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system modules and components in the above embodiments should not be construed as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.
[0256] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims may be performed in a different order and still achieve the desired result. Furthermore, the processes depicted in the drawings are not necessarily shown in a specific order or sequence to achieve the desired result. In some implementations, multitasking and parallel processing may be advantageous.
[0257] The above description is merely a preferred embodiment of this disclosure and is not intended to limit this disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for screening persistent variants based on knowledge graphs and graph neural networks, characterized in that, Includes the following steps: Construct a knowledge graph, and obtain a set of target relationship paths containing variants based on the knowledge graph; Based on the target relation path set, a four-dimensional integrated index is constructed, including execution complexity, variable complexity, variant statement type and semantic similarity. Based on the above index, the variants are screened for candidate stubborn variants by traditional stubbornness scoring. The candidate stubborn variants are further screened using a graph neural network to obtain a stubborn variant set. The context subgraph of the variants is represented by deep embedding. The graph embedding outlier score is weighted and fused with the four-dimensional ensemble index to obtain a comprehensive stubbornness score. Clustering and threshold screening are performed based on the comprehensive stubbornness score.
2. The method for screening stubborn variants based on knowledge graphs and graph neural networks according to claim 1, characterized in that, The method for constructing a knowledge graph includes information extraction, formatted data generation, and methods for storing entity point information and edge information into a graph database.
3. The method for screening stubborn variants based on knowledge graphs and graph neural networks according to claim 1, characterized in that, Methods for obtaining the target relation path set containing variants include using The query statement obtains the set of relational paths to be mined; then, a greedy algorithm is used to reduce the paths to obtain the target set of paths.
4. The method for screening stubborn variants based on knowledge graphs and graph neural networks according to claim 3, characterized in that, The execution complexity The calculation formula is as follows: in, It is a variant. For relational paths, The number of entity points. The number of entity points in the conditional statement; The complexity of the variables The calculation formula is as follows: in, To input the total number, For containing variants Relationship path The number of input variables used; The variant statement type for: in, This refers to the i-th value of the infection degree of the variant statement type; The formula for calculating semantic similarity is as follows: in, For two statements and The common parts of the intersection For two statements and The union of the different parts of the intersection.
5. The method for screening stubborn variants based on knowledge graphs and graph neural networks according to claim 4, characterized in that, The traditional stubbornness scoring screening uses the reachability index. Necessity indicators ; in, ,and ; in, ,and ; set up To represent the refractoryness of a variant, the traditional refractoryness score is used. The calculation formula is as follows: in As the weight, satisfying Since accessibility and infection conditions are equally important, .
6. The method for screening stubborn variants based on knowledge graphs and graph neural networks according to claim 5, characterized in that, Methods for deep embedding representation of context subgraphs include: For the set of stubborn variants Each variant in Extracting data centered on the mutated statement with a radius of [missing information]. neighborhood subgraph ; Using graph attention networks to subgraphs of the domain Mapped to fixed-dimensional semantic embedding vectors .
7. The method for screening stubborn variants based on knowledge graphs and graph neural networks according to claim 6, characterized in that, Methods for embedding graphs into outlier scoring include: For the semantic embedding vector, calculate two outlier features for each candidate variant: stubborn prototype similarity Calculate the cosine similarity between the variant embedding vector and the stubborn prototype vector: in, As a persistent prototype vector, k is performed on the embedding vector of the candidate variant set. means clustering; Local outlier Calculate the local outlier factor of the variant in the embedding space: in, for In the embedded space nearest neighbor set for Locally achievable density; Combining the above two points, we define the outlier score for graph embeddings: in, The normalized local outlier factor. These are the weighting coefficients.
8. The method for screening stubborn variants based on knowledge graphs and graph neural networks according to claim 7, characterized in that, Methods for obtaining a comprehensive refractory score through weighted fusion include: The traditional stubbornness score With the graph embedding outlier score Weighted fusion is performed to obtain the final comprehensive refractory score: in, For the fusion weighting coefficients (recommended) This is used to balance the contributions of traditional ensemble metrics and graph neural network semantic embeddings in the determination of stubbornness.
9. A system for screening stubborn variants based on knowledge graphs and graph neural networks, characterized in that, include: Construction module: Used to construct a knowledge graph and obtain a set of target relationship paths containing variants based on the knowledge graph; The initial screening module is used to construct a four-dimensional integrated index based on the target relation path set, including execution complexity, variable complexity, variant statement type and semantic similarity, and to screen candidate stubborn variants based on the above index using traditional stubbornness scoring. The re-screening module is used to re-screen the candidate stubborn variants based on the graph neural network to obtain a set of stubborn variants, perform deep embedding representation on the context subgraph of the variants, perform weighted fusion of the graph embedding outlier score and the four-dimensional ensemble index to obtain a comprehensive stubbornness score, and perform clustering and threshold screening based on the comprehensive stubbornness score.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more computer programs capable of executing claim 1.
8. The method described in any one of the following.
