A knowledge graph construction method and system based on software testing

By combining template adaptive technology, multi-level thesaurus, and IDF model, the problems of word segmentation and retrieval accuracy in knowledge graphs are solved, retrieval efficiency and knowledge utilization are improved, and intelligent knowledge graph construction is realized.

CN115422372BActive Publication Date: 2026-03-06NAT UNIV OF DEFENSE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211066079.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-01
Publication Date
2026-03-06
Estimated Expiration
2042-09-01

AI Technical Summary

Technical Problem

Existing knowledge graph corpora are sourced from a single source, making it impossible to distinguish word weights. This results in low intelligence in retrieval, with nodes of little relevance being detected, thus affecting the retrieval rate. Keyword extraction is inaccurate and lacks a reasonable update mechanism.

Method used

Template adaptation technology is used for software test document preprocessing to establish a multi-level thesaurus and IDF model file. Hidden Markov model is used for word segmentation, keywords are extracted and a knowledge graph is constructed. The surrounding centrality algorithm is used for retrieval and recommendation.

Benefits of technology

It improves word segmentation accuracy and retrieval hit rate, achieves precise keyword extraction and high relevance of retrieval results, and maximizes the use of dormant test knowledge.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115422372B_ABST
    Figure CN115422372B_ABST
Patent Text Reader

Abstract

This invention relates to a method and system for constructing a knowledge graph based on software testing, belonging to the field of knowledge graph technology. It solves the problems of low reusability and inability to intelligently store software test documents in existing technologies. The method includes: preprocessing and segmenting the received software test documents; updating the multi-level thesaurus with new terms based on the segmentation results; and updating IDF model files for various research directions based on the segmentation results and the research direction to which the document belongs. The method also involves parsing the preprocessed documents to obtain basic data; periodically extracting knowledge entities and their attributes based on the basic data, and establishing the relationships between knowledge entities, their attributes, and the relationships between them; extracting keywords from the attributes of knowledge entities based on the multi-level thesaurus and the IDF model files for various research directions, establishing keyword entities and the relationships between keyword entities and knowledge entities, and obtaining a knowledge graph. This achieves intelligent storage and retrieval of test knowledge, improving the overall utilization rate of data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of knowledge graph technology, and in particular to a method and system for constructing a knowledge graph based on software testing. Background Technology

[0002] Software testing is not only a primary means of ensuring software quality but also a crucial component of software testing and evaluation. Improving the intelligence and standardization of software product testing is a vital way to enhance testing efficiency and quality, thereby strengthening software testing and evaluation capabilities. The data and experience accumulated during testing should also have a degree of inheritability. While test data increases year by year, this accumulated data often remains unused and dormant. How to transform historical test cases into test knowledge is a pressing issue that needs to be addressed.

[0003] Knowledge graphs are widely used in various fields. Enterprises and organizations in these fields are beginning to combine knowledge graph technologies to extract knowledge entities and relationship data from information resources in their respective fields, and construct their own knowledge graphs for information resource retrieval and recommendation. This enables convenient and rapid acquisition of relevant knowledge, improves the way information resources are used, and increases efficiency.

[0004] However, existing knowledge graph corpora are sourced from a single source, making it impossible to distinguish the weight of words. The level of intelligence in retrieval is low, and nodes with little relevance are detected, affecting the retrieval rate. Keyword extraction is inaccurate and lacks a reasonable update mechanism. Summary of the Invention

[0005] Based on the above analysis, the embodiments of the present invention aim to provide a knowledge graph construction method and system based on software testing, so as to solve the problems of low reusability and inability to intelligently store existing software test documents.

[0006] On one hand, embodiments of the present invention provide a knowledge graph construction method based on software testing, including the following steps:

[0007] The received software test documents are preprocessed and segmented. The new vocabulary in the multi-level vocabulary is updated according to the segmentation results. The IDF model files of various research directions are updated according to the segmentation results and the research direction to which the document belongs. The preprocessed documents are parsed to obtain basic data.

[0008] Based on the basic data, knowledge entities and their attributes are extracted periodically, and the relationships between knowledge entities, their attributes, and the relationships between them are established.

[0009] Based on multi-level thesaurus and IDF model files for various research directions, keywords are extracted from the attributes of knowledge entities, keyword entities and the relationship between keyword entities and knowledge entities are established to obtain a knowledge graph.

[0010] Further improvements to the above method include preprocessing the received software test documents, including:

[0011] Parse the software test document to obtain document element information, including: document type, research direction of the document, total number of rows in the table, total number of columns in the table, and data in each cell of the table; according to the software test template corresponding to the document, check whether the total number of rows and columns in the table are consistent with the software test template, and whether the data in each cell of the table meets the constraints of the fields in the software test template. If all checks pass, the preprocessing is successful, and the document is classified and stored according to its research direction; otherwise, an error log is recorded and feedback is provided, and the preprocessing fails.

[0012] Further improvements to the above method involve using a Hidden Markov Model (HMM) to process words, where the position of a character within a word is used as the state. An initial probability matrix, a state transition matrix, and an emission probability matrix are generated based on a multi-level lexicon. The input text is used as an observation sequence, and the optimal state sequence is obtained using the Viterbi algorithm. The word segmentation result is then output based on the optimal state sequence.

[0013] The state is determined by the position of a character in a word, including: the beginning position (B) of a word with more than one character, the end position (E) of a word with more than one character, the middle position (M) of a word with more than one character, and the character being a single-character word (S).

[0014] Further improvements to the above method involve word segmentation of the received software test documents, and updating the multi-level thesaurus with new terms based on the segmentation results, including:

[0015] After converting all successfully preprocessed documents into text, the text is used as input for word segmentation. The resulting words are then combined to form new words from the characters corresponding to consecutive single-character words SS. If a new word does not exist in the new word library of the multi-level dictionary, it is added to the new word library.

[0016] Based on further improvements to the above method, the multi-level thesaurus includes: a first-level standard thesaurus, a second-level hot word thesaurus, a third-level new word thesaurus, a fourth-level synonym thesaurus, and a fifth-level stop word thesaurus. The first-level standard thesaurus is pre-configured by analyzing domain standards and software testing standards; the second-level hot word thesaurus is dynamically updated based on user search criteria, as well as pre-configured frequency and time thresholds; the third-level new word thesaurus is updated based on the word segmentation results of all successfully preprocessed documents; and the fourth-level synonym thesaurus and the fifth-level stop word thesaurus are updated based on user maintenance.

[0017] Based on further improvements to the above method, and according to the word segmentation results and the research direction to which the document belongs, the IDF model files for various research directions are updated, including:

[0018] Based on the stop word library, stop words are removed from the word segmentation results of each document under each research direction;

[0019] The inverse document frequency (IDF) of each word in the segmentation results after removing stop words is calculated using the following formula for each research direction, and the IDF model files for each research direction are composed of each word and its corresponding IDF:

[0020]

[0021] Among them, idf i,j TC is the inverse document frequency of the i-th word in the j-th research direction; i,j Let be the word frequency of the i-th word in the document of the j-th research direction; MC i Let be the number of times the i-th word appears in the built-in corpus.

[0022] Based on further improvements to the above method, keywords are extracted from the attributes of knowledge entities according to a multi-level thesaurus and IDF model files for various research directions, including:

[0023] The attributes of knowledge entities are used to form the current text, which is then segmented into words. Stop words are removed from the segmented results to obtain the words to be extracted.

[0024] Based on a multi-level thesaurus, the thesaurus to which each word to be extracted belongs is identified. Words belonging to the first-level standard thesaurus or the second-level hot word thesaurus are directly used as keywords. For each remaining word to be extracted, the following steps are performed:

[0025] The TF frequency of each remaining word to be extracted is obtained by considering the number of times each word appears in the current text and the number of times it appears in all successfully preprocessed documents.

[0026] Based on the IDF model file of the research direction to which the knowledge entity belongs, obtain the IDF inverse document frequency of each remaining word to be extracted;

[0027] Identify the source attributes and corresponding weights of each remaining word to be extracted, and obtain the position weight and lexicon weight of each remaining word to be extracted based on the lexicon to which each remaining word to be extracted belongs;

[0028] The score for each remaining word to be extracted is obtained by multiplying the TF term frequency, IDF inverse document frequency, position weight, and lexicon weight.

[0029] Sort the scores from highest to lowest, and extract the top-scoring words from the remaining words to be extracted as keywords, based on a preset number of words.

[0030] Further improvements to the above methods include extracting keywords from the attributes of knowledge entities: obtaining synonyms of the extracted keywords based on a thesaurus, establishing synonym entities, and establishing many-to-many relationships between keyword entities and synonym entities.

[0031] Based on further improvements to the above method, the secondary hot word database is dynamically updated according to user search criteria, as well as preset frequency and time thresholds, including:

[0032] The user's search criteria are segmented into words, and the segmented results are used to remove stop words and words that are already in any word library.

[0033] The system sequentially checks whether the remaining words already exist in the user's habitual phrase cache. If they do, the word frequency is incremented by 1. If the word frequency reaches a preset threshold, the word is added to the secondary hot word library and removed from the user's habitual phrase cache. If the words do not exist, the word is added to the user's habitual phrase cache, and the time is updated.

[0034] Based on the update time of each word in the user's habitual phrase cache, and compared with the current time, words that exceed the preset time threshold are removed from the user's habitual phrase cache.

[0035] On the other hand, embodiments of the present invention provide a knowledge graph construction system based on software testing, including:

[0036] The word segmentation module is used to segment the input text into words and obtain the segmentation results.

[0037] The document preprocessing module is used to preprocess the received software test documents, call the word segmentation module to obtain word segmentation results, update the new vocabulary in the multi-level vocabulary based on the word segmentation results, and update the IDF model files of various research directions based on the word segmentation results and the research direction to which the document belongs; and parse the preprocessed document to obtain basic data.

[0038] The knowledge graph construction module is used to periodically extract knowledge entities and their attributes based on basic data, and to establish knowledge entities, their attributes, and the relationships between knowledge entities; based on multi-level thesaurus and IDF model files of various research directions, it extracts keywords from the attributes of knowledge entities, establishes keyword entities and the relationships between keyword entities and knowledge entities, and obtains the knowledge graph.

[0039] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:

[0040] 1. Using template adaptive technology, after each change to the software test document, you only need to upload the new template to the server, and the template will be automatically parsed into the corresponding HTML according to the test document's unified modeling language. It also supports dynamic binding of database fields, and the whole process does not require rewriting the code.

[0041] 2. Establish multi-level thesauruses and their respective update and maintenance methods to improve word segmentation accuracy and retrieval hit rate.

[0042] 3. Improve the IDF calculation method. When training the IDF model on all software test documents, generate IDF models for different research directions. During the keyword extraction process, extract the research direction corresponding to the text and use the corresponding IDF model to extract keywords, thereby improving the accuracy of keyword extraction.

[0043] 4. Based on keywords and synonyms, and taking into account the number of paths and path weights, we propose a surrounding centrality algorithm to retrieve and recommend knowledge, improve the relevance of retrieval results, and maximize the use of dormant test knowledge.

[0044] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0045] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0046] Figure 1 This is a flowchart of a knowledge graph construction method based on software testing in Embodiment 1 of the present invention;

[0047] Figure 2 This is a schematic diagram of the knowledge subgraph obtained according to the retrieval conditions in Embodiment 1 of the present invention. Detailed Implementation

[0048] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0049] Example 1

[0050] A specific embodiment of the present invention discloses a knowledge graph construction method based on software testing. This method primarily addresses the problem of ineffective utilization of electronic warfare equipment software testing data assets. It involves unified storage and management of electronic warfare equipment software testing knowledge, preprocessing it using a unified modeling language, and then performing knowledge extraction, representation, and fusion to construct a knowledge graph for electronic warfare equipment software testing. Figure 1 As shown, it includes the following steps:

[0051] S11: Preprocess and segment the received software test documents, update the new lexicon in the multi-level lexicon according to the segmentation results, and update the IDF model files of various research directions according to the segmentation results and the research direction to which the document belongs; parse the preprocessed documents to obtain basic data.

[0052] It should be noted that, based on the analysis of test-related data generated during the requirements analysis, test planning, and test execution phases of electronic warfare equipment software testing, and taking the project as the dimension, the software testing knowledge for each project includes: test items, test cases, and test defects.

[0053] This step, while acquiring software testing knowledge, performs word segmentation, updates the multi-level lexicon with new words based on the segmentation results, updates the IDF model files for various research directions, and finally saves the software testing knowledge information in the database for subsequent knowledge graph construction. These steps are further detailed below as steps S111-S114.

[0054] S111: Preprocess the received software test documents.

[0055] Software testing knowledge includes both structured and unstructured data. Structured data is relatively conventional and can be obtained through system interfaces, database synchronization, import, and export. Unstructured software testing knowledge is generally stored in Word documents. In the field of electronic warfare, due to differences in the understanding of the system among various military branches and testing units, and even variations in test system document templates within the same testing center from different years, the traditional approach is to create different document templates or convert the templates to JSON or XML for knowledge extraction and storage. However, once the template is adjusted, functions involving template changes need to be rewritten, including document extraction, document validation, document content retrieval, and even adjustments to database table fields, resulting in a large amount of coding work after each change.

[0056] This embodiment employs a highly flexible template adaptive technology. After each change to the test class document, only the new template needs to be uploaded to the server; no rewriting of the code is required. The entire process is as follows:

[0057] ① Upload and parse the software test template, and convert the template into an HTML table.

[0058] It should be noted that the software test template includes the testing center name, document type, version number, and one or more tables. The uploaded software test template is saved in a file library. Simultaneously, OpenXML technology is used to parse the user-uploaded software test template, obtain row and column information, create an HTML file, determine whether cells need to be merged based on the software test template, and if so, merge cells using CSS styles. The column width is parsed based on the cell attributes obtained from OpenXML, and the corresponding CSS styles are set. HTML is generated based on the row and column information and column width. At the same time, the corresponding basic data field list is obtained based on the template type, and a field list dropdown is generated for each cell in the table within the HTML file.

[0059] ② Establish the mapping relationship between software test templates and fields, as well as the constraints of the fields.

[0060] By manually binding fields, select the field dropdown list in each cell of the software testing template and bind the corresponding field information. It should be noted that the basic data includes extended fields used to associate newly added information in the template.

[0061] Considering that the software testing documentation for electronic countermeasures equipment is manually edited by testers, a large number of errors are inevitably introduced, including incorrect table formats, non-compliant defect identifiers, and duplicate unique identifiers. If the documents are not validated before extraction, the extracted data will contain a large amount of dirty data, affecting the subsequent establishment of defect correlations. Therefore, it is necessary to establish constraints for special fields in the documents to preprocess the documents before extraction and improve data quality.

[0062] Specifically, constraints can be set for bound fields through the field attribute editing interface, including unique constraints and regular expression conditions. Unique constraints are created for non-repeating fields such as test knowledge identifiers and titles, primarily used to prevent incorrect relationships from being established due to document errors during relationship extraction. Regular expressions validate the rules for all fields; only fields that satisfy the regular expression will be extracted; otherwise, an error message will be displayed.

[0063] ③ Upload the document to be processed and preprocess the received software test document according to the software test template.

[0064] Upload one or more documents to be processed according to the template type. Parse the uploaded software test documents to obtain document element information, including: document type, research direction of the document, total number of rows in the table, total number of columns in the table, and data in each cell of the table. According to the software test template corresponding to the document, check whether the total number of rows and columns in the table are consistent with the software test template. Check whether the data in each cell of the table meets the constraints of the fields in the software test template (unique constraints or regular expression conditions). If all checks pass, the preprocessing is successful and the documents are classified and stored according to their research direction. Otherwise, record and report the error log, and the preprocessing fails.

[0065] For pre-processed and identified files, the OnlyOffice plugin allows users to directly edit the document online before performing further pre-processing.

[0066] S112: Perform word segmentation on the received software test document and update the new word library in the multi-level word library based on the word segmentation results.

[0067] It should be noted that the word segmentation process utilizes a Hidden Markov Model, taking the position of a character in a word as the state, and generating an initial probability matrix, a state transition matrix, and an emission probability matrix based on a multi-level lexicon. The input text is used as an observation sequence, and the optimal state sequence is obtained using the Viterbi algorithm. The word segmentation result is then output based on the optimal state sequence.

[0068] It should be noted that, in order to balance retrieval hit rate and word segmentation accuracy in the field of electronic warfare, this embodiment establishes a multi-level thesaurus. The multi-level thesaurus includes: a level-one standard thesaurus, a level-two hot word thesaurus, a level-three new word thesaurus, a level-four synonym thesaurus, and a level-five stop word thesaurus; wherein:

[0069] The first-level standard thesaurus is pre-built by analyzing domain standards and software testing standards. Specifically, it is a 2,000-word electronic warfare equipment software testing standard library with the highest weight, formed by experts in the field of electronic warfare equipment software testing analyzing military standards, engineering standards, military standards in the field of evaluation, and test document system templates.

[0070] The secondary hot word database is dynamically updated based on user search criteria, as well as preset frequency and time thresholds, to improve the success rate of word segmentation for popular online words.

[0071] The Level 3 new lexicon is updated based on the word segmentation results of all successfully preprocessed documents. That is, the software test documents are learned unsupervised through the Hidden Markov and Viterbi algorithms mentioned above. Its lexicon capacity exceeds 5,000 words and belongs to the lexicon of electronic countermeasures equipment software testing field. It can significantly improve the word segmentation accuracy and the success rate of word segmentation of professional terms.

[0072] The fourth-level synonym library and the fifth-level stop word library are updated according to user maintenance. That is, the user customizes and configures multiple synonyms and similarity degrees for the words in the first-level standard word library, the second-level hot word library, and the third-level new word library to improve the retrieval hit rate; the user customizes and configures stop words, including meaningless auxiliary words, modal particles, and interfering word groups, such as "test", "environment", etc., to improve the word segmentation efficiency.

[0073] When performing word segmentation processing, the corpus can choose the first-level standard word library and the second-level hot word library in the multi-level word library as the corpus, or combine the multi-level word library with the general corpus on the Internet. Taking the position of a character in a word as the state, including: the starting position B of a character in a word with more than 1 character, the ending position E of a character in a word with more than 1 character, the middle position M of a character in a word with more than 1 character, and the single-character word S. Exemplarily, "serving the country with loyalty" is represented as BMME, "I" is represented as S, and "China" is represented as BE. Thus, it can be known that a word cannot start with M and B, and the initial probability matrix PI is obtained. Exemplarily, the initial probability matrix PI starting with BMES is set as [0.7, 0, 0, 0.3].

[0074] According to the Markov hypothesis, the state at time t + 1 only depends on the state at time t. Based on the fact that only M or E can follow B, only M or E can follow M, only S or B can follow S, and only S or B can follow E, a 4×4 state transition matrix A is obtained, which represents the probability matrix of the current state transitioning to the next state. According to the fact that the current observation only depends on the current state, an emission probability matrix B is established for the probability of each character in each state.

[0075] The initial state probability matrix PI, the transition probability matrix A, and the emission probability matrix B have all been trained and are known. The input text is used as the observation sequence, and the optimal state sequence (i.e., the one with the maximum probability) is obtained using the Viterbi algorithm, and the word segmentation result is output according to the optimal state sequence.

[0076] When using this word segmentation processing method, only by passing in different input texts, the word segmentation results in different scenarios can be obtained. For example, in the scenarios of word segmentation of software test documents, word segmentation of knowledge entity attributes, and word segmentation of the retrieval conditions input by users.

[0077] Perform word segmentation processing on the received software test documents, and update the new word library in the multi-level word library according to the word segmentation results, including:

[0078] After converting all successfully preprocessed documents into text, use them as input text for word segmentation processing to obtain the word segmentation result. Combine the characters corresponding to the continuous single-character words SS to form new words. If the new words do not exist in the new word library of the multi-level word library, add them to the new word library.

[0079] For example, when the obtained optimal state sequence is BESSBE, the characters corresponding to SS are combined to form a new word.

[0080] S113: Update the IDF model files for each research direction based on the word segmentation results and the research direction to which the document belongs.

[0081] Specifically, based on the stop word library, stop words are removed from the word segmentation results of each document under each research direction;

[0082] The inverse document frequency (IDF) of each word in the segmentation results after removing stop words is calculated using the following formula for each research direction, and the IDF model files for each research direction are composed of each word and its corresponding IDF:

[0083]

[0084] Among them, idf i,j TC is the inverse document frequency of the i-th word in the j-th research direction; i,j Let be the word frequency of the i-th word in the document of the j-th research direction; MC i Let be the number of times the i-th word appears in the built-in corpus.

[0085] It should be noted that the built-in corpus is used for keyword extraction, and the New Era People's Daily word segmentation corpus (NEPD) can be selected.

[0086] Compared to existing technologies, the traditional TF-IDF algorithm calculates IDF by dividing the total number of documents in the corpus by the number of documents containing the current word. This method only calculates the inverse frequency of the current word at the document level, without considering the impact of word frequency on inverse frequency. This embodiment considers a word to have a high frequency in a specific type of text (documents related to a specific research direction) and a low frequency in ordinary text, thus indicating that the word has a high discriminative power for that specific type of text. Therefore, the concept of research direction is incorporated into the IDF calculation, resulting in finer granularity and higher accuracy when applied to keyword extraction.

[0087] It should be noted that after receiving the user-uploaded software test document in step S111 and successfully preprocessing it, all successfully preprocessed documents will undergo word segmentation in step S112. The new lexicon will be updated based on the segmentation results, and the IDF model files for various research directions will be updated in step S113. When multiple users upload simultaneously, or when a user uploads while the lexicon or IDF model file is being updated, the operation status is set to determine whether an update operation can proceed. By recording the number of user uploads and the upload time, once the lexicon and IDF model file are updated, the lexicon and model file for all previously uploaded and successfully preprocessed documents will be updated again based on the latest upload time.

[0088] S114: Parse the preprocessed document to obtain basic data.

[0089] It should be noted that after successful software test document preprocessing, the information in the document is saved in the database to obtain the basic data. This step has no execution order restriction with steps S112 and S113; they can be executed simultaneously or after the update is completed.

[0090] Considering that software testing documentation often includes images of the testing process, the preprocessed documents are separated into text and images and stored separately in the database, including:

[0091] Obtain the document element information of the successfully preprocessed document, determine whether there is image information, if so, extract the image information, assign a unique identifier to the image, insert the identifier at the image location, save the image to the file library, save the document element information and the relationship between the document and the image to the basic database, and generate basic data, including: project, test item, test case and test defect.

[0092] For example, the file library is MiniIO.

[0093] Through the above steps, unstructured document information is converted into structured data and extracted into the basic database, while document templates and image information in the document are saved to the file library.

[0094] S12: Based on the basic data, extract knowledge entities and their attributes periodically, and establish knowledge entities, their attributes, and the relationships between knowledge entities.

[0095] It should be noted that while structuring test data enables retrieval and utilization through techniques such as full-text search and exact match, its low level of intelligence results in low data retrieval rates and slow retrieval speeds. This is due to the requirement for a perfect match between query conditions and data content, the inability to search for synonyms, and the inability to directly analyze long sentences. Transforming structured test knowledge into semi-structured graph data allows for intelligent storage and retrieval of test knowledge in graph form, thereby improving the overall utilization rate of the data.

[0096] In this embodiment, the knowledge graph base G = (E, R) for electronic countermeasures equipment software testing is represented as a triple S = {(h, r, t)}. Each triple consists of a pair of entities h, t ∈ E and their direct relation r ∈ R. (h, r, t) represents an entity pair and a multi-step relation path between them, where p = (h, r... 1 ,r 2 ,…r m (h,t) are the starting / ending entities, r 1 ,r 2,…r m It involves relationships along paths, with each entity described by multiple attributes. Therefore, based on the underlying database, knowledge entities and attributes need to be extracted, and relationships between these entities need to be established.

[0097] Since the data has been saved according to various basic data types in step S11, and these basic data types directly correspond to various knowledge entities in the knowledge graph, and the relevant field information in the basic data is directly mapped to the attributes of the knowledge entities, the extraction process of knowledge entities and attributes includes:

[0098] The knowledge graph database periodically monitors the updates of the basic database, retrieves newly saved structured data from the basic database, and creates corresponding knowledge entity nodes in the graph database according to the corresponding knowledge entity type. It then populates the relevant field information from the structured data into the attributes of the knowledge entity nodes. The knowledge entity nodes include: projects, test items, test cases, and test defects.

[0099] For example, if the knowledge graph database detects a new test defect in the base database, it creates a knowledge entity node for the test defect in the graph database. The knowledge entity node name is the "test defect title" of the test defect in the base database, and other field information, such as test defect description, tester, monitoring personnel, and cause of the problem, is used as the attributes of the knowledge entity node.

[0100] Each project has a unique test item identifier, defect identifier, and test case identifier. When creating knowledge entities and attributes, the relationships between knowledge entities are established based on the association identifiers in the attributes, including:

[0101] Based on the one-to-many relationship between test items and projects, when establishing a test item knowledge entity, the project identifier of the test item is obtained, the corresponding project knowledge entity is retrieved based on the project identifier, and the relationship between the test item knowledge entity and the project knowledge entity is established.

[0102] Based on the one-to-many relationship between test items and test cases, when establishing a test case knowledge entity, the test item identifier associated with the test case is obtained, and the corresponding test item knowledge entity is queried based on the test item identifier. If a test item knowledge entity exists, the relationship between the test case knowledge entity and the test item knowledge entity is established; otherwise, the test case knowledge entity is deleted and the relationship is canceled.

[0103] Based on the many-to-many relationship between test cases and test defects, when creating a test defect knowledge entity, the test case identifier associated with the test defect is obtained. The corresponding test case knowledge entity is queried based on the test case identifier. If a test case entity exists, the relationship between the test defect knowledge entity and the test case knowledge entity is established; otherwise, the test defect knowledge entity is deleted and the relationship is canceled.

[0104] S13: Based on the multi-level thesaurus and IDF model files for various research directions, extract keywords from the attributes of knowledge entities, establish keyword entities and the relationship between keyword entities and knowledge entities, and obtain a knowledge graph.

[0105] It should be noted that, in order to achieve accurate retrieval of test knowledge, keywords are extracted from the attributes of knowledge entities, and keyword entities are built using these keywords. Multiple keywords can be extracted for each piece of test knowledge; a many-to-many relationship is established between keywords and knowledge entities.

[0106] Furthermore, the attributes of knowledge entities are divided into three categories: title, description, and content. Each category has a different weight. The positional weight of keywords extracted from different categories is the attribute category weight of the keyword source. The title includes: test item title, test case title, and test defect title; the description includes: test item description, test item tracking, test case description, and test defect description; the content includes: test item sufficiency, test method, test case input / output / expected results, detailed description of test defects, cause of the problem, and modification method.

[0107] Specifically, based on a multi-level thesaurus and IDF model files for various research directions, keywords are extracted from the attributes of knowledge entities, including:

[0108] 1) Assemble the current text from the attributes of the knowledge entities, perform word segmentation, and remove stop words from the segmentation results to obtain the words to be extracted;

[0109] 2) Based on a multi-level thesaurus, identify the thesaurus to which each word to be extracted belongs. Words belonging to the first-level standard thesaurus or the second-level hot word thesaurus are directly used as keywords. For the remaining words to be extracted, perform the following steps:

[0110] ①The TF frequency of the remaining words to be extracted is obtained based on the number of times each word appears in the current text and the number of times it appears in all successfully preprocessed documents;

[0111] It should be noted that the TF term frequency is calculated using the following formula:

[0112]

[0113] Where, n k,m For the remaining words to be extracted t k In text d m The number of times it appears in ∑ l n k,l For the remaining words to be extracted t k The sum of the number of times it appears in all successfully preprocessed documents.

[0114] ② Based on the IDF model file of the research direction to which the knowledge entity belongs, obtain the IDF inverse document frequency of each remaining word to be extracted;

[0115] It should be noted that if the IDF model file is being updated, the IDF inverse document frequency of the corresponding words will be obtained based on the IDF model file before the update.

[0116] ③ Identify the source attributes and corresponding weights of each remaining word to be extracted, and obtain the position weight and lexicon weight of each remaining word to be extracted based on the lexicon to which each remaining word to be extracted belongs;

[0117] It should be noted that the word obtained after word segmentation is partly determined by the word library and its location source. In this embodiment, default values ​​are set for different levels of word libraries and different attribute sources, which can be adjusted in real time.

[0118] For example, the weight information of the lexicon and attribute positions is shown in Table 1.

[0119] Table 1 Example of Permission Assignment

[0120] Thesaurus Lexicon weight Title weight Describing weights Content weight Level 1 Standard Thesaurus 0.5 1.0 0.5 0.1 Secondary hot word database 0.3 0.5 0.25 0.05 Level 3 New Dictionary 0.1 0.1 0.05 0.01 Level 4 Thesaurus 0.1 0.1 0.05 0.01

[0121] ④ The score for each remaining word to be extracted is obtained by multiplying the TF term frequency, IDF inverse document frequency, position weight, and lexicon weight;

[0122] It should be noted that the scores calculated using four dimensions—TF term frequency, IDF inverse document frequency, lexicon weight, and position weight—reflect not only the importance of the keywords but also the characteristics of the electronic warfare field, while also taking into account the impact of keyword position.

[0123] ⑤ Sort the scores from high to low, and extract the top-scoring words from the remaining words to be extracted as keywords, based on the preset number of words.

[0124] The extracted keywords are used as entity names for retrieval. If they do not exist, a new keyword entity node is created, and a many-to-many relationship is established between the keyword entity node and the knowledge entity. If they already exist, it is further determined whether a relationship between the keyword entity node and the knowledge entity already exists. If no relationship exists, a many-to-many relationship is established between them.

[0125] Based on the above steps, a knowledge graph is constructed, including: knowledge entities and their attributes, relationships between knowledge entities, keyword entities, and the relationship between keywords and knowledge entities.

[0126] Preferably, based on a thesaurus, synonyms of the extracted keywords are obtained; the synonyms are used as entity names for retrieval; when the synonym entity does not exist, a many-to-many relationship is established between the synonym entity and the keyword entity and the synonym entity.

[0127] After the knowledge graph is established, the correlation degree of each node in the knowledge graph is calculated based on the search conditions input by the user, and the search results are returned.

[0128] Specifically, the retrieval process includes:

[0129] ① Obtain the search criteria input by the user, perform word segmentation on the search criteria, and obtain the search terms;

[0130] ② Based on the stop word database, remove stop words from the search terms; based on the thesaurus, obtain synonyms from the search terms and add them to the search terms.

[0131] ③ Perform keyword matching on the search terms in the knowledge graph in sequence to obtain the keywords and the knowledge entities and synonyms associated with the keywords, among which the knowledge entities associated with the keywords are used as search results;

[0132] ④ Summarize the score for each search result based on the weight of the keyword's thesaurus and its position, as well as the similarity of synonyms;

[0133] It should be noted that this embodiment uses the knowledge entity associated with the keyword as the central node, and the keyword and synonyms as the surrounding nodes of the central node, with the second-level path as the boundary. Based on the weight of the keyword and synonyms, as well as the similarity of the synonyms, the surrounding centrality of the central node is calculated as the score of the search result. The calculation formula is as follows:

[0134]

[0135] C C (N p ) = Dict p ×Pos p Formula (4)

[0136] C′ C (N q ) = Dict q ×Pos q ×sim q Formula (5)

[0137] Where g is the number of keywords directly related to the central node C, and r is the number of synonyms of the keywords directly related to C; Dict p The keyword N p The weight of the thesaurus, Pos p The keyword Np Position weight, Dict q It is the weight of the thesaurus, Pos q It is a synonym N q Position weights, sim q This represents the similarity score between synonyms. The positional weight of synonyms can be the same as the positional weight of the associated keywords, or it can be configured custom-to-size.

[0138] For example, when the user inputs the search term "signal interception and processing", the matching keyword entities are signal, interception, and processing. Based on the keyword entities, the associated knowledge entities are obtained, such as... Figure 2 As shown. In Figure 2 The connections between entity nodes in the middle are marked with the thesaurus level to which the keyword belongs, as well as its location source.

[0139] Based on the surrounding centrality algorithm and the weights in Table 1, we obtain... Figure 2 The surrounding centrality of the three test items are as follows:

[0140] Signal processing:

[0141]

[0142] Signal interception:

[0143]

[0144] Full pulse acquisition:

[0145]

[0146] Therefore, the test item "signal interception" which is most relevant to the search criteria scored the highest.

[0147] ⑤ When the number of search results is less than the first threshold, or the number of search results with scores exceeding the score threshold is less than the second threshold, a full-text search is performed to obtain supplementary results and their scores, which are then added to the search results; based on the software testing template, the software testing knowledge corresponding to the search results is displayed in descending order of scores.

[0148] For example, Elasticsearch is used for full-text search.

[0149] Furthermore, after obtaining the search results, the software testing knowledge is restored based on the corresponding software testing template, and the results are fed back to the end user in an intuitive way.

[0150] The specific process includes:

[0151] Based on the search results, obtain the corresponding software test template;

[0152] Based on the fields bound in the software test template, the field content is obtained from the records corresponding to the search results and populated into the software test template; if the field content contains an image identifier, the image information is obtained from the file library and inserted into the software test template to obtain software test knowledge;

[0153] Present software testing knowledge in a visual way.

[0154] Preferably, the knowledge entities and relationships associated with the search result are obtained from the knowledge graph database, and the search result is traced throughout its entire lifecycle.

[0155] While performing searches based on user search criteria, the secondary hot keyword database is updated. The process includes:

[0156] After processing the user's input search criteria by word segmentation and removing stop words, remove words that are already in any word database.

[0157] The system sequentially checks whether the remaining words already exist in the user's habitual phrase cache. If they do, the word frequency is incremented by 1. If the word frequency reaches a preset threshold, the word is added to the secondary hot word library and removed from the user's habitual phrase cache. If the words do not exist, the word is added to the user's habitual phrase cache, and the time is updated.

[0158] Based on the update time of each word in the user's habitual phrase cache, and comparing it with the current time, words that exceed a preset time threshold are removed from the user's habitual phrase cache. For example, words that have not been updated for more than 3 months are deleted from the user's habitual phrase cache.

[0159] Compared with existing technologies, this embodiment provides a knowledge graph construction method based on software testing. It employs template adaptive technology, requiring only the uploading of a new template to the server after each software test document change. The template is then automatically parsed into corresponding HTML using the Unified Modeling Language for Test Documents, while also supporting dynamic binding of database fields. The entire process requires no rewriting of code. It establishes multi-level thesauruses and their respective update and maintenance methods to improve word segmentation accuracy and retrieval hit rate. The method also improves the IDF calculation method by generating IDF models for different research directions during IDF model training for all software test documents. During keyword extraction, the research direction corresponding to the text is extracted, and the corresponding IDF model is used for keyword extraction to improve accuracy. Based on keywords and synonyms, and considering both path quantity and path weight, a surrounding centrality algorithm is proposed for knowledge retrieval and recommendation, improving the relevance of retrieval results and maximizing the utilization of dormant test knowledge.

[0160] Example 2

[0161] Another embodiment of the present invention discloses a knowledge graph construction system based on software testing, thereby implementing the knowledge graph construction method in Embodiment 1. The specific implementation of each module is described in the corresponding description in Embodiment 1. The system includes:

[0162] The word segmentation module is used to segment the input text into words and obtain the segmentation results.

[0163] The document preprocessing module is used to preprocess the received software test documents, call the word segmentation module to obtain word segmentation results, update the new vocabulary in the multi-level vocabulary based on the word segmentation results, and update the IDF model files of various research directions based on the word segmentation results and the research direction to which the document belongs; and parse the preprocessed document to obtain basic data.

[0164] The knowledge graph construction module is used to periodically extract and build knowledge entities and their attributes, as well as the relationships between knowledge entities, based on basic data. According to multi-level thesaurus and IDF model files of various research directions, keywords are extracted from the attributes of knowledge entities, keyword entities and the relationship between keyword entities and knowledge entities are established to obtain the knowledge graph.

[0165] Since the knowledge graph construction system based on software testing disclosed in this embodiment and the aforementioned knowledge graph construction method for software testing are related and can be mutually referenced, this description is redundant and will not be repeated here. Because this system embodiment shares the same principle as the aforementioned method embodiment, it also possesses the corresponding technical effects of the aforementioned method embodiment.

[0166] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0167] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1.A software test-based knowledge graph construction method, characterized in that, The method comprises the following steps: The received software test document is preprocessed and segmented, new word libraries in the multi-level word library are updated according to the segmentation result, and IDF model files of various research directions are updated according to the segmentation result and the research direction to which the document belongs; Based on the basic data, knowledge entities and their attributes are extracted at regular intervals, and the relationship between knowledge entities and their attributes and knowledge entities is established; According to the multi-level word library and the IDF model file of each research direction, keywords are extracted from the attributes of the knowledge entity, keyword entities and the relationship between the keyword entities and the knowledge entities are established, and a knowledge graph is obtained; The multi-level word library comprises a first standard word library, a second hot word library, a third new word library, a fourth synonym library and a fifth stop word library; wherein the first standard word library is preconfigured by analyzing field standards and software test standards; the second hot word library is dynamically updated according to user search conditions and preconfigured number threshold and time threshold; the third new word library is updated according to the segmentation result of all successfully preprocessed documents; the fourth synonym library and the fifth stop word library are updated according to user maintenance; The IDF model file of each research direction is updated according to the segmentation result and the research direction to which the document belongs, comprising: removing stop words from the segmentation result of each document in each research direction based on the stop word library; the inverse document frequency of each word in the segmentation result after removing stop words in each research direction is calculated using the following formula, and each word and the corresponding inverse document frequency form the IDF model file of each research direction: where idf i,j is the inverse document frequency of the ith word in the jth research direction; TC i,j is the term frequency of the ith word in the document of the jth research direction; MC i is the number of times the ith word appears in the built-in corpus. 2.The software test based knowledge graph construction method of claim 1, wherein, The preprocessing of the received software test document comprises: The software test document is parsed to obtain document element information, including: document type, research direction to which the document belongs, total number of table rows, total number of table columns and table cell data; the total number of table rows and the total number of columns are sequentially checked for consistency with the software test template, and the table cell data in the table is checked for whether it meets the constraint conditions of the fields in the software test template; if all checks are passed, the preprocessing is successful, and the document is stored according to the research direction to which it belongs; otherwise, record and feedback error logs, and the preprocessing fails. 3.The software test based knowledge graph construction method of claim 2, wherein, The segmentation processing is to use a hidden Markov model, take the position of a word in a word as a state, generate an initial probability matrix, a state transition matrix and an emission probability matrix based on the multi-level word library; input the text as an observation sequence, and use the Viterbi algorithm to obtain an optimal state sequence, and output the segmentation result according to the optimal state sequence; The position of a word in a word as a state comprises: the starting position B of a word in a word with more than one word, the ending position E of a word in a word with more than one word, the middle position M of a word in a word with more than one word, and the single word S. 4.The software test based knowledge graph construction method of claim 3, wherein, The segmentation processing of the received software test document and the updating of the new word library in the multi-level word library according to the segmentation result comprise: After converting all the successfully preprocessed documents into texts, the texts are subjected to word segmentation processing to obtain word segmentation results, and words corresponding to continuous single-word SS in the word segmentation results are grouped into new words, and if the new words do not exist in a new word library in the multi-level word library, the new words are added to the new word library. 5.The software test based knowledge graph construction method of claim 1, wherein, The key words are extracted from the attributes of the knowledge entity according to the multi-level word library and the IDF model files of the research directions, including: The attributes of the knowledge entity are grouped into the current text, and the text is subjected to word segmentation processing to obtain the to-be-extracted words after removing stop words from the word segmentation results; Based on the multi-level word library, each to-be-extracted word is identified to belong to a word library, and the to-be-extracted words belonging to the first-level standard word library or the second-level hot word library are directly used as the key words, and for the remaining to-be-extracted words, the following steps are performed: The TF word frequency of each remaining to-be-extracted word is obtained according to the number of occurrences of each remaining to-be-extracted word in the current text and the number of occurrences of each remaining to-be-extracted word in all the successfully preprocessed documents; The IDF inverse document frequency of each remaining to-be-extracted word is obtained according to the IDF model file of the research direction to which the knowledge entity belongs; The attributes from which each remaining to-be-extracted word originates and the weights corresponding to the attributes are identified, and the position weight and the word library weight of each remaining to-be-extracted word are obtained according to the word library to which each remaining to-be-extracted word belongs; The score of each remaining to-be-extracted word is obtained according to the product of the TF word frequency, the IDF inverse document frequency, the position weight and the word library weight. The scores are sorted from high to low, and the preset number of words with high scores are extracted from the remaining to-be-extracted words as the key words. 6.The software test based knowledge graph construction method of claim 3, wherein, The extracting of the key words from the attributes of the knowledge entity further includes: obtaining the synonyms of the extracted key words based on a synonym library, establishing a many-to-many relationship between the key word entity and the synonym entity. 7.The software test based knowledge graph construction method of claim 1, wherein, The second-level hot word library is dynamically updated according to the user search condition, and the preset number of times threshold and time threshold, including: The user search condition is subjected to word segmentation processing, and the stop words are removed from the word segmentation results, and the words already in any word library are removed; It is judged in sequence whether the remaining words exist in the user's habit word group cache area, if the words exist, the word frequency of the words is added by 1, if the word frequency reaches the preset number of times threshold, the words are added to the second-level hot word library, and the words are removed from the user's habit word group cache area; if the words do not exist, the words are added to the user's habit word group cache area, and the update time is updated; According to the update time of each word in the user's habit word group cache area and the current time, the words exceeding the preset time threshold are removed from the user's habit word group cache area. 8.A software test based knowledge graph construction system, characterized in that, It includes: A word segmentation processing module is configured to perform word segmentation processing on input texts to obtain word segmentation results; A document preprocessing module is configured to preprocess received software test documents, call the word segmentation processing module to obtain word segmentation results, update a new word library in a multi-level word library according to the word segmentation results, and update IDF model files of various research directions according to the word segmentation results and the research direction to which the documents belong; The basic data is obtained by analyzing the preprocessed document; the multi-level word library comprises a first-level standard word library, a second-level hot word library, a third-level new word library, a fourth-level synonym word library and a fifth-level stop word library; the first-level standard word library is preset by analyzing field standards and software test standards; the second-level hot word library is dynamically updated according to user search conditions, a preset number threshold and a time threshold; the third-level new word library is updated according to the word segmentation results of all successfully preprocessed documents; the fourth-level synonym word library and the fifth-level stop word library are updated according to user maintenance; the IDF model files of each research direction are updated according to the word segmentation results and the research direction to which the document belongs, and the updating comprises: removing stop words from the word segmentation results of each document in each research direction based on the stop word library; calculating the inverse document frequency of each word in the word segmentation results after removing stop words in each research direction by using the following formula, and grouping each word and the corresponding inverse document frequency to form the IDF model files of each research direction: where idf i,j is the inverse document frequency of the ith word in the jth research direction; TC i,j is the term frequency of the ith word in the document of the jth research direction; MC i is the number of times the ith word appears in the built-in corpus. The knowledge graph construction module is configured to extract knowledge entities and attributes at regular time intervals based on the basic data, and establish the knowledge entities, the attributes and the relationships between the knowledge entities; extract keywords from the attributes of the knowledge entities according to the multi-level word library and the IDF model files of each research direction, establish keyword entities and the relationships between the keyword entities and the knowledge entities, and obtain a knowledge graph.

Citation Information

Patent Citations

  • Construction method of knowledge graph for persistent social events

    CN113495951A

  • Intelligent recommendation method based on technical innovation assets as knowledge base

    CN114706989A