Time sequence knowledge graph entity alignment method and device
By embedding entity, relationship and time information in the timing knowledge graph, using the time relationship attention mechanism and graph neural network for entity representation learning, combined with iterative learning and loss optimization, the challenge of entity alignment of low-similarity knowledge graph is solved, and the accuracy of alignment and data integrity are improved.
Patent Information
- Application Number
- CN202510164009.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The entity alignment task of low-similarity knowledge graphs poses great challenges, and the existing technology is difficult to effectively solve this problem.
By embedding all entities, relationships and time information in the two timing knowledge graphs into a shared vector space, the time relationship attention mechanism is used to allocate weights to neighbor nodes in the entity neighborhood, the entity representation is determined based on the attention coefficient, and entity alignment is completed through iterative learning and loss optimization.
Improve the accuracy of low-similarity knowledge graph entity alignment, improve training data, fill in missing parts of the knowledge graph, and enhance the applicability of entity alignment methods in heterogeneous and incomplete datasets.
Smart Images

Figure CN119623609A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge graph technology, and in particular to a method and device for aligning entities in a temporal knowledge graph. Background Art
[0002] Knowledge graphs (KGs) are a structured representation of knowledge, usually in the form of triples. Storage information. Temporal knowledge graphs (TKGs) contain timestamp information in the form of quadruple Representing knowledge. However, as the number of knowledge graphs from different sources continues to increase, ensuring their consistency and interoperability becomes critical. The entity alignment task aims to identify and match nodes in different knowledge graphs that represent the same real-world entities, thereby achieving cross-graph data integration and knowledge consolidation.
[0003] Current research on entity alignment (EA) focuses on aligning heterogeneous knowledge graphs, cross-language knowledge graphs, and cross-domain knowledge graphs. Among various EA methods, embedding-based methods have received widespread attention from scholars. These methods map entities and relations in knowledge graphs into low-dimensional vector spaces, converting the entity alignment problem into vector similarity calculations. Classic methods include TransE, TransH, and TransR. In addition, graph neural networks (GNNs) perform well in capturing graph structure information and have been widely used in EA tasks in recent years. For example, a model that combines GCN and GNN.
[0004] However, in previous studies on entity alignment, the datasets used usually show high similarity, and there is significant overlap between the two knowledge graphs. For example, the ICEWS05-15 dataset used in GNN has nearly 50% quadruple overlap. Such high-overlap datasets make the alignment task relatively simple. However, for datasets with low similarity, the knowledge graph entity alignment task is more challenging. Summary of the invention
[0005] In order to solve the technical problem that the entity alignment task of low-similarity knowledge graphs is very challenging, an embodiment of the present invention provides a method and device for entity alignment of a temporal knowledge graph.
[0006] The technical solution of the embodiment of the present invention is achieved as follows: An embodiment of the present invention provides a method for aligning entities in temporal knowledge graphs, the method comprising: embedding all entities, relationships and time information in two temporal knowledge graphs into a shared vector space; using a temporal relationship attention mechanism according to an orthogonal transformation matrix of the relationship and time information in the vector space to assign corresponding weights to neighbor nodes in an entity neighborhood in the vector space; based on the weights, determining the attention coefficients of neighbor nodes in the entity neighborhood; using a graph neural network according to the attention coefficients of neighbor nodes in the entity neighborhood to determine the representation of the entity; based on the entity representation, calculating the distances of entities in different temporal knowledge graphs, and completing the alignment of entities in the temporal knowledge graphs when the loss no longer decreases; selecting high-similarity entity pairs from the aligned entity pairs, incorporating the high-similarity entity pairs into a training set, continuing iterative calculations, aligning entities in different knowledge graphs, and completing the knowledge graphs.
[0007] In one embodiment, the orthogonal transformation matrix of the relationship and time information is: Formula (1) Formula (2) in, represents the relational transformation matrix, represents the time transformation matrix, represents the identity matrix, It's a relationship The embedding is the time step Embedding.
[0008] In one embodiment, the attention coefficient includes time-specific attention importance and relationship-specific attention importance; The calculation formula of the time-specific attention importance is as follows: Formula (3) The relationship-specific attention importance is calculated as follows: Formula (4) in, Indicates time-specific attention importance, Indicates the relationship-specific attention importance, represents the shared temporal and relational attention weight vector, is the time step The embedding It's a relationship The embedding and Respectively represent entities To Entity A collection of relationships and timestamps.
[0009] In one embodiment, the entity is represented as: Formula (5) in, is the representation of the entity, , for entities The global output features of represents the initial input features, , Representing Entities The set of temporal neighbors of Indicates the time step Belongs to entity The set of temporal neighbors of Indicates the time step The embedding vector of represents the activation function, Representing Entities Is Entity Neighbor entities, Indicates the time step and relationship Is Entity and entities The time relationship between represents the attention coefficient, represents the time-dependent entity transformation matrix, represents another attention coefficient, represents the relation-related transformation matrix, Representing Entities Embedding representation at the previous layer.
[0010] In one embodiment, the distance between entities in different temporal knowledge graphs is calculated as follows: Formula (6) in, Represents the distance between entities in different temporal knowledge graphs, , Represent entities in two different temporal knowledge graphs ,entity Representation of an entity.
[0011] In one embodiment, the loss function for calculating the distance between entities in different temporal knowledge graphs is calculated as follows: Formula (7) in, represents the loss function, represents the entity pairs in the set S, Representing Entities Belong to the picture , represents the hyperparameter, represents the distance function between two entities, represents a negative entity pair, Representing Entities Belong to the picture , Represents the distance function for pairs of negative entities.
[0012] In one embodiment, selecting high-similarity entity pairs from aligned entity pairs includes: obtaining a distance between the aligned entity pairs and a preset threshold; and determining entity pairs whose distance is greater than the preset threshold as high-similarity entity pairs.
[0013] An embodiment of the present invention also provides a device for aligning entities in a temporal knowledge graph, which comprises: an embedding module for embedding all entities, relationships and time information in two temporal knowledge graphs into a shared vector space; an attention mechanism module for assigning corresponding weights to neighbor nodes in an entity neighborhood in the vector space using a temporal relationship attention mechanism according to an orthogonal transformation matrix of relationship and time information in the vector space; determining the attention coefficient of the neighbor nodes in the entity neighborhood based on the weight; an entity representation module for determining the representation of the entity using a graph neural network according to the attention coefficient of the neighbor nodes in the entity neighborhood; a loss optimization module for calculating the distance between entities in different temporal knowledge graphs according to the entity representation, and completing the alignment of entities in the temporal knowledge graphs when the loss no longer decreases; an iterative training module for selecting high-similarity entity pairs from the aligned entity pairs, incorporating the high-similarity entity pairs into a training set, continuing iterative calculations, aligning entities in different knowledge graphs, and completing the knowledge graphs.
[0014] An embodiment of the present invention also provides a temporal knowledge graph entity alignment system, comprising: a processor and a memory for storing a computer program that can be run on the processor; wherein, when the processor is used to run the computer program, it executes the steps of any one of the above methods.
[0015] An embodiment of the present invention further provides a storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0016] The method and device for aligning entities in a temporal knowledge graph provided by an embodiment of the present invention embed all entities, relations and time information in two temporal knowledge graphs into a shared vector space; according to the orthogonal transformation matrix of the relation and time information in the vector space, a temporal relation attention mechanism is used to assign corresponding weights to neighbor nodes in the entity neighborhood in the vector space; based on the weights, the attention coefficients of the neighbor nodes in the entity neighborhood are determined; according to the attention coefficients of the neighbor nodes in the entity neighborhood, the representation of the entity is determined using a graph neural network; according to the entity representation, the distances of entities in different temporal knowledge graphs are calculated, and when the loss is no longer reduced, the alignment of entities in the temporal knowledge graph is completed; high-similarity entity pairs are selected from the aligned entity pairs, the high-similarity entity pairs are included in the training set, and the iterative calculation is continued to align entities in different knowledge graphs, and the knowledge graph is completed. The scheme provided by the present invention not only improves the training data, but also fills in the missing parts of the knowledge graph, thereby improving the accuracy of the overall alignment and improving the applicability of the entity alignment method in heterogeneous and incomplete data sets. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a flowchart of a method for aligning entities in a temporal knowledge graph according to an embodiment of the present invention; Figure 2 A schematic diagram of an iterative completion strategy process according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a device for aligning entities in a temporal knowledge graph according to an embodiment of the present invention; Figure 4 1 is a diagram showing the internal structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0018] Before introducing the solution of this embodiment, the following contents are explained first.
[0019] 1. Entity Alignment Existing knowledge graph entity alignment methods include translation-based models and graph neural network-based models. Translation-based methods usually embed the entities and relations of the knowledge graph into a low-dimensional vector space. In this case, the head entity vector plus the relationship vector equals the tail entity vector, for example , and ensures that the correct triples have a small distance by minimizing a loss function. A typical translation-based model is TransE. The TransH model built on TransE maps the entity vector of the triple to a relation-specific hyperplane and applies the TransE triple constraint within the hyperplane. The TransR model sets a mapping matrix for each relation, uses the matrix to transform the entity embedding vector of the corresponding relation, and then applies the TransE triple constraint. In addition to using relation triplets, JAPE improves the performance of entity alignment by combining the attribute features of entities to learn their representations.
[0020] With the development of temporal knowledge graphs (TKGs), temporal knowledge graph embedding (TKGE) has attracted more and more attention. A typical TKGE model, TTransE, represents timestamps together with entities and relations as latent vectors and embeds time into its scoring function. The TKG embedding model ATiSE uses additive time series decomposition to represent entities and relations as multi-dimensional Gaussian distributions, capturing their evolution with trends, seasonality, and random components. To perform temporal reasoning, TeRo models the temporal evolution of entity embeddings in complex vector space by rotating from the initial time to the current time. Specifically, for time interval facts, each relation is represented by a pair of dual complex embeddings that manage the start and end of the relation respectively.
[0021] 2. Graph Neural Networks Graph Neural Networks (GNNs) play a key role in entity alignment (EA), combining node features and topological information to generate context-aware embedding vectors and learn high-quality entity representations. EvolveGCN usually decomposes the temporal graph into multiple static snapshots and adopts a combination of GNNs and recursive architectures, where GNNs process graph information and recursive models manage dynamic aspects. The Temporal Message Passing (TeMP) framework enhances its graph prediction capabilities by combining graph neural networks, temporal dynamic models, and data interpolation techniques, leveraging multi-hop structural information and temporal facts of recent time steps.
[0022] The GCN and GAT models developed from GNNs have also played an important role in temporal entity alignment. GCN-Align uses graph convolutional networks to embed entities in each knowledge graph into a unified vector space, independent of prior relational knowledge. HGCN is an alignment joint learning framework that first uses entity embeddings learned by GCN to approximate relational representations, and then incorporates relational approximations into entities, iteratively learning better representations for both. RDGCN is a novel relation-aware dual-graph convolutional network that integrates relational information, enhances entity representation, and captures neighboring structures by performing attention interactions between knowledge graphs and their dual relational counterparts. RREA obtains relation-specific embeddings for each entity in a more efficient way through relational reflection transformations, and assigns different weight coefficients according to the type of relationship between entities. This enables the model to distinguish the importance of different entities.
[0023] 3. Iterative training Iterative training methods select high-confidence entity pairs from the alignment results to expand the training set. Some researchers select high-confidence entity pairs based on the distance between entities in the structural vector space, and add these pairs to the training set through direct and soft alignment methods. Some researchers have proposed a bootstrap framework to improve the accuracy of high-confidence entity pairs in the selection process by designing a global optimization objective. In order to address the shortcomings of seed entity pairs, lnga uses an iterative training strategy to train GCN, continuously annotate unlabeled instances, and select high-quality instances for retraining to generate better entity embeddings. The EASY framework introduces a structure-based refinement strategy (SRS) to iteratively correct mismatched entities identified by NEAP. SRS uses a confidence seed generator based on graph matching differences to guide entity representation learning. These representations are used to calculate the structural similarity between entities, and SRS adjusts mismatched entities by considering semantic and structural similarities.
[0024] Based on the above related introduction, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments.
[0025] The embodiment of the present invention provides a method for aligning entities in a temporal knowledge graph, such as Figure 1 As shown, the method includes: Step 101: embed all entities, relations, and time information in the two temporal knowledge graphs into a shared vector space; Step 102: assigning corresponding weights to neighbor nodes in the entity neighborhood in the vector space using a temporal relationship attention mechanism according to an orthogonal transformation matrix of the relationship and time information in the vector space; and determining attention coefficients of neighbor nodes in the entity neighborhood based on the weights; Step 103: Determine the representation of the entity using a graph neural network according to the attention coefficients of neighboring nodes in the neighborhood of the entity; Step 104: Calculate the distances between entities in different temporal knowledge graphs according to the entity representations, and complete the alignment of entities in the temporal knowledge graphs when the loss is no longer reduced; Step 105: Select high-similarity entity pairs from the aligned entity pairs, add the high-similarity entity pairs into the training set, continue iterative calculations, align entities in different knowledge graphs, and complete the knowledge graphs.
[0026] This embodiment is designed for low-similarity datasets and combines iterative completion with graph neural networks to dynamically complete the knowledge graph while aligning entities. The iterative strategy of this embodiment not only improves the training data, but also fills in the missing parts of the knowledge graph, thereby improving the accuracy of the overall alignment.
[0027] Below, this embodiment will be described with a specific example.
[0028] First, let’s define the problem.
[0029] The temporal knowledge graph (TKG) is represented as ,in , and are the collections of entities, relations, and timestamps, respectively. is a set of four tuples. TKG is based on four tuples. The real-world information is represented in the form of , and It is worth noting that Expressed as , which is the start timestamp and end timestamp In some cases, there may be .set up and For two TKGs, and To align the seed sets. The timestamps in the two sets are merged into a unified set , share the same timestamp. The EA task between TKGs is to identify additional equivalent entity pairs based on the alignment seeds.
[0030] Based on the defined problem, the model proposed in this embodiment is introduced.
[0031] This example proposes an RL-TEA model that combines iterative learning and graph neural networks (GNNs) to solve the entity alignment task in temporal knowledge graphs. The key idea behind RL-TEA is to exploit the temporal and relational information of entities through a temporal relational attention mechanism and iteratively improve the alignment process by incorporating high-confidence entity pairs into the training set. This iterative strategy not only expands the training data, but also fills in the missing parts of the knowledge graph, thereby improving the accuracy of the overall alignment. The following subsections detail the components and steps of the proposed method.
[0032] 1.1 Temporal Relation Attention Network Project all entities, relations, and time steps from two temporal knowledge graphs (TKGs) into a common vector space ,in Represents an embedded dimension. ,relation and time steps The embeddings are expressed as Since using an orthogonal transformation matrix can achieve robust results when transforming one isomorphic embedding into another, in entity relation embedding, the orthogonal transformation matrix can keep the norm and relative distance of the transformed entities unchanged. Defining relation embedding and time embedding The transformation matrix is as follows: (1) in, , represents the relational transformation matrix, represents the time transformation matrix, represents the identity matrix, It's a relationship The embedding is the time step The norm of the orthogonal transformation entity remains unchanged, which means that the length of the entity embedding vector remains unchanged: (2) The relative distance between entities remains unchanged after the transformation, which means that the angle between the embedding vectors of two entities remains unchanged: (3) The temporal attention mechanism is used to integrate temporal and relational information into entity representation. It assigns different weights to neighbor nodes based on the orthogonal transformation matrices of their respective relations and timestamps. To construct the temporal relational attention mechanism, we establish the time-specific attention importance and relationship-specific attention importance : (4) in, represents the shared temporal and relational attention weight vector, is the time step The embedding It's a relationship Embedding. and Respectively represent entities To Entity A collection of relationships and timestamps.
[0033] 1.2 Graph Neural Networks Graph Attention Network (GAT) improves the standard Graph Convolutional Network (GCN) by utilizing the self-attention mechanism. This mechanism computes the hidden representation of a node by paying attention to its neighbors. The definition of the GAT layer is as follows: (5) in, Is Entity To Entity The attention coefficient, is the shared transformation matrix, represents entity embedding, is a nonlinear activation function. Therefore, substituting formula (1) and formula (4) into formula (5) yields a new entity feature update formula: (6) To capture multi-hop neighborhood information, we use cross-layer representation to generate global output features by combining entity features from different layers. The global output characteristics of The definition is as follows: (7) in, Indicates the number of layers, represents the initial input features. We also combine the average embedding of the concatenated timestamps and the output features of the entity to obtain a multi-view embedding as the final entity representation: (8) in, is the representation of the entity, , for entities The global output features of represents the initial input features, , Representing Entities The set of temporal neighbors of Indicates the time step Belongs to entity The set of temporal neighbors of Indicates the time step The embedding vector of represents the activation function, Representing Entities Is Entity Neighbor entities, Indicates the time step and relationship Is Entity and entities The time relationship between represents the attention coefficient, represents the time-dependent entity transformation matrix, represents another attention coefficient, represents the relation-related transformation matrix, Representing Entities Embedding representation at the previous layer.
[0034] 1.3 Entity Alignment Entity alignment is predicted based on the distance between the final entity output features from the source knowledge graph and the target knowledge graph. and , we use the Euclidean norm, also known as norm, to measure the distance between them: (9) in, Represents the distance between entities in different temporal knowledge graphs, , Represent entities in two different temporal knowledge graphs ,entity Representation of an entity.
[0035] This embodiment adopts a negative sampling strategy, using complete negative sampling instead of random negative sampling to achieve faster convergence. The marginal-based logistic loss function of the entity pair can be defined as follows: (10) in, represents the loss function, represents the entity pairs in the set S, Representing Entities Belong to the picture , represents the hyperparameter, represents the distance function between two entities, represents a negative entity pair, Representing Entities Belong to the picture , Represents the distance function for pairs of negative entities.
[0036] 1.4 Iterative Learning The alignment process is improved by applying an iterative strategy that considers the one-to-one correspondence between entities in the knowledge graph. In each iteration, if a pair of entities If they are confirmed as each other’s nearest neighbors, they are identified as newly aligned entity pairs and added to the next round of training sets. Figure 2 As shown, not only the asymmetry of the alignment direction is taken into account, but also the fidelity of entity alignment is improved by filling the gaps in the graph based on the selected high-similar entity pairs.
[0037] In summary, the RL-TEA model in this embodiment improves the accuracy of entity alignment tasks in cross-temporal knowledge graphs (TKGs) through time- and relationship-aware attention mechanisms and iterative learning strategies. In short, the main components and execution flow of the framework are as follows: 1. Input data preprocessing: The model takes two knowledge graphs (TKG1 and TKG2) at different times as input. Each knowledge graph contains three types of information: entities, relationships, and timestamps.
[0038] 2. Temporal Relational Attention Network: This module projects the entities, relations, and timestamps of the two knowledge graphs into a shared embedding space. It then uses a time-aware and relation-aware attention mechanism to integrate the temporal and relational information to update the embedding representation of the entity.
[0039] 3. Graph Neural Network: The GNN module further aggregates entity features. Using a multi-layer GNN structure, entity features are updated layer by layer. By aggregating the features of neighbor nodes at different GNN levels, the model can capture the information of multi-hop neighbor nodes.
[0040] 4. Multi-view embedding: Combine the GNN output features of the entity at each layer and the average embedding value of the neighbor timestamp to obtain the final multi-view embedding representation.
[0041] 5. Entity alignment: Euclidean distance is used to calculate the similarity between entities in the source knowledge graph and the target knowledge graph. The model is optimized by minimizing negative sampling strategy.
[0042] 6. Iterative learning: The iterative learning strategy is one of the core innovations of the RL-TEA model. The model is trained on the initial training set. After obtaining the preliminary alignment results, the entity pairs with high confidence are added to the training set as new samples for the next round of iterative training.
[0043] This embodiment proposes an innovative time-aware entity alignment method called RL-TEA, which combines iterative learning and graph neural networks. In the model, the timestamp information of TKGs is regarded as the connection between entities, the entities, relations and timestamps from different knowledge graphs are embedded into a vector space, and the representation of entities is learned using graph neural networks. Subsequently, a temporal relationship-aware mechanism is designed to integrate time and relationship information by weighted calculation of relations and timestamps within the entity neighborhood. At the same time, in order to further improve the alignment efficiency, an innovative iterative completion strategy is proposed, which uses high-confidence alignment results as a new source of training data and reversely completes the knowledge graph based on these entity pairs. By aligning edges while completing the knowledge graph, the accuracy of entity alignment can be effectively improved.
[0044] In summary, the advantages of this embodiment are as follows: 1. A GNN model combined with a relational temporal attention mechanism is proposed. This model updates entity representations by aggregating information from neighboring nodes, effectively utilizing the relationships between entities, especially temporal information.
[0045] 2. An iterative learning method is introduced to select high-confidence entity pairs to expand the training set. This method also reversely completes the knowledge graph based on these high-confidence entity pairs to fill in the missing or sparse parts of the dataset, thereby obtaining a more complete and rich knowledge graph and improving the effectiveness of the alignment task.
[0046] The method for aligning entities in a temporal knowledge graph provided by an embodiment of the present invention embeds all entities, relations and time information in two temporal knowledge graphs into a shared vector space; according to the orthogonal transformation matrix of the relation and time information in the vector space, a temporal relation attention mechanism is used to assign corresponding weights to neighbor nodes in the entity neighborhood in the vector space; based on the weights, the attention coefficients of the neighbor nodes in the entity neighborhood are determined; according to the attention coefficients of the neighbor nodes in the entity neighborhood, a graph neural network is used to determine the representation of the entity; according to the entity representation, the distances of entities in different temporal knowledge graphs are calculated, and when the loss is no longer reduced, the alignment of entities in the temporal knowledge graph is completed; high-similarity entity pairs are selected from the aligned entity pairs, the high-similarity entity pairs are included in the training set, and the iterative calculation is continued to align entities in different knowledge graphs, and the knowledge graph is completed. The scheme provided by the present invention not only improves the training data, but also fills in the missing parts of the knowledge graph, thereby improving the accuracy of the overall alignment and improving the applicability of the entity alignment method in heterogeneous and incomplete data sets.
[0047] In order to implement the method of the embodiment of the present invention, the embodiment of the present invention also provides a time series knowledge graph entity alignment device, such as Figure 3As shown, the temporal knowledge graph entity alignment device 300 includes: an embedding module 301, an attention mechanism module 302, an entity representation module 303, a loss optimization module 304 and an iterative training module 305; wherein: An embedding module 301, used to embed all entities, relations and time information in two temporal knowledge graphs into a shared vector space; An attention mechanism module 302 is used to assign corresponding weights to neighbor nodes in the entity neighborhood in the vector space using a temporal relationship attention mechanism according to an orthogonal transformation matrix of the relationship and time information in the vector space; and determine an attention coefficient of the neighbor nodes in the entity neighborhood based on the weights; An entity representation module 303, configured to determine the representation of the entity using a graph neural network according to the attention coefficients of neighboring nodes in the neighborhood of the entity; A loss optimization module 304 is used to calculate the distances of entities in different temporal knowledge graphs according to the entity representations, and complete the alignment of entities in the temporal knowledge graphs when the loss is no longer reduced; The iterative training module 305 is used to select high-similarity entity pairs from the aligned entity pairs, incorporate the high-similarity entity pairs into the training set, continue iterative calculations, align entities in different knowledge graphs, and complete the knowledge graphs.
[0048] In actual application, the embedding module 301, the attention mechanism module 302, the entity representation module 303, the loss optimization module 304 and the iterative training module 305 can be implemented by the processor in the temporal knowledge graph entity alignment device 300.
[0049] It should be noted that: when the above-mentioned device provided in the above-mentioned embodiment is executed, only the division of the above-mentioned program modules is used as an example. In actual application, the above-mentioned processing can be assigned to different program modules as needed, that is, the internal structure of the terminal is divided into different program modules to complete all or part of the above-mentioned processing. In addition, the above-mentioned device provided in the above-mentioned embodiment belongs to the same concept as the above-mentioned method embodiment. The specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0050] In order to implement the method of the embodiment of the present invention, the embodiment of the present invention also provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of the above method.
[0051] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present invention, the embodiment of the present invention further provides an electronic device (computer device). Specifically, in one embodiment, the computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor A01, a network interface A02, a display screen A04, an input device A05 and a memory (not shown in the figure) connected through a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A06. The non-volatile storage medium A06 stores an operating system B01 and a computer program B02. The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A06. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor A01, the method of any one of the above embodiments is implemented. The display screen A04 of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device A05 of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0052] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0053] The device provided by the embodiment of the present invention includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the method of any one of the above embodiments is implemented.
[0054] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0055] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0056] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0057] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0058] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0059] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0060] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0061] It can be understood that the memory of the embodiment of the present invention can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAMbus random access memory (DRRAM, Direct Rambus Random Access Memory).The memories described in the embodiments of the present invention are intended to include, but are not limited to, these and any other suitable types of memories.
[0062] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0063] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for aligning entities in a temporal knowledge graph, characterized in that: The method comprises: Embed all entities, relations, and time information in two temporal knowledge graphs into a shared vector space; Assigning corresponding weights to neighbor nodes in the entity neighborhood in the vector space using a temporal relationship attention mechanism according to an orthogonal transformation matrix of the relationship and time information in the vector space; determining attention coefficients of the neighbor nodes in the entity neighborhood based on the weights; Determining a representation of the entity using a graph neural network according to attention coefficients of neighboring nodes in a neighborhood of the entity; According to the entity representation, the distances of entities in different temporal knowledge graphs are calculated, and when the loss is no longer reduced, the alignment of the entities in the temporal knowledge graphs is completed; Select high-similar entity pairs from the aligned entity pairs, add the high-similar entity pairs into the training set, continue iterative calculation, align entities in different knowledge graphs, and complete the knowledge graph.
2. The method for aligning entities in a temporal knowledge graph according to claim 1, characterized in that: The orthogonal transformation matrix of the relationship and time information is: Formula (1) Formula (2) in, represents the relational transformation matrix, represents the time transformation matrix, represents the identity matrix, It's a relationship The embedding is the time step Embedding.
3. The method for aligning entities in a temporal knowledge graph according to claim 1, characterized in that: The attention coefficient includes time-specific attention importance and relationship-specific attention importance; The calculation formula of the time-specific attention importance is as follows: Formula (3) The relationship-specific attention importance is calculated as follows: Formula (4) in, Indicates time-specific attention importance, Indicates the relationship-specific attention importance, represents the shared temporal and relational attention weight vector, is the time step The embedding It's a relationship The embedding and Respectively represent entities To Entity A collection of relationships and timestamps.
4. The method for aligning entities in a temporal knowledge graph according to claim 3, characterized in that: The entity is represented as: Formula (5) in, is the representation of the entity, , for entities The global output features of represents the initial input features, , Representing Entities The set of temporal neighbors of Indicates the time step Belongs to entity The set of temporal neighbors of Indicates the time step The embedding vector of represents the activation function, Representing Entities Is Entity Neighbor entities, Indicates the time step and relationship Is Entity and entities The time relationship between represents the attention coefficient, represents the time-dependent entity transformation matrix, represents another attention coefficient, represents the relation-related transformation matrix, Representing Entities Embedding representation at the previous layer.
5. The method for aligning entities in a temporal knowledge graph according to claim 1, characterized in that: The calculation formula for the distance between entities in different temporal knowledge graphs is as follows: Formula (6) in, Represents the distance between entities in different temporal knowledge graphs, , Represent entities in two different temporal knowledge graphs ,entity Representation of an entity.
6. The method for aligning entities in a temporal knowledge graph according to claim 1, characterized in that: The loss function for calculating the distance between entities in different temporal knowledge graphs is calculated as follows: Formula (7) in, represents the loss function, represents the entity pairs in the set S, Representing Entities Belong to the picture , represents the hyperparameter, represents the distance function between two entities, represents a negative entity pair, Representing Entities Belong to the picture , Represents the distance function for pairs of negative entities.
7. The method for aligning entities in a temporal knowledge graph according to claim 1, characterized in that: Select high-similar entity pairs from the aligned entity pairs, including: Get the distance of the aligned entity pairs and the preset threshold; The entity pairs whose distance is greater than the preset threshold are determined as high-similarity entity pairs.
8. A temporal knowledge graph entity alignment device, characterized in that: The temporal knowledge graph entity alignment device comprises: The embedding module is used to embed all entities, relations and time information in two temporal knowledge graphs into a shared vector space; an attention mechanism module, configured to assign corresponding weights to neighbor nodes in the entity neighborhood in the vector space using a temporal relationship attention mechanism according to an orthogonal transformation matrix of the relationship and time information in the vector space; and determine an attention coefficient of the neighbor nodes in the entity neighborhood based on the weights; An entity representation module, configured to determine a representation of the entity using a graph neural network according to attention coefficients of neighboring nodes in a neighborhood of the entity; A loss optimization module, used to calculate the distances of entities in different temporal knowledge graphs according to the entity representations, and to complete the alignment of entities in the temporal knowledge graphs when the loss is no longer reduced; The iterative training module is used to select high-similarity entity pairs from the aligned entity pairs, incorporate the high-similarity entity pairs into the training set, continue iterative calculation, align entities in different knowledge graphs, and complete the knowledge graphs.
9. A temporal knowledge graph entity alignment system, characterized in that: include: A processor and a memory for storing a computer program that can be run on the processor; wherein, when the processor is used to run the computer program, the steps of the method according to any one of claims 1 to 7 are executed.
10. A storage medium storing a computer program, wherein: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Medical knowledge graph construction method for multi-source heterogeneous data fusion and incremental updating
CN121506516A