Knowledge graph dynamic updating method and device, equipment and storage medium

By introducing the semantic concept neural network layer into the dynamic update method of knowledge graphs and performing edge semantic analysis, the problem of uninterpretation of edge prediction results in dynamic expansion of knowledge graphs is solved, and the accuracy and reliability of knowledge graphs are improved.

CN120146166APending Publication Date: 2025-06-13PENG CHENG LAB
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510196808.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-20
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

In the prior art, when the knowledge graph is dynamically expanded, the edge prediction results lack interpretability, which makes it difficult for users to trust the newly expanded knowledge, affecting the accuracy and reliability of the knowledge graph.

Method used

A dynamic update method of knowledge graph is proposed. Through the graph neural network encoder, semantic concept neural network layer and graph neural network decoder, the initial knowledge graph is obtained for node mask and edge mask, embedding encoding and edge semantic analysis, and predictive knowledge graph is generated, and the knowledge graph expansion model is trained based on the prediction knowledge graph and the initial knowledge graph.

Benefits of technology

It improves the interpretability of side prediction results in the knowledge graph expansion scenario, improves the accuracy and reliability of the extended knowledge graph, and ensures that the newly expanded knowledge can more clearly explain the logical basis and reasoning process behind it.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120146166A_ABST
    Figure CN120146166A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a dynamic updating method and device of a knowledge graph, equipment and a storage medium, and relates to the technical field of graph data processing. The method comprises the following steps of: performing node masking and edge masking on an initial knowledge graph to obtain a mask knowledge graph, and inputting the mask knowledge graph into a graph neural network encoder for embedding and encoding to obtain edge embedded data of each connecting edge and node embedded data of each node; inputting the edge embedded data and the corresponding node embedded data into a semantic concept neural network layer, performing edge semantic analysis on the edge embedded data to obtain predicted edge semantics, and inputting the node embedded data and the predicted edge semantics into a graph neural network decoder for reconstruction to obtain a predicted knowledge graph; and training a knowledge graph extension model based on the predicted knowledge graph and the initial knowledge graph, and updating the initial knowledge graph by using the trained knowledge graph extension model. And interpretability is provided for a prediction result through edge semantic analysis, and the reliability and accuracy of an expansion result are improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Technical Field

[0002] This application relates to the technical field of graph data processing, and particularly to a method, apparatus, device, and storage medium for dynamically updating a knowledge graph. Background Art

[0003] As a structured tool for representing entities and their relationships, the knowledge graph has been widely used in many fields such as recommendation systems, question answering systems, social networks, and search engines. With the continuous emergence of new knowledge, when there are new nodes, such as new users, new items, or new concepts, etc., the knowledge graph needs to be dynamically extended to quickly determine its reasonable connection relationships with existing nodes.

[0004] In related technologies, the prediction process of graph neural networks is usually used to predict newly added edges and nodes. However, the obtained prediction results for edges lack interpretability, making it difficult to clearly explain the underlying reasons for establishing these relationships, and unable to clarify the logical basis and reasoning process behind them. This non-interpretability of edge prediction leads to users' difficulty in trusting the newly extended knowledge, thereby affecting the accuracy and reliability of the knowledge graph in practical applications. Summary of the Invention

[0005] The main objective of the embodiments of this application is to propose a method, apparatus, device, and storage medium for dynamically updating a knowledge graph, improving the interpretability of edge prediction results in the knowledge graph expansion scenario, and enhancing the accuracy and reliability of the expanded knowledge graph.

[0006] To achieve the above objective, in the first aspect of the embodiments of this application, a method for dynamically updating a knowledge graph is proposed, which is executed by a knowledge graph expansion model. The knowledge graph expansion model includes a graph neural network encoder, a semantic concept neural network layer, and a graph neural network decoder. The method includes:

[0007] Obtain an initial knowledge graph, and perform node masking and edge masking on the initial knowledge graph to obtain a masked knowledge graph;

[0008] Input the masked knowledge graph into the graph neural network encoder for embedding encoding to obtain edge embedding data for each connected edge and node embedding data for each node. Input the edge embedding data and the corresponding node embedding data into the semantic concept neural network layer to perform edge semantic parsing on the edge embedding data to obtain predicted edge semantics, and input the node embedding data and the predicted edge semantics into the graph neural network decoder for reconstruction to obtain a predicted knowledge graph;

[0009] Train the knowledge graph expansion model based on the predicted knowledge graph and the initial knowledge graph, and use the trained knowledge graph expansion model to update the initial knowledge graph.

[0010] In some embodiments, performing node masking and edge masking on the initial knowledge graph to obtain a masked knowledge graph includes:

[0011] Randomly selecting some nodes from the initial knowledge graph as masked nodes, and masking the node attributes of the masked nodes to obtain a first knowledge graph;

[0012] Randomly selecting some connecting edges from the initial knowledge graph or the first knowledge graph as masked edges, masking the edge attributes of the masked edges, and masking the node attributes of the two nodes corresponding to the masked edges to obtain a second knowledge graph;

[0013] Obtaining the masked knowledge graph according to the second knowledge graph, or obtaining the masked knowledge graph according to the first knowledge graph and the second knowledge graph.

[0014] In some embodiments, the semantic concept neural network layer includes multiple neurons, and each neuron corresponds to an edge semantic information. Before inputting the edge embedding data and the corresponding node embedding data into the semantic concept neural network layer to perform edge semantic parsing on the edge embedding data to obtain predicted edge semantics, the method further includes:

[0015] Obtaining multiple connecting edges of the initial knowledge graph, using the two nodes corresponding to the connecting edges as connecting nodes, and obtaining the connecting edge attributes of the connecting edges and the connecting node attributes of the two connecting nodes;

[0016] Obtaining the edge semantic information of the connecting edges according to the connecting edge attributes and the connecting node attributes, where the edge semantic information is used to semantically interpret the connecting edges in the initial knowledge graph;

[0017] Constructing corresponding neurons based on the edge semantic information, and obtaining the semantic concept neural network layer by using the neurons.

[0018] In some embodiments, obtaining the edge semantic information of the connecting edges according to the connecting edge attributes and the connecting node attributes includes:

[0019] At least obtaining an edge direction parameter, an edge strength parameter, and an edge type parameter from the connecting edge attributes, and at least obtaining a node type parameter and a node strength parameter from the connecting node attributes;

[0020] Generating a semantic vector according to the edge direction parameter, the edge strength parameter, the edge type parameter, the node type parameter, and the node strength parameter;

[0021] Generating the edge semantic information of the connecting edges based on the semantic vector.

[0022] In some embodiments, generating the edge semantic information of the connection edge based on the semantic vector includes:

[0023] Obtain at least one neighborhood node of each connection node, form a neighborhood vector set of the corresponding connection node according to the neighborhood semantic vectors corresponding to the neighborhood nodes, and calculate the similarity of the two neighborhood vector sets to obtain a neighborhood similarity parameter;

[0024] According to the edge direction parameter, divide the two connection nodes into an upstream node and a downstream node, obtain a first intermediate parameter according to the product of the edge strength parameter and the node strength parameter of the upstream node, obtain a second intermediate parameter according to the product of the edge strength parameter and the node strength parameter of the downstream node, and perform a weighted sum on the edge type parameter, the first intermediate parameter, and the second intermediate parameter to obtain an upstream and downstream strength parameter;

[0025] Obtain the edge semantic information according to the neighborhood similarity parameter and the upstream and downstream strength parameters.

[0026] In some embodiments, training the knowledge graph expansion model based on the predicted knowledge graph and the initial knowledge graph includes:

[0027] Obtain the node attributes of each node, the edge attributes of each connection edge and the corresponding edge semantic information from the initial knowledge graph, and obtain the predicted node attributes of each node and the predicted edge attributes of each connection edge from the predicted knowledge graph;

[0028] Calculate a node loss value according to the node attributes and the predicted node attributes, calculate an edge attribute loss value according to the edge attributes and the predicted edge attributes, and calculate an edge semantic loss value according to the edge semantic information and the predicted edge semantics. Obtain a total loss value according to the node loss value, the edge attribute loss value, and the edge semantic information edge semantic loss value;

[0029] Based on the total loss value, adjust the parameters of the knowledge graph expansion model to obtain the trained knowledge graph expansion model.

[0030] In some embodiments, updating the initial knowledge graph by using the trained knowledge graph expansion model includes:

[0031] Obtain at least one expansion node and expansion edges related to the expansion node, and update the initial knowledge graph according to the expansion node and the expansion edges to obtain an expanded knowledge graph;

[0032] Input the extended knowledge graph into the knowledge graph extension model for data prediction to generate the extended node attributes corresponding to each extended node, as well as the extended edge attributes and extended edge semantic information corresponding to each extended edge.

[0033] To achieve the above object, a second aspect of the embodiments of the present application proposes a dynamic update device for a knowledge graph, which is executed by a knowledge graph extension model. The knowledge graph extension model includes a graph neural network encoder, a semantic concept neural network layer, and a graph neural network decoder. The device includes:

[0034] Masking module: used to obtain the initial knowledge graph and perform node masking and edge masking on the initial knowledge graph to obtain a masked knowledge graph;

[0035] Prediction module: used to input the masked knowledge graph into the graph neural network encoder for embedding encoding to obtain the edge embedding data of each connected edge and the node embedding data of each node, input the edge embedding data and the corresponding node embedding data into the semantic concept neural network layer to perform edge semantic parsing on the edge embedding data to obtain the predicted edge semantics, and input the node embedding data and the predicted edge semantics into the graph neural network decoder for reconstruction to obtain a predicted knowledge graph;

[0036] Application module: used to train the knowledge graph extension model based on the predicted knowledge graph and the initial knowledge graph, and use the trained knowledge graph extension model to update the initial knowledge graph.

[0037] To achieve the above object, a third aspect of the embodiments of the present application proposes an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the method described in the first aspect above.

[0038] To achieve the above object, a fourth aspect of the embodiments of the present application proposes a storage medium. The storage medium is a storage medium that stores a computer program, and when the computer program is executed by a processor, it implements the method described in the first aspect above.

[0039] The dynamic update method, device, equipment, and storage medium of the knowledge graph proposed in the embodiments of the present application are executed by a knowledge graph extension model. The knowledge graph extension model includes a graph neural network encoder, a semantic concept neural network layer, and a graph neural network decoder. By obtaining an initial knowledge graph and performing node masking and edge masking on the initial knowledge graph, a masked knowledge graph is obtained. The masked knowledge graph is input into the graph neural network encoder for embedding encoding to obtain edge embedding data for each connected edge and node embedding data for each node. The edge embedding data and the corresponding node embedding data are input into the semantic concept neural network layer to perform edge semantic parsing on the edge embedding data to obtain predicted edge semantics. The node embedding data and the predicted edge semantics are input into the graph neural network decoder for reconstruction to obtain a predicted knowledge graph. The knowledge graph extension model is trained based on the predicted knowledge graph and the initial knowledge graph, and the trained knowledge graph extension model is used to update the initial knowledge graph. In the training process of the embodiments of the present application, masking operations are used to enhance the model's ability to infer and recover the complete knowledge graph from limited information, improving the model's understanding ability. At the same time, in the prediction process, the semantic concept neural network layer is used to map the embedding data of nodes and edges to a fixed concept space to achieve edge semantic parsing of the edge embedding data. Through edge semantic parsing, the meaning of the edge is represented in a more explicit semantic form, providing interpretability for the prediction results. Moreover, based on the predicted edge semantics, the knowledge graph is extended, which can provide more accurate semantic understanding for the model when expanding the knowledge graph, guiding the model to determine the types and directions of new nodes, avoiding adding unreasonable or incorrect relationships, and improving the reliability and accuracy of the expansion results. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 is a schematic structural diagram of the knowledge graph extension model provided by the embodiments of the present application.

[0041] Figure 2 is a flowchart of the dynamic update method of the knowledge graph provided by the embodiments of the present application.

[0042] Figure 3 is a flowchart of performing node masking and edge masking on the initial knowledge graph to obtain a masked knowledge graph according to the embodiments of the present application.

[0043] Figure 4 is a flowchart of constructing the semantic concept neural network layer provided by the embodiments of the present application.

[0044] Figure 5 is a flowchart of obtaining edge semantic information of a connected edge according to the attributes of the connected edge and the attributes of the connected nodes provided by the embodiments of the present application.

[0045] Figure 6 is a flowchart of generating edge semantic information of a connected edge based on a semantic vector provided by the embodiments of the present application.

[0046] Figure 7 It is a flowchart for training a knowledge graph expansion model based on a prediction knowledge graph and an initial knowledge graph provided by an embodiment of the present application.

[0047] Figure 8 It is a flowchart for updating an initial knowledge graph by using a trained knowledge graph expansion model provided by an embodiment of the present application.

[0048] Figure 9 It is a block diagram of the structure of a dynamic update device for a knowledge graph provided by another embodiment of the present application.

[0049] Figure 10 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0050] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0051] It should be noted that although functional module division is performed in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order from the module division in the device or the order in the flowchart.

[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.

[0053] First, several nouns involved in the present application are parsed:

[0054] Artificial Intelligence (AI): It is a new technical science that studies, develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence; artificial intelligence is a branch of computer science. Artificial intelligence attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. The research in this field includes robots, speech recognition, image recognition, natural language processing and expert systems, etc. Artificial intelligence can simulate the information process of human consciousness and thinking. Artificial intelligence also uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results of theories, methods, technologies and application systems.

[0055] As a structured tool for representing entities and their relationships, knowledge graphs have been widely used in many fields such as recommendation systems, question-answering systems, social networks, and search engines. With the continuous emergence of new knowledge, when there are new nodes, such as new users, new items, or new concepts, etc., the knowledge graph needs to be dynamically expanded to quickly determine its reasonable connection relationships with existing nodes.

[0056] In related technologies, the prediction process of graph neural networks is usually used to predict newly added edges and nodes. However, the obtained prediction results for edges lack interpretability, making it difficult to clearly explain the deep reasons for establishing these relationships, and unable to clarify the logical basis and reasoning process behind them. Especially in scenarios with high transparency requirements such as medical and legal fields, this problem is particularly obvious. This non-interpretability of edge prediction leads to users' difficulty in trusting the newly expanded knowledge, thereby affecting the accuracy and reliability of the knowledge graph in practical applications.

[0057] Moreover, the prediction process in related technologies relies on large-scale labeled data, while the labeled data in real knowledge graphs is scarce, and the labeling process is expensive and time-consuming, resulting in the difficulty of generalizing prediction-related models in dynamic expansion scenarios.

[0058] Based on this, the embodiments of this application provide a method, device, equipment, and storage medium for dynamically updating a knowledge graph. During the training process, mask operations are used to enhance the model's ability to infer and recover the complete knowledge graph from limited information, improving the model's understanding ability. At the same time, during the prediction process, a semantic concept neural network layer is used to map the embedding data of nodes and edges to a fixed concept space, realizing the edge semantic analysis of the edge embedding data. Through the edge semantic analysis, the meaning of the edge is represented in a more explicit semantic form, providing interpretability for the prediction results. Furthermore, based on the predicted edge semantics, the expansion of the knowledge graph can provide more accurate semantic understanding for the model when expanding the knowledge graph, guiding the model to determine the types and directions of new nodes, avoiding adding unreasonable or incorrect relationships, and improving the reliability and accuracy of the expansion results.

[0059] The embodiments of this application provide a method, device, equipment, and storage medium for dynamically updating a knowledge graph, which will be specifically described through the following embodiments. First, the method for dynamically updating the knowledge graph in the embodiments of this application will be described.

[0060] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines to enable the machines to have the functions of perception, reasoning, and decision-making.

[0061] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields involved, including both hardware-level technologies and software-level technologies. The basic technologies of artificial intelligence generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. The software technologies of artificial intelligence mainly include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0062] The method for dynamically updating the knowledge graph provided by the embodiments of the present application relates to the field of graph data processing technology. The method for dynamically updating the knowledge graph provided by the embodiments of the present application can be applied to a terminal, or to a server, or can be a computer program running on a terminal or a server. For example, the computer program can be a native program or software module in an operating system; it can be a local (Native) application (Application, APP), that is, a program that needs to be installed in an operating system to run, such as a client that supports the dynamic update of the knowledge graph, that is, a program that only needs to be downloaded to a browser environment to run; it can also be a small program that can be embedded in any APP. In short, the above computer program can be any form of application program, module, or plug-in. Among them, the terminal communicates with the server through a network. The method for dynamically updating the knowledge graph can be executed by the terminal or the server, or jointly executed by the terminal and the server.

[0063] In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, etc. The server can be an independent server, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms; it can also be a service node in a blockchain system, and the service nodes in the blockchain system form a Peer To Peer (P2P) network, and the P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP) protocol. The terminal and the server can be connected through communication connection methods such as Bluetooth, Universal Serial Bus (USB), or network, and this embodiment does not limit this here.

[0064] This application can be used in numerous general-purpose or special-purpose computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet-type devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This application can also be practiced in a distributed computing environment, where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0065] It should be noted that in each specific embodiment of this application, when it comes to performing relevant processing based on data related to the user's identity or characteristics, such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first. Moreover, the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when this application embodiment needs to obtain the user's sensitive personal information, the user's separate permission or separate consent will be obtained through methods such as pop-up windows or redirecting to a confirmation page. After clearly obtaining the user's separate permission or separate consent, the necessary user-related data for enabling the normal operation of this application embodiment will be obtained.

[0066] First, the knowledge graph expansion model in the embodiments of the present application will be described below.

[0067] Referring to Figure 1 , Figure 1 is a schematic structural diagram of the knowledge graph expansion model provided by the embodiments of the present application. Among them, the knowledge graph expansion model includes a graph neural network encoder, a semantic concept neural network layer, and a graph neural network decoder. The output data of the graph neural network decoder serves as the input data of the semantic concept neural network layer. The output data of the semantic concept neural network layer and part of the output data of the graph neural network decoder jointly serve as the input data of the graph neural network decoder. The output data of the graph neural network decoder is the prediction result of the knowledge graph expansion model. Among them, the graph neural network encoder can be composed of a graph convolutional network, and the graph neural network decoder can be composed of a multi-layer perceptron. This embodiment does not make any limitations in this regard.

[0068] Next, the dynamic update method of the knowledge graph will be described in combination with the Figure 1 knowledge graph expansion model.

[0069] Figure 2 is an optional flowchart of the dynamic update method of the knowledge graph provided by the embodiments of the present application. Figure 2 The method in Figure 2 may include but is not limited to steps 110 to 130. At the same time, it can be understood that this embodiment does not make a specific limitation on the order of steps 110 to 130 in

[0070] Step 110: Obtain an initial knowledge graph, and perform node masking and edge masking on the initial knowledge graph to obtain a masked knowledge graph.

[0071] In one embodiment, the initial knowledge graph is the knowledge graph that needs to be dynamically expanded. The initial knowledge graph contains multiple nodes, and these nodes represent various entities. These entities can be either specific things in the real world, such as people, places, organizations, etc.; or they can be abstract concepts, such as events, disciplines, etc. At the same time, each node has a corresponding node attribute, which is used to describe the characteristics, properties, or other relevant information of this node. For example, if the node represents "city", then its node attributes may include "population", "country where it is located", "geographical location", etc.

[0072] In addition, at least one connection edge in the initial knowledge graph is used to connect two nodes and indicate the relationship between the nodes. For example, in a knowledge graph focusing on personal relationships, connection edges such as "kinship" and "friendship" may appear. These connection edges serve to connect different person nodes to each other. Similar to node attributes, each connection edge also contains edge attributes, which provide a more in-depth description of the relationship characteristics between the two nodes. It can be understood that both node attributes and edge attributes can be set according to actual needs.

[0073] In one embodiment, to solve the problem of scarce labeled data in the knowledge graph in related technologies, the embodiments of the present application use the process of sub-supervised learning to reduce the dependence on labeled data. The mask process is used to generate relevant samples required for training, enabling the training of the knowledge graph expansion model to achieve the prediction process of connection relationships under the condition of unlabeled or scarce labels.

[0074] In one embodiment, referring to Figure 3 , Figure 3 is the flowchart of the node masking and edge masking of the initial knowledge graph in the embodiments of the present application to obtain the masked knowledge graph, which specifically includes the following steps:

[0075] Step 310: Randomly select some nodes from the initial knowledge graph as masked nodes, and mask the node attributes of the masked nodes to obtain the first knowledge graph.

[0076] In one embodiment, a certain masking ratio is used to randomly select some nodes from the initial knowledge graph as masked nodes, and the corresponding node attributes of the masked nodes are replaced with mask values. For example, if the node attributes are represented by a matrix composed of "0" and "1", the "1" in it can be replaced with "0" to achieve the masking process. All masked nodes are masked according to this process, and the initial knowledge graph is converted into the first knowledge graph. It can be understood that the masking ratio can be set according to actual needs.

[0077] Step 320: Randomly select some connection edges from the initial knowledge graph or the first knowledge graph as masked edges, mask the edge attributes of the masked edges, and mask the node attributes of the two nodes corresponding to the masked edges to obtain the second knowledge graph.

[0078] In one embodiment, after performing node masking, edge masking is also required, that is, masking some of the connecting edges. At this time, the initial knowledge graph can be selected for edge masking, or edge masking can be performed based on the first knowledge graph. The process of edge masking is similar to that of node masking. Part of the connecting edges are randomly selected from the initial knowledge graph or the first knowledge graph as masked edges, and the edge attributes of the masked edges are replaced with relevant masking values. And since each masked edge corresponds to two nodes, in order to maintain data consistency and processing integrity, the node attributes of the two nodes corresponding to the masked edge also need to be masked. The masking method of node attributes can be similar to that of edge attributes, and is also replaced with relevant masking values. Finally, the second knowledge graph is obtained.

[0079] Step 330: Obtain a masked knowledge graph according to the second knowledge graph, or obtain a masked knowledge graph according to the first knowledge graph and the second knowledge graph.

[0080] In one embodiment, if the second knowledge graph is obtained based on the first knowledge graph, the second knowledge graph is directly used as the masked knowledge graph at this time. If the second knowledge graph is obtained based on the initial knowledge graph, the first knowledge graph and the second knowledge graph need to be merged at this time, and the masked knowledge graph is obtained after the merger. During the merger process, if a certain node is not masked in the first knowledge graph but is masked in the second knowledge graph, it is masked in the masked knowledge graph.

[0081] In the training process of the embodiments of the present application, by using the masking operation to simulate the model's prediction of missing nodes and edges, after the model has this prediction ability, the extended nodes can be regarded as missing nodes in the extended scenario, and their edges can be effectively predicted. Therefore, this embodiment improves the model's ability to infer and restore a complete knowledge graph from limited information through the masking operation, and improves the model's generalization ability and understanding ability. And the problem of insufficient labeled data is solved by the self-supervised method.

[0082] In one embodiment, multiple masked knowledge graphs are obtained as training samples according to the above process, and the relevant attribute data in the initial knowledge graph is used as labels, and multiple training samples are obtained accordingly. Next, the graph neural network encoder, semantic concept neural network layer, and graph neural network decoder in the knowledge graph expansion model are all initialized with parameters, and parameters such as the maximum number of batches and learning rate for training are set. Enter the following training process.

[0083] Step 120: Input the masked knowledge graph into the graph neural network encoder for embedding encoding to obtain the edge embedding data of each connected edge and the node embedding data of each node. Input the edge embedding data and the corresponding node embedding data into the semantic concept neural network layer to perform edge semantic parsing on the edge embedding data, obtain the predicted edge semantics, and input the node embedding data and the predicted edge semantics into the graph neural network decoder for reconstruction to obtain the predicted knowledge graph.

[0084] In one embodiment, referring to Figure 1 , after obtaining the masked knowledge graph, use it as a training sample and input it into the graph neural network encoder for embedding encoding. At this time, the graph neural network encoder performs embedding encoding on the node attributes of each node in the masked knowledge graph to generate the corresponding node embedding data, and performs embedding encoding on each connected edge to generate the corresponding edge embedding data.

[0085] In one embodiment, the graph neural network encoder can be a GNN or GCN network, and generates the node embedding data corresponding to each node by aggregating the node attributes of the node itself and its neighbor nodes. In addition to performing embedding encoding on the nodes, the graph neural network encoder also uses the edge attributes of each connected edge and the node attributes of the two end nodes for embedding encoding to obtain the edge embedding data corresponding to each connected edge.

[0086] According to the above process, each connected edge contains an edge embedding data and two corresponding node embedding data. At this time, input the edge embedding data and the two corresponding node embedding data together into the semantic concept neural network layer for semantic parsing. The purpose of the semantic parsing process is to realize the interpretable semantic analysis of the edge embedding data, and obtain the predicted edge semantics through the semantic concept neural network layer.

[0087] The structure of the semantic concept neural network layer in the embodiments of the present application will be described in detail below to illustrate why the semantic concept neural network layer can interpret the semantics of the edge embedding data.

[0088] In one embodiment, the semantic concept neural network layer includes multiple neurons, and each neuron corresponds to an edge semantic information, which is used to interpret the features of the edge. The determination method of the edge semantic information will be described in detail below. Referring to Figure 4 , Figure 4 is the construction flow chart of the semantic concept neural network layer provided by the embodiments of the present application, which specifically includes the following steps:

[0089] Step 410: Obtain multiple connected edges of the initial knowledge graph, use the two nodes corresponding to the connected edge as the connected nodes, and obtain the connected edge attributes of the connected edge and the connected node attributes of the two connected nodes.

[0090] In one embodiment, multiple connection edges are selected from the initial knowledge graph. Here, they can be randomly selected or all selected. Suppose the number of types of interpretability results of the connection edges is N. At this time, the number of selected connection edges is at least more than N, ensuring that at least these N different interpretability results can be covered. This is because the goal of this embodiment is to understand the connection logic of the initial knowledge graph by analyzing these connection edges. Only by selecting a sufficient number and comprehensive types of connection edges can various different connection logics be fully revealed.

[0091] The interpretability results here are set according to the specific content of the initial knowledge graph. Each interpretability result corresponds to a specific connection logic of the connection edges in the initial knowledge graph. When seeing a certain interpretability result, one can clearly know the connection logic of the corresponding connection edges in the initial knowledge graph, and the interpretability of the edge connection can be achieved.

[0092] In one embodiment, after the above process selects multiple connection edges, the two nodes connected to the selected connection edges are called connection nodes. At this time, the connection edge attributes of the connection edges and the connection node attributes of the two connection nodes are obtained.

[0093] Step 420: Obtain the edge semantic information of the connection edges according to the connection edge attributes and the connection node attributes.

[0094] In one embodiment, the edge semantic information is used to semantically interpret the connection edges in the initial knowledge graph. Refer to Figure 5 , Figure 5 is the flowchart for obtaining the edge semantic information of the connection edges according to the connection edge attributes and the connection node attributes provided by the embodiments of the present application, which specifically includes the following steps:

[0095] Step 510: At least obtain the edge direction parameter, edge strength parameter, and edge type parameter from the connection edge attributes, and at least obtain the node type parameter and node strength parameter from the connection node attributes.

[0096] In one embodiment, the connection edge attributes include the edge direction parameter, edge strength parameter, edge type parameter, etc., and the connection node attributes at least include the node type parameter and node strength parameter.

[0097] Among them, the edge direction parameter is used to describe the direction characteristics of the relationship represented by the connection edge. In the initial knowledge graph, many relationships have clear directions. The edge direction parameter clarifies the flow direction of this relationship, which helps to accurately understand the interaction and dependency relationships between entities.

[0098] The edge strength parameter measures the strength of the relationship represented by the connecting edge. This parameter can be obtained based on certain data statistics or analyses during the construction of the initial knowledge graph. For example, in a social network knowledge graph, if the connecting edge represents a "friendship relationship", the edge strength parameter can be determined by data such as the interaction frequency and communication duration between two people. The edge strength parameter of the friendship relationship between two people with frequent interactions and long communication times may be higher, and vice versa.

[0099] The edge type parameter is used to clarify the specific category of the relationship represented by the connecting edge. In the initial knowledge graph, there may be multiple types of relationships between different nodes. For example, the "belonging to" relationship, the "association" relationship, etc. The edge type parameter can clearly define these different relationship categories, making the relationship expression in the initial knowledge graph more accurate and clear.

[0100] The node type parameter is used to clarify the category of the entity represented by the connecting node in the initial knowledge graph, and different categories are represented by the node type parameter. The node strength parameter is used to measure the importance or influence of the connecting node in the initial knowledge graph, and this parameter can be measured by the number of connections of the node, the degree of closeness of association with other important nodes, etc.

[0101] Step 520: Generate a semantic vector according to the edge direction parameter, edge strength parameter, edge type parameter, node type parameter, and node strength parameter.

[0102] In one embodiment, after obtaining the above-mentioned edge direction parameter, edge strength parameter, edge type parameter, node type parameter, and node strength parameter, they are integrated into a unified representation form, concatenated into a vector, and a semantic vector is obtained.

[0103] Step 530: Generate the edge semantic information of the connecting edge based on the semantic vector.

[0104] In one embodiment, referring to Figure 6 , Figure 6 is the flowchart for generating the edge semantic information of the connecting edge based on the semantic vector provided by the embodiment of the present application, which specifically includes the following steps:

[0105] Step 610: Obtain at least one neighborhood node of each connecting node, form a neighborhood vector set of the corresponding connecting node according to the neighborhood semantic vectors corresponding to the neighborhood nodes, and calculate the similarity of the two neighborhood vector sets to obtain a neighborhood similarity parameter.

[0106] In one embodiment, since the initial knowledge graph contains multiple nodes, each node serving as a connection node may include at least one node directly connected thereto. For example, in a social network knowledge graph, if the connection node is a certain user, then its neighborhood nodes are the user's direct friends. It can be understood that each connection node may have one or more neighborhood nodes, which is related to the specific structure of the initial knowledge graph. In the embodiment of the present application, by traversing the connection edges of each connection node in the initial knowledge graph, its corresponding neighborhood nodes can be determined.

[0107] According to the above composition method of the semantic vector, for each connection node, the semantic vectors of each of its neighborhood nodes are obtained, and these semantic vectors form the neighborhood vector set of the connection node. Therefore, for a connection edge, it has two connection nodes, and thus two neighborhood vector sets. At this time, the similarity of these two neighborhood vector sets is calculated to obtain the neighborhood similarity parameter. The measurement of similarity can adopt methods such as cosine similarity or Euclidean distance. This embodiment is not limited thereto.

[0108] Step 620: According to the edge direction parameter, the two connection nodes are divided into an upstream node and a downstream node. The first intermediate parameter is obtained by multiplying the edge strength parameter by the node strength parameter of the upstream node, and the second intermediate parameter is obtained by multiplying the edge strength parameter by the node strength parameter of the downstream node. The edge type parameter, the first intermediate parameter, and the second intermediate parameter are weighted and summed to obtain the upstream and downstream strength parameter.

[0109] In one embodiment, since the connection edge has an edge direction parameter, the flow direction of the relationship indicated by the connection edge can be determined through the edge direction parameter, and according to this flow direction, the two connection nodes can be divided into an upstream node and a downstream node. It can be understood that if there is no direction for the connection edge in a certain initial knowledge graph, the upstream node and the downstream node are randomly determined at this time.

[0110] Since the edge strength parameter reflects the strength of the relationship represented by the connection edge, and the node strength parameter measures the importance of the node itself in the initial knowledge graph, after having the upstream node and the downstream node, the first intermediate parameter can be obtained by multiplying the edge strength parameter by the node strength parameter of the upstream node, and the contribution degree of the upstream node to the relationship strength based on its own importance is quantified by using the first intermediate parameter. Similarly, in the same way, the product of the edge strength parameter and the node strength parameter of the downstream node is calculated to obtain the second intermediate parameter, and the contribution of the downstream node to the relationship strength based on its own importance is indicated by using the second intermediate parameter.

[0111] Next, since the edge type parameter can clarify the specific category of the relationship represented by the connection edge, and different types of relationships have different importance in the analysis of the initial knowledge graph. Therefore, in the embodiments of the present application, the edge type parameter, the first intermediate parameter, and the second intermediate parameter are weighted and summed, so as to comprehensively consider the relationship type and the contribution of the upstream and downstream nodes to the relationship strength of the connection edge, and obtain an upstream and downstream strength parameter that can comprehensively reflect the relationship characteristics of the connection edge and its two connected nodes.

[0112] Step 630: Obtain edge semantic information according to the neighborhood similarity parameter and the upstream and downstream strength parameter.

[0113] In one embodiment, the neighborhood similarity parameter and the upstream and downstream strength parameter related to the connection edge are obtained according to the above process, and the edge semantic information corresponding to the connection edge is obtained in a weighted summation manner. The edge semantic information here can be an integer or a floating point number. Through the edge semantic information, the semantic information of the connection edge can be quantitatively indicated, thus realizing the interpretability of the connection edge.

[0114] Step 430: Construct corresponding neurons based on the edge semantic information, and use the neurons to obtain a semantic concept neural network layer.

[0115] In one embodiment, it is assumed that there are N types of edge semantic information in the initial knowledge graph. Therefore, N neurons are constructed, and each neuron corresponds to predicting one type of edge semantic information. Thus, according to these neurons, a semantic concept neural network layer is obtained. For example, there are three types of connection edges in the initial knowledge graph, namely "kinship", "colleague relationship", and "friendship". Therefore, there are three different types of edge semantic information, and three neurons are constructed, respectively corresponding to predicting these three relationships. Each neuron judges whether the input connection edge-related data belongs to the category of its corresponding edge semantic information by learning the features in the initial knowledge graph. During the training process, the neuron will adjust its own parameters to maximize the prediction accuracy of its corresponding edge semantic information.

[0116] As can be seen from the above, since the semantic concept neural network layer has the ability to predict different types of edge semantic information, when a connection edge in the initial knowledge graph and the relevant information of its connected nodes are given, each neuron in the semantic concept neural network layer will respectively predict the possibility that the connection edge belongs to the edge semantic information corresponding to itself, and output the probability values of different edge semantic information. By comparing these probability values, the most likely edge semantic information of the connection edge can be determined.

[0117] In addition, when the initial knowledge graph is incomplete or needs to be extended, the semantic concept neural network layer can predict the semantic information of the missing edges according to the existing relevant information of the nodes and edges, so as to complete the completion work of the initial knowledge graph.

[0118] The above process describes the construction process of the semantic concept neural network layer and its prediction principle in the embodiments of the present application. Therefore, after obtaining the edge embedding data of the connection edges and the corresponding node embedding data, inputting them into the semantic concept neural network layer to perform edge semantic parsing on the edge embedding data, the predicted edge semantics can be obtained. It can be understood that the predicted edge semantics are the relevant predicted values of the edge semantic information.

[0119] After having the predicted edge semantics, the graph neural network decoder receives the node embedding data and the predicted edge semantics as inputs, and uses its own network structure and the patterns learned during the training process to infer and predict the node attributes and edge attributes. Since the node embedding data contains the feature information of the nodes, and the predicted edge semantics provide information about the relationships between the nodes. Therefore, the graph neural network decoder comprehensively processes this information to predict the node attributes of each node and the edge attributes of each connection edge, generating a predicted knowledge graph. Among them, the graph neural network decoder can be obtained by a multi-layer perceptron or other similar structures.

[0120] In one embodiment, the predicted knowledge graph includes the predicted node attributes of each node in the initial knowledge graph and the predicted edge attributes of each connection edge. Among them, the predicted node attributes include the prediction results of the masked nodes and the prediction results of other nodes, and the predicted edge attributes include the prediction results of the masked edges and the prediction results of other connection edges.

[0121] Step 130: Train a knowledge graph extension model based on the predicted knowledge graph and the initial knowledge graph, and use the trained knowledge graph extension model to update the initial knowledge graph.

[0122] In one embodiment, referring to Figure 7 , Figure 7 is the flowchart of training a knowledge graph extension model based on the predicted knowledge graph and the initial knowledge graph provided by the embodiments of the present application, which specifically includes the following steps:

[0123] Step 710: Obtain the node attributes of each node, the edge attributes of each connection edge, and the corresponding edge semantic information from the initial knowledge graph, and obtain the predicted node attributes of each node and the predicted edge attributes of each connection edge from the predicted knowledge graph.

[0124] In one embodiment, the initial knowledge graph is used as the label during the training process. Specifically, the node attributes of each node, the edge attributes of each connection edge, and the edge semantic information corresponding to each connection edge are obtained as labels. Then, the predicted node attributes of each node and the predicted edge attributes of each connection edge in the predicted knowledge graph are obtained. The purpose of setting the labels is to guide the predicted node attributes to be as close as possible to the node attributes and the predicted edge attributes to be as close as possible to the edge attributes through a self-supervised process.

[0125] Step 720: Calculate the node loss value according to the node attributes and the predicted node attributes, calculate the edge attribute loss value according to the edge attributes and the predicted edge attributes, and calculate the edge semantic loss value according to the edge semantic information and the predicted edge semantics. Obtain the total loss value based on the node loss value, the edge attribute loss value, and the edge semantic loss value.

[0126] In one embodiment, the total loss value is expressed as:

[0127]

[0128] where Loss represents the total loss value, represents the node loss value, represents the edge attribute loss value, represents the edge semantic loss value, n_atom represents the total number of nodes (including masked nodes), n_bond represents the total number of connecting edges (including masked edges), P i represents the node attribute of the i-th node, represents the predicted node attribute of the i-th node, B i represents the edge attribute of the i-th connecting edge, represents the predicted edge attribute of the i-th connecting edge, C i represents the edge semantic information of the i-th connecting edge, represents the predicted edge semantics of the i-th connecting edge.

[0129] It can be seen that the total loss value includes the recovery loss and the semantic loss. Among them, the recovery loss includes the node loss value and the edge attribute loss value, which are used to measure the restoration ability of the knowledge graph expansion model for the masked node attributes and edge attributes, ensuring that the knowledge graph expansion model can accurately reconstruct the original content of the initial knowledge graph. The semantic loss, on the other hand, is used to constrain the output semantic consistency of the semantic concept neural network layer, ensuring that the feature values of the semantic concept neural network layer can match the initially designed multiple edge semantic information, thereby ensuring that the predicted edge semantics have clear semantic interpretations.

[0130] Step 730: Adjust the parameters of the knowledge graph expansion model based on the total loss value to obtain a trained knowledge graph expansion model.

[0131] In one embodiment, after obtaining the total loss value, the parameters of the knowledge graph expansion model can be adjusted according to the total loss value. After reaching the iteration termination condition, a trained knowledge graph expansion model is obtained. Among them, the iteration termination condition can be that the prediction accuracy reaches the preset accuracy, or the number of iterations reaches the preset number of iterations. This embodiment does not make any limitations in this regard.

[0132] In the embodiments of the present application, a self-supervised learning mechanism is used to dynamically update the initial knowledge graph, and a corresponding sample is generated through a masking process, so as to complete the connection prediction between new nodes and the nodes of the existing knowledge graph under the condition of no annotation or scarce annotation. Compared with the supervised learning method that relies on a large amount of labeled data, self-supervised learning significantly reduces the data dependence and improves the applicability of the knowledge graph expansion model in the dynamic knowledge graph expansion scenario. In addition, the knowledge graph expansion model includes a graph neural network encoder and a graph neural network decoder, so it can efficiently encode the topological structure and attribute information of nodes and quickly adapt to the connection requirements of new nodes in a dynamic environment.

[0133] In one embodiment, after having a trained knowledge graph expansion model, the initial knowledge graph can be updated and expanded by using the knowledge graph expansion model. Refer to Figure 8 , Figure 8 which is a flowchart for updating the initial knowledge graph by using the trained knowledge graph expansion model provided by the embodiments of the present application, and specifically includes the following steps:

[0134] Step 810: Obtain at least one expansion node and expansion edges related to the expansion node, and update the initial knowledge graph according to the expansion node and the expansion edges to obtain an expanded knowledge graph.

[0135] In one embodiment, to obtain the expansion nodes to be added to the initial knowledge graph and the expansion edges corresponding to each expansion node, it can be understood that the expansion edges can connect two different expansion nodes or can also connect an expansion node and a node in the initial knowledge graph. After having the expansion nodes and the expansion edges, the expansion nodes and the expansion edges can be added to the initial knowledge graph to obtain an expanded knowledge graph.

[0136] Step 820: Input the expanded knowledge graph into the knowledge graph expansion model for data prediction, and generate the expansion node attributes corresponding to each expansion node, the expansion edge attributes corresponding to each expansion edge, and the expansion edge semantic information.

[0137] In one embodiment, after obtaining the expanded knowledge graph, it becomes a necessary step to generate the attributes of the expansion nodes and the attributes of the expansion edges. For this purpose, the expanded knowledge graph is input into the knowledge graph expansion model for data prediction. With the help of this model, the expansion node attributes corresponding to each expansion node and the expansion edge attributes corresponding to each expansion edge are predicted and generated.

[0138] Meanwhile, the output data of the semantic concept neural network layer is used as the extended edge semantic information. For example, the formation of a certain extended edge may be due to the high similarity of the neighborhoods of its corresponding two nodes. By using the extended edge semantic information to interpret the semantics of the extended edge, not only can the accuracy of the edge prediction result be clarified, but also its interpretability can be enhanced. Using transparent connection bases can enhance the trust of users and applications in the results, which is applicable to the extension and update of dynamic knowledge graphs. For example, the dynamic recommendation of new items in a recommendation system, the prediction of new user relationships in a social network, and the extension of new knowledge points in an intelligent question answering system, etc.

[0139] The technical solution provided by the embodiment of the present application is executed by a knowledge graph extension model. The knowledge graph extension model includes a graph neural network encoder, a semantic concept neural network layer, and a graph neural network decoder. By obtaining an initial knowledge graph and performing node masking and edge masking on the initial knowledge graph, a masked knowledge graph is obtained. The masked knowledge graph is input into the graph neural network encoder for embedding encoding to obtain edge embedding data for each connected edge and node embedding data for each node. The edge embedding data and the corresponding node embedding data are input into the semantic concept neural network layer to perform edge semantic parsing on the edge embedding data to obtain predicted edge semantics. The node embedding data and the predicted edge semantics are input into the graph neural network decoder for reconstruction to obtain a predicted knowledge graph. The knowledge graph extension model is trained based on the predicted knowledge graph and the initial knowledge graph, and the trained knowledge graph extension model is used to update the initial knowledge graph. In the training process of the embodiment of the present application, masking operations are used to improve the model's ability to infer and recover the complete knowledge graph from limited information, and improve the model's understanding ability. At the same time, in the prediction process, the semantic concept neural network layer is used to map the embedding data of nodes and edges to a fixed concept space to realize the edge semantic parsing of the edge embedding data. Through the edge semantic parsing, the meaning of the edge is represented in a more explicit semantic form, providing interpretability for the prediction result. Moreover, based on the predicted edge semantics, the extension of the knowledge graph can provide more accurate semantic understanding when the model extends the knowledge graph, guiding the model to determine the type and direction of new nodes, avoiding adding unreasonable or incorrect relationships, and improving the reliability and accuracy of the extension result.

[0140] The embodiment of the present application also provides a dynamic update device for a knowledge graph, which can implement the above-mentioned dynamic update method of the knowledge graph. Refer to Figure 9 , the device includes:

[0141] Masking module 910: used to obtain the initial knowledge graph and perform node masking and edge masking on the initial knowledge graph to obtain a masked knowledge graph.

[0142] Prediction module 920: It is used to input the masked knowledge graph into the graph neural network encoder for embedding encoding to obtain the edge embedding data of each connected edge and the node embedding data of each node, input the edge embedding data and the corresponding node embedding data into the semantic concept neural network layer to perform edge semantic parsing on the edge embedding data to obtain the predicted edge semantics, and input the node embedding data and the predicted edge semantics into the graph neural network decoder for reconstruction to obtain the predicted knowledge graph.

[0143] Application module 930: It is used to train the knowledge graph extension model based on the predicted knowledge graph and the initial knowledge graph, and use the trained knowledge graph extension model to update the initial knowledge graph.

[0144] The specific implementation manner of the knowledge graph dynamic update device in this embodiment is basically the same as that of the above knowledge graph dynamic update method, and will not be elaborated here.

[0145] This application embodiment also provides an electronic device, including:

[0146] At least one memory;

[0147] At least one processor;

[0148] At least one program;

[0149] The program is stored in the memory, and the processor executes the at least one program to implement the knowledge graph dynamic update method described above in this application. This electronic device can be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a vehicle-mounted computer, etc.

[0150] Please refer to Figure 10 , Figure 10 which shows the hardware structure of an electronic device in another embodiment. The electronic device includes:

[0151] Processor 1001, which can be implemented in ways such as a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in this application embodiment;

[0152] The memory 1002 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM), etc. The memory 1002 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1002 and are called by the processor 1001 to execute the dynamic update method of the knowledge graph in the embodiments of this application;

[0153] The input / output interface 1003 is used to implement information input and output;

[0154] The communication interface 1004 is used to implement communication interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or through wireless means (such as mobile network, WIFI, Bluetooth, etc.); and

[0155] The bus 1005 transmits information between the various components of the device (such as the processor 1001, the memory 1002, the input / output interface 1003, and the communication interface 1004);

[0156] Among them, the processor 1001, the memory 1002, the input / output interface 1003, and the communication interface 1004 are communicatively connected to each other inside the device through the bus 1005.

[0157] The embodiments of this application also provide a storage medium. The storage medium is a storage medium that stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned dynamic update method of the knowledge graph.

[0158] As a non-transitory storage medium, the memory can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory can include high-speed random access memory and can also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory optionally includes a memory remotely disposed relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above-mentioned network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0159] The dynamic update method, device, equipment, and storage medium of the knowledge graph proposed in the embodiments of this application are executed by a knowledge graph extension model. The knowledge graph extension model includes a graph neural network encoder, a semantic concept neural network layer, and a graph neural network decoder. By obtaining an initial knowledge graph and performing node masking and edge masking on the initial knowledge graph, a masked knowledge graph is obtained. The masked knowledge graph is input into the graph neural network encoder for embedding encoding to obtain edge embedding data for each connected edge and node embedding data for each node. The edge embedding data and the corresponding node embedding data are input into the semantic concept neural network layer to perform edge semantic parsing on the edge embedding data to obtain predicted edge semantics. The node embedding data and the predicted edge semantics are input into the graph neural network decoder for reconstruction to obtain a predicted knowledge graph. The knowledge graph extension model is trained based on the predicted knowledge graph and the initial knowledge graph, and the trained knowledge graph extension model is used to update the initial knowledge graph. In the training process of the embodiments of this application, masking operations are used to enhance the model's ability to infer and restore the complete knowledge graph from limited information, improving the model's understanding ability. At the same time, in the prediction process, the semantic concept neural network layer is used to map the embedding data of nodes and edges to a fixed concept space to achieve edge semantic parsing of the edge embedding data. Through edge semantic parsing, the meaning of the edge is represented in a more explicit semantic form, providing interpretability for the prediction results. Moreover, based on the predicted edge semantics, the extension of the knowledge graph can provide more accurate semantic understanding when the model extends the knowledge graph, guiding the model to determine the types and directions of new nodes, avoiding adding unreasonable or incorrect relationships, and improving the reliability and accuracy of the extension results.

[0160] The embodiments described in the embodiments of this application are for more clearly illustrating the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are equally applicable to similar technical problems.

[0161] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than those shown in the figures, or combine some steps, or different steps.

[0162] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0163] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or a suitable combination thereof.

[0164] As used in the specification of this application and the above-mentioned drawings, the terms "first", "second", "third", "fourth", etc. (if any) are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data may be interchanged under appropriate circumstances so that the embodiments of this application described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0165] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects and indicates that three relationships may exist. For example, "A and / or B" may mean: only A exists, only B exists, and both A and B exist simultaneously. Here, A and B may be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or a similar expression means any combination of these items, including any combination of single items (ones) or plural items (ones). For example, at least one (one) of a, b, or c may mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c may be single or multiple.

[0166] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the above-mentioned unit division is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical, or other forms.

[0167] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0168] In addition, each functional unit in various embodiments of the present application may be integrated in a processing unit, may exist separately as individual physical units, or two or more units may be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0169] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store programs.

[0170] The preferred embodiments of the embodiments of the present application have been described above with reference to the accompanying drawings, and thus do not limit the scope of the rights of the embodiments of the present application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the rights of the embodiments of the present application.

Claims

1. A method for dynamically updating a knowledge graph, characterized in that: The method is performed by a knowledge graph expansion model, wherein the knowledge graph expansion model includes a graph neural network encoder, a semantic concept neural network layer, and a graph neural network decoder. The method includes: Obtain an initial knowledge graph, and perform node masking and edge masking on the initial knowledge graph to obtain a masked knowledge graph; Input the masked knowledge graph into the graph neural network encoder for embedding coding to obtain edge embedding data of each connecting edge and node embedding data of each node, input the edge embedding data and the corresponding node embedding data into the semantic concept neural network layer to perform edge semantic analysis on the edge embedding data to obtain predicted edge semantics, and input the node embedding data and the predicted edge semantics into the graph neural network decoder for reconstruction to obtain a predicted knowledge graph; The knowledge graph extension model is trained based on the predicted knowledge graph and the initial knowledge graph, and the initial knowledge graph is updated using the trained knowledge graph extension model.

2. The method for dynamically updating a knowledge graph according to claim 1, characterized in that: The performing node masking and edge masking on the initial knowledge graph to obtain a masked knowledge graph includes: Randomly select some nodes from the initial knowledge graph as mask nodes, mask the node attributes of the mask nodes, and obtain a first knowledge graph; Randomly selecting some connecting edges from the initial knowledge graph or the first knowledge graph as mask edges, masking the edge attributes of the mask edges, and masking the node attributes of two nodes corresponding to the mask edges, to obtain a second knowledge graph; The masked knowledge graph is obtained according to the second knowledge graph, or the masked knowledge graph is obtained according to the first knowledge graph and the second knowledge graph.

3. The method for dynamically updating a knowledge graph according to claim 1, characterized in that: The semantic concept neural network layer includes a plurality of neurons, each of which corresponds to an edge semantic information. Before inputting the edge embedding data and the corresponding node embedding data into the semantic concept neural network layer to perform edge semantic analysis on the edge embedding data to obtain predicted edge semantics, the method further includes: Acquire multiple connection edges of the initial knowledge graph, use two nodes corresponding to the connection edges as connection nodes, and acquire connection edge attributes of the connection edges and connection node attributes of the two connection nodes; Acquire edge semantic information of the connection edge according to the connection edge attribute and the connection node attribute, wherein the edge semantic information is used to perform semantic interpretation on the connection edge in the initial knowledge graph; Corresponding neurons are constructed based on the edge semantic information, and the semantic concept neural network layer is obtained using the neurons.

4. The method for dynamically updating a knowledge graph according to claim 3, characterized in that: The acquiring edge semantic information of the connection edge according to the connection edge attribute and the connection node attribute includes: Acquire at least an edge direction parameter, an edge strength parameter and an edge type parameter from the connection edge attributes, and acquire at least a node type parameter and a node strength parameter from the connection node attributes; Generate a semantic vector according to the edge direction parameter, the edge strength parameter, the edge type parameter, the node type parameter and the node strength parameter; The edge semantic information of the connecting edge is generated based on the semantic vector.

5. The method for dynamically updating a knowledge graph according to claim 4, characterized in that: The generating the edge semantic information of the connecting edge based on the semantic vector includes: Acquire at least one neighboring node of each of the connection nodes, form a neighborhood vector set of the corresponding connection node according to the neighborhood semantic vectors corresponding to the neighborhood nodes, and calculate the similarity of two neighborhood vector sets to obtain a neighborhood similarity parameter; According to the edge direction parameter, the two connection nodes are divided into upstream nodes and downstream nodes, a first intermediate parameter is obtained according to the product of the edge strength parameter and the node strength parameter of the upstream node, a second intermediate parameter is obtained according to the product of the edge strength parameter and the node strength parameter of the downstream node, and a weighted sum is performed on the edge type parameter, the first intermediate parameter and the second intermediate parameter to obtain an upstream and downstream strength parameter; The edge semantic information is obtained according to the neighborhood similarity parameter and the upstream and downstream strength parameters.

6. The method for dynamically updating a knowledge graph according to claim 1, characterized in that: The step of training the knowledge graph extension model based on the predicted knowledge graph and the initial knowledge graph includes: Obtaining node attributes of each node, edge attributes of each connecting edge and corresponding edge semantic information from the initial knowledge graph, and obtaining predicted node attributes of each node and predicted edge attributes of each connecting edge from the predicted knowledge graph; Calculate a node loss value according to the node attribute and the predicted node attribute, calculate an edge attribute loss value according to the edge attribute and the predicted edge attribute, and calculate an edge semantic loss value according to the edge semantic information and the predicted edge semantics, and obtain a total loss value according to the node loss value, the edge attribute loss value, and the edge semantic information edge semantic loss value; The parameters of the knowledge graph extension model are adjusted based on the total loss value to obtain the trained knowledge graph extension model.

7. The method for dynamically updating a knowledge graph according to any one of claims 1 to 6, characterized in that: The updating of the initial knowledge graph by using the trained knowledge graph extension model includes: Obtain at least one extended node and an extended edge related to the extended node, and update the initial knowledge graph according to the extended node and the extended edge to obtain an extended knowledge graph; The extended knowledge graph is input into the knowledge graph extension model for data prediction to generate extended node attributes corresponding to each extended node and extended edge attributes and extended edge semantic information corresponding to each extended edge.

8. A knowledge graph dynamic update device, characterized in that: The method is executed by a knowledge graph expansion model, wherein the knowledge graph expansion model includes a graph neural network encoder, a semantic concept neural network layer, and a graph neural network decoder. The device includes: Masking module: used to obtain an initial knowledge graph, and perform node masking and edge masking on the initial knowledge graph to obtain a masked knowledge graph; Prediction module: used for inputting the masked knowledge graph into the graph neural network encoder for embedding coding, obtaining edge embedding data of each connecting edge and node embedding data of each node, inputting the edge embedding data and the corresponding node embedding data into the semantic concept neural network layer to perform edge semantic analysis on the edge embedding data to obtain predicted edge semantics, and inputting the node embedding data and the predicted edge semantics into the graph neural network decoder for reconstruction to obtain a predicted knowledge graph; Application module: used to train the knowledge graph extension model based on the predicted knowledge graph and the initial knowledge graph, and update the initial knowledge graph using the trained knowledge graph extension model.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the dynamic update method of the knowledge graph described in any one of claims 1 to 7 when executing the computer program.

10. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the dynamic update method of the knowledge graph described in any one of claims 1 to 7.

Citation Information

Cited By

  • Fragmented semantic understanding order building system and method based on knowledge graph

    CN120725026A

  • Knowledge graph-based fragmented semantic understanding and building system and method

    CN120725026B