Sequence-sensitive API recommendation method based on gated graph neural network
By modeling the API call sequence as directed graphs and using the gated graph neural network model to learn partial order relationships, the problems of poor recommendation accuracy and inability to recommend sequence-sensitive API usage patterns in existing API recommendation methods are solved, and more accurate and practical API recommendations are achieved.
Patent Information
- Application Number
- CN202411852409.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing code-based API recommendation methods have problems with poor recommendation accuracy and the inability to recommend API usage patterns with call order relationships.
Using the sequentially sensitive API recommendation method based on gated graph neural network, a vector representation of each method declaration is generated for API recommendation by modeling the API call sequence as a directed graph and using the gated graph neural network model to learn the partial order relationship between API calls.
It improves the accuracy and practicality of API recommendations, can recommend API usage patterns with call order relationships, and enhances software development efficiency.
Smart Images

Figure CN119781751A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an order-sensitive automatic API recommendation method based on a gated graph neural network, and belongs to the technical field of software engineering and software automation. Background Art
[0002] In the process of modern software development, developers usually use third-party libraries to implement the required functions instead of implementing new systems from scratch. Such libraries expose their functions through application programming interfaces (APIs) and control the interaction with clients through APIs. However, it is not easy to correctly learn and master the usage of APIs: official documents usually only provide API descriptions without detailed example usage, and the content of API documents may be unclear, incomplete or wrong; querying informal sources such as StackOverflow can be time-consuming and error-prone, because the API usage examples found on question-and-answer websites may be of poor quality; in addition, some complex APIs are difficult to learn and master; some studies have shown that developers even spend up to 19% of their programming time searching for source code on the Internet, especially API usage examples.
[0003] In recent years, the problem of automatic recommendation of API function calls and usage patterns has attracted a lot of efforts and attention from the research community. Many API recommendation techniques have been proposed to facilitate the learning process of developers and improve development efficiency. These methods are generally divided into two categories: 1) Query-based API recommendation methods, which accept natural language queries entered by users as input and retrieve and recommend relevant APIs based on the input query statements. However, in practice, these methods have significant defects: first, these methods require developers to explicitly provide precise natural language queries as input, which will bring additional burdens to developers, especially those with insufficient development experience; second, in order to train the model to overcome the semantic gap between natural language and programming language, additional knowledge artifacts will be explicitly required: such as API documents, corpora composed of codes and comments, posts from question-and-answer websites, etc. Therefore, the performance of query-based recommendation methods is largely limited by the length of the input query and unclear, incomplete and erroneous documents or descriptions. 2) Code-based methods, which recommend the next API to be used in a method declaration by considering the surrounding code of the recommendation point as context and the open source code repository as background data. Obviously, this type of method does not require explicit input from the user, nor does it require the support of additional knowledge components. Instead, it automatically provides an API recommendation list during the user programming process based on the relevant API usage information in the open source code. However, among the existing code-based API recommendation methods, the methods based on clustering or prediction models still have problems of high redundancy and poor operating performance, and the methods based on recommendation algorithms (such as collaborative filtering) or neural networks still have significant problems such as low recommendation accuracy and the generated recommendation patterns do not consider the call order. Summary of the invention
[0004] Purpose of the invention: The code-based method automatically provides an API recommendation list during the user programming process based only on the relevant API usage information in the open source code, without requiring explicit user input or the support of additional knowledge components. However, the existing code-based API recommendation algorithms still have significant problems such as poor recommendation accuracy and inability to recommend API usage patterns with call order relationships.
[0005] In view of the problems and shortcomings in the prior art, in order to further improve the accuracy of API recommendation, this paper innovatively proposes an order-sensitive API recommendation method based on gated graph neural network. Based on the open source project code, this method models the extracted API call sequence as a directed graph data structure, and uses the gated graph neural network model to learn the partial order relationship between API calls, and intends to automatically and accurately recommend API usage patterns for the functional implementation of the method declaration being edited by the developer.
[0006] Technical solution: A sequence-sensitive API recommendation method based on gated graph neural network. First, the API call sequence is extracted from the project source code, and the extracted API call sequence is modeled into a directed graph data structure, where each node in the graph represents an API call; then the semantic representation of each API node is initialized using a pre-trained word2vec model, and the ID representation of each graph node is randomly initialized using a separate network layer; then the gated graph neural network (GGNN) model is used to train and learn the vector representation of each graph node (i.e., API node), and the vector representation of each method declaration is obtained through the API sequence representation of each method declaration and the semantic representation of the method itself; finally, the recommendation result is output based on the global preference features (vector representation of method declaration) and local preference features (vector representation of the previous API call) of the context of the API recommendation point. Compared with previous API pattern recommendation methods, this work encodes the calling order of the API sequence into the data structure of a directed graph for the first time, and uses GGNN to train and learn the partial order relationship, which ultimately solves the order problem of each API call in the API recommendation pattern, enhances the accuracy and practicality of the API recommendation pattern, and improves software development efficiency. Specifically, it includes the following steps:
[0007] Step 1: First, statically analyze the target Java project source code to extract the method information and API call sequence information declared in each project;
[0008] Step 2: Model the extracted API call sequence into a directed graph data structure, where each node in the graph represents an API call, and the call order relationship between nodes is encoded in the form of a connection matrix;
[0009] Step 3: For each node in the directed graph, use the pre-trained word2vec model to initialize its text attribute vector representation, and use another independent network layer to initialize its unique node ID vector representation;
[0010] Step 4: Use the gated graph neural network model to train and learn the vector representation of each node in the directed graph, and generate the vector representation of each method declaration based on the API call sequence representation of each method declaration and its text attribute representation;
[0011] Step 5: Generate a recommendation result based on the characteristics of the method declaration at the recommendation point (global preference) and the characteristics of the previous API call (local preference).
[0012] The specific implementation process of step 1 is as follows:
[0013] 11) Using Rascall M 3 Build and traverse the target Java project's abstract syntax tree;
[0014] 12) Analysis of M 3 The method declaration and API call relationship provided by the model. 3 The method declaration data provided by the model contains a<v1,v2> Pair, where v1 and v2 are values representing locations. These locations are uniform resource identifiers that represent artifact identities (also called logical locations) or physical pointers to the corresponding artifacts on the file system (also called physical locations). Declaration relationships map the logical location of an artifact (such as a method) to its physical location. A "method call" relationship maps the logical location of the caller to the logical location of the callee. Based on the caller, all "method call" relationships are classified and organized.
[0015] 13) For each project, output the signature information and API call sequence of all methods declared in it. A method declaration usually consists of a return value (which may be void), a method name, a parameter list (which may be empty), and a method body, where the first three items constitute the method signature. 3 The model provides a method call mapping relationship, which outputs the method signature information of each caller (i.e., declaration) and the callee (i.e., API call sequence) information in its method body.
[0016] In the step 2, the extracted API call sequence is modeled into a data structure of a directed graph, each node in the graph represents a specific API call, the direction of the directed edge in the graph represents the front-end relationship between the API calls, each directed edge is assigned a regularized weight, and then an in-edge adjacency matrix and an out-edge adjacency matrix are generated according to the constructed directed graph, and the connection matrix of the directed graph is obtained by splicing the two adjacency matrices. The specific implementation process of step 2 is: first, the API call is regarded as a node of the directed graph, the API call sequence is regarded as the directed edge in the graph, and the directed graph is constructed according to the front-end order of the API sequence in each method declaration; then, according to the out-degree size of the source point of each directed edge, a regularized weight is assigned to each directed edge, and the weight represents the proportion of each outgoing edge to the total number of outgoing edges; finally, based on the constructed directed graph, the adjacency matrices representing the outgoing and incoming edge information of each graph node, that is, the outgoing edge matrix and the incoming edge matrix, are obtained, and the connection matrix representing the connection information of the entire directed graph is obtained by splicing the two adjacency matrices.
[0017] In step 3, an embedding vector is initialized for each node in the directed graph. In order to more accurately represent the feature information of the graph nodes, in addition to assigning a unique ID identity representation to each node, the text attribute features of each node are also encoded into the embedding representation of the graph node. The specific implementation process of step 3 is: for each node in the directed graph, first use a pre-trained word2vec model skip-gram to initialize its text attribute vector representation, then use another independent network layer to initialize its unique node ID vector representation, and finally obtain the initialization vector representation of each node by splicing these two vector representations.
[0018] In step 4, a gated graph neural network model is used to train and learn the vector representation of each node in the directed graph, and a vector representation of each method declaration is generated based on the API call sequence representation and its text attribute representation of each method declaration. The specific implementation process of step 4 is: first, based on the connection matrix of the constructed directed graph and the calculation mode of the gated graph neural network algorithm, the neighbor node features are aggregated for each initialized graph node, and the node's own feature representation is updated; then, based on the learned feature representation of all API call nodes, the API call sequence representation of the method declaration is constructed; then, in accordance with the method in step 3, the pre-trained skip-gram model is used to generate the text attribute feature representation of each method declaration; finally, the vector representation of each method declaration containing both the call sequence and text attribute features is generated by combining the two feature vectors.
[0019] In step 5, the recommendation result is generated based on the features of the method declaration at the recommendation point (global preference) and the features of the previous API call (local preference). The specific implementation process of step 5 is: first, based on the feature representation of the method declaration at the recommendation point, the global preference features of the recommendation point are generated; then, based on the feature representation of the API call at the previous position of the recommendation point, the local preference features of the recommendation point are generated; based on the global preference and the local preference, the preference feature representation of the recommendation point is generated; finally, based on the preference feature representation of the recommendation point, a prediction score vector of all candidate API calls is generated, and the score vector is processed by the softmax function to finally output a prediction label vector.
[0020] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the order-sensitive API recommendation method based on a gated graph neural network as described above are implemented.
[0021] A computer-readable storage medium stores a computer program for executing the order-sensitive API recommendation method based on a gated graph neural network as described above.
[0022] Compared with the prior art, the present invention has the following advantages:
[0023] 1) The present invention discloses a code-based API recommendation method, which does not require explicit user input or the support of additional knowledge artifacts. It only requires open source code as background data and automatically recommends APIs during the user's development process. Compared with query-based technologies, the present invention can directly help users improve development efficiency.
[0024] 2) This invention models the API call sequence as a directed graph data structure for the first time. By directly encoding the partial order relationship features between API calls, it achieves more accurate feature modeling and more precise API recommendations to help users complete the development and implementation of the current declaration.
[0025] 3) The present invention uses a gated graph neural network to train and learn the order of API call sequences, generates more accurate API vector representation and method declaration vector representation, and realizes the recommendation of API usage patterns with calling order relationships, solving the problem that existing work cannot recommend order-sensitive API usage patterns. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is an overview diagram of an order-sensitive API recommendation method based on a gated graph neural network according to an embodiment of the present invention;
[0027] Figure 2 is a schematic diagram of an API call sequence according to an embodiment of the present invention being modeled as a directed graph;
[0028] Figure 3 It is a schematic diagram of constructing a directed graph as a connection matrix according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The present invention is further explained below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.
[0030] The order-sensitive API recommendation method based on the gated graph neural network aims at a large number of open source projects in the open source software repository (OSS library). First, the API call sequence in each method declaration is extracted; then the extracted API call sequence is modeled as a directed graph data structure, and a connection matrix of the directed graph is constructed; then the vector representation of each graph node (i.e., API call) is learned through the gated graph neural network model, and a vector representation of each method declaration is generated; finally, the preference feature at the recommendation point is generated based on the vector representation of the method declaration at the recommendation point and the vector representation of the last called API, and the final prediction result is calculated and output based on the preference feature. At the same time, in addition to assigning a unique ID feature representation to each graph node, the present invention also uses a pre-trained skip-gram model to learn and generate a text attribute feature representation for each API call, and generates a feature representation of the signature attribute of each method declaration in the same way to achieve a more accurate feature representation. Compared with other code-based API recommendation technologies, the present invention models the API call sequence as a directed graph data structure for the first time, and represents the partial order relationship between API calls as directed edges, thereby achieving a more accurate modeling method and greatly improving the recommendation accuracy. In addition, the present invention uses a gated graph neural network model to train and learn the sequence of API call sequences, generates a more accurate API vector representation and method declaration vector representation, and realizes the recommendation of API usage patterns with call order relationships, solving the problem that existing work cannot recommend order-sensitive API usage patterns.
[0031] This embodiment provides an order-sensitive API recommendation method based on a gated graph neural network, which improves the accuracy of API recommendation and solves the problem that existing work cannot recommend API usage patterns with order relationships. Figure 1 As shown, the specific steps include:
[0032] Step 1: Perform static analysis on the Java project source code to extract the method information and API call sequence information declared in each project. 3 Build and traverse the target Java project's abstract syntax tree and analyze M 3 The method declaration and API call relationship provided by the model. 3The method data provided by the model contains a<v1,v2> Pair, where v1 and v2 are values representing locations. These locations are unified resource identifiers that represent artifact identities (also called logical locations) or physical pointers to corresponding artifacts on the file system (also called physical locations). Declaration relationships map the logical locations of artifacts (such as methods) to their physical locations. "Method call" relationships map the logical location of the caller to the logical location of the callee. Based on the caller, all "method call" relationships are classified and organized. For each project, the signature information and API call sequence of all methods declared in it are output. A method declaration usually consists of a return value (possibly void), a method name, a parameter list (possibly empty), and a method body, where the first three items constitute the method signature. Based on Rascal M 3 The model provides a method call mapping relationship, which outputs the method signature information of each caller (i.e., declaration) and the callee (i.e., API sequence) information in its method body.
[0033] Step 2: Model the extracted API call sequence into a directed graph data structure. Each node in the graph represents an API call, and the call order relationship between nodes is encoded in the form of a connection matrix. The specific implementation process of step 2 is:
[0034] 21) The API call sequence extracted from each method declaration is modeled into a directed graph data structure, where each node in the graph represents a specific API call, and the direction of the directed edge represents the order of the API calls.
[0035] 22) For each method declaration m, the API call sequence involved can be modeled into a directed subgraph G according to the order of calls m =(V m ,E m );V m Represents the subgraph node set, that is, the set of all API calls involved in method m; E m Represents the set of directed edges of the subgraph, that is, the set of contextual relationships between all API calls involved in method m;
[0036] 23) For a directed subgraph G m =(V m ,E m ), each node v∈V m Represents an API call v, each directed edge (v k ,v k+1 )∈E m Represents the API call sequence m in method m seq In the API call v k+1 Followed by v kIt is then called; each directed edge is assigned a normalized weight, and the weight value of each edge is calculated based on the out-degree of the source point of the directed edge. For example, if a vertex v has 3 outgoing edges, the weights of these 3 outgoing edges are all assigned 1 / 3; Figure 2 As shown, the API call sequence on the left can be modeled as a directed graph on the right.
[0037] 24) Based on the constructed directed graph, two adjacency matrices representing outgoing edge information and incoming edge information are generated respectively, and the connection matrix of the entire directed graph is obtained by concatenating the two adjacency matrices; Figure 3 As shown, the connection matrix on the right can be constructed based on the directed graph on the left, and each cell value in the matrix represents the weight of the corresponding edge.
[0038] Step 3: For each node in the directed graph, use the pre-trained word2vec model to initialize its text attribute vector representation, and use another independent network layer to initialize its unique node ID vector representation. The specific implementation process is:
[0039] 31) For each node (i.e., API call) in the graph, its vector representation initialization includes two steps: text attribute feature representation initialization and ID feature representation initialization;
[0040] 32) Extract the text information of the method signature of each API call node v, and use a word segmenter to parse the API declaration name into a set of word sequences w(v) = {w v,1 ,w v,2 ,...,w v,n}, and then use the pre-trained word2vec model to initialize the vector representation of this set of word sequences S(v) = {w v,1 ,w v,2 ,...,w v,n}, and the text attribute embedding representation of the API is obtained by combining the vector representations of all words
[0041]
[0042] The model vec Represents the pre-trained skip-gram model;
[0043] 33) Use another independent network layer to randomly initialize the ID embedding representation of each node Give each node a unique identity;
[0044] 34) Generate the initialization vector representation of each node based on the text attribute embedding and ID feature embedding of each node
[0045]
[0046] 35) The parameters of all network layers involved in this step (such as the parameters of the network layer that generates ID embedding) will be trained and optimized together with the gated graph neural network model introduced below.
[0047] Step 4: Use the gated graph neural network model to train and learn the vector representation of each node in the directed graph, and generate the vector representation of each method declaration based on the API call sequence representation and its text attribute representation of each method declaration. The specific implementation process is:
[0048] 41) Construct outgoing edge matrices according to the directed graph and the in-edge matrix By concatenating two adjacency matrices, we can obtain a connection matrix that represents the connection information of the directed graph. Where n is the size of the vertex set V of the directed graph, such as Figure 3 shown.
[0049] 42) Based on the constructed connection matrix A, for each node v in the graph, the aggregation process of its neighbor node features is calculated as:
[0050]
[0051] in Contains the outgoing and incoming edge information of node v, is the weight matrix, is node v k The vector representation at time t-1 is, Represents the matrix A (out) and A (in) Corresponding to node v k Two rows of . (d is the dimension of the embedding vector, n is the number of graph nodes)
[0052] 43) Based on the constructed connection matrix A, for each node v in the graph, the updating process of its feature vector is calculated as:
[0053]
[0054] Where z and r represent the update gate and reset gate respectively, σ(x) = 1 / (1+e -x ) is the sigmoid activation function, ⊙ is the dot product symbol, W z , U z , W r , U r , W and U are all weight matrices.
[0055] 44) Based on the learned vector representation of all API call nodes, use the self-attention mechanism to aggregate all API calls involved in method m and generate the API sequence representation of method m
[0056]
[0057] Where q, W1 and W2 are weight matrices, σ(x) = 1 / (1+e -x ) is the sigmoid activation function.
[0058] 45) API sequence representation based on method m and text attributes Generate the final vector representation e of method m m :
[0059]
[0060] The text attribute of method m represents It is also initialized by the pre-trained word2vec model.
[0061] Step 5: Generate recommendation results based on the characteristics of the method declaration (global preference) and the characteristics of the previous API call (local preference) at the recommendation point. The specific implementation process is as follows:
[0062] 51) Based on the feature representation of the method declaration of the recommended point obtained in step 4, e m and the feature representation of the API call located one position above the recommendation point Generate preference feature representation of recommendation points
[0063]
[0064] Where W3 represents the weight matrix of a linear layer.
[0065] 52) Preference feature representation based on recommendation points And the feature representations of all candidate API calls, generate the prediction score vector for all candidates
[0066]
[0067] 53) Use the softmax function to process the predicted score vector Generate and output the final label vector
[0068]
[0069] Obviously, those skilled in the art should understand that the various steps of the order-sensitive API recommendation method based on the gated graph neural network of the above-mentioned embodiment of the present invention can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
Claims
1. An order-sensitive API recommendation method based on gated graph neural network, characterized in that: The method includes the following steps: by modeling the API call sequence as a directed graph data structure, a gated graph neural network model is used to learn the partial order relationship between API calls to generate an API recommendation pattern; The following steps are involved: Step 1: Perform static analysis on the target Java project source code to extract the method information and API call sequence information declared in each project; Step 2: Model the extracted API call sequence into a directed graph data structure, where each node in the graph represents an API call, and the call order relationship between nodes is encoded in the form of a connection matrix; Step 3: For each node in the directed graph, use the pre-trained word2vec model to initialize its text attribute vector representation, and use another independent network layer to initialize its unique node ID vector representation; Step 4: Use the gated graph neural network model to train and learn the vector representation of each node in the directed graph, and generate the vector representation of each method declaration based on the API call sequence representation of each method declaration and its text attribute representation; Step 5: Generate a recommendation result based on the characteristics of the method declaration at the recommendation point and the characteristics of the previous API call.
2. The order-sensitive API recommendation method based on gated graph neural network according to claim 1 is characterized in that: The specific implementation process of step 1 is as follows: 11) Using Rascal M 3 Build and traverse the target Java project's abstract syntax tree; 12) Analysis of M 3 The method declaration and API call relationship provided by the model; 13) For each project, output the signature information and API call sequence of all methods declared in it.
3. The order-sensitive API recommendation method based on gated graph neural network according to claim 1 is characterized in that: The specific implementation process of step 2 is as follows: 21) Modeling the API call sequence extracted from each method declaration into a directed graph data structure, where each node in the graph represents a specific API call, and the direction of the directed edge represents the order of the API calls; 22) Each method declaration m, which involves an API call sequence, can be modeled as a directed subgraph G according to the order of calls. m =(V m ,E m );V m Represents the subgraph node set, that is, the set of all API calls involved in method m; E m Represents the set of directed edges of the subgraph, that is, the set of contextual relationships between all API calls involved in method m; 23) For a directed subgraph G m =(V m ,E m ), each node v∈V m Represents an API call, each directed edge (v k ,v k+1 )∈E m Represents the API call sequence m in method m seq In the API call v k+1 Followed by v k It is then called; each directed edge is assigned a regularized weight, and the weight value of each edge is calculated based on the out-degree size of the source point of the directed edge; 24) Based on the constructed directed graph, two adjacency matrices representing outgoing edge information and incoming edge information are generated respectively, and the connection matrix of the entire directed graph is obtained by concatenating the two adjacency matrices.
4. The order-sensitive API recommendation method based on gated graph neural network according to claim 1 is characterized in that: In step 3: 31) For each node in the graph, its vector representation initialization includes two steps: text attribute feature representation initialization and ID feature representation initialization; 32) Extract the text attribute information of each node, use the tokenizer to parse the API declaration name into a set of word sequences, then use the pre-trained word2vec model to initialize the vector representation of this set of word sequences, and obtain the text attribute embedding representation of the API by combining the vector representations of all words 33) Use another independent network layer to randomly initialize the ID embedding representation of each node Give each node an identity feature; 34) Generate the initialization vector representation of each node based on the text attribute embedding and ID feature embedding of each node 5. The order-sensitive API recommendation method based on gated graph neural network according to claim 1 is characterized in that: The step 4 comprises: 41) Construct outgoing edge matrices according to directed graphs and the in-edge matrix By concatenating two adjacency matrices, we can obtain a connection matrix that represents the connection information of the directed graph. Where n is the size of the vertex set V of the directed graph; 42) Based on the constructed connection matrix A, for each node v in the graph, the aggregation process of its neighbor node features is calculated as: in Contains the outgoing and incoming edge information of node v, is the weight matrix, is node v k The vector representation at time t-1 is, Represents the matrix A (out) and A (in) Corresponding to node v k Two lines of; 43) Based on the constructed connection matrix A, for each node v in the graph, the updating process of its feature vector is calculated as: Where z and r represent the update gate and reset gate respectively, σ(x) = 1 / (1+e -x ) is the sigmoid activation function, ⊙ is the dot product symbol; 44) Based on the learned vector representation of all API call nodes, use the self-attention mechanism to aggregate all API calls involved in method m and generate the API sequence representation of method m 45) API sequence representation based on method m and text attributes Generate the final vector representation e of method m m : The text attribute of method m represents It is also initialized by the pre-trained word2vec model.
6. The order-sensitive API recommendation method based on gated graph neural network according to claim 1 is characterized in that: In step 5, based on the features of the method declaration at the recommendation point and the features of the previous API call, a recommendation result is generated; the steps include: 51) The characteristic representation of the method declaration at the base recommendation point m and the feature representation of the API call located one position above the recommendation point Generate preference feature representation of recommendation points 52) Preference feature representation based on recommendation points And the feature representations of all candidate API calls, generate the prediction score vector for all candidates 53) Use the softmax function to process the predicted score vector Generate and output the final label vector 7. The order-sensitive API recommendation method based on gated graph neural network according to claim 2 is characterized in that: In the step 12), analyze M 3 The method declaration and API call relationship provided by the model; 3 The method declaration data provided by the model contains a<v1,v2> Yes, where v1 and v2 are values representing locations; the location is a uniform resource identifier representing a logical location or a physical location; and the declaration relationship maps the logical location of an artifact to its physical location; The "method call" relationship maps the logical position of the caller to the logical position of the callee; based on the caller, all "method call" relationships are classified and organized.
8. The order-sensitive API recommendation method based on gated graph neural network according to claim 2 is characterized in that: In step 13), the signature information and API call sequence of all methods declared by each project are output, and the specific contents are as follows: 131) A method declaration consists of a return value, a method name, a parameter list, and a method body, of which the first three items constitute the method signature; 132) Based on Rascal M 3 The model provides a method call mapping relationship, which outputs the method signature information of each caller and the callee information in its method body.
9. A computer device, characterized in that: The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the order-sensitive API recommendation method based on a gated graph neural network as described in any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the order-sensitive API recommendation method based on a gated graph neural network as described in any one of claims 1-8.
Citation Information
Patent Citations
API recommendation method based on deep learning, code context structure and text information
CN111966817A
Project recommendation method of graph neural network based on directed and undirected structure information
CN114117229A
API recommendation method based on context and graph learning
CN114996567A
Neural time gate time sequence enhancement session recommendation method based on graph neural network
CN117556133A
Context-aware API recommendation method with implicit feedback mechanism
CN117892014A