A method and system for maintaining engineering machinery software
By applying a hierarchical clustering algorithm to build a software hierarchical clustering model in the maintenance of engineering machinery software, the cumbersome and complex problems of the software maintenance process are solved, efficient and accurate software maintenance is achieved, and labor costs and time are saved.
Patent Information
- Application Number
- CN202111418925.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2041-11-26
AI Technical Summary
The maintenance process of engineering machinery software is cumbersome and complex, and depends on the experience of the maintainer, and is inefficient, making it difficult to achieve efficient and accurate software maintenance.
The software code search method based on hierarchical clustering algorithm is adopted to build a software hierarchical clustering model, and code search and maintenance are performed based on functional requirements and modification requests, simplifying the workflow of maintenance personnel.
It realizes the efficiency and accuracy of software maintenance, saves a lot of labor costs and time, and provides convenient and effective methods and directions for software maintenance.
Smart Images

Figure CN114327581B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of engineering machinery, and specifically relates to an engineering machinery software maintenance method and system, and more specifically relates to an engineering machinery software code retrieval method and system based on a hierarchical clustering algorithm. Background Art
[0002] In recent years, construction machinery has developed rapidly, and the digitalization and automation of machinery have become new development trends. The functions of construction machinery are increasing, and the software system is constantly evolving. After the software is delivered and put into operation, users often make new modification requests due to adding new requirements, discovering new software failures, adapting to new environments, etc., and the proportion of software maintenance in the software development cycle is also increasing. The modification requests made by users are usually described in natural language. When performing software maintenance tasks, maintainers first need to assist users in analyzing modification requests, then understand and analyze the software, and then perform modifications based on maintenance requests. The maintenance process is cumbersome and complicated, and requires high experience from maintainers and is inefficient. How to accurately and efficiently perform software maintenance tasks is the key to ensuring the stable operation of construction machinery.
[0003] Cluster analysis is an unsupervised machine learning algorithm that aims to group similar objects into the same cluster and dissimilar objects into different clusters. Hierarchical clustering is a type of clustering algorithm that divides data sets by calculating the similarity between data points of different categories. It uses a "bottom-up" approach to calculate the similarity between two types of data points, combine the two most similar data points among all data points, and iterate this process until the preset number of clusters or certain conditions are reached, generating a clustering hierarchy that meets the requirements. The specific idea of hierarchical clustering is:
[0004] 1) Select some test samples and perform hierarchical cluster analysis on them;
[0005] 2) Calculate the change trend of performance metrics DBI and DI, and combine with manual verification to obtain a suitable number of clusters and the corresponding cluster threshold;
[0006] 3) Use this indicator as the condition for ending clustering, perform cluster analysis on all samples, and select the clustering level that meets the requirements from the analysis results.
[0007] At present, there are many categories in the construction machinery industry. The software development process is function-oriented, and it is difficult to follow the development principle of high cohesion and low coupling. In addition, the difference in programming style between maintainers and developers further increases the difficulty of software maintenance. The maintenance of construction machinery software mainly relies on the maintainer's experience, which cannot achieve efficient and accurate software maintenance.
[0008] In the Chinese invention patent application with publication number CN 104166550A, a method for re-customizing modification requests for software maintenance is proposed, including: pre-processing the modification request to remove redundant parts; using the wordnet tool to perform synonym expansion on the pre-processed modification request as the object of code library matching; extracting useful identifiers in the program, segmenting and storing them; matching the results of the above two steps to remove duplicate information; sorting the results of the previous step according to a specific method to complete the re-customization of the modification request. The method completes the re-customization of the modification request by synonym expansion, matching, and re-sorting the modification request, making the modification request more intuitive and clear, thereby more accurately locating the code segment that needs to be maintained and improving the efficiency of software maintenance. The method focuses on re-customizing the user's modification request and does not involve the specific maintenance method of the software code entity.
[0009] In the Chinese invention patent application with publication number CN102508767A, a software maintenance method based on formal concepts is proposed. First, formal concept analysis technology is used to locate features and identify the class of the corresponding modification request in the source code; then the modification impact analysis is performed on the software to evaluate whether to accept the corresponding modification request; the modification is implemented to perform modification propagation analysis, and finally the modified software is regression tested. This method applies formal concept analysis technology to various software maintenance activities, including feature location, program understanding, modification analysis, regression testing, error location, etc. This method focuses on using formal concepts as an auxiliary tool for various activities in the software maintenance process to provide a reference for actual software maintenance tasks, and does not propose a specific maintenance method for code entities. Summary of the invention
[0010] In response to the above problems, the present invention proposes a method and system for engineering machinery software maintenance, which can simplify the process of maintenance personnel understanding the software, analyzing the program, and then performing modification work, saving a lot of manpower costs and time, and providing a convenient and effective method and direction for software maintenance.
[0011] In order to achieve the above technical objectives and the above technical effects, the present invention is implemented through the following technical solutions:
[0012] In a first aspect, the present invention provides a method for maintaining engineering machinery software, comprising:
[0013] Based on functional requirements, a software hierarchical clustering model is constructed;
[0014] Retrieving corresponding software code entities based on the modification request and the software hierarchical clustering model;
[0015] Based on the retrieved software code entities, the hierarchical clustering model is maintained.
[0016] Optionally, the method for constructing the software hierarchical clustering model includes:
[0017] Preprocess the functional requirements to obtain valid eigenvalues;
[0018] constructing a function description vector based on the eigenvalue or the combination of eigenvalues;
[0019] Use TF weights to calculate the weights in the function description vector corresponding to each eigenvalue and obtain the vector representation of each function;
[0020] Based on the vector representation of each function, a hierarchical clustering algorithm is applied to transform the functions into a functional hierarchy;
[0021] Obtain the mapping relationship between functions and software code entities;
[0022] The software hierarchical clustering model is obtained by combining the mapping relationship between the functions and the software code entities and the functional hierarchy.
[0023] Optionally, the method for acquiring the mapping relationship between the function and the software code entity includes:
[0024] Design usage scenarios for each function;
[0025] Insert and recompile the software code entity to obtain executable target code;
[0026] Execute the usage scenario of each function, and the executable target code triggers the software code entity that each function depends on, and obtains the mapping relationship between the function and the software code entity.
[0027] Optionally, the functional hierarchy structure includes several functional levels, each functional level includes several functional nodes; and the method for obtaining the software hierarchical clustering model includes:
[0028] A specific supporting structure is established between functional levels. For the functional nodes at the bottom of the structure, the software code entity belonging to each functional node is the specific code part of all functions of each functional node, and the software code entity of the upper parent node of each functional node is the supporting code part associated with the upper parent node. The supporting code part is a software code entity shared between the functional nodes.
[0029] Optionally, the method for constructing the specific support structure includes:
[0030] Performing an XOR operation on all software code entities related to the functions at the bottom layer of the functional hierarchy to obtain a specific software code entity specific to the functions at the lowest layer of the functional hierarchy, that is, a specific code portion;
[0031] The supporting code parts of all functions are calculated through continuous iterative propagation. The initial value of the supporting code part is the intersection of the software code entities of all the lowest-level function nodes in the function hierarchy. For two consecutive function levels, the initial value of the supporting code part of the function node of the previous level is obtained by the intersection operation of the next level; at the same time, the final value of the software code entity contained in the supporting code part of the function node of the next level is obtained by subtracting the initial value of the supporting code part of the previous level from the initial value;
[0032] After the above calculations, each node in the functional hierarchy is mapped to a set of software code entities.
[0033] Optionally, the calculation formula of the TF weight is:
[0034]
[0035] Among them, ω i (i=1,2,…,t) is the weight of the i-th eigenvalue in the function description vector, freq i is the number of times the i-th eigenvalue appears in the functional requirement, and maxfreq is the maximum number of times the eigenvalue appears in the functional requirement.
[0036] Optionally, the retrieving corresponding software codes based on the modification request and the software hierarchical clustering model specifically includes:
[0037] Pre-process the modification request, extract valid keywords in the modification request, and expand and search the keywords;
[0038] Matching the keywords obtained through preprocessing with the feature values or feature value combinations obtained through preprocessing of the functional requirements;
[0039] If the keyword is a characteristic value in the functional requirement, the keyword is converted into the corresponding characteristic value in the functional requirement;
[0040] If the keyword is not a feature value in the functional requirement, it is associated with the corresponding feature value in the functional requirement according to the semantic relevance;
[0041] Constructing a query vector based on the keywords obtained through preprocessing;
[0042] Use TF weight to calculate the weight of the feature value of each keyword after matching in the corresponding vector, and convert the query vector into a TF weight vector;
[0043] Based on the TF weight vector and the preset semantic search strategy, the software hierarchical clustering model is searched to obtain the corresponding software code.
[0044] Optionally, the retrieval of the software hierarchical clustering model based on the TF weight vector and a preset semantic retrieval strategy to obtain the corresponding software code is specifically as follows:
[0045] Evaluate the semantic relevance of the keyword feature vector to the TF weight vector, and sort the TF weight vectors from large to small according to the semantic relevance;
[0046] Calculate the cosine similarity of the currently unretrieved TF weight vector with the highest semantic relevance with the nodes in the software hierarchical clustering model from high to low, and put the code entity corresponding to the functional node with the highest cosine similarity into the result set of TF weight vector retrieval;
[0047] Manually screen and judge the software code entities in the result set to obtain the final code entity queried by the current search conditions.
[0048] Optionally, maintaining the hierarchical clustering model based on the retrieved software code is specifically:
[0049] For software maintenance modification requests of the error correction type, only the specific code part corresponding to the function in the search results is modified;
[0050] For software maintenance and modification requests of the function addition type, it is necessary to calculate the specific code part and the supporting code part in the newly added function code entity, and add the specific code part to the corresponding hierarchical structure based on the search results before maintenance;
[0051] For software maintenance and modification requests of the function deletion type, it is necessary to determine whether the function node corresponding to the function in the software hierarchy is the lowest-level function node based on the search results. If it is not the lowest-level function node, delete it directly; if it is a lowest-level function node, it is necessary to delete the specific code part in the software code entity of the function node.
[0052] In a second aspect, the present invention provides an engineering machinery software maintenance system, comprising:
[0053] A building module is used to build a software hierarchical clustering model based on functional requirements;
[0054] A retrieval module, used to retrieve corresponding software code entities based on the modification request and the software hierarchical clustering model;
[0055] A maintenance module is used to maintain the hierarchical clustering model based on the retrieved software code entities.
[0056] Compared with the prior art, the present invention has the following beneficial effects:
[0057] The present invention uses semantic information in the description of software functional requirements as an aid, and adopts semantic hierarchical clustering technology to convert the code into a hierarchical structure suitable for retrieval, thereby realizing a code hierarchical clustering model. The key semantic information in the maintenance request is extracted, and the software code is retrieved using a retrieval algorithm, and the results of the software code maintenance are updated to the software hierarchical clustering model to ensure that the software model can be continuously updated as the software runs. The present invention uses a hierarchical clustering algorithm to obtain the high-level logic of the software function implementation, and combines the dynamic mapping of the source code and the function to ultimately realize the hierarchical decomposition and division of the software source code. Through a retrieval method based on the semantic information of the modification request, the location of the relevant code is realized, which simplifies the process of maintenance personnel understanding the software, analyzing the program, and then performing the modification work, saving a lot of manpower costs and time, and providing a convenient and effective method and direction for software maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments and in conjunction with the accompanying drawings, wherein:
[0059] Figure 1 A schematic diagram of the process of constructing a software hierarchical clustering model of the present invention;
[0060] Figure 2 It is a structural schematic diagram of the software retrieval system of the present invention;
[0061] Figure 3 Schematic diagram of the workflow of the keyword expansion module of the present invention;
[0062] Figure 4 Schematic diagram of the workflow of the semantic retrieval module of the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the scope of protection of the present invention.
[0064] The application principle of the present invention is described in detail below in conjunction with the accompanying drawings.
[0065] Example 1
[0066] The present invention provides a method for maintaining engineering machinery software, comprising the following steps:
[0067] Step (1) construct a software hierarchical clustering model based on functional requirements;
[0068] Step (2) retrieves corresponding software code based on the modification request and the software hierarchical clustering model;
[0069] Step (3) maintains the hierarchical clustering model based on the retrieved software code.
[0070] In a specific implementation of the embodiment of the present invention, the method for constructing the software hierarchical clustering model includes:
[0071] (101) Preprocess the functional requirements to obtain valid feature values; specifically: apply the basic rules of text preprocessing in information retrieval technology to convert the functional requirements description expressed in natural language into a standard text of verb plus name or noun plus verb; use the word segmentation tool to segment the standard text to obtain the feature values of the entire functional requirements description. In order to improve the accuracy of subsequent hierarchical clustering, two interference factors need to be considered: one is the case of English letters. For the convenience of processing, this method converts English letters into uppercase; the other is to use symbols such as "()", "-", "," " / ", "&" as stop words to obtain valid feature values.
[0072] (102) Based on the eigenvalue or the combination of eigenvalues, construct a function description vector; specifically, the function description vector is used to express each function in the function requirement description, and the expression of the function description vector is: Where: t is the number of all feature words; ω i (i=1,2,…,) is the i-th eigenvalue in the function description vector The weight in
[0073] (103) Use TF weight to calculate the weight of each eigenvalue in the corresponding function description vector; the calculation formula is:
[0074]
[0075] Among them, freq i is the number of times the i-th eigenvalue appears in the functional requirement, and maxfreq is the maximum number of times the eigenvalue appears in the functional requirement.
[0076] (104) After obtaining the vector representation of each function, a hierarchical clustering algorithm is applied to convert the function into a hierarchical structure; specifically, the hierarchical clustering algorithm is an iterative process, which repeatedly clusters the data to form a series of nested clusters, and selects the appropriate hierarchical cluster as the final result. In the embodiment of the present invention, a bottom-up strategy is adopted, each function is regarded as a minimum cluster, the two most similar clusters are found to be merged into a new cluster, and the cluster and other clusters are used as inputs for the next round of clustering calculations, and this step is repeated until a preset number or end condition is reached, thereby obtaining a functional hierarchy. The end condition refers to the calculation of the change trend of the test sample distance-related performance metrics DBI and DI during the cluster analysis process, combined with the appropriate number of clusters and the corresponding distance threshold obtained by manual verification. Therefore, the key to cluster analysis is how to calculate the distance between two clusters. For cluster C i and C j , the distance can be calculated in the following three ways:
[0077] Minimum distance:
[0078] Maximum distance:
[0079] Average distance:
[0080] Among them, x and z represent clusters C respectively. i and C j samples, dist(x,z) represents the distance between samples x and z.
[0081] The minimum distance is determined by the closest elements of the two clusters, the maximum distance is determined by the farthest elements of the two clusters, and the average distance depends on all elements of the two clusters;
[0082] (105) Obtaining a mapping relationship between functions and software code entities; specifically: designing a usage scenario for each function;
[0083] The software code entity is inserted and recompiled to obtain executable target code; each usage scenario is executed, and the executable target code triggers the software code entity that each function depends on, and the mapping relationship between the function and the software code entity is obtained.
[0084] (106) Combining the mapping relationship between the functions and the software code entities and the hierarchical structure, a software hierarchical clustering model is obtained; specifically, the functional hierarchical structure includes a plurality of functional levels, each functional level includes a plurality of functional nodes; the method for obtaining the software hierarchical clustering model includes:
[0085] A specific supporting structure is established between functional levels. For the functional nodes at the bottom of the structure, the software code entity belonging to each functional node is the specific code part of all functions of each functional node, and the software code entity of the upper parent node of each functional node is the supporting code part associated with the upper parent node. The supporting code part is a software code entity shared between the functional nodes.
[0086] First, performing an XOR operation on all software code entities related to the functions at the bottom layer of the functional hierarchy to obtain a specific software code entity specific to the functions at the lowest layer of the functional hierarchy, i.e., a specific code portion;
[0087] Secondly, the supporting code parts of all functions are calculated through continuous iterative propagation. The initial value of the supporting code part is the intersection of all the lowest level function code entities in the function hierarchy. For two consecutive function levels, the initial value of the supporting part of the function node of the previous level can also be obtained through the intersection operation of the next level. At the same time, the final value of the code entity contained in the supporting part of the function node of the next level can be obtained by subtracting the initial value of the supporting part of the previous level from the initial value.
[0088] After the above calculations, each node in the functional hierarchy is mapped to a set of software code entities.
[0089] In a specific implementation of the embodiment of the present invention, the retrieving corresponding software code based on the modification request and the software hierarchical clustering model specifically includes:
[0090] Pre-process the modification request, extract valid keywords in the modification request, and expand and search the keywords;
[0091] Match the keywords obtained through preprocessing with the feature values obtained through preprocessing of the functional requirements;
[0092] If the keyword is a characteristic value in the functional requirement, the keyword is converted into the corresponding characteristic value in the functional requirement;
[0093] If the keyword is not a feature value in the functional requirement, the keyword is expanded by associating it with the corresponding feature value in the functional requirement according to the semantic relevance;
[0094] A query vector is constructed based on the keywords obtained through preprocessing. Specifically, a query vector of the modification request is constructed using a method similar to that of constructing a function description vector to express the key information in the modification request. The expression of the query vector is: Where: t is the number of all feature values and extended keywords; is the ith eigenvalue in the function vector The weight in , if If it is an extended keyword, it is 0.
[0095] Use TF weight to calculate the weight of the feature value after each keyword is matched in the corresponding query vector, and convert the query vector into a TF weight vector;
[0096] Based on the TF weight vector and the preset semantic search strategy, the software hierarchical clustering model is searched to obtain the corresponding software code.
[0097] The software hierarchical clustering model is retrieved based on the TF weight vector and the preset semantic retrieval strategy to obtain the corresponding software code, specifically:
[0098] a) evaluating the semantic relevance of the keyword feature vector on the TF weight vector, and sorting the TF weight vector from high to low according to the semantic relevance;
[0099] b) Calculate the cosine similarity of the TF weight vector with the highest correlation that is not currently searched with the nodes in the model from high to low; put the software code entity corresponding to the node with the highest cosine similarity into the result set of the search condition;
[0100] c) Manually screen and judge the code entities in the result set to obtain the final code entity queried by the current search conditions;
[0101] d) Determine whether there are any unsearched conditions. If so, go to step b); otherwise, terminate the query.
[0102] In a specific implementation of the embodiment of the present invention, maintaining the hierarchical clustering model based on the retrieved software code is specifically:
[0103] For software maintenance such as error correction, only the specific code part corresponding to the corresponding function in the search results is modified;
[0104] For software codes with added functions, it is necessary to calculate the specific code and supporting code of the newly added functions, and add the specific code to the corresponding hierarchical structure based on the search results before maintenance;
[0105] For software maintenance of the function deletion type, determine whether the node corresponding to the functional feature in the model is the lowest-level functional code. If it is not a bottom-level functional node, it can be deleted directly; if it is a bottom-level functional node, it is necessary to delete the specific code part in the function node code entity.
[0106] Combine the following Figure 1-4 The specific process of the method in the embodiment of the present invention is described in detail.
[0107] The specific embodiments of the present invention are further described below in conjunction with the accompanying drawings:
[0108] Figure 1 The following is a flow chart of the software hierarchical clustering model construction method of the present invention. The whole process is performed according to the following steps:
[0109] 1) At the beginning of the process, the functional requirement description text is preprocessed to obtain all functional characteristic values and characteristic value combinations;
[0110] 2) Convert all functional descriptions into vectors based on all functional feature values obtained;
[0111] 3) Perform TF weight calculation and convert the function description vector into a TF weight vector;
[0112] 4) Adopt a bottom-up clustering strategy to continuously perform clustering calculations on the TF weight vector;
[0113] 5) Use the clustering quality factor corresponding to each iterative clustering result as an indicator to determine whether the expected goal has been achieved;
[0114] 6) If the expected goal is achieved, manual adjustments are made to obtain the final functional requirements hierarchy;
[0115] 7) Insert and compile the code entity according to the functional usage scenario to obtain the mapping relationship between the function and the code;
[0116] 8) Use the above information to restore the hierarchical structure of the code and establish a software hierarchical clustering model.
[0117] Figure 2 It is a flow chart of the software maintenance system of the present invention, which mainly includes a software hierarchical clustering model, a software model maintenance module, a keyword expansion module, a semantic retrieval module, etc.
[0118] Figure 3 The following is a schematic diagram of the workflow of the keyword expansion module of the present invention. The entire working process is performed according to the following steps:
[0119] 1) Preprocess the collected modification requests and extract keywords;
[0120] 2) Match the keywords with the corresponding feature values in the functional requirements;
[0121] 3) If the keyword in the modification request is not a feature value in the functional requirement description, it needs to be expanded by the maintenance personnel, and the expanded content is sorted according to semantic relevance;
[0122] 4) Constructing the query vector of the maintenance request according to the method of function vector conversion in the code hierarchical clustering model;
[0123] 5) Perform TF weight calculation to convert the query vector into a TF weight vector;
[0124] 6) Obtain the search conditions after keyword expansion.
[0125] Figure 4 The following is a schematic diagram of the workflow of the semantic search module of the present invention. The entire working process is performed according to the following steps:
[0126] 1) Search the code hierarchical clustering model according to the semantic relevance of the search conditions output by the keyword expansion module, sorting from large to small;
[0127] 2) Obtain preliminary software code retrieval results;
[0128] 3) Manually organize the preliminary results of code retrieval to obtain the final software code retrieval results.
[0129] Example 2
[0130] Based on the same inventive concept as that of Embodiment 1, the present invention provides an engineering machinery software maintenance system, comprising:
[0131] A building module is used to build a software hierarchical clustering model based on functional requirements;
[0132] A retrieval module, used to retrieve corresponding software codes based on the modification request and the software hierarchical clustering model;
[0133] A maintenance module is used to maintain the hierarchical clustering model based on the retrieved software code.
[0134] The rest are the same as in Example 1.
[0135] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A method for maintaining engineering machinery software, characterized in that: include: Based on functional requirements, a software hierarchical clustering model is constructed; Retrieving corresponding software code entities based on the modification request and the software hierarchical clustering model; Maintaining the hierarchical clustering model based on the retrieved software code entities; The method for constructing the software hierarchical clustering model includes: Preprocess the functional requirements to obtain valid eigenvalues; Based on the eigenvalues or the combination of eigenvalues, construct a function description vector; Use TF weights to calculate the weights in the function description vector corresponding to each eigenvalue and obtain the vector representation of each function; Based on the vector representation of each function, a hierarchical clustering algorithm is applied to transform the functions into a functional hierarchy; Obtain the mapping relationship between functions and software code entities; Combining the mapping relationship between the functions and the software code entities and the functional hierarchy structure, a software hierarchical clustering model is obtained; The retrieving corresponding software codes based on the modification request and the software hierarchical clustering model specifically includes: preprocessing the modification request, extracting valid keywords in the modification request, and expanding and searching the keywords; Matching the keywords obtained through preprocessing with the feature values or feature value combinations obtained through preprocessing of the functional requirements; If the keyword is a feature value in the functional requirement, the keyword is converted into the feature value corresponding to the functional requirement; if the keyword is not a feature value in the functional requirement, it is associated with the feature value corresponding to the functional requirement according to the semantic relevance; Constructing a query vector based on the keywords obtained through preprocessing; Use TF weight to calculate the weight of the feature value of each keyword after matching in the corresponding vector, and convert the query vector into a TF weight vector; Based on the TF weight vector and a preset semantic search strategy, a software hierarchical clustering model is searched to obtain corresponding software codes; The maintaining of the hierarchical clustering model based on the retrieved software code is specifically as follows: For software maintenance and modification requests of the error correction type, only the specific code part corresponding to the function in the search results is modified; for software maintenance and modification requests of the function addition type, the specific code part and the supporting code part in the newly added function code entity need to be calculated, and the specific code part is added to the corresponding hierarchical structure according to the search results before maintenance; For software maintenance and modification requests of the function deletion type, it is necessary to determine whether the function node corresponding to the function in the software hierarchy is the lowest-level function node based on the search results. If it is not the lowest-level function node, delete it directly; if it is a lowest-level function node, it is necessary to delete the specific code part in the software code entity of the function node.
2. A method for maintaining engineering machinery software according to claim 1, characterized in that: The method for obtaining the mapping relationship between the function and the software code entity includes: Design usage scenarios for each function; Insert and recompile the software code entity to obtain executable target code; Execute the usage scenario of each function, and the executable target code triggers the software code entity that each function depends on, and obtains the mapping relationship between the function and the software code entity.
3. The method for maintaining engineering machinery software according to claim 1, characterized in that: The functional hierarchy structure includes several functional levels, each of which includes several functional nodes; the method for obtaining the software hierarchical clustering model includes: A specific supporting structure is established between functional levels. For the functional nodes at the bottom of the structure, the software code entity belonging to each functional node is the specific code part of all functions of each functional node, and the software code entity of the upper parent node of each functional node is the supporting code part associated with the upper parent node. The supporting code part is a software code entity shared between the functional nodes.
4. A method for maintaining engineering machinery software according to claim 3, characterized in that: The method for constructing the specific support structure comprises: Performing an XOR operation on all software code entities related to the functions at the bottom layer of the functional hierarchy to obtain a specific software code entity specific to the functions at the lowest layer of the functional hierarchy, that is, a specific code portion; The supporting code parts of all functions are calculated through continuous iterative propagation. The initial value of the supporting code part is the intersection of the software code entities of all the lowest-level function nodes in the function hierarchy. For two consecutive function levels, the initial value of the supporting code part of the function node of the previous level is obtained by the intersection operation of the next level; at the same time, the final value of the software code entity contained in the supporting code part of the function node of the next level is obtained by subtracting the initial value of the supporting code part of the previous level from the initial value; After the above calculations, each node in the functional hierarchy is mapped to a set of software code entities.
5. The method for maintaining engineering machinery software according to claim 1, characterized in that: The calculation formula of the TF weight is: Among them, ω i (i=1,2,…,t) is the weight of the i-th eigenvalue in the function description vector, freq i is the number of times the i-th eigenvalue appears in the functional requirement, and maxfreq is the maximum number of times the eigenvalue appears in the functional requirement.
6. The method for maintaining engineering machinery software according to claim 1, characterized in that: The software hierarchical clustering model is retrieved based on the TF weight vector and the preset semantic retrieval strategy to obtain the corresponding software code, specifically: Evaluate the semantic relevance of the keyword feature vector to the TF weight vector, and sort the TF weight vectors from large to small according to the semantic relevance; Calculate the cosine similarity of the currently unretrieved TF weight vector with the highest semantic relevance with the nodes in the software hierarchical clustering model from high to low, and put the code entity corresponding to the functional node with the highest cosine similarity into the result set of TF weight vector retrieval; Manually screen and judge the software code entities in the result set to obtain the final code entity queried by the current search conditions.
7. A construction machinery software maintenance system, characterized in that: include: A building module is used to build a software hierarchical clustering model based on functional requirements; A retrieval module, used to retrieve corresponding software code entities based on the modification request and the software hierarchical clustering model; A maintenance module, used for maintaining the hierarchical clustering model based on the retrieved software code entities; The method for constructing the software hierarchical clustering model includes: Preprocess the functional requirements to obtain valid eigenvalues; Based on the eigenvalues or the combination of eigenvalues, construct a function description vector; Use TF weights to calculate the weights in the function description vector corresponding to each eigenvalue and obtain the vector representation of each function; Based on the vector representation of each function, a hierarchical clustering algorithm is applied to transform the functions into a functional hierarchy; Obtain the mapping relationship between functions and software code entities; Combining the mapping relationship between the functions and the software code entities and the functional hierarchy structure, a software hierarchical clustering model is obtained; The retrieving corresponding software codes based on the modification request and the software hierarchical clustering model specifically includes: preprocessing the modification request, extracting valid keywords in the modification request, and expanding and searching the keywords; Matching the keywords obtained through preprocessing with the feature values or feature value combinations obtained through preprocessing of the functional requirements; If the keyword is a feature value in the functional requirement, the keyword is converted into the feature value corresponding to the functional requirement; if the keyword is not a feature value in the functional requirement, it is associated with the feature value corresponding to the functional requirement according to the semantic relevance; Constructing a query vector based on the keywords obtained through preprocessing; Use TF weight to calculate the weight of the feature value of each keyword after matching in the corresponding vector, and convert the query vector into a TF weight vector; Based on the TF weight vector and a preset semantic search strategy, a software hierarchical clustering model is searched to obtain corresponding software codes; The maintaining of the hierarchical clustering model based on the retrieved software code is specifically as follows: For software maintenance and modification requests of the error correction type, only the specific code part corresponding to the function in the search results is modified; for software maintenance and modification requests of the function addition type, the specific code part and the supporting code part in the newly added function code entity need to be calculated, and the specific code part is added to the corresponding hierarchical structure according to the search results before maintenance; For software maintenance and modification requests of the function deletion type, it is necessary to determine whether the function node corresponding to the function in the software hierarchy is the lowest-level function node based on the search results. If it is not the lowest-level function node, delete it directly; if it is a lowest-level function node, it is necessary to delete the specific code part in the software code entity of the function node.
Citation Information
Patent Citations
Software maintenance method based on formal concept analysis
CN102508767A
Software maintenance oriented method for re-customizing modification request
CN104166550A
Software refactoring method through clustering
CN103559025A
Object software oriented automatic refactoring method
CN106484401A