Knowledge graph updating method and device, storage medium and electronic device

By constructing functions to represent the entity and relationship distribution in the timing knowledge graph, the quadruple to be added are determined, the update process of the timing knowledge graph is optimized, the problem of knowledge sparsity is solved, and the utilization efficiency of the knowledge graph is improved.

CN115114442BActive Publication Date: 2025-08-15TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210360766.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-07
Publication Date
2025-08-15
Estimated Expiration
2042-04-07

AI Technical Summary

Technical Problem

Knowledge sparsity in the timing knowledge graph leads to low update efficiency, affecting the utilization efficiency of downstream models.

Method used

By constructing the first and second functions, representing the distribution of entities and relationships in the timing knowledge graph on time information, the target evaluation function is constructed, the quadruple to be supplemented are determined and added to the knowledge graph, and the update process of the timing knowledge graph is optimized.

Benefits of technology

It improves the utilization efficiency of the timing knowledge graph, optimizes the update efficiency of the knowledge graph, enhances the time information distribution of entities and relationships, and solves the problem of knowledge sparseness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115114442B_ABST
    Figure CN115114442B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for updating a knowledge graph, a storage medium, and an electronic device. The method comprises: obtaining a first time-series knowledge graph to be updated, constructing a first function and a second function according to the first time-series knowledge graph, constructing a target evaluation function according to the first function and the second function, determining a quadruple to be added in a second group of quadruple according to the target evaluation function, and adding the quadruple to be added to the first time-series knowledge graph to obtain a second time-series knowledge graph. The embodiments of the present application can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving. The present application solves the technical problem of low utilization efficiency of time-series knowledge graphs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and specifically, to a method and device for updating a knowledge graph, a storage medium, and an electronic device. Background Art

[0002] Currently, a temporal knowledge graph refers to a knowledge graph that contains temporal information. Knowledge graphs typically store knowledge in the form of triples, such as (e1, r, e2), where e1 and e2 are entity nodes in the knowledge graph and r is a relationship edge in the graph. Temporal knowledge graphs typically store knowledge in the form of quads, such as (e1, r, e2, t), where t is the time information. This can be a specific time node, such as "2021-12-01," or a time period, such as "1995 to 2021" or "since 2020."

[0003] However, due to the richness of real-world knowledge, the knowledge in the temporal knowledge graph is often sparse, making it difficult to determine the relationship between some entities in the temporal knowledge graph. When the knowledge graph needs to be updated, the corresponding quadruple can only be added artificially, resulting in low utilization efficiency of the temporal knowledge graph, which in turn affects the downstream models that rely on the temporal knowledge graph.

[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0005] The embodiments of the present application provide a method and device for updating a knowledge graph, a storage medium, and an electronic device to at least solve the technical problem of low utilization efficiency of temporal knowledge graphs.

[0006] According to one aspect of an embodiment of the present application, a method for updating a knowledge graph is provided, comprising: obtaining a first temporal knowledge graph to be updated, wherein the first temporal knowledge graph comprises a first group of quadruple groups, each quadruple in the first group of quadruple groups comprises a first entity, a first relationship between the first entity and a second entity, the second entity, and first time information; constructing a first function and a second function according to the first temporal knowledge graph, wherein the first function is used to represent the distribution of entities in the first group of quadruple groups on time information, and the second function is used to represent the distribution of relationships in the first group of quadruple groups on time information; constructing a target evaluation function according to the first function and the second function, wherein the target evaluation function is used to determine the value of a target parameter for the quadruple group to be processed, the value of the target parameter being used to represent the distance between the first distribution and the second distribution, the first distribution being the distribution of two entities in the quadruple group to be processed on time information, and the second distribution being the distribution of relationships in the quadruple group to be processed on time information; according to the target evaluation function, Determine the quadruple to be added in the second group of quadruple, and add the quadruple to be added to the first temporal knowledge graph to obtain a second temporal knowledge graph, wherein the two entities in each quadruple in the second group of quadruple are entities already in the first temporal knowledge graph, the time information in each quadruple in the second group of quadruple is the time information already in the first temporal knowledge graph, and each quadruple in the second group of quadruple is different from the quadruple in the first group of quadruple.

[0007] According to another aspect of an embodiment of the present application, a device for updating a knowledge graph is also provided, including: an acquisition module for acquiring a first time-series knowledge graph to be updated, wherein the first time-series knowledge graph includes a first group of quadruple groups, and each quadruple in the first group of quadruple groups includes a first entity, a first relationship between the first entity and the second entity, the second entity, and first time information; a first construction module for constructing a first function and a second function based on the first time-series knowledge graph, wherein the first function is used to represent the distribution of entities in the first group of quadruple groups on time information, and the second function is used to represent the distribution of relationships in the first group of quadruple groups on time information; a second construction module for constructing a target evaluation function based on the first function and the second function, wherein the target evaluation function is used to determine the value of a target parameter for the quadruple to be processed, and the value of the target parameter is used to represent the distance between the first distribution and the second distribution, and the first distribution is the time distribution of two entities in the quadruple to be processed. The second distribution is the distribution of the relationship in the quadruple to be processed on the time information; a processing module is used to determine the quadruple to be added in the second group of quadruple according to the target evaluation function, and add the quadruple to be added to the first time series knowledge graph to obtain a second time series knowledge graph, wherein the two entities in each quadruple in the second group of quadruple are entities already in the first time series knowledge graph, the time information in each quadruple in the second group of quadruple is the time information already in the first time series knowledge graph, and each quadruple in the second group of quadruple is different from the quadruple in the first group of quadruple.

[0008] Optionally, the second construction module includes: a first generation unit, used to generate a positive sample quadruple set and a negative sample quadruple set based on the first temporal knowledge graph, wherein the first group of quadruples includes the positive sample quadruple set, and the negative sample quadruple set includes quadruples obtained by replacing the first entity or the second entity in some or all of the quadruples in the positive sample quadruple set; a first construction unit, used to construct the first function and the second function based on the positive sample quadruple set and the negative sample quadruple set, wherein the positive sample quadruple set and the negative sample quadruple set are used to determine the parameters in the first function and the second function.

[0009] Optionally, the first construction unit includes: a first acquisition subunit, used to acquire a first initial function and a second initial function to be trained, wherein the first initial function is used to represent the distribution of entities in the positive sample quadruple set and the negative sample quadruple set on the time information, and the second initial function is used to represent the distribution of relationships between the positive sample quadruple set and the negative sample quadruple set on the time information; an update subunit, used to update the values of parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set, so that the parameters in the first initial function and the second initial function and the joint likelihood function formed by the positive sample quadruple set and the negative sample quadruple set meet a first preset condition, and the first initial function and the second initial function when the first preset condition is met are determined as the first function and the second function.

[0010] Optionally, the device is used to update the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set in the following manner, so that the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set meets a first preset condition: the values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set and the negative sample quadruple set, so that the values of the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set are maximized.

[0011] Optionally, the device is used to update the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set in the following manner: determine the negative sample sampling rate according to the positive sample quadruple set and the negative sample quadruple set, wherein the negative sample sampling rate represents the number of negative sample quadruples obtained by sampling each positive sample quadruple in the positive sample quadruple set; obtain a predetermined number of training rounds, a target interval, and a time series window length, wherein the number of training rounds is used to represent the number of training rounds for training the first initial function and the second initial function to the first function and the second function. number, the target interval is used to represent the preset difference between the target parameter corresponding to the quadruple in the positive sample quadruple set and the target parameter corresponding to the quadruple in the negative sample quadruple set, and the timing window length is used to represent the time span of the quadruple in the positive sample subset when a positive sample subset is sampled from the positive sample quadruple set for training each time during the training process; according to the positive sample quadruple set, the negative sample sampling rate, the number of training rounds, the target interval and the timing window length, the values of the parameters in the first initial function and the second initial function are updated to obtain the first function and the second function.

[0012] Optionally, the device is used to determine the quadruple to be supplemented in the second group of quadruple according to the target evaluation function in the following manner: determine the value of the target parameter for each quadruple in the second group of quadruple through the target evaluation function, wherein each quadruple in the second group of quadruple includes the current entity, the relationship between the current entity and the target entity, the target entity, and current time information; determine the quadruple to be supplemented in the second group of quadruple according to the value of the target parameter corresponding to each quadruple in the second group of quadruple, wherein the value of the target parameter corresponding to the quadruple to be supplemented meets the second preset condition.

[0013] Optionally, the device is used to determine the quadruple to be added in the second group of quadruple according to the value of the target parameter corresponding to each quadruple in the second group of quadruple in the following manner: determine a third group of quadruple to be added in the second group of quadruple according to the value of the target parameter corresponding to each quadruple in the second group of quadruple, wherein the value of the target parameter corresponding to the quadruple in the third group of quadruple is greater than a preset threshold; or determine a third group of quadruple to be added in the second group of quadruple according to the value of the target parameter corresponding to each quadruple in the second group of quadruple, wherein, in the second group of quadruples, the values of the target parameter corresponding to the quadruple in the third group of quadruple are the first N values arranged from high to low according to the values of the target parameter, and N is a positive integer greater than or equal to 1.

[0014] Optionally, the device is used to construct a first function and a second function based on the first time series knowledge graph in the following manner: construct a first mean function, a first kernel function and a first covariance matrix based on the first time series knowledge graph, and determine the first function based on the first mean function, the first kernel function and the first covariance matrix, wherein the first mean function is used to represent the expectation of the distribution of entities in the first group of quadruples on time information, and the first kernel function and the first covariance matrix are used to represent the variance and covariance of the distribution of entities in the first group of quadruples on time information; construct a second mean function, a second kernel function and a second covariance matrix based on the first time series knowledge graph, and determine the second function based on the second mean function, the second kernel function and the second covariance matrix, wherein the second mean function is used to represent the expectation of the distribution of relationships in the first group of quadruples on time information, and the second kernel function and the second covariance matrix are used to represent the variance and covariance of the distribution of relationships in the first group of quadruples on time information.

[0015] Optionally, the device is also used to: obtain a target request, wherein the target request is used to request reply information of a target question, and the target question corresponds to a third entity in the second temporal knowledge graph; in response to the target request, search the quadruple where the third entity is located in the second temporal knowledge graph, and determine the information corresponding to the fourth entity in the quadruple where the third entity is located as the reply information, wherein the quadruple where the third entity is located is the quadruple supplemented in the second temporal knowledge graph relative to the first temporal knowledge graph; and send the information corresponding to the fourth entity.

[0016] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned knowledge graph updating method during runtime.

[0017] According to another aspect of the embodiments of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-described knowledge graph update method.

[0018] According to another aspect of the embodiments of the present application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the above-mentioned knowledge graph updating method through the computer program.

[0019] In an embodiment of the present application, a first time-series knowledge graph to be updated is obtained, wherein the first time-series knowledge graph includes a first group of quadruple groups, each quadruple in the first group of quadruple groups includes a first entity, a first relationship between the first entity and the second entity, a second entity, and first time information, and a first function and a second function are constructed according to the first time-series knowledge graph, wherein the first function is used to represent the distribution of entities in the first group of quadruple groups on time information, and the second function is used to represent the distribution of relationships in the first group of quadruple groups on time information, and a target evaluation function is constructed according to the first function and the second function, wherein the target evaluation function is used to determine the value of a target parameter for the quadruple group to be processed, and the value of the target parameter is used to represent the distance between the first distribution and the second distribution, the first distribution is the distribution of two entities in the quadruple group to be processed on time information, and the second distribution is the distribution of the entities in the quadruple group to be processed on time information. The distribution of the relationship on the time information is determined according to the target evaluation function in the second group of quadruple, and the quadruple to be added is added to the first temporal knowledge graph to obtain a second temporal knowledge graph, wherein the two entities in each quadruple in the second group of quadruple are the entities already in the first temporal knowledge graph, the time information in each quadruple in the second group of quadruple is the time information already in the first temporal knowledge graph, and each quadruple in the second group of quadruple is different from the quadruple in the first group of quadruple. In response to the knowledge sparsity problem in the temporal knowledge graph, the entities and relationships in the temporal knowledge graph are constructed as a distribution on the time information, and then by constructing the target evaluation function of the quadruple in the temporal knowledge graph, the target parameter of the valid quadruple is as high as possible, and the target parameter of the invalid quadruple is as low as possible; then, according to an entity, relationship and time information in the quadruple to be added, another possible entity is predicted to update the first temporal knowledge graph to the second temporal knowledge graph. Therefore, the purpose of data enhancement of the temporal knowledge graph and optimization of the update efficiency of the temporal knowledge graph is achieved, thereby realizing the technical effect of improving the utilization efficiency of the temporal knowledge graph and solving the technical problem of low utilization efficiency of the temporal knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0021] Figure 1 This is a schematic diagram of an application environment of an optional knowledge graph updating method according to an embodiment of the present application;

[0022] Figure 2 This is a flowchart of an optional knowledge graph updating method according to an embodiment of the present application;

[0023] Figure 3 This is a schematic diagram of an application program for an optional knowledge graph updating method according to an embodiment of the present application;

[0024] Figure 4 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application;

[0025] Figure 5 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application;

[0026] Figure 6 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application;

[0027] Figure 7 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application;

[0028] Figure 8 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application;

[0029] Figure 9 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application;

[0030] Figure 10 This is a schematic structural diagram of an optional knowledge graph updating device according to an embodiment of the present application;

[0031] Figure 11 This is a schematic structural diagram of an optional knowledge graph update product according to an embodiment of the present application;

[0032] Figure 12 It is a schematic structural diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0033] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0035] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretations:

[0036] Temporal knowledge graphs: These refer to knowledge graphs that contain temporal information. Knowledge graphs typically store knowledge as triples, such as (e1, r, e2), where e1 and e2 are entity nodes in the graph and r is a relationship edge. Temporal knowledge graphs typically store knowledge as quadruples, such as (e1, r, e2, t), where t represents time information. This can be a specific time node, such as "2021-12-01," or a time period, such as "1995 to 2021" or "since 2020."

[0037] Temporal Knowledge Graph Completion: Due to the richness of real-world knowledge, the knowledge in the temporal knowledge graph is often sparse. The goal of temporal knowledge graph completion is to complete the entities in the temporal knowledge graph based on the existing knowledge in the temporal knowledge graph.

[0038] Temporal knowledge graph representation learning: The goal of temporal knowledge graph representation learning is to map the entity nodes and relationship edges in the temporal knowledge graph to a feature space, and encode as much semantic and structural information in the graph as possible for use in various downstream tasks.

[0039] Multidimensional Gaussian process: A Gaussian process defined in a multidimensional vector space. A necessary and sufficient condition for a random process to be a multidimensional Gaussian process is that the combination of a finite number of multidimensional Gaussian distributions sampled from it obeys a matrix Gaussian distribution with a specific parameter.

[0040] The present application will be described below with reference to the following embodiments:

[0041] According to one aspect of the embodiment of the present application, a method for updating a knowledge graph is provided. Optionally, in this embodiment, the method for updating a knowledge graph can be applied to Figure 1In the hardware environment composed of the server 101 and the terminal device 103 shown in FIG. Figure 1 As shown, the server 101 is connected to the terminal 103 via a network and can be used to provide services for the terminal device or the application installed on the terminal device. The application can be a video application, instant messaging application, browser application, educational application, game application, customer service application, etc. A database 105 may be set up on the server or independently of the server to provide data storage services for the server 101, for example, a game data storage server. The above-mentioned network may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The terminal device 103 may be a terminal configured with an application, and may include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop computer, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, an intelligent voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft and other computer equipment. The above-mentioned server may be a single server, or a server cluster composed of multiple servers, or a cloud server. The application 107 is an application installed on the terminal device 103, and the application 107 using the above-mentioned knowledge graph update method is displayed through the terminal device 103 or other connected display devices.

[0042] Combine Figure 1 As shown, the above-mentioned knowledge graph updating method can be implemented on the terminal device 103 through the following steps:

[0043] S1, obtaining a first time-series knowledge graph to be updated on the terminal device 103, wherein the first time-series knowledge graph includes a first set of quadruple groups, each quadruple in the first set of quadruple groups includes a first entity, a first relationship between the first entity and a second entity, the second entity, and first time information;

[0044] S2, constructing a first function and a second function based on the first temporal knowledge graph on the terminal device 103, wherein the first function is used to represent the distribution of entities in the first set of quadruple over time information, and the second function is used to represent the distribution of relationships in the first set of quadruple over time information;

[0045] S3. Constructing a target evaluation function on the terminal device 103 based on the first function and the second function. The target evaluation function is used to determine a value of a target parameter for the quadruple to be processed. The value of the target parameter is used to represent the distance between the first distribution and the second distribution. The first distribution is the distribution of two entities in the quadruple to be processed over time information, and the second distribution is the distribution of relationships in the quadruple to be processed over time information.

[0046] S4. On the terminal device 103, based on the target evaluation function, determine the quadruple to be added in the second group of quadruple, and add the quadruple to be added to the first temporal knowledge graph to obtain a second temporal knowledge graph, wherein the two entities in each quadruple in the second group of quadruple are entities already in the first temporal knowledge graph, the time information in each quadruple in the second group of quadruple is the time information already in the first temporal knowledge graph, and each quadruple in the second group of quadruple is different from the quadruple in the first group of quadruple.

[0047] Optionally, in this embodiment, the above-mentioned knowledge graph updating method can also be implemented by a server, for example, Figure 1 It is implemented in the server 101 shown; or it is implemented by the user terminal and the server together.

[0048] The above is only an example and is not specifically limited in this embodiment.

[0049] Alternatively, as an optional implementation, Figure 2 As shown, the updating method of the above knowledge graph includes:

[0050] S202, obtaining a first time-series knowledge graph to be updated, wherein the first time-series knowledge graph includes a first set of quadruple groups, each quadruple in the first set of quadruple groups includes a first entity, a first relationship between the first entity and a second entity, the second entity, and first time information;

[0051] Optionally, in an embodiment of the present application, the first temporal knowledge graph to be updated may include but is not limited to a knowledge graph that stores knowledge in the form of quadruple, and the first group of quadruple may include but is not limited to (e1, r, e2, t), wherein e1 is the first entity, which may be an entity node in various scenarios, for example, knowledge entity nodes such as culture, tourism, and news; r is the first relationship between the first entity and the second entity, which may be an edge used to describe the relationship between the first entity and the second entity in various scenarios, for example, "Zhang San is a singer", then the first relationship is an identity definition, which is used to represent the relationship between the first entity "Zhang San" and the second entity "singer", e2 is the second entity, which may be an entity node in various scenarios, for example, knowledge entity nodes such as culture, tourism, and news; t is the first time information, which may be a specific time node, for example, "2021-12-01", or a time period, for example, "1995 to 2021" or "since 2020". The above-mentioned temporal knowledge graph can be represented as in They are respectively the collection of entity, relationship, and time information in the first temporal knowledge graph mentioned above.

[0052] For example, Figure 3 is an application diagram of an optional knowledge graph updating method according to an embodiment of the present application, such as Figure 3 As shown, the first temporal knowledge graph may include but is not limited to a first group of quadruples, wherein the first group of quadruples includes multiple quadruples, each quadruple includes a first entity, a first relationship, a second entity and a first time information. Taking Zhang San as the first entity, the quadruples to which it belongs are at least as follows: (Zhang San, 1, Li Si, t1), (Zhang San, 1, publishing company, t2), (Zhang San, 1, game A, t3), (Zhang San, 0, song D, t1), (Zhang San, 1, movie B, t3). It can be understood that when the first relationship exists, the value of r is 1, and when the first relationship does not exist, the value of r is 0. When a user needs to search for the historical information of "Zhang San" through the temporal knowledge graph, it can be known that "Zhang San" consulted "Li Si" at time information t1, "Li Si" composed music at the first time information and obtained soundtrack C, "Zhang San" mailed song C to the publishing company at time information t2, and "Zhang San" purchased game A and watched movie B at time information t3.

[0053] The above is only an example and the embodiments of the present application do not impose any specific limitations.

[0054] S204: Construct a first function and a second function based on the first temporal knowledge graph, wherein the first function is used to represent the distribution of entities in the first set of quadruple over time information, and the second function is used to represent the distribution of relationships in the first set of quadruple over time information;

[0055] Optionally, in an embodiment of the present application, the above-mentioned first function and second function may include but are not limited to the distribution of entities in the first group of quadruple in time information, and the distribution of relationships in the first group of quadruple in time information. Specifically, it may include but is not limited to constructing a first function through the time information in the first group of quadruple to represent the entities in the first group of quadruple, and constructing a second function through the time information in the first group of quadruple to represent the relationships in the first group of quadruple.

[0056] It should be noted that the above representations of entities and relationships may include but are not limited to representations of entities and relationships based on multidimensional Gaussian processes.

[0057] For example, a multidimensional Gaussian process refers to a Gaussian process defined in a multidimensional vector space. A necessary and sufficient condition for a random process to be a multidimensional Gaussian process is that the combination of a finite number of arbitrarily sampled multidimensional Gaussian distributions obeys a matrix Gaussian distribution with a specific parameter.

[0058] Definition: A random process f is defined on the indicator set The d-dimensional Gaussian process on , and its vector mean function is The kernel function is k: The semi-positive definite covariance matrix is If and only if any finite sampling combination obeys a joint matrix Gaussian distribution, that is:

[0059]

[0060] in, is the mean matrix, and M ij =μ j (x i ), is the covariance matrix, and ∑ ij =k(x i , x j ), at this time, it is recorded as:

[0061]

[0062] Optionally, in the embodiment of the present application, the first function and the second function may include but are not limited to the following:

[0063] Entity and relationship representation construction based on multidimensional Gaussian process: For each entity e i ∈ε and every relation Map them to the time information set defined in d-dimensional Gaussian process on :

[0064]

[0065]

[0066] in, is the mean function of the multidimensional Gaussian process, is the kernel function of the multidimensional Gaussian process, is the covariance matrix of the multidimensional Gaussian process.

[0067] S206: Constructing a target evaluation function based on the first function and the second function, wherein the target evaluation function is used to determine a value of a target parameter for the quadruple to be processed, and the value of the target parameter is used to represent the distance between the first distribution and the second distribution, where the first distribution is the distribution of two entities in the quadruple to be processed over time information, and the second distribution is the distribution of relationships in the quadruple to be processed over time information;

[0068] Optionally, in an embodiment of the present application, the above-mentioned target evaluation function may include but is not limited to a scoring function, which is used to determine the value of the target parameter for the quadruple to be processed, that is, to determine the distance between the first distribution and the second distribution in the quadruple to be processed.

[0069] For example, it may include but is not limited to Bhattacharyya distance. For the quadruple to be processed (e1, r, e2, t), the role of the relationship r is constructed as the translation from entity e1 to entity e2. Therefore, for the valid quadruple, the distribution e 1,t -e 2,t (corresponding to the first distribution mentioned above) and the distribution r t (corresponding to the second distribution mentioned above) should be as close as possible, that is:

[0070] f(e1, r, e2, t) = D B (e 1,t -e 2,t , r t )

[0071] Among them, f(e1, r, e2, t) is the above-mentioned target evaluation function, D B (d, d') is the Bhattacharyya distance between distribution d and distribution d', distribution d is the first distribution, and distribution d' is the second distribution.

[0072] It should be noted that the first distribution is the distribution of the two entities in the quadruple to be processed on the time information, which can be understood as the mapping of the two entities in the quadruple to be processed to the time information set The vector difference on .

[0073] For example, Figure 4 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application, such as Figure 4 As shown, e 1,t 、e 2,t That is, the two entities in the above-mentioned quaternary group to be processed, the distribution of the two entities in the above-mentioned quaternary group in time information can be understood as the distribution e 1,t -e 2,t .

[0074] For example, Figure 5 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application, such as Figure 5 As shown, r t That is, the relationship in the above-mentioned quaternary group to be processed. The distribution of the relationship in the above-mentioned quaternary group to be processed in time information can be understood as the distribution r t .

[0075] For example, Figure 6 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application, such as Figure 6 As shown, the value of the target parameter is used to represent the first distribution e 1,t -e 2,t With the second distribution r t The smaller the distance, the smaller the first distribution e 1,t -e 2,t With the second distribution r t The closer.

[0076] It should be noted that the target evaluation function constructed according to the first function and the second function can be understood as 1,t =e1(t) and e 2,t =e2(t) to construct the first distribution mentioned above, and r t =r t Construct the second distribution above, where:

[0077]

[0078]

[0079] The above is only an example, and the embodiments of the present application do not impose any specific limitations.

[0080] S208. According to the target evaluation function, determine the quadruple to be added in the second group of quadruple, and add the quadruple to be added to the first temporal knowledge graph to obtain a second temporal knowledge graph, wherein the two entities in each quadruple in the second group of quadruple are entities already in the first temporal knowledge graph, the time information in each quadruple in the second group of quadruple is the time information already in the first temporal knowledge graph, and each quadruple in the second group of quadruple is different from the quadruple in the first group of quadruple.

[0081] Optionally, in an embodiment of the present application, the above-mentioned second group of quadruple may include but is not limited to transforming the association relationship between the existing entities and the existing time information in the first group of quadruple to obtain the above-mentioned second group of quadruple. For example, the first group of quadruple includes (e1, r1, e2, t1), (e1, r0, e3, t2), then the above-mentioned second group of quadruple may include but is not limited to (e2, r1, e3, t1), (e1, r1, e3, t1), etc., which are a set of quadruple sets including different relationships composed of the existing entities and the existing time information in the first group of quadruple.

[0082] Optionally, in an embodiment of the present application, the above-mentioned target evaluation function is used to determine the values of the target parameters of the quadruple to be added. Specifically, it may include but is not limited to determining the values of the target parameters of the entity to be added in the quadruple to be added.

[0083] For example, let the set of quadruple to be added be C (taking the tail entity prediction as an example, the same applies to the head entity prediction):

[0084] C={(e i ,r i , the tail entity to be added, t i )},i=1,…,c

[0085] According to the set of four tuples to be added C and the first temporal knowledge graph Construct the second set of four-tuple ε * ,Right now:

[0086]

[0087] According to the above objective evaluation function, ε * All entities in the target parameter are determined and sorted, namely:

[0088]

[0089] Select entities whose target parameter value is greater than the threshold ζ (or select the first k entities), and form the above-mentioned quadruple to be added to the first temporal knowledge graph to generate the second temporal knowledge graph Right now:

[0090]

[0091]

[0092] For example, Figure 7 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application, such as Figure 7 As shown, the first set of quadruples also includes (Zhang San, 0, song D, t1), which means that "Zhang San" has no relationship with song D at time t1. However, in real life, "Zhang San" may mail multiple songs to the publishing company at the same time. Therefore, the first temporal knowledge graph needs to be completed.

[0093] Assume (Zhang San, 1, the tail entity to be added, t1) as the above-mentioned four-tuple C to be completed. According to the set of four-tuples to be added C and the first temporal knowledge graph Construct the second set of four-tuple ε * That is:

[0094]

[0095] in, Indicates the tail entity to be added to the above four-tuple C to be completed.

[0096] The second set of quaternions ε is calculated by the following formula * Sort the entities included in:

[0097]

[0098] By selecting entities whose target parameter values are greater than the threshold ζ (or selecting the first k entities), the above-mentioned four-tuple to be added is added to the first temporal knowledge graph to generate the second temporal knowledge graph That is, the quadruple to be added (Zhang San, 1, song D, t1) and (Zhang San, 1, movie F, t1) are added to the first temporal knowledge graph to generate the second temporal knowledge graph.

[0099] As an example, it can be understood that at time t1, "Zhang San" not only consulted "Li Si" and obtained song C, but also obtained song D and movie F through other channels. That is, (Zhang San, 1, song D, t1) and (Zhang San, 1, movie F, t1) are added as quadruples to be added to the first temporal knowledge graph to obtain the second temporal knowledge graph.

[0100] Optionally, in an embodiment of the present application, due to the richness and variability of real-world knowledge, the knowledge in the time-series knowledge graph is often sparse. The present application provides a method for updating a knowledge graph. In this scenario, the time-series knowledge graph can be updated to improve the density of the time-series knowledge graph so that it can be used for downstream tasks supported by numerous knowledge graphs.

[0101] Figure 8 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application, such as Figure 8 As shown, the typical application flow chart of the above-mentioned knowledge graph updating method may include but is not limited to the following steps:

[0102] S1, obtain the original temporal knowledge graph;

[0103] S2, obtain the quadruple to be added to complete the temporal knowledge graph;

[0104] S3, adding the quadruple to be added into the first temporal knowledge graph to complete (corresponding to the aforementioned update) the first temporal knowledge graph and obtain a second temporal knowledge graph;

[0105] S4, applies the second temporal knowledge graph to downstream tasks.

[0106] The embodiments of this application may include, but are not limited to, applications in the knowledge graph construction and question-answering system of intelligent assistants, enabling rapid and effective information complementation of the time-series knowledge graphs provided by partners for various scenarios (culture, tourism, news, etc.), and customizing private knowledge graphs. Furthermore, the extracted results are applied to the question-answering system to help improve the system's knowledge base and ensure that the system can answer user questions quickly, effectively, and accurately.

[0107] The task of knowledge graph question answering (KBQA) is to answer natural language questions using a knowledge graph as a knowledge base. The answer to a question is usually an entity (node) in the graph, and the reasoning required to answer the question is based on a single fact, multiple hops, or connection / comparison-based reasoning.

[0108] Temporal KBQA has the following additional features:

[0109] 1. The knowledge base is a temporal knowledge graph.

[0110] 2. The answer is entity or duration.

[0111] 3. Requires complex temporal reasoning.

[0112] This application proposes a method for updating a temporal knowledge graph based on a multidimensional Gaussian process. This method addresses the problem of incomplete knowledge in the temporal knowledge graph, constructs a temporal knowledge graph representation based on a multidimensional Gaussian process, and updates the temporal knowledge graph based on the temporal knowledge graph representation.

[0113] This application includes but is not limited to the following stages:

[0114] The first stage is to learn the temporal knowledge graph representation based on multi-dimensional Gaussian process, and the second stage is to complete the temporal knowledge graph based on representation learning.

[0115] For example, Figure 9 is a schematic diagram of another optional knowledge graph updating method according to an embodiment of the present application, such as Figure 9 The specific steps are as follows:

[0116] S1, prepare the original temporal knowledge graph as input;

[0117] S2, constructing entity and relationship representations based on multidimensional Gaussian processes, consists of three parts:

[0118] S3, constructs the mean vector function of entities and relationships;

[0119] S4, kernel function for constructing entities and relationships;

[0120] S5, constructing semi-positive definite covariance functions of entities and relations;

[0121] S6, constructs a scoring function based on the temporal knowledge graph representation;

[0122] S7, training the temporal knowledge graph completion method on the original temporal knowledge graph;

[0123] S8, a training-based method to complete the temporal knowledge graph.

[0124] The above is only an example and the embodiments of the present application do not impose any specific limitations.

[0125] Through the embodiment of the present application, a first time-series knowledge graph to be updated is obtained, wherein the first time-series knowledge graph includes a first group of quadruple groups, each quadruple in the first group of quadruple groups includes a first entity, a first relationship between the first entity and the second entity, a second entity, and first time information, and a first function and a second function are constructed according to the first time-series knowledge graph, wherein the first function is used to represent the distribution of entities in the first group of quadruple groups on time information, and the second function is used to represent the distribution of relationships in the first group of quadruple groups on time information, and a target evaluation function is constructed according to the first function and the second function, wherein the target evaluation function is used to determine the value of a target parameter for the quadruple group to be processed, and the value of the target parameter is used to represent the distance between the first distribution and the second distribution, the first distribution is the distribution of two entities in the quadruple group to be processed on time information, and the second distribution is the distribution of the entities in the quadruple group to be processed on time information. The distribution of the relationship on the time information is determined according to the target evaluation function in the second group of quadruple, and the quadruple to be added is added to the first temporal knowledge graph to obtain a second temporal knowledge graph, wherein the two entities in each quadruple in the second group of quadruple are the entities already in the first temporal knowledge graph, the time information in each quadruple in the second group of quadruple is the time information already in the first temporal knowledge graph, and each quadruple in the second group of quadruple is different from the quadruple in the first group of quadruple. In response to the knowledge sparsity problem in the temporal knowledge graph, the entities and relationships in the temporal knowledge graph are constructed as a distribution on the time information, and then by constructing the target evaluation function of the quadruple in the temporal knowledge graph, the target parameter of the valid quadruple is as high as possible, and the target parameter of the invalid quadruple is as low as possible; then, according to an entity, relationship and time information in the quadruple to be added, another possible entity is predicted to update the first temporal knowledge graph to the second temporal knowledge graph. Therefore, the purpose of data enhancement of the temporal knowledge graph and optimization of the update efficiency of the temporal knowledge graph is achieved, thereby realizing the technical effect of improving the utilization efficiency of the temporal knowledge graph and solving the technical problem of low utilization efficiency of the temporal knowledge graph.

[0126] As an optional solution, constructing the first function and the second function according to the first time series knowledge graph includes:

[0127] S1, generating a positive sample quadruple set and a negative sample quadruple set according to the first temporal knowledge graph, wherein the first set of quadruples includes the positive sample quadruple set, and the negative sample quadruple set includes quadruples obtained by replacing the first entity or the second entity in some or all quadruples in the positive sample quadruple set;

[0128] S2. Construct a first function and a second function according to the positive sample quadruple set and the negative sample quadruple set, wherein the positive sample quadruple set and the negative sample quadruple set are used to determine parameters in the first function and the second function.

[0129] Optionally, in an embodiment of the present application, the above-mentioned positive sample quadruple set represents the real quadruple in the above-mentioned first group of quadruples, and the above-mentioned negative sample quadruple set is the quadruple obtained by replacing the first entity or the second entity in some or all of the quadruples in the positive sample quadruple set.

[0130] For example, for any given temporal knowledge graph Among them, They are entity, relationship, and timestamp collections respectively. Constructing a training positive sample dataset And training negative sample dataset

[0131] by Figure 3 As shown in the example, the quadruple (Zhang San, 1, Li Si, t1) is a positive sample quadruple in the above-mentioned positive sample quadruple set. By replacing the first entity or the second entity in the above-mentioned quadruple, (Li Si, 1, Li Si, t1) and (Zhang San, 1, song D, t1) are obtained as negative sample quadruple in the above-mentioned negative sample quadruple set.

[0132] Specifically, the number of quadruple groups in the negative sample quadruple group set may be determined by presetting a negative sample sampling rate.

[0133] For example, the negative sample sampling rate η represents the ratio of positive sample quadruple to constructed negative sample quadruple in the training sample. η=10 means that 10 negative sample quadruple are sampled for each positive sample quadruple.

[0134] The above is only an example, and the embodiments of the present application do not impose any specific limitations.

[0135] Through the embodiments of the present application, the first function and the second function are constructed by using a set of positive sample quadruple and a set of negative sample quadruple, which can optimize the parameters in the first function and the second function so that the first function and the second function can more realistically represent the entities and relationships in the first group of quadruple through time information t, with low requirements on the amount of original sample data and faster training and inference speeds.

[0136] As an optional solution, constructing a first function and a second function according to a set of positive sample quadruple and a set of negative sample quadruple includes:

[0137] Obtain a first initial function and a second initial function to be trained, wherein the first initial function is used to represent the distribution of entities in the positive sample quadruple set and the negative sample quadruple set in time information, and the second initial function is used to represent the distribution of relationships in the positive sample quadruple set and the negative sample quadruple set in time information;

[0138] The values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set and the negative sample quadruple set, so that the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set meets the first preset condition, and the first initial function and the second initial function that meet the first preset condition are determined as the first function and the second function.

[0139] Optionally, in an embodiment of the present application, the above-mentioned first initial function is an initial function preset before the first function is trained, and the parameters of the above-mentioned first initial function are initial values pre-configured by the staff based on prior experience; the above-mentioned second initial function is an initial function preset before the first function is trained, and the parameters of the above-mentioned first initial function are initial values pre-configured by the staff based on prior experience; and then the values of the parameters in the first initial function and the second initial function are updated through the positive sample quadruple set and the negative sample quadruple set, so that the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set meets the first preset condition.

[0140] It should be noted that the first preset condition includes but is not limited to the value of the joint likelihood function being maximum or meeting a preset threshold or approaching a preset value.

[0141] Through the embodiment of the present application, a first initial function and a second initial function to be trained are obtained, wherein the first initial function is used to represent the distribution of entities in the positive sample quadruple set and the negative sample quadruple set in time information, and the second initial function is used to represent the distribution of relationships in the positive sample quadruple set and the negative sample quadruple set in time information. The values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set and the negative sample quadruple set, so that the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set meets the first preset condition. The first initial function and the second initial function that meet the first preset condition are determined as the first function and the second function. The parameters of the first initial function and the second initial function can be updated by training the parameters to construct the above-mentioned first function and second function.

[0142] As an optional solution, the values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set and the negative sample quadruple set, so that the joint likelihood function formed by the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set satisfies the first preset condition, including:

[0143] The values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set and the negative sample quadruple set, so that the value of the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set is maximized.

[0144] Optionally, in an embodiment of the present application, maximizing the value of the above-mentioned joint likelihood function may include but is not limited to maximizing the likelihood of observing training samples in the positive sample quadruple set and the negative sample quadruple set under the first initial function and the second initial function corresponding to the current parameters.

[0145] For example, based on the first temporal knowledge graph Generate positive and negative sample sets D + and D - , the training parameters maximize the joint likelihood function of the parameters in the first and second initial functions and the training samples in the positive sample quadruple set and the negative sample quadruple set. The likelihood function represents the probability of observing the occurrence of the training sample under the corresponding parameters, that is:

[0146]

[0147] Among them, q is the positive sample quadruple, and q′ is the negative sample quadruple.

[0148] It should be noted that the first-order Markov hypothesis may be introduced, but is not limited to the following: that is, the representation of entities and relationships is only related to adjacent time nodes, that is:

[0149] p(e i,t |e i,t-1 , e i,t-2 …, e i,1 )=p(e i,t |e i,t-1 )

[0150] Based on the above joint likelihood function, we can include but are not limited to constructing a loss function as the negative log joint likelihood, and simplify it to:

[0151]

[0152] Through the embodiments of the present application, the value of the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set can be maximized, and then, the maximization of the value of the joint likelihood function is converted into the minimization of the value of the negative logarithmic joint likelihood function, and the negative logarithmic joint likelihood function is determined as the loss function of the training model to realize the training of the values of the parameters in the first initial function and the second initial function, update the values of the parameters in the above-mentioned first initial function and the second initial function, and obtain the above-mentioned first function and second function.

[0153] As an optional solution, updating the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set includes:

[0154] Determining a negative sample sampling rate according to the positive sample quadruple set and the negative sample quadruple set, wherein the negative sample sampling rate represents the number of negative sample quadruples obtained by sampling each positive sample quadruple in the positive sample quadruple set;

[0155] Obtaining a predetermined number of training rounds, a target interval, and a timing window length, wherein the number of training rounds is used to indicate the number of training times for training the first initial function and the second initial function into the first function and the second function, the target interval is used to indicate a preset difference between a target parameter corresponding to a quadruple in the positive sample quadruple set and a target parameter corresponding to a quadruple in the negative sample quadruple set, and the timing window length is used to indicate a time span of the quadruples in the positive sample subset each time a positive sample subset is sampled from the positive sample quadruple set for training during the training process;

[0156] According to the positive sample quadruple set, the negative sample sampling rate, the number of training rounds, the target interval and the time series window length, the values of the parameters in the first initial function and the second initial function are updated to obtain the first function and the second function.

[0157] Optionally, in an embodiment of the present application, the above-mentioned negative sample sampling rate may include but is not limited to being flexibly set according to the number of quadruple groups in the positive sample quadruple set. For example, the negative sample sampling rate η: represents the ratio of positive samples to constructed negative samples in the training sample, and η=10 means sampling 10 negative samples for each positive sample.

[0158] Optionally, in an embodiment of the present application, the above-mentioned number of training rounds represents the pre-desired number of training rounds for training the first initial function and the second initial function into the first function and the second function. For example, n=10 means that the training sample will be trained 10 times to train the first initial function and the second initial function into the first function and the second function.

[0159] Optionally, in an embodiment of the present application, the above-mentioned target interval represents evaluating the training samples in the positive sample quadruple and the negative sample quadruple according to the above-mentioned target evaluation function to determine the difference range of the target parameters. For example, the target interval λ represents the interval of the target parameters between the positive and negative samples. λ=0.5 means that during the training process, the target parameters of the positive samples are required to be 0.5 higher than the target parameters of the negative samples.

[0160] Optionally, in the embodiment of the present application, the time window length L represents the time span of the quadruple in the positive sample subset when sampling the positive sample subset from the positive sample quadruple set for training each time during the training process. The time span may include but is not limited to the maximum value of the time difference between each two time information in the multiple time information included in each positive sample subset. For example, it represents that during the training process, each training subset The time span of L = 3 means that a subset with a time span of 3 will be sampled from the training sample each time. Conduct training.

[0161] Optionally, in an embodiment of the present application, the values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set, the negative sample sampling rate, the number of training rounds, the target interval, and the time series window length. The first function and the second function may be implemented by, but not limited to, the following algorithms:

[0162] Algorithm: Time series knowledge graph update training algorithm based on multi-dimensional Gaussian process:

[0163] Input: Time Series Knowledge Graph Positive sample set D + , negative sample sampling rate η, number of training rounds n, target interval λ, dimension d: represents the dimension of the space, d = 3 means that entities and relationships will be mapped into a multidimensional Gaussian process in a three-dimensional Euclidean space, and the time series window length L.

[0164] Output: Model parameter set P = {b, α, φ, β, ψ, σ, l, ω}

[0165] Among them, b represents the part of the first and second functions that does not change with time, α is the first-order direction parameter, which controls the evolution direction of the first and second functions that change linearly with time; φ is the first-order rate parameter, which controls the evolution rate of the first and second functions that change linearly with time; β is the second-order direction parameter, which controls the evolution direction of the first and second functions that change quadratically with time; ψ is the second-order rate parameter, which controls the evolution rate of the first and second functions that change quadratically with time, σ is the variance parameter, l is the scale parameter, and ω is the diagonal vector.

[0166]

[0167] The above is only an example, and the embodiments of the present application do not impose any specific limitations.

[0168] As an optional solution, according to the target evaluation function, the quadruple to be added is determined in the second set of quadruple, including:

[0169] Determining a value of a target parameter for each quadruple in the second set of quadruple groups by using a target evaluation function, wherein each quadruple in the second set of quadruple groups includes a current entity, a relationship between the current entity and a target entity, the target entity, and current time information;

[0170] According to the value of the target parameter corresponding to each quadruple in the second group of quadruple, a quadruple to be added is determined in the second group of quadruple, wherein the value of the target parameter corresponding to the quadruple to be added meets the second preset condition.

[0171] Optionally, in an embodiment of the present application, the above-mentioned target parameter values determined for each quadruple in the second group of quadruple may include but are not limited to the target parameter values determined for the entities included in each quadruple in the second group of quadruple. In other words, the above-mentioned target parameters may include but are not limited to being used to evaluate the quadruple in the second group of quadruple, and may also include but are not limited to being used to evaluate the entities in the second group of quadruple.

[0172] Optionally, in an embodiment of the present application, the current entity is a known quadruple in the second set of quadruples, and the target entity is an entity to be added to the second set of quadruples. The second preset condition may include, but is not limited to, determining that the value of the target parameter corresponding to the quadruple to be added is greater than or less than a preset threshold as the second preset condition, and may also include, but is not limited to, arranging the target parameter values from high to low and determining the top N values as the second preset condition.

[0173] As an optional solution, according to the value of the target parameter corresponding to each quadruple in the second set of quadruples, determining the quadruple to be added in the second set of quadruples includes:

[0174] Determining a third group of quadruple groups to be added in the second group of quadruple groups based on the value of the target parameter corresponding to each quadruple group in the second group of quadruple groups, wherein the value of the target parameter corresponding to the quadruple group in the third group of quadruple groups is greater than a preset threshold; or

[0175] According to the value of the target parameter corresponding to each quadruple in the second group of quadruples, a third group of quadruples to be added is determined in the second group of quadruples, wherein, in the second group of quadruples, the values of the target parameters corresponding to the quadruples in the third group of quadruples are arranged from high to low according to the values of the target parameters, and N is a positive integer greater than or equal to 1.

[0176] Optionally, in an embodiment of the present application, the third group of quadruple may be a quadruple whose target parameter value is greater than a preset threshold, which can be understood as the target parameter value of the target entity in the third group of quadruple is greater than the preset threshold.

[0177] For example, when the value of the target parameter of quadruple A is 5, the value of the target parameter of quadruple B is 6, the value of the target parameter of quadruple C is 7, the value of the target parameter of quadruple D is 8, and the preset threshold is 6, then the above-mentioned third group of quadruple is the above-mentioned quadruple C and quadruple D.

[0178] Optionally, in an embodiment of the present application, the above-mentioned third group of quadruples can be arranged from high to low according to the values of the target parameters, and the values of the target parameters are the quadruples with the first N values. It can be understood that the values of the target parameters of the target entities in the above-mentioned third group of quadruples are the entities with the first N values.

[0179] For example, when the value of the target parameter of quadruple A is 5, the value of the target parameter of quadruple B is 6, the value of the target parameter of quadruple C is 7, the value of the target parameter of quadruple D is 8, and N is 3, then the third group of quadruple is the above-mentioned quadruple B, quadruple C and quadruple D.

[0180] As an optional solution, constructing the first function and the second function according to the first time series knowledge graph includes:

[0181] Constructing a first mean function, a first kernel function, and a first covariance matrix according to the first time series knowledge graph, and determining a first function according to the first mean function, the first kernel function, and the first covariance matrix, wherein the first mean function is used to represent the expectation of the distribution of entities in the first group of quadruples on the time information, and the first kernel function and the first covariance matrix are used to represent the variance and covariance of the distribution of entities in the first group of quadruples on the time information;

[0182] A second mean function, a second kernel function and a second covariance matrix are constructed according to the first time series knowledge graph, and a second function is determined according to the second mean function, the second kernel function and the second covariance matrix, wherein the second mean function is used to represent the expectation of the distribution of the relations in the first group of quadruples on the time information, and the second kernel function and the second covariance matrix are used to represent the variance and covariance of the distribution of the relations in the first group of quadruples on the time information.

[0183] Optionally, in an embodiment of the present application, the above-mentioned construction of the first mean function, the first kernel function, and the first covariance matrix based on the first time series knowledge graph, and the determination of the first function based on the first mean function, the first kernel function, and the first covariance matrix, and the construction of the second mean function, the second kernel function, and the second covariance matrix based on the first time series knowledge graph, and the determination of the second function based on the second mean function, the second kernel function, and the second covariance matrix may include but is not limited to the construction of the first function and the second function based on the multidimensional Gaussian distribution. Specifically, it can be converted into the construction of the following three functions:

[0184] Construct the first mean function and the second mean function. For entity e i and relationship r j , assuming that the trend of its mean function changing over time can be fitted by a quadratic polynomial function:

[0185]

[0186]

[0187] in, It is a time-invariant basic representation, which represents the part of the representation of entities and relationships that does not change with time; is a first-order direction parameter that controls the direction of the linear evolution of the time-varying part of the representation of entities and relationships; is a first-order rate parameter that controls the rate at which the representation of entities and relationships evolves linearly over time; is a second-order directional parameter that controls the evolution direction of entities and relationships over time quadratically; It is a second-order rate parameter that controls the evolution rate of entities and relationships as a function of time.

[0188] Construct the first kernel function and the second kernel function. For entity e i and relationship r j , using the exponential quadratic kernel to construct its kernel function:

[0189]

[0190]

[0191] in, is the variance parameter. The larger the variance parameter, the larger the overall variance of the corresponding d-dimensional Gaussian process. is the scale parameter. The larger the scale parameter is, the smaller the correlation between samples is at the same time interval.

[0192] Construct the first covariance matrix and the second covariance matrix. For entity e i and relationship r j , for the convenience of calculation and derivation, assume that its semi-positive definite covariance matrix is a diagonal matrix:

[0193]

[0194]

[0195] in is a diagonal vector.

[0196] As an optional solution, the method further includes:

[0197] Obtaining a target request, wherein the target request is used to request a response to a target question, where the target question corresponds to a third entity in the second temporal knowledge graph;

[0198] In response to the target request, searching the second temporal knowledge graph for the quadruple containing the third entity, and determining information corresponding to the fourth entity in the quadruple containing the third entity as reply information, wherein the quadruple containing the third entity is the quadruple added to the second temporal knowledge graph relative to the first temporal knowledge graph;

[0199] Send information corresponding to the fourth entity.

[0200] Optionally, in the embodiment of the present application, it is possible to *according to the second temporal knowledge graph Perform downstream tasks: First, in the second time series knowledge graph Based on the first and second functions, a new temporal knowledge graph representation {e′ i (t)|e i ∈ε} and Then, the second temporal knowledge graph and the first and second functions on it are used for downstream tasks, namely:

[0201]

[0202] The following is a further explanation of this application with reference to specific examples:

[0203] This application proposes a method for completing a temporal knowledge graph based on a multidimensional Gaussian process. This method addresses the problem of knowledge sparsity in the temporal knowledge graph and constructs a temporal knowledge graph representation based on a multidimensional Gaussian process, wherein the following entity representation is the above-mentioned first function, the relationship representation is the following second function, and the representation of entities and relationships is the above-mentioned first function and second function, and then the temporal knowledge graph is completed based on the representation of entities and relationships.

[0204] Specifically, first of all, the present invention of the present application proposes a method for completing a time series knowledge graph based on a multidimensional Gaussian process. This method addresses the problem of incomplete knowledge in the time series knowledge graph, constructs a time series knowledge graph representation based on a multidimensional Gaussian process, and completes the time series knowledge graph based on the graph representation. By mapping entities and relationships into multidimensional Gaussian process representations, this method can effectively model local perturbations of entity and relationship semantics, and model the uncertainty of their semantics. Based on these two points, it is possible to effectively improve the completion effect of the time series knowledge graph, achieve data enhancement of the time series knowledge graph, and thus improve the performance of downstream tasks.

[0205] This application was trained on the training sets of the public temporal knowledge graphs ICEWS14 and ICEWS05-15. After selecting model parameters based on the validation set, it was tested on the test set. The ranking of the real entity of each sample among the candidate entities was recorded, and the mean of the reciprocal of all rankings on the test set was recorded, recorded as MRR (Mean reciprocal rank); if the rank is less than or equal to k, it is considered a successful prediction. The number of successful predictions on the test set is recorded and averaged to generate Hit@1, Hit@3, and Hit@10, corresponding to the cases of k = 1, 3, and 10, respectively. The specific test results are shown in Table 1 below:

[0206] Table 1 Results of temporal knowledge graph completion on the datasets ICEWS14 and ICEWS05-15

[0207]

[0208]

[0209] This application uses graph representation learning methods to complete the temporal knowledge graph, but other strategies are also available, such as those based on graph neural networks. This application maps entities and relationships into a multidimensional Gaussian process space for representation learning. Complex space or non-Euclidean space can also be used. This application uses a multidimensional Gaussian process to model the entities and relationships at each specific time node as a multidimensional Gaussian distribution. Gaussian process regression can also be used to model the entities and relationships at each specific time node as samples sampled from a Gaussian distribution.

[0210] It is understandable that in the specific implementation of this application, related data such as user information* is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0211] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0212] According to another aspect of the embodiment of the present application, a knowledge graph updating device for implementing the above-mentioned knowledge graph updating method is also provided. Figure 10 As shown, the device includes:

[0213] An acquisition module 1002 is configured to acquire a first time-series knowledge graph to be updated, wherein the first time-series knowledge graph includes a first set of quadruple groups, each quadruple in the first set of quadruple groups includes a first entity, a first relationship between the first entity and a second entity, the second entity, and first time information;

[0214] A first construction module 1004 is configured to construct a first function and a second function based on the first temporal knowledge graph, wherein the first function is configured to represent the distribution of entities in the first set of quadruple groups over time information, and the second function is configured to represent the distribution of relationships in the first set of quadruple groups over time information;

[0215] A second construction module 1006 is configured to construct a target evaluation function based on the first function and the second function, wherein the target evaluation function is used to determine a value of a target parameter for the quadruple to be processed, and the value of the target parameter is used to represent the distance between the first distribution and the second distribution, where the first distribution is the distribution of two entities in the quadruple to be processed over time information, and the second distribution is the distribution of relations in the quadruple to be processed over time information;

[0216] Processing module 1008 is used to determine the quadruple to be added in the second group of quadruple according to the target evaluation function, and add the quadruple to be added to the first temporal knowledge graph to obtain a second temporal knowledge graph, wherein the two entities in each quadruple in the second group of quadruple are entities already in the first temporal knowledge graph, the time information in each quadruple in the second group of quadruple is the time information already in the first temporal knowledge graph, and each quadruple in the second group of quadruple is different from the quadruple in the first group of quadruple.

[0217] As an optional solution, the second building block includes:

[0218] A first generating unit is configured to generate a positive sample quadruple set and a negative sample quadruple set according to the first temporal knowledge graph, wherein the first set of quadruples includes the positive sample quadruple set, and the negative sample quadruple set includes quadruples obtained by replacing the first entity or the second entity in some or all of the quadruples in the positive sample quadruple set;

[0219] The first construction unit is used to construct a first function and a second function according to the positive sample quadruple set and the negative sample quadruple set, wherein the positive sample quadruple set and the negative sample quadruple set are used to determine parameters in the first function and the second function.

[0220] As an optional solution, the first building block includes:

[0221] A first acquisition subunit is configured to acquire a first initial function and a second initial function to be trained, wherein the first initial function is used to represent the distribution of entities in the positive sample quadruple set and the negative sample quadruple set over time information, and the second initial function is used to represent the distribution of relationships in the positive sample quadruple set and the negative sample quadruple set over time information;

[0222] An updating subunit is used to update the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set, so that the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set meets the first preset condition, and the first initial function and the second initial function when the first preset condition is met are determined as the first function and the second function.

[0223] As an optional solution, the apparatus is configured to update the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set in the following manner, so that a joint likelihood function formed by the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set satisfies a first preset condition:

[0224] The values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set and the negative sample quadruple set, so that the value of the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set is maximized.

[0225] As an optional solution, the apparatus is configured to update the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set in the following manner:

[0226] Determining a negative sample sampling rate according to the positive sample quadruple set and the negative sample quadruple set, wherein the negative sample sampling rate represents the number of negative sample quadruples obtained by sampling each positive sample quadruple in the positive sample quadruple set;

[0227] Obtaining a predetermined number of training rounds, a target interval, and a timing window length, wherein the number of training rounds is used to indicate the number of training times for training the first initial function and the second initial function into the first function and the second function, the target interval is used to indicate a preset difference between a target parameter corresponding to a quadruple in the positive sample quadruple set and a target parameter corresponding to a quadruple in the negative sample quadruple set, and the timing window length is used to indicate a time span of the quadruples in the positive sample subset each time a positive sample subset is sampled from the positive sample quadruple set for training during the training process;

[0228] According to the positive sample quadruple set, the negative sample sampling rate, the number of training rounds, the target interval and the time series window length, the values of the parameters in the first initial function and the second initial function are updated to obtain the first function and the second function.

[0229] As an optional solution, the device is used to determine the quadruple to be added in the second set of quadruples according to the target evaluation function in the following manner:

[0230] Determining a value of a target parameter for each quadruple in the second set of quadruple groups by using a target evaluation function, wherein each quadruple in the second set of quadruple groups includes a current entity, a relationship between the current entity and a target entity, the target entity, and current time information;

[0231] According to the value of the target parameter corresponding to each quadruple in the second group of quadruple, a quadruple to be added is determined in the second group of quadruple, wherein the value of the target parameter corresponding to the quadruple to be added meets the second preset condition.

[0232] As an optional solution, the device is used to determine the quadruple to be added in the second set of quadruple according to the value of the target parameter corresponding to each quadruple in the second set of quadruple in the following manner:

[0233] Determining a third group of quadruple groups to be added in the second group of quadruple groups based on the value of the target parameter corresponding to each quadruple group in the second group of quadruple groups, wherein the value of the target parameter corresponding to the quadruple group in the third group of quadruple groups is greater than a preset threshold; or

[0234] According to the value of the target parameter corresponding to each quadruple in the second group of quadruples, a third group of quadruples to be added is determined in the second group of quadruples, wherein, in the second group of quadruples, the values of the target parameters corresponding to the quadruples in the third group of quadruples are arranged from high to low according to the values of the target parameters, and N is a positive integer greater than or equal to 1.

[0235] As an optional solution, the apparatus is configured to construct the first function and the second function according to the first temporal knowledge graph in the following manner:

[0236] Constructing a first mean function, a first kernel function, and a first covariance matrix according to the first time series knowledge graph, and determining a first function according to the first mean function, the first kernel function, and the first covariance matrix, wherein the first mean function is used to represent the expectation of the distribution of entities in the first group of quadruples on the time information, and the first kernel function and the first covariance matrix are used to represent the variance and covariance of the distribution of entities in the first group of quadruples on the time information;

[0237] A second mean function, a second kernel function and a second covariance matrix are constructed according to the first time series knowledge graph, and a second function is determined according to the second mean function, the second kernel function and the second covariance matrix, wherein the second mean function is used to represent the expectation of the distribution of the relations in the first group of quadruples on the time information, and the second kernel function and the second covariance matrix are used to represent the variance and covariance of the distribution of the relations in the first group of quadruples on the time information.

[0238] As an optional solution, the device is also used to:

[0239] Obtaining a target request, wherein the target request is used to request a response to a target question, where the target question corresponds to a third entity in the second temporal knowledge graph;

[0240] In response to the target request, searching the second temporal knowledge graph for the quadruple containing the third entity, and determining information corresponding to the fourth entity in the quadruple containing the third entity as reply information, wherein the quadruple containing the third entity is the quadruple added to the second temporal knowledge graph relative to the first temporal knowledge graph;

[0241] Send information corresponding to the fourth entity.

[0242] According to one aspect of the present application, a computer program product is provided, comprising a computer program / instructions containing program code for executing the method illustrated in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1109 and / or installed from a removable medium 1111. When the computer program is executed by the central processing unit 1101, the various functions provided in the embodiments of the present application are performed.

[0243] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0244] Figure 11 The block diagram schematically shows a computer system structure of an electronic device used to implement an embodiment of the present application.

[0245] It should be noted that Figure 11 The computer system 1100 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0246] like Figure 11 As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to the program stored in the read-only memory 1102 (ROM) or the program loaded from the storage part 1108 into the random access memory 1103 (RAM). Various programs and data required for system operation are also stored in the random access memory 1103. The CPU 1101, the read-only memory 1102, and the random access memory 1103 are connected to each other via a bus 1104. An input / output interface 1105 (i.e., an I / O interface) is also connected to the bus 1104.

[0247] The following components are connected to the input / output interface 1105: an input section 1106 including a keyboard, a mouse, and the like; an output section 1107 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 1108 including a hard disk; and a communication section 1109 including a network interface card such as a local area network card or a modem. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the input / output interface 1105 as needed. Removable media 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1110 as needed, so that computer programs read therefrom can be installed into the storage section 1108 as needed.

[0248] In particular, according to an embodiment of the present application, the processes described in the various method flow charts can be implemented as computer software programs. For example, an embodiment of the present application includes a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the methods shown in the flow charts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1109 and / or installed from a removable medium 1111. When the computer program is executed by the central processing unit 1101, the various functions defined in the system of the present application are performed.

[0249] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned knowledge graph updating method is also provided. The electronic device may be Figure 1 The terminal device or server shown in FIG. This embodiment is described by taking the electronic device as a terminal device as an example. Figure 12 As shown, the electronic device includes a memory 1202 and a processor 1204 . The memory 1202 stores a computer program. The processor 1204 is configured to execute the steps in any one of the above method embodiments through the computer program.

[0250] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.

[0251] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:

[0252] S1, obtaining a first time-series knowledge graph to be updated, wherein the first time-series knowledge graph includes a first set of quadruple groups, each quadruple in the first set of quadruple groups includes a first entity, a first relationship between the first entity and a second entity, the second entity, and first time information;

[0253] S2, constructing a first function and a second function based on the first temporal knowledge graph, wherein the first function is used to represent the distribution of entities in the first set of quadruple over time information, and the second function is used to represent the distribution of relationships in the first set of quadruple over time information;

[0254] S3, constructing a target evaluation function based on the first function and the second function, wherein the target evaluation function is used to determine a value of a target parameter for the quadruple to be processed, the value of the target parameter being used to represent the distance between the first distribution and the second distribution, the first distribution being the distribution of two entities in the quadruple to be processed over time information, and the second distribution being the distribution of relationships in the quadruple to be processed over time information;

[0255] S4. According to the target evaluation function, determine the quadruple to be added in the second group of quadruple, and add the quadruple to be added to the first temporal knowledge graph to obtain a second temporal knowledge graph, wherein the two entities in each quadruple in the second group of quadruple are entities already in the first temporal knowledge graph, the time information in each quadruple in the second group of quadruple is the time information already in the first temporal knowledge graph, and each quadruple in the second group of quadruple is different from the quadruple in the first group of quadruple.

[0256] Alternatively, those skilled in the art will appreciate that Figure 12 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile internet device (MID), a PAD, or other terminal devices. Figure 12 It does not limit the structure of the electronic device. For example, the electronic device may also include Figure 12 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 12 Different configurations shown.

[0257] Among them, the memory 1202 can be used to store software programs and modules, such as the program instructions / modules corresponding to the knowledge graph updating method and device in the embodiment of the present application. The processor 1204 executes various functional applications and data processing by running the software programs and modules stored in the memory 1202, that is, realizes the above-mentioned knowledge graph updating method. The memory 1202 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1202 may further include a memory remotely located relative to the processor 1204, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1202 can be used specifically but not limited to store entities, relationships, time information and other information. As an example, such as Figure 12 As shown, the memory 1202 may include, but is not limited to, the acquisition module 1002, the first construction module 1004, the second construction module 1006, and the processing module 1008 in the knowledge graph update device. In addition, it may also include, but is not limited to, other module units in the knowledge graph update device, which will not be repeated in this example.

[0258] Optionally, the transmission device 1206 is configured to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one embodiment, the transmission device 1206 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 1206 is a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.

[0259] In addition, the above-mentioned electronic device also includes: a display 1208 for displaying the above-mentioned temporal knowledge graph; and a connection bus 1210 for connecting the various module components in the above-mentioned electronic device.

[0260] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, which may be a distributed system formed by connecting multiple nodes via network communication. The nodes may form a peer-to-peer (P2P) network, and any computing device, such as a server, terminal, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.

[0261] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the knowledge graph updating method provided in various optional implementation methods of the above-mentioned knowledge graph updating.

[0262] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0263] S1, obtaining a first time-series knowledge graph to be updated, wherein the first time-series knowledge graph includes a first set of quadruple groups, each quadruple in the first set of quadruple groups includes a first entity, a first relationship between the first entity and a second entity, the second entity, and first time information;

[0264] S2, constructing a first function and a second function based on the first temporal knowledge graph, wherein the first function is used to represent the distribution of entities in the first set of quadruple over time information, and the second function is used to represent the distribution of relationships in the first set of quadruple over time information;

[0265] S3, constructing a target evaluation function based on the first function and the second function, wherein the target evaluation function is used to determine a value of a target parameter for the quadruple to be processed, the value of the target parameter being used to represent the distance between the first distribution and the second distribution, the first distribution being the distribution of two entities in the quadruple to be processed over time information, and the second distribution being the distribution of relationships in the quadruple to be processed over time information;

[0266] S4. According to the target evaluation function, determine the quadruple to be added in the second group of quadruple, and add the quadruple to be added to the first temporal knowledge graph to obtain a second temporal knowledge graph, wherein the two entities in each quadruple in the second group of quadruple are entities already in the first temporal knowledge graph, the time information in each quadruple in the second group of quadruple is the time information already in the first temporal knowledge graph, and each quadruple in the second group of quadruple is different from the quadruple in the first group of quadruple.

[0267] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0268] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0269] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present application, 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. This computer software product is stored in a storage medium and includes a number of instructions for causing one or more computer devices (such as personal computers, servers, or network devices) to execute all or part of the steps of the methods described in various embodiments of the present application.

[0270] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0271] In the several embodiments provided herein, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is merely a logical functional division. Actual implementations may employ alternative divisions, such as combining or integrating multiple units or components into another system, or omitting or disabling certain features. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through interfaces, or indirect coupling or communication connection between units or modules, either electrical or otherwise.

[0272] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the objectives of this embodiment as needed.

[0273] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0274] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for updating a knowledge graph, characterized in that: Applied in question answering systems, including: Obtaining a first time-series knowledge graph to be updated in the question-answering system, wherein the first time-series knowledge graph includes a first set of quadruple groups, each quadruple in the first set of quadruple groups includes a first entity, a first relationship between the first entity and a second entity, the second entity, and first time information; Constructing a first function and a second function based on the first temporal knowledge graph, wherein the first function is used to represent the distribution of entities in the first set of quadruple over time information, and the second function is used to represent the distribution of relationships in the first set of quadruple over time information; A target evaluation function is constructed according to the first function and the second function, wherein the target evaluation function is used to determine the value of a target parameter for the quadruple to be processed, and the value of the target parameter is used to represent the distance between the first distribution and the second distribution, the first distribution is the distribution of the two entities in the quadruple to be processed in time information, and the second distribution is the distribution of the relationship in the quadruple to be processed in time information; according to the target evaluation function, a quadruple to be supplemented is determined in the second group of quadruples, and the quadruple to be supplemented is added to the first temporal knowledge graph to obtain a second temporal knowledge graph, wherein the two entities in each quadruple in the second group of quadruples are entities already in the first temporal knowledge graph, the time information in each quadruple in the second group of quadruples is the time information already in the first temporal knowledge graph, and each quadruple in the second group of quadruples is different from the quadruple in the first group of quadruples; The method also includes: obtaining a target request, wherein the target request is used to request reply information of a target question, and the target question corresponds to a third entity in the second temporal knowledge graph; in response to the target request, searching for the quadruple where the third entity is located in the second temporal knowledge graph, and determining the information corresponding to the fourth entity in the quadruple where the third entity is located as the reply information, wherein the quadruple where the third entity is located is the quadruple supplemented in the second temporal knowledge graph relative to the first temporal knowledge graph; and sending the information corresponding to the fourth entity.

2. The method according to claim 1, characterized in that The constructing of the first function and the second function according to the first time series knowledge graph includes: Generating a positive sample quadruple set and a negative sample quadruple set according to the first temporal knowledge graph, wherein the first set of quadruples includes the positive sample quadruple set, and the negative sample quadruple set includes quadruples obtained by replacing the first entity or the second entity in some or all quadruples in the positive sample quadruple set; The first function and the second function are constructed according to the positive sample quadruple set and the negative sample quadruple set, wherein the positive sample quadruple set and the negative sample quadruple set are used to determine parameters in the first function and the second function.

3. The method according to claim 2, characterized in that The constructing the first function and the second function according to the positive sample quadruple set and the negative sample quadruple set includes: Obtain a first initial function and a second initial function to be trained, wherein the first initial function is used to represent the distribution of entities in the positive sample quadruple set and the negative sample quadruple set on the time information, and the second initial function is used to represent the distribution of relationships between the positive sample quadruple set and the negative sample quadruple set on the time information; The values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set and the negative sample quadruple set, so that the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set meets a first preset condition, and the first initial function and the second initial function that meet the first preset condition are determined as the first function and the second function.

4. The method according to claim 3, characterized in that The updating of the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set, so that a joint likelihood function formed by the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set satisfies a first preset condition, includes: The values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set and the negative sample quadruple set, so that the value of the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set is maximized.

5. The method according to claim 3, characterized in that The updating of the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set includes: Determining a negative sample sampling rate according to the positive sample quadruple set and the negative sample quadruple set, wherein the negative sample sampling rate represents the number of negative sample quadruples obtained by sampling each positive sample quadruple in the positive sample quadruple set; Obtaining a predetermined number of training rounds, a target interval, and a timing window length, wherein the number of training rounds is used to represent the number of training times for training the first initial function and the second initial function into the first function and the second function, the target interval is used to represent a preset difference between the target parameter corresponding to the quadruple in the positive sample quadruple set and the target parameter corresponding to the quadruple in the negative sample quadruple set, and the timing window length is used to represent the time span of the quadruples in the positive sample subset each time a positive sample subset is sampled from the positive sample quadruple set for training during the training process; According to the positive sample quadruple set, the negative sample sampling rate, the number of training rounds, the target interval and the time series window length, the values of the parameters in the first initial function and the second initial function are updated to obtain the first function and the second function.

6. The method according to claim 1, characterized in that Determining the quadruple to be added in the second group of quadruple according to the target evaluation function includes: Determining a value of the target parameter for each quadruple in the second set of quadruple by using the target evaluation function, wherein each quadruple in the second set of quadruple includes a current entity, a relationship between the current entity and a target entity, the target entity, and current time information; According to the value of the target parameter corresponding to each quadruple in the second group of quadruple, the quadruple to be added is determined in the second group of quadruple, wherein the value of the target parameter corresponding to the quadruple to be added meets the second preset condition.

7. The method according to claim 6, characterized in that The step of determining the quadruple to be supplemented in the second group of quadruple according to the value of the target parameter corresponding to each quadruple in the second group of quadruple includes: Determining a third group of quadruple groups to be added in the second group of quadruple groups based on the value of the target parameter corresponding to each quadruple group in the second group of quadruple groups, wherein the value of the target parameter corresponding to the quadruple group in the third group of quadruple groups is greater than a preset threshold; or According to the value of the target parameter corresponding to each quadruple in the second group of quadruples, a third group of quadruples to be added is determined in the second group of quadruples, wherein, in the second group of quadruples, the values of the target parameter corresponding to the quadruple in the third group of quadruples are the first N values, arranged from high to low according to the values of the target parameter. N is a positive integer greater than or equal to 1.

8. The method according to claim 1, characterized in that The constructing of the first function and the second function according to the first time series knowledge graph includes: Constructing a first mean function, a first kernel function, and a first covariance matrix according to the first time series knowledge graph, and determining the first function according to the first mean function, the first kernel function, and the first covariance matrix, wherein the first mean function is used to represent the expectation of the distribution of entities in the first group of quadruples on the time information, and the first kernel function and the first covariance matrix are used to represent the variance and covariance of the distribution of entities in the first group of quadruples on the time information; A second mean function, a second kernel function and a second covariance matrix are constructed according to the first time series knowledge graph, and the second function is determined according to the second mean function, the second kernel function and the second covariance matrix, wherein the second mean function is used to represent the expectation of the distribution of the relations in the first group of quadruples in the time information, and the second kernel function and the second covariance matrix are used to represent the variance and covariance of the distribution of the relations in the first group of quadruples in the time information.

9. A knowledge graph updating device, characterized in that: Applied in question answering systems, including: an acquisition module, configured to acquire a first time-series knowledge graph to be updated in the question-answering system, wherein the first time-series knowledge graph includes a first set of quadruple groups, each quadruple in the first set of quadruple groups includes a first entity, a first relationship between the first entity and a second entity, the second entity, and first time information; A first construction module is configured to construct a first function and a second function based on the first temporal knowledge graph, wherein the first function is used to represent the distribution of entities in the first set of quadruple over time information, and the second function is used to represent the distribution of relations in the first set of quadruple over time information; A second construction module is used to construct a target evaluation function based on the first function and the second function, wherein the target evaluation function is used to determine the value of a target parameter for the quadruple to be processed, and the value of the target parameter is used to represent the distance between the first distribution and the second distribution, the first distribution is the distribution of the two entities in the quadruple to be processed in time information, and the second distribution is the distribution of the relationship in the quadruple to be processed in time information; a processing module is used to determine the quadruple to be supplemented in the second group of quadruples according to the target evaluation function, and add the quadruple to be supplemented to the first time series knowledge graph to obtain a second time series knowledge graph, wherein the two entities in each quadruple in the second group of quadruples are entities already in the first time series knowledge graph, the time information in each quadruple in the second group of quadruples is the time information already in the first time series knowledge graph, and each quadruple in the second group of quadruples is different from the quadruple in the first group of quadruples; The device is also used to: obtain a target request, wherein the target request is used to request reply information of a target question, and the target question corresponds to a third entity in the second temporal knowledge graph; in response to the target request, search the second temporal knowledge graph for the quadruple where the third entity is located, and determine the information corresponding to the fourth entity in the quadruple where the third entity is located as the reply information, wherein the quadruple where the third entity is located is the quadruple supplemented in the second temporal knowledge graph relative to the first temporal knowledge graph; and send the information corresponding to the fourth entity.

10. The device according to claim 9, characterized in that The second building block includes: A first generating unit is configured to generate a positive sample quadruple set and a negative sample quadruple set according to the first temporal knowledge graph, wherein the first set of quadruples includes the positive sample quadruple set, and the negative sample quadruple set includes quadruples obtained by replacing the first entity or the second entity in some or all quadruples in the positive sample quadruple set; A first construction unit is configured to construct the first function and the second function according to the positive sample quadruple set and the negative sample quadruple set, wherein the positive sample quadruple set and the negative sample quadruple set are used to determine parameters in the first function and the second function.

11. The device according to claim 10, characterized in that The first building block comprises: A first acquisition subunit is configured to acquire a first initial function and a second initial function to be trained, wherein the first initial function is used to represent the distribution of entities in the positive sample quadruple set and the negative sample quadruple set on the time information, and the second initial function is used to represent the distribution of relationships between the positive sample quadruple set and the negative sample quadruple set on the time information; An updating subunit is used to update the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set, so that the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set meets a first preset condition, and the first initial function and the second initial function when the first preset condition is met are determined as the first function and the second function.

12. The device according to claim 11, characterized in that The apparatus is configured to update the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set in the following manner, so that a joint likelihood function formed by the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set satisfies a first preset condition: The values of the parameters in the first initial function and the second initial function are updated according to the positive sample quadruple set and the negative sample quadruple set, so that the value of the joint likelihood function composed of the parameters in the first initial function and the second initial function and the positive sample quadruple set and the negative sample quadruple set is maximized.

13. The device according to claim 11, characterized in that The device is configured to update the values of the parameters in the first initial function and the second initial function according to the positive sample quadruple set and the negative sample quadruple set in the following manner: Determining a negative sample sampling rate according to the positive sample quadruple set and the negative sample quadruple set, wherein the negative sample sampling rate represents the number of negative sample quadruples obtained by sampling each positive sample quadruple in the positive sample quadruple set; Obtaining a predetermined number of training rounds, a target interval, and a timing window length, wherein the number of training rounds is used to represent the number of training times for training the first initial function and the second initial function into the first function and the second function, the target interval is used to represent a preset difference between the target parameter corresponding to the quadruple in the positive sample quadruple set and the target parameter corresponding to the quadruple in the negative sample quadruple set, and the timing window length is used to represent the time span of the quadruples in the positive sample subset each time a positive sample subset is sampled from the positive sample quadruple set for training during the training process; According to the positive sample quadruple set, the negative sample sampling rate, the number of training rounds, the target interval and the time series window length, the values of the parameters in the first initial function and the second initial function are updated to obtain the first function and the second function.

14. The device according to claim 9, characterized in that The device is used to determine the quadruple to be added in the second group of quadruples according to the target evaluation function in the following manner: Determining a value of the target parameter for each quadruple in the second set of quadruple by using the target evaluation function, wherein each quadruple in the second set of quadruple includes a current entity, a relationship between the current entity and a target entity, the target entity, and current time information; According to the value of the target parameter corresponding to each quadruple in the second group of quadruple, the quadruple to be added is determined in the second group of quadruple, wherein the value of the target parameter corresponding to the quadruple to be added meets the second preset condition.

15. The device according to claim 14, characterized in that The device is configured to determine the quadruple to be supplemented in the second group of quadruple according to the value of the target parameter corresponding to each quadruple in the second group of quadruple in the following manner: Determining a third group of quadruple groups to be added in the second group of quadruple groups based on the value of the target parameter corresponding to each quadruple group in the second group of quadruple groups, wherein the value of the target parameter corresponding to the quadruple group in the third group of quadruple groups is greater than a preset threshold; or According to the value of the target parameter corresponding to each quadruple in the second group of quadruples, a third group of quadruples to be added is determined in the second group of quadruples, wherein, in the second group of quadruples, the values of the target parameter corresponding to the quadruple in the third group of quadruples are the first N values, arranged from high to low according to the values of the target parameter. N is a positive integer greater than or equal to 1.

16. The device according to claim 9, characterized in that The device is configured to construct a first function and a second function according to the first time series knowledge graph in the following manner: Constructing a first mean function, a first kernel function, and a first covariance matrix according to the first time series knowledge graph, and determining the first function according to the first mean function, the first kernel function, and the first covariance matrix, wherein the first mean function is used to represent the expectation of the distribution of entities in the first group of quadruples on the time information, and the first kernel function and the first covariance matrix are used to represent the variance and covariance of the distribution of entities in the first group of quadruples on the time information; A second mean function, a second kernel function and a second covariance matrix are constructed according to the first time series knowledge graph, and the second function is determined according to the second mean function, the second kernel function and the second covariance matrix, wherein the second mean function is used to represent the expectation of the distribution of the relations in the first group of quadruples in the time information, and the second kernel function and the second covariance matrix are used to represent the variance and covariance of the distribution of the relations in the first group of quadruples in the time information.

17. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein the program can be executed by a terminal device or a computer to execute the method described in any one of claims 1 to 8.

18. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

19. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 8 through the computer program.

Citation Information

Patent Citations

  • Time sequence knowledge graph completion method based on space-time architecture

    CN112364108A

  • KR20210092148A