Knowledge graph explanatory text generation method based on graph neural network hierarchical structure
Through the hierarchical structure of graph neural networks, combined with embedding layers, multi-head self-attention mechanisms and long short-term memory networks, hierarchical text descriptions are generated from nodes to subgraphs to the entire graph, which solves the problem of insufficient expression of graph hierarchical structures and realizes efficient graph explanatory text generation.
Patent Information
- Application Number
- CN202411973613.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-12-30
AI Technical Summary
Existing graph data text generation methods lack the ability to accurately express the graph hierarchy, resulting in insufficient interpretability of the generated text, especially in high-risk fields such as medicine, finance, and education.
A method based on the hierarchical structure of graph neural networks is adopted. Through embedding layers, multi-head self-attention mechanism and long short-term memory network, hierarchical text descriptions from nodes to subgraphs to the entire graph are generated. The K-means algorithm is used to divide the subgraphs and perform pooling operations, and the cross-entropy loss is combined to optimize the training process.
The generated text is highly organized and coherent, accurately conveying the structural information of the graph, enhancing the transparency and interpretability of the model, and can explain in detail the important role of nodes and subgraphs, thereby improving the richness and accuracy of the graph description.
Smart Images

Figure CN119918511B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, intelligent system, and program product for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure. Background Art
[0002] With the continuous expansion of graph data applications across various fields, graph neural networks have become a core tool for analyzing and processing graph data. Graph data is a typical non-Euclidean data structure consisting of nodes and edges. It has been widely used in fields such as knowledge graphs, social networks, molecular graphs, and recommender systems. Traditional machine learning methods, such as convolutional neural networks and recurrent neural networks, have certain limitations when processing graph data because these methods generally assume that the data is regular (such as the grid structure of images or text data), while graph data has a more flexible and complex structure.
[0003] With the maturity of graph neural network technology, the representation learning capabilities of graphs have gradually expanded and improved. However, how to combine graph learning with natural language generation technology, especially expressing the structure and semantics of graphs through text descriptions generated by graphs, is still a forward-looking technology research direction.
[0004] In recent years, deep learning-based text generation models have made significant progress, particularly in text generation techniques based on recurrent neural networks and long short-term memory networks. Natural language generation, a key research area in natural language processing, aims to generate natural language descriptions from structured data. Currently, by converting input feature vectors into natural language text, long short-term memory network models have been widely used in tasks such as dialogue systems, text summarization, and image description generation.
[0005] Through summary, this patent found that the main shortcomings of graph structure text generation technology include:
[0006] Graph data typically has a complex hierarchical structure, encompassing nodes, edges, subgraphs, and the entire graph. When generating descriptive text for a graph, accurately converting this hierarchical information into structured text remains a challenge. Existing text generation methods often lack the ability to handle this hierarchical structure, resulting in explanatory text that often provides only simplistic descriptions of a single node or edge, lacking a descriptive language for the entire graph—in other words, a lack of a hierarchical representation of the graph structure.
[0007] Interpretability is a crucial factor in the processing and analysis of graph data. This is especially true in high-risk fields such as medicine, finance, and education. The generated text for graphs must provide detailed explanations to help users understand the model's generation process and decision-making outcomes. Existing technologies for generating explanatory text for graphs often fail to fully consider the transparency and interpretability of the generation process.
[0008] In short, the relationships between nodes and edges in the science and technology map structure are complex and changeable. How to accurately and clearly express these complex relationships in textual form to ensure that the generated text has high coherence and readability, as well as transparency and explainability, is still a technical problem that needs to be solved urgently. Summary of the Invention
[0009] The present invention provides a method, intelligent system and program for generating explanatory text from a knowledge graph based on a hierarchical structure of a graph neural network, to solve the difficult problems existing in the above-mentioned prior art.
[0010] To achieve the above objectives, the present invention provides a method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure, comprising the following steps:
[0011] Input a graph and its corresponding node features, edge features, and adjacency matrix, convert the node features and edge features into vectors respectively, fuse the node features and edge features represented by the vectors to obtain a fused vector having node information and corresponding edge information, and encode the fused vector;
[0012] The input graph is divided into multiple subgraphs, and pooling operations are performed on the divided subgraphs and the input graph respectively to obtain the feature vector corresponding to each subgraph and the feature vector of the entire graph;
[0013] Decode the encoded fusion vector, the feature vector corresponding to each subgraph, and the full graph feature vector respectively to obtain the node text corresponding to the fusion vector, the subgraph text corresponding to each subgraph feature vector, and the full graph text corresponding to the full graph feature vector;
[0014] The node text, each subgraph text, and the full graph text are sequentially generated into a total graph explanation text to form a graph explanation text with a hierarchical structure.
[0015] In some embodiments, encoding the fusion vector comprises the following steps:
[0016] According to the adjacency matrix, the features of each node of the fusion vector and the features of its neighboring nodes are weighted summed multiple times, and the results of each weighted summation are spliced, and the spliced linear transformation is mapped to the target dimensional space.
[0017] In some embodiments, after performing weighted summation on the features of each node of the fusion vector and the features of its neighboring nodes, the result of the weighted summation is further transformed through a feedforward network.
[0018] In some embodiments, the feedforward network includes two linear transformation layers and an activation function layer; the result after each weighted summation is sequentially processed by the first layer linear transformation, the activation function layer, and the second layer linear transformation before being output.
[0019] In some embodiments, before the result after each weighted summation is transformed through the feedforward network, the result after each weighted summation is subjected to residual connection and normalization processing.
[0020] In some embodiments, the residual connection processing includes the following steps: adding the fusion vector to the result of weighted summation.
[0021] In some embodiments, a multi-head self-attention mechanism is used to perform multiple weighted summations on the features of each node of the fusion vector and the features of its neighboring nodes.
[0022] In some embodiments, the fused vector is normalized before being encoded.
[0023] According to another aspect of the present invention, an intelligent system is provided for implementing the above-mentioned method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure, comprising an embedding layer, a fusion layer, a self-attention layer, a subgraph partitioning and pooling layer, a full-graph pooling layer, and a long short-term memory network layer.
[0024] The embedding layer converts the node features and edge features corresponding to the input graph into vector representations in a continuous space respectively; the fusion layer fuses the node features and edge features represented by the vector output by the embedding layer, and performs normalization after fusion; the self-attention layer uses a multi-head self-attention mechanism to perform multiple weighted summations on the features of each node of the fusion vector output by the fusion layer and the features of its neighboring nodes, and performs residual connection and normalization on the results of each weighted summation. The results after each residual connection and normalization are further transformed through the feedforward network, and the outputs of each feedforward network are spliced. The post-linear transformation is mapped to the target dimensional space; the subgraph partitioning and pooling layer divides the input graph into multiple subgraphs, performs pooling operations on the divided subgraphs, and obtains the feature vector corresponding to each subgraph; the full-graph pooling layer performs pooling operations on the input graph to obtain the full-graph feature vector; the long short-term memory network layer respectively decodes the fusion vector output by the self-attention layer, the feature vector corresponding to the subgraph output by the subgraph partitioning and pooling layer, and the full-graph feature vector output by the full-graph pooling layer, and generates a total graph explanation text in sequence from the decoded node text, subgraph text, and full-graph text, forming a graph explanation text with a hierarchical structure.
[0025] According to another aspect of the present invention, a program product is also provided, including a computer program or instructions, which, when executed by a processor, implements the steps of a method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure as described above.
[0026] Implementing one of the above technical solutions of the present invention has the following advantages or beneficial effects:
[0027] By accurately modeling the graph's hierarchical structure, this paper generates highly organized and coherent graph description text, accurately conveying the graph's structural information. The generated text clearly layers the graph from nodes to subgraphs and then to the entire graph, showcasing the complexity and details of the graph. It not only maintains high coherence but also explains in detail the important role of each node and subgraph, enhancing the model's transparency and interpretability. Further beneficial effects are as follows:
[0028] 1. Efficient fusion of graph structure and node information: This paper utilizes embedding layers, attention mechanisms, pooling operations, and other techniques to efficiently integrate node features, edge features, and adjacency relationships within the graph within the encoder. Through a multi-head self-attention mechanism, the model flexibly captures complex dependencies between nodes and effectively integrates information about a node and its neighbors, providing richer and more accurate feature representations for subsequent explanatory text generation.
[0029] 2. Accurate graph structure representation: It can accurately capture the features of nodes and edges in the graph, and generate a graph feature representation containing more comprehensive information through multi-layer processing.
[0030] 3. Enhanced capture of inter-node relationships: The self-attention mechanism enables the model to dynamically weight nodes based on their relative importance to neighboring nodes, improving the ability to express complex relationships between nodes.
[0031] 4. Hierarchical graph description generation: This invention accurately generates hierarchical text descriptions through a multi-level generation process from nodes to subgraphs and then to the full graph. First, a local description of the node is generated, followed by a description of the subgraph, and finally a description of the full graph, forming a clearly structured, progressively unfolding text sequence. This hierarchical description not only expresses the personalized information of the node, but also reveals the global patterns and complex structure of the entire graph.
[0032] 5. Progressive generation from local to global: The text generation process unfolds layer by layer with clear levels, avoiding the problem of generating fragmented and incoherent text in existing technologies.
[0033] 6. Expressing the complexity of the graph: By describing subgraphs and the entire graph, the model can accurately display the global structure and macro-relationships of the graph, improving the richness and accuracy of the graph description. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0035] Figure 1 This is a flowchart of a method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure according to an embodiment of the present invention;
[0036] Figure 2 This is a network structure diagram of an intelligent system according to an embodiment of the present invention.
[0037] In the figure: 501, embedding layer; 502, fusion layer; 503, self-attention layer; 504, sub-graph partitioning and pooling layer; 505, full-graph pooling layer; 506, long short-term memory network layer. DETAILED DESCRIPTION
[0038] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without creative work are within the scope of protection of the present invention.
[0039] Example 1:
[0040] Figure 1 The figure shows a method for generating explanatory text from a knowledge graph based on a hierarchical structure of a graph neural network. The method includes the following steps:
[0041] S100, input the graph and its corresponding node features, edge features and adjacency matrix, convert the node features and edge features into vector representations respectively, fuse the node features and edge features represented by the vectors to obtain a fused vector with node information and corresponding edge information, and encode the fused vector.
[0042] The input node features are converted into vector representations in a continuous space through an embedding layer (e.g., the embedding layer corresponding to the neural network shown in the figure). This layer embeds the features of each node into a hidden dimension space, forming an embedded representation (vector representation) of the node. The features of the two edges connecting the nodes are also embedded, forming an edge embedding representation. The edge embedding is then added to the node embedding to obtain a fused embedding that contains information about both the node and the connected edges.
[0043] Encoding the fused vector involves performing multiple weighted sums of the features of each node in the fused vector with the features of its neighboring nodes according to the adjacency matrix, concatenating the results of each weighted summation, and linearly transforming the concatenated results to map them to the target dimensional space. A multi-head self-attention mechanism is used to perform multiple weighted sums of the features of each node in the fused vector with the features of its neighboring nodes.
[0044] It should be noted that the multi-head self-attention mechanism uses N layers. Within each layer, this method applies the multi-head self-attention mechanism to calculate the relationships between nodes. The features of each node are weighted summed with the features of its neighboring nodes. This allows node features to be updated based on the relative relationships between nodes. To efficiently parallelize this process, a multi-head self-attention mechanism is introduced, which computes attention in parallel in different subspaces and then merges the results.
[0045] The encoding process uses a multi-head self-attention mechanism to calculate relationships between nodes. Each node's features are weighted and summed with the features of its neighboring nodes, updating the node's representation based on these relationships. To improve computational efficiency, a multi-head mechanism is employed. This involves computing multiple attention heads in parallel, each focusing on a different subspace, and then merging the results. Each head independently computes the query, key, and value, and the updated node representation is obtained through a weighted summation.
[0046] After multiple layers of self-attention, the final encoding of each node is obtained. This encoding combines the information of each node itself and its relationship with other nodes.
[0047] After the multi-head self-attention calculation, residual connections are added, followed by normalization. Residual connections add the input and output, making the training process more stable. Normalization further adjusts the output distribution, thereby facilitating model training. The self-attention output of each layer is fed into a feedforward neural network for further transformation. This neural network typically includes two linear transformations and an activation function. Through the feedforward network, node representations are further updated, thereby improving the model's expressiveness.
[0048] S200: Divide the input graph into multiple subgraphs, perform pooling operations on the divided subgraphs and the input graph respectively, and obtain a feature vector corresponding to each subgraph and a feature vector of the entire graph.
[0049] In a specific example, in step S200, the full image is divided into k sub-images using the K-means algorithm, and an average pooling operation is performed on each sub-image to obtain a feature vector of each sub-image. The pooled sub-image feature vector represents information about the entire sub-image.
[0050] It should be noted that the entire graph is divided into multiple subgraphs using the K-means algorithm. For each subgraph, pooling is used to extract its features. K-means clustering divides the nodes in the graph into clusters, each representing a subgraph. The subgraph's features are then derived by calculating the average value of the nodes in each subgraph.
[0051] Furthermore, the node features of the entire graph are pooled to obtain the global feature representation of the graph. The full-graph pooling operation aggregates the feature vectors of all nodes in the graph to obtain the global feature vector of the entire graph. The full-graph pooling operation uses average pooling:
[0052] S300: Decode the encoded node vector, the feature vector corresponding to each subgraph, and the full graph feature vector respectively to obtain the node text corresponding to the fusion vector, the subgraph text corresponding to each subgraph feature vector, and the full graph text corresponding to the full graph feature vector;
[0053] In this specific example, for node text generation in step S300, the node feature matrix output by the encoder is accepted and a text description is generated for each node. The generated text typically includes the node's attributes, category, and its relationship with neighboring nodes. The feature vector is converted into text through an LSTM layer.
[0054] Furthermore, for the full-graph text generation in step S300, the subgraph features reflect the local hierarchical structure of the graph. The decoder generates a local description of the graph based on the subgraph features and converts the feature vector into text through the LSTM layer.
[0055] Furthermore, for full-image text generation in step S300, global features reflect the structure of the entire graph, and the decoder generates a global description of the graph based on these features. The feature vectors are converted into text via the LSTM layer. The full-image text generation input is the embedded representation of the entire image, which is used to generate a global description of the graph.
[0056] The features of nodes, subgraphs, and the entire graph are converted into text through the LSTM model. Finally, the generated text passes through a Softmax layer, is mapped into a vocabulary, and its text description is output.
[0057] S400: Generate a total graph explanation text from the node text, each subgraph text, and the whole graph text in sequence, forming a graph explanation text with a hierarchical structure.
[0058] In a specific example, for the generation of the overall graph explanation text of step S400, the order of the generated text mainly depends on the structure from local to global, from details to summary, to ensure the hierarchy and coherence of the information. Specifically, the following order can be adopted: first describe the details of a single node, including the node's attributes, categories, and relationships with adjacent nodes. This part usually contains very specific information. Next, describe the subgraphs in the graph, which may represent specific modules, groups, or features, and have certain internal structures and relationships. Finally, generate an overall description of the entire graph, emphasizing the pattern, structure, and overall relationship of the entire graph.
[0059] Based on the above embodiment, the method is also trained, and during the training process, the goal is to minimize the difference between the generated text and the real text. The cross entropy loss is used to measure the similarity between the generated text and the real text. The loss function calculates the text generation loss of each node, subgraph and full graph respectively, and then sums these losses according to the weighting coefficient to obtain the total loss. The Adam optimizer is used for training. The Adam optimizer can combine momentum and adaptive learning rate and is suitable for training deep neural networks. During the training process, the optimized parameters include the embedding matrix of nodes and edges, the weight of the attention mechanism, the weight of the feedforward network, the parameters of the LSTM model, etc.
[0060] By accurately modeling the graph's hierarchical structure, the method of this embodiment generates highly organized and coherent graph description text, accurately conveying the graph's structural information. The generated text clearly lays out the hierarchy from nodes to subgraphs to the full graph, showcasing the complexity and details of the graph. It not only maintains a high level of coherence but also provides a detailed explanation of the role of each node and subgraph, enhancing the model's transparency and interpretability.
[0061] In summary, the above method of this embodiment proposes a technical solution that combines graph neural networks with text generation. By inputting node features and an adjacency matrix, an embedding layer is used to transform the node features, and then the nodes are encoded using a multi-head self-attention mechanism and a feedforward neural network. Ultimately, an embedded representation of each node and a global feature representation of the graph are obtained. The full graph is divided into multiple subgraphs using the K-means algorithm, and each subgraph is pooled to extract subgraph features. Finally, the node features, subgraph features, and full graph features are concatenated as input to the decoder. The decoder uses the LSTM layer to generate text descriptions of nodes, subgraphs, and the full graph, and generates a structured description of the graph from local to global through layer-by-layer generation. The generated text can accurately reflect the structure and semantics of the graph from details to summary, from local to global.
[0062] Example 2
[0063] like Figure 2 As shown, this embodiment provides an intelligent system for implementing the method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure as described in Example 1, including an embedding layer 501, a fusion layer 502, a self-attention layer 503, a subgraph partitioning and pooling layer 504, a full-graph pooling layer 505, and a long short-term memory network layer 506. Among them:
[0064] The embedding layer 501 converts the node features and edge features corresponding to the input graph into vector representations in a continuous space.
[0065] The fusion layer 502 fuses the node features and edge features represented by the vectors output by the embedding layer 501 and performs normalization after fusion.
[0066] The self-attention layer 503 uses a multi-head self-attention mechanism to perform multiple weighted summations on the features of each node of the fusion vector output by the fusion layer 502 and the features of its neighboring nodes, and performs residual connection and normalization processing on the results of each weighted summation. The results of each residual connection and normalization processing are further transformed through the feedforward network, and the outputs of each feedforward network are spliced. After splicing, the linear transformation is mapped to the target dimensional space.
[0067] The subgraph partitioning and pooling layer 504 partitions the input graph into multiple subgraphs, performs pooling operations on the partitioned subgraphs, and obtains the feature vector corresponding to each subgraph. The K-means algorithm is used to partition the entire graph into k subgraphs.
[0068] The full-image pooling layer 505 performs a pooling operation on the input image to obtain a full-image feature vector.
[0069] The long short-term memory network layer 506 decodes the fusion vector output by the self-attention layer 503, the feature vector corresponding to the subgraph output by the subgraph partitioning and pooling layer 504, and the full-graph feature vector output by the full-graph pooling layer 505, and sequentially generates the total graph explanation text from the decoded node text, subgraph text, and full-graph text, forming a graph explanation text with a hierarchical structure.
[0070] Based on the above embodiment, the embedding layer 501 may further include a node embedding layer and an edge embedding layer. The node embedding layer is used to convert the node features corresponding to the input graph into a vector representation in a continuous space, and the edge embedding layer converts the edge features into a vector representation in a continuous space.
[0071] The feedforward network consists of two linear transformation layers and one activation function layer; the result of each weighted summation is sequentially processed by the first layer of linear transformation, the activation function layer, and the second layer of linear transformation before being output.
[0072] The computing models of the above-mentioned embedding layer 501, fusion layer 502, self-attention layer 503, sub-graph partitioning and pooling layer 504, full-graph pooling layer 505, and long short-term memory network layer 506 and their related settings, as well as the training and optimization of the intelligent system model correspond to those in Example 1 and will not be repeated here.
[0073] Example 3
[0074] The embodiment further provides a program product, including a computer program or instructions, which, when executed by a processor, implement the steps of the method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure as described in the first embodiment above. Since the embodiment of the computer program product portion corresponds to the embodiment of the method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure, the embodiment of the computer program product portion is described in the description of the first embodiment above and will not be repeated here.
[0075] Those skilled in the art will appreciate that the accompanying drawings are merely schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.
[0076] Those skilled in the art will appreciate that the modules in the apparatuses of the embodiments may be distributed in the apparatuses of the embodiments as described in the embodiments, or may be located in one or more apparatuses different from the embodiments with corresponding changes. The modules in the above embodiments may be combined into one module or further divided into multiple sub-modules.
[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating explanatory text from a knowledge graph based on a hierarchical structure of a graph neural network, characterized in that: The following steps are involved: Input a graph and its corresponding node features, edge features, and adjacency matrix, convert the node features and edge features into vector representations, fuse the node features and edge features represented by the vectors, and obtain a fused vector with node information and corresponding edge information. Based on the adjacency matrix, use a multi-head self-attention mechanism to perform multiple weighted summations on the features of each node in the fused vector and the features of its neighboring nodes. The results of each weighted summation are concatenated and linearly transformed and mapped to the target dimensional space. The input graph is divided into multiple subgraphs, and pooling operations are performed on the divided subgraphs and the input graph respectively to obtain the feature vector corresponding to each subgraph and the feature vector of the entire graph; Decode the encoded fusion vector, the feature vector corresponding to each subgraph, and the full graph feature vector respectively to obtain the node text corresponding to the fusion vector, the subgraph text corresponding to each subgraph feature vector, and the full graph text corresponding to the full graph feature vector; The node text, each subgraph text, and the full graph text are sequentially generated into a total graph explanation text to form a graph explanation text with a hierarchical structure.
2. The method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure according to claim 1, characterized in that: Each time, after weighted summing is performed on the features of each node of the fusion vector and the features of its neighboring nodes, the result of the weighted summing is further transformed through a feedforward network.
3. The method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure according to claim 2, characterized in that: The feedforward network includes two linear transformation layers and an activation function layer; the result after each weighted summation is sequentially processed by the first layer linear transformation, the activation function layer, and the second layer linear transformation before being output.
4. The method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure according to claim 2, characterized in that: Before the result after each weighted summation is transformed through the feedforward network, the result after each weighted summation is subjected to residual connection and normalization processing.
5. The method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure according to claim 4, characterized in that: The residual connection processing includes the following steps: The fusion vector is added to the weighted summation result.
6. A method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure according to any one of claims 1 to 5, characterized in that: Before encoding the fusion vector, normalization is performed on it.
7. An intelligent system, characterized in that: A method for generating explanatory text from a knowledge graph based on a graph neural network hierarchical structure, comprising an embedding layer, a fusion layer, a self-attention layer, a subgraph partitioning and pooling layer, a full-graph pooling layer, and a long short-term memory network layer, for implementing any one of claims 1 to 6; The embedding layer converts the node features and edge features corresponding to the input graph into vector representations in a continuous space. The fusion layer fuses the node features and edge features represented by the vectors output by the embedding layer, and performs normalization processing after fusion; The self-attention layer uses a multi-head self-attention mechanism to perform multiple weighted summations on the features of each node of the fusion vector output by the fusion layer and the features of its neighboring nodes, performs residual connection and normalization processing on the results of each weighted summation, further transforms the results of each residual connection and normalization processing through a feedforward network, splices the outputs of each feedforward network, and linearly transforms and maps them to the target dimensional space after splicing; The subgraph partitioning and pooling layer divides the input graph into multiple subgraphs, performs pooling operations on the divided subgraphs, and obtains the feature vector corresponding to each subgraph; The full-image pooling layer performs a pooling operation on the input image to obtain a full-image feature vector; The long short-term memory network layer decodes the fusion vector output by the self-attention layer, the feature vector corresponding to the subgraph output by the subgraph partitioning and pooling layer, and the full-graph feature vector output by the full-graph pooling layer, and sequentially generates a total graph explanation text from the decoded node text, subgraph text, and full-graph text to form a graph explanation text with a hierarchical structure.
8. A program product comprising a computer program or instructions, characterized in that When the computer program or instructions are executed by a processor, the steps of a method for generating explanatory text of a knowledge graph based on a graph neural network hierarchical structure as described in any one of claims 1 to 6 are implemented.