Knowledge graph updating method and device, electronic equipment and medium
By optimizing the word embedding of the initial knowledge graph in the cloud and sending it to the edge nodes, the edge nodes update the knowledge graph, which solves the problems of poor real-time knowledge graph update and idle computing resources in the existing technology, and achieves more efficient and real-time knowledge graph updates.
Patent Information
- Application Number
- CN202510004720.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-05-13
AI Technical Summary
The existing technology has problems such as poor real-time and idle computing resources during the knowledge graph update process, especially in the cloud-based full corpus data retraining, which consumes time and does not fully utilize the computing resources of edge nodes.
By optimizing the word embedding of the initial knowledge graph in the cloud, the optimized target knowledge graph is generated and sent to the edge node. The edge node is updated based on the target knowledge graph, making full use of the computing power resources of the edge node.
It improves the accuracy and update efficiency of the knowledge graph, enhances the real-timeness of the knowledge graph, and avoids the idle waste of computing resources.
Smart Images

Figure CN119990272A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a knowledge graph updating method, device, electronic device and medium. Background Art
[0002] As a structured form of knowledge representation, knowledge graph plays an important role in artificial intelligence, natural language processing and other fields. Its construction and update rely on massive corpus data, which mainly comes from the Internet and is updated in real time with the rapid development of the Internet. Therefore, the real-time and accuracy of knowledge graphs become key challenges in their construction and update process.
[0003] At present, the relevant technology adopts the knowledge graph update method of retraining with full corpus data in the cloud. Due to the large amount of corpus sample data and the time-consuming knowledge graph update, the knowledge graph update frequency is low and the real-time performance is poor. At the same time, in the computing power network cloud-edge collaborative scenario, when updating the knowledge graph, the computing tasks are mainly concentrated in the cloud, and the computing power resources of the edge nodes are not fully utilized, resulting in a certain amount of idle waste of computing power resources. Summary of the invention
[0004] The present disclosure provides a knowledge graph updating method, device, electronic device and medium to solve the problems in related technologies. By optimizing the word embedding of the initial knowledge graph using the cloud, the accuracy of the knowledge graph is improved, and the computing power resources of the edge nodes are fully utilized to improve the updating efficiency and real-time performance of the knowledge graph.
[0005] The first aspect of the present disclosure proposes a knowledge graph updating method, which is applied to the cloud, and includes: constructing an initial knowledge graph based on full sample data, the initial knowledge graph including a triple set of entities and relationships, the triple set including a head entity, a tail entity, and a relationship between the head entity and the tail entity; optimizing the word embeddings in the head entity matrix, the tail entity matrix, and the relationship matrix corresponding to the initial knowledge graph to obtain an optimized target knowledge graph, and sending the target knowledge graph to an edge node; receiving a virtual knowledge graph sent by the edge node, and storing the virtual knowledge graph, the virtual knowledge graph being a knowledge graph updated by the edge node based on the target knowledge graph.
[0006] In some embodiments of the present disclosure, the word embeddings in the head entity matrix, tail entity matrix and relationship matrix corresponding to the initial knowledge graph are optimized to obtain an optimized target knowledge graph, including: based on the triple set of entities and relationships in the initial knowledge graph, constructing the head entity matrix, tail entity matrix and relationship matrix corresponding to the initial knowledge graph; based on the triple set of entities and relationships in the knowledge graph, generating head entity negative samples corresponding to the head entity matrix, tail entity negative samples corresponding to the tail entity, and relationship negative samples corresponding to the relationship matrix; based on the head entity negative samples corresponding to the head entity matrix, the tail entity negative samples corresponding to the tail entity, and the relationship negative samples corresponding to the relationship matrix, in combination with the gradient descent algorithm, optimizing the word embeddings of the head entities in the head entity matrix, the tail entities in the tail entity matrix, and the relationships in the relationship matrix to obtain the optimized target word embeddings and the target knowledge graph corresponding to the target word embeddings.
[0007] In some embodiments of the present disclosure, the method includes: obtaining updated full sample data at preset time intervals; updating the target knowledge graph based on the updated full sample data, and sending the updated target knowledge graph to the edge node.
[0008] The second aspect of the present disclosure proposes a knowledge graph updating method, which is applied to edge nodes. The method includes: using the domain sample data corresponding to each edge node to generate an edge node knowledge graph for each edge node; receiving a target knowledge graph sent from the cloud, updating the target knowledge graph based on each edge node knowledge graph to obtain a virtual knowledge graph, wherein the target knowledge graph is a knowledge graph after the cloud optimizes the initial knowledge graph through word embedding; and sending the virtual knowledge graph to the cloud.
[0009] In some embodiments of the present disclosure, the target knowledge graph is updated based on each edge node knowledge graph to obtain a virtual knowledge graph including: determining multiple relationships corresponding to the target entity in the first edge node knowledge graph based on the target entity in the target knowledge graph; traversing the first relationship among the multiple relationships in the first edge node knowledge graph to determine whether the target knowledge graph has the first relationship in the first edge node knowledge graph; if the target knowledge graph does not have the first relationship among the multiple relationships, verifying the first relationship using the second edge node, and updating the target knowledge graph using the first relationship according to the verification result to obtain an updated virtual knowledge graph.
[0010] In some embodiments of the present disclosure, the method includes: receiving an updated target knowledge graph sent from the cloud at a preset time interval.
[0011] The third aspect of the present disclosure provides a knowledge graph updating device, which is applied to the cloud and includes:
[0012] A construction unit is used to construct an initial knowledge graph based on the full sample data. The initial knowledge graph includes a triple set of entities and relationships. The triple set includes a head entity, a tail entity, and a relationship between the head entity and the tail entity.
[0013] An optimization unit is used to optimize the word embeddings in the head entity matrix, the tail entity matrix, and the relationship matrix corresponding to the initial knowledge graph to obtain an optimized target knowledge graph, and send the target knowledge graph to the edge node;
[0014] The receiving unit is used to receive the virtual knowledge graph sent by the edge node and store the virtual knowledge graph, where the virtual knowledge graph is the knowledge graph updated by the edge node based on the target knowledge graph.
[0015] The fourth aspect of the present disclosure provides a knowledge graph updating device, which is applied to an edge node and includes:
[0016] A generating unit, used to generate an edge node knowledge graph for each edge node by using the sample data in the domain corresponding to each edge node;
[0017] An updating unit is used to receive a target knowledge graph sent from the cloud, update the target knowledge graph based on the knowledge graph of each edge node, and obtain a virtual knowledge graph. The target knowledge graph is a knowledge graph after the cloud optimizes the initial knowledge graph through word embedding;
[0018] The sending unit is used to send the virtual knowledge graph to the cloud.
[0019] The fifth aspect embodiment of the present disclosure proposes an electronic device, comprising: a processor and a memory for storing a computer program that can be run on the processor, wherein the processor, when used to run the computer program, executes the method described in the first aspect embodiment or the second aspect embodiment of the present disclosure.
[0020] The sixth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment or the second aspect embodiment of the present disclosure.
[0021] In summary, according to the knowledge graph updating method proposed in the present invention, an initial knowledge graph is constructed based on the full sample data; the word embeddings in the head entity matrix, tail entity matrix and relationship matrix corresponding to the initial knowledge graph are optimized to obtain the optimized target knowledge graph, and the target knowledge graph is sent to the edge node; the virtual knowledge graph sent by the edge node is received, and the virtual knowledge graph is stored. The virtual knowledge graph is the knowledge graph updated by the edge node based on the target knowledge graph, so that the word embedding of the initial knowledge graph is optimized when constructing the target knowledge graph, and the accuracy of the target knowledge graph is improved. At the same time, the target knowledge graph is sent to the edge node, and the target knowledge graph is updated by the edge node, so that the computing power resources of the edge node are fully utilized, and the knowledge graph update efficiency and real-time performance are improved.
[0022] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0024] Figure 1 A schematic diagram of updating a knowledge graph in a related technology provided by an embodiment of the present disclosure;
[0025] Figure 2 A flowchart of a knowledge graph updating method provided in an embodiment of the present disclosure;
[0026] Figure 3 A flowchart of a knowledge graph updating method provided in an embodiment of the present disclosure;
[0027] Figure 4 A flowchart of a knowledge graph updating method provided in an embodiment of the present disclosure;
[0028] Figure 5 A flowchart of a knowledge graph updating method provided in an embodiment of the present disclosure;
[0029] Figure 6 A flowchart of a knowledge graph updating method provided in an embodiment of the present disclosure;
[0030] Figure 7 A schematic diagram of an edge node knowledge graph and a target knowledge graph provided in an embodiment of the present disclosure;
[0031] Figure 8 A schematic diagram of the structure of a knowledge graph updating device provided in an embodiment of the present disclosure;
[0032] Fig. 9 A flowchart of a knowledge graph updating method provided in an embodiment of the present disclosure;
[0033] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0034] The embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions.
[0035] Building and updating knowledge graphs is a complex task. The underlying knowledge graph relies on massive corpus data. Since the Internet generates massive data in real time, the underlying corpus data is also constantly updated, so the knowledge graph model needs to be constantly updated to ensure the real-time nature of the knowledge graph.
[0036] At present, in the computing power network architecture system in related technologies, edge nodes are usually used to collect and clean data samples, and cloud storage and training models are used to build and update knowledge graphs.
[0037] like Figure 1 As shown, the present disclosure provides a schematic diagram of updating a knowledge graph in a related art. Figure 1 First, the edge nodes collect corpus data from all data sources and store them centrally in the cloud corpus storage nodes; secondly, the knowledge graph training nodes train the knowledge graph model based on the cloud corpus data; finally, when the data in the corpus storage node is updated, the cloud will fully retrain the knowledge graph model.
[0038] It can be seen that the knowledge graph update method in the relevant technology has two main shortcomings: first, the existing knowledge graph model update adopts the update method of re-training with full corpus data on the cloud. Due to the large amount of corpus sample data, the knowledge graph update is time-consuming, resulting in a low frequency of knowledge graph updates and poor real-time performance; second, in the computing power network cloud-edge collaborative scenario, when training and updating the knowledge graph, the computing tasks are mainly concentrated in the cloud, and the computing power resources of the edge nodes are not fully utilized, resulting in a certain amount of idle waste of computing power resources.
[0039] In order to solve the above problems, the knowledge graph updating method disclosed in the present invention proposes a method for updating the knowledge graph in a collaborative manner between computing power network cloud and edge. The edge nodes construct their own knowledge graphs and their word embedding representations by analyzing the local corpus, and then align them with the knowledge graph in the central cloud. The breadth-first search strategy is used to ensure the comprehensiveness and consistency of the alignment process. When a new entity relationship is detected, a decentralized mutual verification mechanism is adopted. The Euclidean distance between the embedding vectors of the entity and the relationship is calculated, and a threshold is set to judge the rationality of the new relationship. When more than half of the edge nodes pass the verification, the new relationship is updated to the virtual knowledge graph in the cloud. At the same time, negative sample enhancement is introduced. On the basis of the existing word embedding, negative samples are constructed based on the head entity, relationship, and tail entity of the knowledge graph, respectively. The objective function is to minimize the Euclidean distance between the sum of the head entity and the relationship of the positive sample and the tail entity, and to maximize the Euclidean distance between the sum of the negative sample entity and the relationship and the tail entity. For each word embedding vector, the gradient descent method is used to iterate step by step to obtain the extreme optimal word embedding, and the knowledge graph is constructed using the optimized word embedding. When updating the knowledge graph, the computing resources of edge nodes can be fully utilized while taking into account the accuracy and real-time performance of the knowledge graph.
[0040] The knowledge graph updating method provided in this application is introduced in detail below with reference to the accompanying drawings.
[0041] Figure 2 A flow chart of a knowledge graph updating method provided in an embodiment of the present disclosure. Figure 2 As shown, the method is applied in the cloud, and the knowledge graph updating method includes steps 101-103.
[0042] Step 101, construct an initial knowledge graph based on the full sample data.
[0043] In an embodiment of the present disclosure, the initial knowledge graph includes a set of triples of entities and relationships, and the set of triples includes a head entity, a tail entity, and a relationship between the head entity and the tail entity. A knowledge graph is a graphical data structure for representing entities, concepts, and the relationships between them, and can be used in various application scenarios, such as intelligent question answering, recommendation systems, semantic search, etc.
[0044] The present disclosure can obtain full sample data collected from multiple data sources (such as databases, web pages, API interfaces, etc.), ensuring the diversity and integrity of the data to cover as many entities and relationships as possible.
[0045] Among them, after the cloud in the present disclosure obtains the full amount of sample data, it can also pre-process the full amount of sample data, such as data cleaning (removing duplicate data, processing missing values, correcting erroneous data, etc.), data format unification (converting data from different sources into a unified format), text processing (for text data, word segmentation, stop word removal, stem extraction, etc.), etc.
[0046] Afterwards, the present disclosure can extract entities and relationships from the full amount of sample data to construct an initial knowledge graph.
[0047] Entity extraction specifically includes: using named entity recognition (NER) technology to identify entities (such as names of people, places, and organizations) from all sample data. Among them, the accuracy of entity extraction can be improved by combining dictionaries and rule methods.
[0048] Relation extraction specifically includes: using relationship extraction technology to identify the relationship between entities from the full amount of sample data. This can be achieved based on template matching, machine learning or deep learning methods.
[0049] Step 102, optimize the word embeddings in the head entity matrix, tail entity matrix and relationship matrix corresponding to the initial knowledge graph to obtain an optimized target knowledge graph, and send the target knowledge graph to the edge node.
[0050] In an embodiment of the present disclosure, the head entity matrix (Head Entity Matrix) includes the word embedding vectors of all head entities; the tail entity matrix (Tail Entity Matrix) includes the word embedding vectors of all tail entities; and the relation matrix (Relation Matrix) includes the word embedding vectors of all relations.
[0051] The present disclosure can select a model based on knowledge graph embedding, such as TransE, DistMult, ComplEx, etc. The loss function is defined according to the selected model, such as a distance-based loss function (such as L1 or L2 loss in TransE) or a similarity-based loss function (such as negative log-likelihood loss in DistMult). Use an optimization algorithm (such as SGD, Adam, etc.) to minimize the loss function, thereby optimizing the word embeddings in the head entity matrix, the tail entity matrix, and the relationship matrix. Use the optimized word embedding matrix to update the initial knowledge graph to obtain the target knowledge graph. Then use an efficient transmission protocol (such as HTTP, HTTPS, MQTT, etc.) to distribute the target knowledge graph to the edge nodes, where the target knowledge graph can be compressed to reduce transmission time and bandwidth consumption.
[0052] Step 103, receiving the virtual knowledge graph sent by the edge node and storing the virtual knowledge graph, where the virtual knowledge graph is the knowledge graph updated by the edge node based on the target knowledge graph.
[0053] In the embodiments of the present disclosure, the virtual knowledge graph is obtained by the edge node after receiving the target knowledge graph and updating it using its own edge node knowledge graph. The virtual knowledge graph is a temporary knowledge graph stored in the cloud. When the knowledge graph service is needed, the present disclosure can query the virtual knowledge graph in the cloud, which can improve the real-time performance of the knowledge graph while ensuring relative accuracy. The cloud receives the virtual knowledge graph sent by the edge node and selects a suitable database (such as a graph database, a relational database, etc.) to store the virtual knowledge graph.
[0054] Specifically, the database can use Neo4j as a graph database, or use relational databases such as MySQL and PostgreSQL to store knowledge graphs.
[0055] In addition, since it is costly to recalculate the knowledge graph in the cloud, in order to reduce costs, the present disclosure can recalculate the knowledge graph in the cloud at intervals, that is, the present disclosure can obtain updated full sample data at preset time intervals; based on the updated full sample data, update the target knowledge graph, and send the updated target knowledge graph to the edge node.
[0056] In summary, according to the knowledge graph updating method proposed in the present invention, an initial knowledge graph is constructed based on the full sample data; the word embeddings in the head entity matrix, tail entity matrix and relationship matrix corresponding to the initial knowledge graph are optimized to obtain the optimized target knowledge graph, and the target knowledge graph is sent to the edge node; the virtual knowledge graph sent by the edge node is received, and the virtual knowledge graph is stored. The virtual knowledge graph is the knowledge graph updated by the edge node based on the target knowledge graph, so that the word embedding of the initial knowledge graph is optimized when constructing the target knowledge graph, and the accuracy of the target knowledge graph is improved. At the same time, the target knowledge graph is sent to the edge node, and the target knowledge graph is updated by the edge node, so that the computing power resources of the edge node are fully utilized, and the knowledge graph update efficiency and real-time performance are improved.
[0057] As a possible implementation, Figure 3 The flowchart of a knowledge graph updating method shown in FIG. 1 is a flow chart of a knowledge graph updating method. Based on the above embodiment, the specific process of constructing an initial knowledge graph based on the full sample data includes the following steps:
[0058] Step 201, use a word segmentation tool to segment the full amount of sample data to obtain the word segmentation data corresponding to the full amount of sample data.
[0059] In an embodiment of the present disclosure, the full sample data refers to all text data stored on the cloud corpus storage node. In the present disclosure, word segmentation refers to dividing a continuous text string into independent words or phrases. In this process, a special word segmentation tool is needed to complete it. These word segmentation tools can be based on statistical models or machine learning algorithms, and can automatically identify and segment words in the text. Among them, the word segmentation tools in the present disclosure can be jieba, SnowNLP, etc. Jieba is a Chinese word segmentation library based on Python, which supports three word segmentation modes: precise mode, full mode and search engine mode. SnowNLP is a feature-rich Chinese natural language processing library that, in addition to word segmentation, also supports sentiment analysis, text classification and other functions. In practical applications, the appropriate word segmentation tool can be selected according to specific needs.
[0060] After processing the complete sample data, the word segmentation tool in the present disclosure will output the corresponding word segmentation results. These word segmentation results are usually presented in the form of vocabulary lists, each list corresponding to the word segmentation results of a text sample. These word segmentation data are the basis of subsequent NLP tasks and can be used for training models, extracting features, etc.
[0061] Step 202: Encode the word segmentation data to obtain the word embedding corresponding to each word in the word segmentation data.
[0062] In an embodiment of the present disclosure, the present disclosure may convert each word in the word segmentation data into a vector representation of a fixed length (ie, word embedding).
[0063] The present disclosure can convert each word in the word segmentation data into a vector in a high-dimensional space through the word2vec word embedding technology, so that semantically similar words are also close in the vector space. The present disclosure can use word2vec to perform One-Hot encoding on the word vector, and represent each word as a vector with the same size as the vocabulary, that is, word embedding. Word2vec has two main training models: CBOW (Continuous Bag of Words) and Skip-Gram. The present disclosure can use the Skip-Gram model for training. The Skip-Gram model learns the vector representation of a word by predicting the context words around a given word. It is based on the assumption that similar words will appear in similar contexts.
[0064] After word2vec training, each word is mapped to a vector of fixed length, which is the word embedding representation of the word. The dimension of the word embedding (i.e., the length of the vector) is usually specified during training.
[0065] The closer the word embedding distance is, the higher the similarity of the words is. In the vector space, semantically similar words will be mapped to close positions, so the metrics such as Euclidean distance or cosine similarity between them will be smaller.
[0066] Step 203, based on word embedding, construct an initial knowledge graph, the initial knowledge graph includes a triple set of entities and relationships, the triple set includes a head entity, a tail entity, and a relationship between the head entity and the tail entity.
[0067] In an embodiment of the present disclosure, the present disclosure can utilize the semantic relationship between each word in the word embedding of each word, and then construct a set of triples containing entities and relationships based on these relationships, and finally form a structured initial knowledge graph.
[0068] Specifically, the initial knowledge graph G generated by the present disclosure can be expressed as:
[0069] G=(E,R,S) Formula 1
[0070] Where E is a set of entities, R is a set of relations, and S is a set of triplets of entities and relations. In S, a triple (h, r, t) is used to represent the word embedding, where h is the head entity, t is the tail entity, and r is the relationship between the head entity and the tail entity. h, r, and t can generate a 1*k-dimensional vector word embedding according to step 202.
[0071] Assume that the entity and relationship set S contains n triples (h, r, t), and the knowledge graph system has m edge nodes, where any entity and relationship triple can be represented as (h i ,r i ,t i ), where i∈n.
[0072] For example, the triple (Beijing, capital, China) means "Beijing is the capital of China". The head entity is the first entity in the triple, usually indicating the starting point of the relationship. The tail entity is the second entity in the triple, usually indicating the end point of the relationship. The relationship is the link between the head entity and the tail entity, describing a certain connection or attribute between them.
[0073] In summary, the present disclosure uses the word segmentation tool to perform detailed word segmentation processing on the full sample data, thereby obtaining the corresponding word segmentation data, encoding these word segmentation data so that each word can be converted into a unique word embedding, and based on these rich word embedding information, construct an initial knowledge graph. The initial knowledge graph is centered on a set of triples of entities and relationships. Each triple clearly shows the head entity, the tail entity, and the close relationship between them, providing a comprehensive and intuitive knowledge representation.
[0074] As a possible implementation, Figure 4 The flowchart of a knowledge graph updating method shown in FIG. 1 is a flowchart of a knowledge graph updating method. Based on the above embodiment, the word embeddings in the head entity matrix, the tail entity matrix and the relationship matrix corresponding to the initial knowledge graph are optimized to obtain the specific process of the optimized target knowledge graph, including the following steps:
[0075] Step 301, based on the triple set of entities and relationships in the initial knowledge graph, construct the head entity matrix, tail entity matrix and relationship matrix corresponding to the initial knowledge graph.
[0076] In the embodiments of the present disclosure, in order to better implement the update of the knowledge graph in the future, the present disclosure can construct the head entity matrix, tail entity matrix and relationship matrix of the initial knowledge graph, as shown below:
[0077] The head entity matrix H of the initial knowledge graph is expressed as:
[0078]
[0079] Where H represents the head entity matrix of the initial knowledge graph, and h i ={h i1 ,h i2 ,...h ik} represents the i-th head entity, h ik Represents the k-th dimension vector of the i-th head entity.
[0080] Similarly, the relationship matrix R of the initial knowledge graph is expressed as:
[0081]
[0082] Where R represents the relationship matrix of the initial knowledge graph, and r i = {r i1 ,r i2 ,...r ik} represents the i-th relationship, r ik The k-th dimensional vector representing the i-th relationship.
[0083] Similarly, the tail entity matrix T of the initial knowledge graph is expressed as:
[0084]
[0085] Where T represents the entity matrix at the end of the initial knowledge graph, and t i ={t i1 ,t i2 ,...,t ik} represents the i-th tail entity, r ik Represents the k-th dimension vector of the i-th tail entity.
[0086] Step 302, based on the triple set of entities and relations in the knowledge graph, generate head entity negative samples corresponding to the head entity matrix, tail entity negative samples corresponding to the tail entity, and relationship negative samples corresponding to the relationship matrix.
[0087] In the embodiments of the present disclosure, for any relationship in the knowledge graph, the optimal relationship needs to satisfy:
[0088] t=h+rFormula 2
[0089] As shown in Formula 2, the smaller the error between the tail entity vector and the sum of the head entity vector and the relationship vector, the more accurate the knowledge graph construction is. The present disclosure optimizes word embedding through a method for updating the knowledge graph through negative sample enhancement, and uses the optimized word embedding to update the knowledge graph, thereby improving the accuracy of the knowledge graph.
[0090] In an optional embodiment of the present disclosure, the present disclosure takes optimizing the word embedding of the relationship in the relationship matrix as an example, and the specific process is as follows:
[0091] The present invention can randomly generate l negative sample relations based on the existing initial knowledge graph with v relation samples. For any given relation r i , randomly generate negative sample head entities and tail entities, where the qth negative triplet can be represented by (nh q ,r q ,nt q ). Among them, nh, r, and nt are three variables. n has no actual meaning and can be named as other variables.
[0092] The present disclosure can generate head entity negative samples and tail entity negative samples based on the above steps.
[0093] Step 303, based on the head entity negative samples corresponding to the head entity matrix, the tail entity negative samples corresponding to the tail entity, and the relationship negative samples corresponding to the relationship matrix, combined with the gradient descent algorithm, the word embeddings of the head entity in the head entity matrix, the word embeddings of the tail entity in the tail entity matrix, and the word embeddings of the relationship in the relationship matrix are optimized to obtain the optimized target word embeddings and the target knowledge graph corresponding to the target word embeddings. That is, the present disclosure can generate a head entity objective function corresponding to the head entity negative sample, a tail entity objective function corresponding to the tail entity negative sample, and a relationship objective function corresponding to the relationship negative sample based on the head entity negative sample, the tail entity negative sample, and the relationship objective function; based on the head entity objective function, the tail entity objective function, and the relationship objective function, respectively determine the head entity minimum value of the head entity objective function, the tail entity minimum value of the tail entity objective function, and the relationship minimum value of the relationship objective function; when the head entity minimum value is less than the preset head entity iteration threshold, the head entity minimum value is used as the target word embedding after the head entity is optimized; when the tail entity minimum value is less than the preset tail entity iteration threshold, the tail entity minimum value is used as the target word embedding after the tail entity is optimized; when the relationship minimum value is less than the preset head entity iteration threshold, the relationship minimum value is used as the target word embedding after the relationship is optimized.
[0094] In an optional embodiment of the present disclosure, after the generated negative relationship samples are obtained, the objective function in the present disclosure can be expressed as Formula 3:
[0095]
[0096] in, Given the sum of squared vector distances between positive samples of a given relationship, It represents the sum of squared distances between vectors of negative samples. The larger the distance between the sum of head entities and relations of negative samples and the tail entity, the more accurate the word embedding is.
[0097] The present disclosure can find the minimum value of the relationship in formula 3, where the entity and the tail entity are known quantities, and the relationship to be optimized r i is a k-dimensional vector, and r is obtained by calculation i The minimum value of the extreme value is i Find the partial derivative of each dimensional vector, assuming r i The j-th vector of is used to calculate the minimum value, as shown in Formula 4:
[0098]
[0099] Assume r i The initial word embedding is u i , r ij The initial word embedding is u ij , where formula 4 represents the ij Derivative, assuming the gradient descent learning rate is α i(Adjustable, the initial value can be set to 0.001), use Formula 5 to iterate the word embedding of the relationship.
[0100]
[0101] Use Formula 5 to continue iterating. When the difference between two iteration values is less than γ (preset relationship iteration threshold, which can be adjusted), stop the iteration and use it as the word embedding of the final optimized relationship, that is, the target word embedding.
[0102] The present disclosure can complete the word embedding of the relationship according to the above steps. i All vectors are iterated to form the final r i Target word embedding.
[0103] According to the above steps, the word embedding optimization of each relationship in the initial knowledge graph is completed.
[0104] Similarly, the same as the above steps, for any given head entity, randomly generate negative sample relations and tail entities, use the gradient descent method to obtain the extreme value of each dimensional vector of the head entity h, and obtain the word embedding of the optimal head entity; for any given tail entity, randomly generate negative sample relations and head entities, use the gradient descent method to obtain the extreme value of each dimensional vector of the tail entity t, and obtain the word embedding of the optimal tail entity. The specific content will not be repeated here.
[0105] In summary, the knowledge graph updating method disclosed in the present invention, on the basis of existing word embeddings, constructs negative samples based on the head entity, relationship, and tail entity of the knowledge graph respectively, takes the Euclidean distance between the sum of the head entity and relationship of the positive sample and the tail entity as the minimum, and the Euclidean distance between the sum of the entity and relationship of the negative sample and the tail entity as the maximum as the objective function, for each word embedding vector, the gradient descent method is used to step by step iterate to obtain the extreme optimal word embedding, and the knowledge graph is constructed using the optimized word embedding, so that when updating the knowledge graph, the knowledge graph word embedding is enhanced by negative samples to improve the accuracy of knowledge graph updating.
[0106] Figure 5 A flow chart of a knowledge graph updating method provided in an embodiment of the present disclosure. Figure 5 As shown, the method is applied to edge nodes, and the knowledge graph updating method includes steps 401-403.
[0107] Step 401, using the in-domain sample data corresponding to each edge node, generate an edge node knowledge graph for each edge node.
[0108] In the embodiments of the present disclosure, edge nodes can use sample data in the domain to construct and generate a knowledge graph of the domain, that is, an edge node knowledge graph of each edge node, through methods such as sample collection, entity extraction, relationship extraction, and entity linking. On the one hand, it can improve the utilization rate of edge node computing resources. On the other hand, since the edge knowledge graph has fewer data samples and a faster update frequency, the real-time performance of the knowledge graph can be improved when updating the virtual knowledge graph.
[0109] Step 402, receiving the target knowledge graph sent from the cloud, updating the target knowledge graph based on each edge node knowledge graph, and obtaining a virtual knowledge graph. The target knowledge graph is the knowledge graph after the cloud optimizes the initial knowledge graph through word embedding.
[0110] In an embodiment of the present disclosure, after receiving the target knowledge graph in the cloud, the edge node in the present disclosure can obtain the target word embedding in the target knowledge graph, and perform knowledge graph alignment based on the target word embedding, thereby updating the target knowledge graph and obtaining a virtual knowledge graph.
[0111] The virtual knowledge graph is essentially a knowledge graph that has been cross-validated between edge computing nodes. The virtual knowledge graph in the present disclosure guarantees the accuracy of the knowledge graph to a certain extent through decentralized cross-validation of the knowledge graph between edge nodes. In addition, the edge end updates the knowledge graph data sample with fewer samples and the update is highly real-time, so the virtual knowledge graph is updated to the cloud first. When the client requests a knowledge graph, it requests a virtual knowledge graph, which can ensure the real-time nature of the knowledge graph without losing accuracy. Subsequently, the cloud retrains the knowledge graph based on the full amount of samples to ensure the accuracy of the knowledge graph.
[0112] Step 403, sending the virtual knowledge graph to the cloud.
[0113] In an embodiment of the present disclosure, the virtual knowledge graph in the present disclosure is a knowledge graph verified by all edge knowledge graphs, updated in the cloud, and stored in the cloud.
[0114] In summary, the knowledge graph updating method disclosed in the present invention generates an edge node knowledge graph for each edge node by utilizing the sample data in the domain corresponding to each edge node; receives the target knowledge graph sent from the cloud, updates the target knowledge graph based on each edge node knowledge graph, and obtains a virtual knowledge graph, where the target knowledge graph is the knowledge graph of the cloud after word embedding optimization of the initial knowledge graph; sends the virtual knowledge graph to the cloud to optimize the word embedding of the initial knowledge graph when constructing the target knowledge graph, thereby improving the accuracy of the target knowledge graph, and at the same time sends the target knowledge graph to the edge node, uses the edge node to update the target knowledge graph, fully utilizes the computing power resources of the edge node, and improves the knowledge graph update efficiency and real-time performance.
[0115] As a possible implementation, Figure 6 The flowchart of a knowledge graph updating method shown in the figure, based on the above embodiment, updates the target knowledge graph based on each edge node knowledge graph to obtain the specific process of the virtual knowledge graph, including the following steps:
[0116] Step 501, based on the target entity in the target knowledge graph, determine multiple relationships corresponding to the target entity in the first edge node knowledge graph.
[0117] In an embodiment of the present disclosure, the present disclosure can align all edge node knowledge graphs with the target knowledge graph, that is, recursively align the knowledge graphs outward from the center of a target knowledge graph.
[0118] Specifically, the present disclosure first determines the target entity in the target knowledge graph, that is, the entity that currently needs to be aligned in the target knowledge graph. After obtaining the target entity, for multiple edge nodes, the present disclosure first uses the first edge node knowledge graph of the first edge node to determine multiple relationships corresponding to the target entity.
[0119] Step 502, traverse the first relationship among the multiple relationships in the first edge node knowledge graph, and determine whether the target knowledge graph has the multiple relationships in the first edge node knowledge graph.
[0120] In an embodiment of the present disclosure, the present disclosure can traverse the first relationship among multiple relationships in the first edge node knowledge graph, and based on the target relationship and multiple relationships, determine that the master in the target knowledge graph has multiple relationships in the first edge node knowledge graph, that is, determine whether the target relationship is the same as the multiple relationships.
[0121] Specifically, Figure 7 As shown, the present disclosure provides a schematic diagram of an edge node knowledge graph and a target knowledge graph. Figure 7 , the edge node knowledge graph includes the "entity C" part of relationship B, and the target knowledge graph does not include entity C. The gray area represents the part to be completed. The present disclosure can use a breadth-first traversal algorithm to complete the part starting from the root node of the knowledge graph. The specific steps are as follows:
[0122] First, we start from the root node of the edge node knowledge graph "Entity A" and traverse all the relationships in sequence, such as Figure 7 , three relationship models of “relationship A”, “relationship B” and “relationship C” are identified in the edge node knowledge graph, and multiple relationships are obtained.
[0123] Secondly, we start traversing from relationship A (the first relationship) among the multiple relationships in the edge node knowledge graph, and check whether the target knowledge graph has the first relationship. If it has the first relationship and the entities are the same, we start traversing the second relationship among the next multiple relationships. We traverse all relationships and entities in this way.
[0124] Step 503: Use the second edge node to verify the first relationship, and use the first relationship to update the target knowledge graph according to the verification result to obtain an updated virtual knowledge graph.
[0125] In an embodiment of the present disclosure, during the breadth-first traversal process, when it is found that the first relationship existing in the knowledge graph of the first edge node is not present in the target knowledge graph, the present disclosure can virtually update the knowledge graph in the cloud through mutual verification between edge knowledge graphs. The knowledge graph alignment combined with decentralized mutual verification knowledge graph update efficiency is much higher than the update frequency of the full knowledge graph, thereby improving the real-time nature of the knowledge graph update.
[0126] Specifically, the present disclosure can verify the first relationship through the second edge node knowledge graph to obtain a verification result, where the second edge node knowledge graph is the edge node knowledge graph other than the first edge node knowledge graph in the edge node knowledge graph; if the number of verification passes in the verification result is greater than or equal to a preset number, it is determined that the first relationship is valid, and the target knowledge graph is updated using the first relationship to obtain an updated virtual knowledge graph.
[0127] Among them, the first relationship is verified through the second edge node knowledge graph to obtain a verification result, which specifically includes: determining the Euclidean distance corresponding to the first relationship in the second edge node knowledge graph, comparing the Euclidean distance with a preset mutual verification threshold, if the Euclidean distance is less than the preset mutual verification threshold, determining that the verification result of the second edge node knowledge graph is verification passed, if the Euclidean distance is greater than or equal to the preset mutual verification threshold, determining that the verification result of the second edge node knowledge graph is verification failed.
[0128] In an optional embodiment of the present disclosure, assuming that the first edge node knowledge graph has a first relationship (sh, sr, st), but does not have it in the cloud, the first relationship is sent to each other edge knowledge graph node (i.e., the second edge node corresponding to the second edge node knowledge graph).
[0129] Since each edge node of the edge node knowledge graph maintains the local knowledge graph and knowledge graph word embedding, each edge node knowledge graph uses its own word embedding to verify the relationship (sh, sr, st), as shown in Formula 6:
[0130] d=|sh+sr-st|Formula 6
[0131] As mentioned above, each word embedding is represented by a 1*k dimensional vector, and d is the Euclidean distance between entities and relations.
[0132] The present disclosure can pre-set a mutual verification threshold β, and β can be flexibly adjusted according to the situation. When the Euclidean distance verification obtained by the second edge node knowledge graph of the second edge node is d<β, it means that the relationship verification is passed, that is, the verification result is passed. When the edge node knowledge graph verification pass rate is greater than or equal to a preset number (for example, half of all edge nodes), it means that the first relationship is passed, the target knowledge graph is updated, and a virtual knowledge graph is obtained, and the virtual knowledge graph is sent to the cloud. The virtual knowledge graph is a temporary knowledge graph stored in the cloud. When the knowledge graph service is needed, the cloud virtual knowledge graph is queried, which can improve the real-time performance of the knowledge graph while ensuring relative accuracy.
[0133] Among them, the present disclosure can adopt the method of cloud-based target knowledge graph and virtual knowledge graph. Since the virtual knowledge graph is updated frequently, the real-time nature of the knowledge graph can be guaranteed. Since it is costly to recalculate the knowledge graph in the cloud, the present disclosure can recalculate the knowledge graph in the cloud at preset time intervals, so that the edge node can receive the updated target knowledge graph sent from the cloud at preset time intervals. The method of combining the cloud-based target knowledge graph and the virtual knowledge graph is realized, that is, the accuracy of the knowledge graph is guaranteed while maintaining the real-time nature of the knowledge graph.
[0134] In summary, the knowledge graph updating method disclosed in the present invention constructs a knowledge graph and graph word embedding based on the local domain corpus through edge nodes; aligns the edge knowledge graph and the cloud knowledge graph, and recursively traverses outward with the knowledge graph root node as the center through breadth-first traversal to complete the knowledge graph alignment; when a new relationship is found in the edge knowledge graph, the relationship is sent to other edge knowledge graph nodes for decentralized verification, and other nodes use the local domain edge word embedding to verify the Euclidean distance between the sum of the head entity and the relationship and the tail entity. When the number of edge nodes whose distance is less than the mutual verification threshold exceeds half, the knowledge graph relationship is updated to the cloud through verification; finally, the full knowledge graph update is completed regularly to ensure the accuracy of the knowledge graph while maintaining the real-time nature of the knowledge graph.
[0135] Corresponding to the methods provided in the above-mentioned embodiments, the present disclosure also provides a knowledge graph updating device. Since the device provided in the embodiments of the present disclosure corresponds to the methods provided in the above-mentioned embodiments, the implementation method of the method is also applicable to the device provided in this embodiment and will not be described in detail in this embodiment.
[0136] Figure 8 Schematic diagram of a knowledge graph updating device 800 provided in an embodiment of the present disclosure. Figure 8As shown, the device is applied to the cloud, and the knowledge graph updating device includes:
[0137] A construction unit 810 is used to construct an initial knowledge graph based on the full sample data, where the initial knowledge graph includes a triple set of entities and relationships, where the triple set includes a head entity, a tail entity, and a relationship between the head entity and the tail entity;
[0138] The optimization unit 820 is used to optimize the word embeddings in the head entity matrix, the tail entity matrix and the relationship matrix corresponding to the initial knowledge graph to obtain an optimized target knowledge graph, and send the target knowledge graph to the edge node;
[0139] The receiving unit 830 is used to receive the virtual knowledge graph sent by the edge node and store the virtual knowledge graph, where the virtual knowledge graph is the knowledge graph updated by the edge node based on the target knowledge graph.
[0140] In some embodiments of the present disclosure, the optimization unit 820 is used to: construct a head entity matrix, a tail entity matrix and a relationship matrix corresponding to the initial knowledge graph based on the triple set of entities and relationships in the initial knowledge graph; generate head entity negative samples corresponding to the head entity matrix, tail entity negative samples corresponding to the tail entity, and relationship negative samples corresponding to the relationship matrix based on the triple set of entities and relationships in the knowledge graph; optimize the word embeddings of the head entities in the head entity matrix, the tail entities in the tail entity matrix, and the relationship negative samples corresponding to the relationship matrix based on the head entity negative samples corresponding to the head entity matrix, the tail entity negative samples corresponding to the tail entity, and the relationship negative samples corresponding to the relationship matrix, in combination with the gradient descent algorithm, to obtain the optimized target word embeddings and the target knowledge graph corresponding to the target word embeddings.
[0141] In some embodiments of the present disclosure, the optimization unit 820 is further used to: obtain updated full sample data at preset time intervals; update the target knowledge graph based on the updated full sample data, and send the updated target knowledge graph to the edge node.
[0142] Fig. 9 Schematic diagram of a knowledge graph updating device 900 provided in an embodiment of the present disclosure. Fig. 9 As shown, the device is applied to an edge node, and the knowledge graph updating device includes:
[0143] A generating unit 910, configured to generate an edge node knowledge graph for each edge node using the sample data in the domain corresponding to each edge node;
[0144] An updating unit 920 is used to receive a target knowledge graph sent from the cloud, and to update the target knowledge graph based on each edge node knowledge graph to obtain a virtual knowledge graph, where the target knowledge graph is a knowledge graph after the cloud optimizes the initial knowledge graph through word embedding;
[0145] The sending unit 930 is used to send the virtual knowledge graph to the cloud.
[0146] In some embodiments of the present disclosure, the update unit 920 is used to: determine multiple relationships corresponding to the target entity in the first edge node knowledge graph based on the target entity in the target knowledge graph; traverse the first relationship among the multiple relationships in the first edge node knowledge graph to determine whether the target knowledge graph has the first relationship in the first edge node knowledge graph; if the target knowledge graph does not have the first relationship among the multiple relationships, use the second edge node to verify the first relationship, and update the target knowledge graph using the first relationship according to the verification result to obtain an updated virtual knowledge graph.
[0147] In some embodiments of the present disclosure, the updating unit 920 is further used to: receive an updated target knowledge graph sent from the cloud at a preset time interval.
[0148] In the embodiments provided in the present application, the methods and devices provided in the embodiments of the present application are introduced. In order to implement the functions in the methods provided in the embodiments of the present application, the electronic device may include a hardware structure and a software module, and implement the functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. A function of the functions may be executed in the form of a hardware structure, a software module, or a hardware structure plus a software module.
[0149] Fig.10 1 is a block diagram of an electronic device 1000 for implementing the above-mentioned knowledge graph updating method according to an exemplary embodiment. For example, the electronic device 1000 may be a mobile phone, a computer, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0150] Reference Fig.10 The electronic device 1000 may include a communication interface 1001, which can interact with other devices; a processor 1002, which is connected to the communication interface 1001 to interact with other devices and is used to execute the method provided by one or more of the above technical solutions when running a computer program; and a memory 1003, on which the computer program is stored. Specifically, the specific processing process of the processor 1002 can refer to the knowledge graph update method described in the above embodiment of the present disclosure.
[0151] Of course, in actual application, the various components in the electronic device 1000 are coupled together through the bus system 1004. It can be understood that the bus system 1004 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 1004 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Fig.10 Various buses are labeled as bus system 1004 .
[0152] The memory 1003 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device 1000. Examples of such data include: any computer program used to operate on the electronic device 1000.
[0153] The method disclosed in the above embodiment of the present application can be applied to the processor 1002, or implemented by the processor 1002. The processor 1002 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 1002. The above processor 1002 may be a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 1002 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 1003, and the processor 1002 reads the information in the memory 1003, and completes the steps of the above method in combination with its hardware.
[0154] In an exemplary embodiment, the electronic device 1000 can be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD), field programmable gate array (FPGA), general processor, controller, microcontroller (MCU), microprocessor, or other electronic components to execute the aforementioned method.
[0155] An embodiment of the present disclosure further proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the knowledge graph updating method described in the above embodiment of the present disclosure.
[0156] An embodiment of the present disclosure further proposes a computer program product, including a computer program, which executes the knowledge graph updating method described in the above embodiment of the present disclosure when a processor is used to execute the computer program.
[0157] An embodiment of the present disclosure also proposes a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send signals to the processor, the signals include computer instructions stored in the memory, and when the processor executes the computer instructions, the electronic device executes the knowledge graph updating method described in the above embodiments of the present disclosure.
[0158] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0159] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0160] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.
[0161] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.
[0162] It should be understood that the various parts of the embodiments of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0163] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0164] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0165] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A knowledge graph updating method, characterized in that: The method is applied to the cloud, and the method includes: Based on the full sample data, an initial knowledge graph is constructed, wherein the initial knowledge graph includes a triple set of entities and relationships, wherein the triple set includes a head entity, a tail entity, and a relationship between the head entity and the tail entity; Optimizing the word embeddings in the head entity matrix, the tail entity matrix, and the relationship matrix corresponding to the initial knowledge graph to obtain an optimized target knowledge graph, and sending the target knowledge graph to the edge node; Receive a virtual knowledge graph sent by the edge node, and store the virtual knowledge graph, where the virtual knowledge graph is a knowledge graph updated by the edge node based on the target knowledge graph.
2. The method according to claim 1, characterized in that The step of optimizing the word embeddings in the head entity matrix, the tail entity matrix, and the relationship matrix corresponding to the initial knowledge graph to obtain an optimized target knowledge graph includes: Based on the triple set of entities and relationships in the initial knowledge graph, construct a head entity matrix, a tail entity matrix and a relationship matrix corresponding to the initial knowledge graph; Based on the triple set of entities and relations in the knowledge graph, respectively generate head entity negative samples corresponding to the head entity matrix, tail entity negative samples corresponding to the tail entity, and relationship negative samples corresponding to the relationship matrix; Based on the head entity negative samples corresponding to the head entity matrix, the tail entity negative samples corresponding to the tail entity and the relationship negative samples corresponding to the relationship matrix, combined with the gradient descent algorithm, the word embeddings of the head entity in the head entity matrix, the word embeddings of the tail entity in the tail entity matrix and the word embeddings of the relationship in the relationship matrix are optimized to obtain the optimized target word embeddings and the target knowledge graph corresponding to the target word embeddings.
3. The method according to claim 1, characterized in that: The method comprises: Obtain and update the full sample data at preset time intervals; Based on the updated full sample data, the target knowledge graph is updated, and the updated target knowledge graph is sent to the edge node.
4. A knowledge graph updating method, characterized in that: The method is applied to an edge node, and the method comprises: Using the sample data in the domain corresponding to each edge node, an edge node knowledge graph is generated for each edge node; Receive a target knowledge graph sent from the cloud, and update the target knowledge graph based on each edge node knowledge graph to obtain a virtual knowledge graph, wherein the target knowledge graph is a knowledge graph obtained by optimizing the initial knowledge graph on the cloud through word embedding; The virtual knowledge graph is sent to the cloud.
5. The method according to claim 4, characterized in that The updating of the target knowledge graph based on each edge node knowledge graph to obtain a virtual knowledge graph comprises: Based on the target entity in the target knowledge graph, determine multiple relationships corresponding to the target entity in the first edge node knowledge graph; Traversing a first relationship among multiple relationships in the first edge node knowledge graph, and determining whether the target knowledge graph has the first relationship in the first edge node knowledge graph; If the target knowledge graph does not have the first relationship among the multiple relationships, the first relationship is verified using the second edge node, and the target knowledge graph is updated using the first relationship based on the verification result to obtain an updated virtual knowledge graph.
6. The method according to claim 4, characterized in that The method comprises: At preset time intervals, receive the updated target knowledge graph sent from the cloud.
7. A knowledge graph updating device, characterized in that: The device is applied to the cloud, and the device includes: A construction unit, used to construct an initial knowledge graph based on the full sample data, wherein the initial knowledge graph includes a triple set of entities and relationships, and the triple set includes a head entity, a tail entity, and a relationship between the head entity and the tail entity; An optimization unit, used to optimize the word embeddings in the head entity matrix, the tail entity matrix and the relationship matrix corresponding to the initial knowledge graph to obtain an optimized target knowledge graph, and send the target knowledge graph to the edge node; A receiving unit is used to receive the virtual knowledge graph sent by the edge node and store the virtual knowledge graph, where the virtual knowledge graph is the knowledge graph updated by the edge node based on the target knowledge graph.
8. A knowledge graph updating device, characterized in that: The device is applied to an edge node, and the device includes: A generating unit, used to generate an edge node knowledge graph for each edge node by using the sample data in the domain corresponding to each edge node; An updating unit, configured to receive a target knowledge graph sent from the cloud, and update the target knowledge graph based on each edge node knowledge graph to obtain a virtual knowledge graph, wherein the target knowledge graph is a knowledge graph obtained by optimizing the initial knowledge graph on the cloud through word embedding; A sending unit is used to send the virtual knowledge graph to the cloud.
9. An electronic device, characterized in that: include: a processor and a memory for storing a computer program capable of being executed on the processor, Wherein, when the processor is used to run the computer program, it executes the method described in any one of claims 1 to 3 or 4 to 6.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 3 or 4 to 6.