Method for constructing and completing knowledge graph based on joint extraction and link prediction

By combining a joint triplet extraction model based on latent relation detection and conditional entity mapping with a multi-weighted directed graph convolutional neural network and a decoder model, the problems of relation redundancy and insufficient global feature capture in existing knowledge graph construction are solved, and more efficient knowledge graph construction and completion are achieved.

CN118467747BActive Publication Date: 2026-06-26CHONGQING UNIV OF POSTS & TELECOMM

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHONGQING UNIV OF POSTS & TELECOMM
Filing Date
2024-02-29
Publication Date
2026-06-26

Smart Images

  • Figure CN118467747B_ABST
    Figure CN118467747B_ABST
Patent Text Reader

Abstract

The application belongs to the field of knowledge graph, and particularly relates to a knowledge graph construction and completion method based on joint extraction and link prediction, comprising: a joint entity relationship extraction method based on latent relationship detection and conditional entity mapping, which is used to construct a knowledge graph; and a knowledge graph link prediction method fusing graph structure information and multiple features, which is used to automatically complete the knowledge graph generated in the extraction stage. The method solves the problems of relationship redundancy and noise in the existing knowledge graph construction method in the triple extraction process, which cannot accurately identify overlapping triples, and the problems of insufficient global feature capture and failure to utilize graph structure information in the knowledge graph completion stage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of knowledge graphs, specifically relating to a method for constructing and completing knowledge graphs based on joint extraction and link prediction. Background Technology

[0002] With the advent of the information age, massive amounts of text data are constantly emerging. Extracting useful information from this vast amount of data and storing it presents a significant challenge. Against this backdrop, knowledge graphs, as a powerful tool for representing and organizing structured knowledge, have gradually attracted widespread attention.

[0003] Knowledge graphs are a semantically related and structured way of representing knowledge, using a graph format to represent relationships between entities. Knowledge in a knowledge graph is typically represented as structured triples; a triple (h, r, t) effectively represents the fact that a relationship r exists between the head entity h and the tail entity t. This structured representation enables computers to better understand, reason about, and process knowledge in the real world. Currently, knowledge graphs are widely used in commercial fields such as recommendation systems and search engines.

[0004] Joint extraction, which extracts the triples that constitute a knowledge graph from text, is a powerful tool and key technology for building knowledge graphs. It improves overall extraction performance by simultaneously processing multiple related tasks. Joint extraction can better capture the complex semantic information between entities and relations, thus constructing a more accurate and richer knowledge graph. Furthermore, a crucial indicator of knowledge graph quality is its completeness; a more complete knowledge graph delivers higher performance to downstream applications. The triples obtained after extraction are often incomplete. Therefore, link prediction methods are needed to infer potentially missing triples from known triples in the knowledge graph, achieving automatic knowledge graph completion.

[0005] In recent years, deep learning methods have developed rapidly, with models such as BERT, convolutional neural networks, and graph neural networks being used for joint triple extraction and knowledge graph completion tasks. In the field of relation extraction, traditional pipeline methods first extract entities from a sentence and then classify relations for each entity. This approach treats triple extraction as two sub-tasks: named entity recognition and relation classification. Therefore, it is susceptible to error accumulation and ignores the correlation between entity extraction and relation classification. This invention uses a more advanced joint extraction scheme, employing a multi-task framework to decompose a given task into several interconnected sub-tasks while simultaneously updating shared parameters. In the field of knowledge graph completion, models can be divided into three main categories: The first category is translation-based models, which learn the embedding vectors of entities and relations to model translation relationships between entities in a low-dimensional space. The core idea of ​​this type of method is that, in the relation space, the relationship between two entities can be viewed as the representation vector of one entity being translated into the representation vector of the other entity through translation operations such as translation. The second category is tensor decomposition-based methods, which are techniques for learning entity and relation representations by decomposing tensors (including entities, relations, and attributes) in the knowledge graph. The third category is based on deep learning methods, which learn the semantics of existing entities and relations in the knowledge graph and use them to supplement missing triples in order to complete the knowledge graph.

[0006] Existing joint extraction-based methods and deep learning-based knowledge graph completion methods have higher performance than other methods, but they also have some problems: ① Previous joint extraction models directly use the whole sentence representation, such as the CLS representation in BERT, for classification, resulting in relation redundancy. ② When candidate head entities and relations are mapped to tail entities, their embedding representations are directly added to the sentence representation, generating noise and failing to accurately identify overlapping triples. ③ In the completion stage, existing models do not capture the global features between entities and relations effectively when learning their features. ④ Existing models do not distinguish between different relations in the knowledge graph well, meaning they do not capture relation-specific features sufficiently. ⑤ After the joint extraction stage, a graph structure has been formed, but the subsequent completion stage does not fully utilize the natural graph structure information of the knowledge graph. In summary, existing models still have significant room for improvement. Summary of the Invention

[0007] To address the aforementioned technical problems, this invention proposes a method for constructing and completing knowledge graphs based on joint extraction and link prediction, comprising:

[0008] S1: Obtain a public dataset, process the large amount of text data in the dataset into sentences that can be processed by BERT, and collect the necessary relations from the corpus;

[0009] S2: Triple extraction is performed using a joint triple extraction model based on latent relation detection and conditional entity mapping to construct a preliminary knowledge graph;

[0010] S3: Treat the entities in the triples of the knowledge graph as nodes in the graph and the relations as edges in the graph, forming an adjacency matrix that can represent the graph result of the knowledge graph; generate initial embedding matrices E and R for the entities and relations in the knowledge graph in a random manner, where each row of the matrix represents the embedding vector of an entity and a relation, respectively.

[0011] S4: Split the graph into outgoing and incoming subgraphs, and generate the corresponding weighted adjacency matrix A of the outgoing subgraphs. out The weighted adjacency matrix A of the inbound subgraph in The initial entity embedding E and two adjacency matrices are input into a multi-weighted directed graph convolutional neural network to perform message passing of features between nodes, resulting in a new set of entity embedding vectors E′ rich in graph structure information.

[0012] S5: The new entity embedding vector set E′ rich in graph structure information and the initial relation embedding R are used as input to the decoder model. Together with the triple set, the corresponding head entity vector and relation vector are reshaped into the input graph of the two-dimensional convolutional neural network.

[0013] The beneficial effects of this invention are:

[0014] This invention constructs a knowledge graph using a joint entity relation extraction method based on latent relation detection and conditional entity mapping. It also automatically completes the knowledge graph generated during the extraction stage by using a knowledge graph link prediction method that integrates graph structure information and multiple features. This solves the problems of relation redundancy and noise-induced inaccurate identification of overlapping triples in existing knowledge graph construction methods during triple extraction, as well as the problems of insufficient global feature capture and failure to utilize graph structure information in the knowledge graph completion stage. Attached Figure Description

[0015] Figure 1 This is a flowchart of a knowledge graph construction and completion method based on joint extraction and link prediction according to the present invention. Detailed Implementation

[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0017] A knowledge graph construction and completion method based on joint extraction and link prediction, such as Figure 1 As shown, it includes:

[0018] S1: Obtain a public dataset, process the large amount of text data in the dataset into sentences that can be processed by BERT, and collect the necessary relations from the corpus;

[0019] S2: Triple extraction is performed using a joint triple extraction model based on latent relation detection and conditional entity mapping to construct a preliminary knowledge graph;

[0020] S3: Treat the entities in the triples of the knowledge graph as nodes in the graph and the relations as edges in the graph, forming an adjacency matrix that can represent the graph result of the knowledge graph; generate initial embedding matrices E and R for the entities and relations in the knowledge graph in a random manner, where each row of the matrix represents the embedding vector of an entity and a relation, respectively.

[0021] S4: Split the graph into outgoing and incoming subgraphs, and generate the corresponding weighted adjacency matrix A of the outgoing subgraphs. out The weighted adjacency matrix A of the inbound subgraph in The initial entity embedding E and two adjacency matrices are input into a multi-weighted directed graph convolutional neural network to perform message passing of features between nodes, resulting in a new set of entity embedding vectors E′ rich in graph structure information.

[0022] S5: The new entity embedding vector set E′ rich in graph structure information and the initial relation embedding R are used as input to the decoder model. Together with the triple set, the corresponding head entity vector and relation vector are reshaped into the input graph of the two-dimensional convolutional neural network.

[0023] This invention employs a joint triplet extraction model based on latent relation detection and conditional entity mapping to extract triples and construct a preliminary knowledge graph. The steps are as follows:

[0024] Step 1: Obtain a public dataset, process the large amount of text data into sentences that can be processed by BERT, and collect the necessary relations from the corpus.

[0025] The publicly available datasets used in this invention include NYT and WebNLG. Both NYT and WebNLG annotate the last word of each entity and the span of that entity. The NYT dataset contains 56,195 sentences in the training set, 5,000 sentences in the validation set, 5,000 sentences in the test set, and 24 predefined relations. The WebNLG dataset contains 5,019 sentences in the training set, 500 sentences in the validation set, 703 sentences in the test set, and 171 predefined relations. An English model based on bert-base-cased3 is used as the sentence encoder. The pre-trained parameters are fine-tuned with an initial learning rate of 0.00001, while the initial learning rate for the downstream task is set to 0.00005. Specifically, the sentence S is first segmented and multiplied by l labels X = (x1, x2, ..., x...). l The sentence X is fed into the BERT model, which includes two special start and end markers [CLS] and [SEP], to obtain the contextual embedding H of the sentence. e =(h1,h2,...,h l ), here H e ∈R l×d , l refers to the length of the segmented sentence, and d refers to the embedding dimension.

[0026] Step 2: Extract triples based on the joint triple extraction model of latent relation detection and conditional entity mapping, and construct a preliminary knowledge graph.

[0027] Existing triple joint extraction models typically rely on the overall sentence representation of a pre-trained language model (e.g., BERT's [CLS] representation) for latent relation detection, without adequately addressing the trigger words for different relations. For example, in the sentence below, "American pilot Alan Shepard died in California and was born in New Hampshire," the three bolded words—pilot, California, and New Hampshire—are trigger words that should be associated with three relations in the sentence: "place of death," "occupation," and "place of birth." In other words, latent relation detection tasks require more sensitive token representations to link different latent relations with their corresponding trigger words.

[0028] Furthermore, to effectively extract overlapping triples and associate trigger words with latent relations, this invention employs a joint model based on latent relation detection and conditional mapping. First, a non-autoregressive decoder is used to associate different latent relations with their corresponding trigger words. Second, for candidate entity tagging, two different sequence tags are used to identify candidate head entities and candidate tail entities. Finally, for conditional entity mapping, by merging conditional layer normalization, each head entity and each latent relation are combined into a condition in the sentence, used to find the tail entity corresponding to that condition to form a triple.

[0029] The candidate entity tagging module uses Begin, Inside, and Outside, abbreviated as BIO, to identify the tag for each token. "BS" indicates that the token is the beginning of a head entity; "IS" indicates that the token is the insertion point of a head entity; and "BO" and "IO" represent the beginning and insertion point of a tail entity, respectively. The use of two different sequence taggers to extract candidate head and tail entities is to solve the entity overlap problem known as Sort of Entities (SOO).

[0030] Two different sequence markers are used to identify candidate head entities and candidate tail entities, including:

[0031]

[0032]

[0033] in, and These represent the probabilities of each token in the sentence being the head entity and the tail entity, respectively. W represents the i-th token in a given sentence. head and W tail b represents the trainable weights of the two markers respectively. head and b tail These represent the trainable biases of the two markers, respectively.

[0034] For the extracted head entities and detected latent relations, firstly, entity mapping representations are obtained through conditional normalization, where each candidate head entity and each latent relation are conditionally concatenated. Secondly, a tail entity-sensitive sentence representation is obtained using a multi-head self-attention layer. Finally, the tail entity-sensitive representation is input into a feedforward neural network to obtain the final output. Specifically, for each (candidate head entity, latent relation) pair combination, the representation of the i-th head entity is denoted as... It is obtained by calculating the average of the start token and the end token. Furthermore, the j-th relation is mapped to... The embedding of this relationship is obtained in the same dimensional space. To obtain a non-linear representation of relation embeddings, a fully connected layer with ReLU activation function is used:

[0035] Next, the head entity representation and relation representation are connected to form conditions. Conditional layer normalization is then used to integrate these conditions into the sentence representation, resulting in the entity mapping representation:

[0036]

[0037] Among them, H m This represents entity mapping representation. The vector representation of the i-th candidate head entity. H represents the vector representation of the j-th potential relation. e Sentence representation vector, CLN represents conditional layer normalization.

[0038] Finally, a multi-head self-attention layer is used to capture tail entity-sensitive features in the sentence:

[0039]

[0040] H tail =MultiHead s (H m = [head1, head2, ... head] i …,head h ]×W O

[0041] Among them, H tail H represents tail entity sensitive representation. m Represents entity mapping representation, head h head i Let W represent the h-th and i-th attention heads, respectively, where h represents the number of attention heads. i Q W i K W i V W O denoted as the first, second, third, and fourth trainable parameters of the multi-head self-attention layer, respectively, and d represents the sentence embedding dimension.

[0042] In order to map the given (head) i ,rel j Align the tail entity with the tuple, each token represents The tag used to identify the token: Finally, iterate through each tail-aligned entity. k Does it exist in the candidate tail entity set? If so, then...

[0043] (head i ,rel j ,tail k Add it to the triplet result set.

[0044] Thus, the process of extracting triples from text sentences to construct a knowledge graph is completed. By comparison, the F1 score and recall rate of the triple joint extraction module of this invention are superior to those of common baseline models.

[0045] This invention utilizes a knowledge graph embedding model that integrates graph structure information and multiple features for knowledge graph completion. The steps are as follows:

[0046] Step 1: Preprocess the results of the triplet extraction stage to form an adjacency matrix that can represent the knowledge graph graph results; generate initial embeddings E and R for entities and relations in the knowledge graph.

[0047] To fully utilize the graph structure information of knowledge graphs, graph neural networks are needed for message passing. Adjacency matrices are a prerequisite for graph neural networks. This invention preprocesses triples, treating entities as nodes in the graph and relations as edges. For example, a triple (h, r, t) represents a directed edge from node h to node t in the graph structure. Furthermore, to transform triples into computer-understandable knowledge, they need to be embedded in a low-dimensional vector space. Specifically, a corresponding k-dimensional vector representation (v) is generated for each triple (h, r, t). h ,v r ,v t ), where v h ,v r ,v t ∈R k .

[0048] Step 2: Split the graph into outgoing and incoming subgraphs, and generate the corresponding weighted adjacency matrix A of the outgoing subgraphs. out The weighted adjacency matrix A of the inbound subgraph in The initial embedding representation E of the entity vector generated in step 1 and the two adjacency matrices are input into a multi-weighted directed graph convolutional neural network to perform message passing of features between nodes, resulting in a new set of entity embedding vectors E′ rich in graph structure information.

[0049] Existing graph convolutional neural networks do not consider the directional nature of graph structures. In knowledge graphs, there is directionality between head and tail entities. This invention divides the complete graph into ingress and egress subgraphs, and performs message passing on each subgraph separately. Furthermore, considering the multi-relation characteristic of knowledge graphs, when the central node aggregates information from its neighbors, it assigns different weights α to information from edges representing different relations. r This can reduce the oversmoothing problem in graph convolutional neural networks. Furthermore, since the central node shows different levels of attention to different neighbors, this invention also assigns weights α to different neighbors. e The adjacency matrix of two directional subgraphs is calculated using the following formula:

[0050]

[0051]

[0052] Among them, A out Express the weighted adjacency matrix of the edge subgraph, A in Let α represent the weighted adjacency matrix of the ingress subgraph. r Represents the relation weight, α e Represents entity weight, Let I represent the adjacency matrix of relation t in the edge subgraph, where I represents the identity matrix and T represents the total number of relations. Let represent the adjacency matrix of relation t in the inbound subgraph.

[0053] The process of message passing on two subgraphs and obtaining new entity embeddings:

[0054] E′=σ(A in EW in )+σ(A out EW out )

[0055] Where E′ represents a new set of entity embedding vectors rich in graph structure information, and A out Express the weighted adjacency matrix of the edge subgraph, A in Let W represent the weighted adjacency matrix of the ingress subgraph, E represent the initial entity embedding, and W represent the weighted adjacency matrix of the ingress subgraph. in W represents the transition matrix of the incoming edge subgraph. out Represent the transition matrix of the edge subgraph.

[0056] Step 3: Use E′ and R as input to the decoder, and combine them with the set of triples to obtain the corresponding head entity vector v. h and relation vector v r The input image is reshaped into a two-dimensional convolutional neural network.

[0057] Generally, embedding vectors of the same dimension k are generated for entities and relations. In this invention, the default value of k is 200. To enable the convolutional neural network to perform convolution operations on the feature vectors of entities and relations, the vectors of the given head entity and relation are combined (v... h ,v r The matrix is ​​queried, stacked, and reshaped into an h×w matrix, i.e., h×w=2k (h=w=20 in this invention), which serves as the input to the improved convolutional neural network model.

[0058] The improved convolutional neural network model uses a convolutional neural network to perform feature fusion operations on head entity features and relation features. The convolutional module learns local feature information, the unbiased large kernel attention module learns global information, and the relation-aware feature extraction branch learns relation-specific feature information. The decoder model can be divided into three modules: the convolutional module, the unbiased large kernel attention mechanism, and the relation-aware feature extraction branch.

[0059] The convolutional module is the main part of the decoder, used to perform convolution operations on the input graph composed of head entities and relations and learn its semantics. Let the above input graph be i, then the convolution operation is as follows:

[0060] o1=Conv(i)+b

[0061] Here, o1 represents local feature information, Conv() represents the convolution operation, and b is the bias. Through the convolution operation, the model can learn the local features of the input image.

[0062] The unbiased large kernel attention mechanism is an improvement upon the large kernel attention mechanism. Essentially a self-attention mechanism, it enables the model to capture global features. The unbiased large kernel attention consists of three 3×3 dilated convolutional layers with different dilation sizes. Through precise design, it maintains the same global feature capture capability as the original large kernel attention while overcoming the bias towards certain location features. The formula for this plugin is as follows:

[0063]

[0064] Among them, A f This represents a bias-free large kernel attention mechanism. `DWDConv()` represents depthwise separable dilated convolution, combined with 1×1 pointwise convolution to reduce model parameters and training costs. The superscripts in the formula represent the dilation size; that is, the dilation values ​​for the three convolutional layers in this invention are 1, 3, and 9 respectively. When the dilation is 1, the convolutional layer is denoted as `DWConv()`. The subscripts in the formula represent the kernel size; that is, the kernel size for all three convolutional layers is 3. The outermost `Conv1()` represents pointwise convolution. Output A f This is the attention obtained through unbiased large kernel attention. Finally, the attention is multiplied point-by-point with the input local feature information o1 to obtain the first feature information o2, which contains the global features.

[0065] o2=o1·A f

[0066] The relation-aware feature extraction branch is a parallel branch to the aforementioned backbone network. Its purpose is to extract relation-specific features that may be overlooked, which is more in line with the multi-relational nature of knowledge graphs. The specific steps of this branch are as follows:

[0067] ① A fully connected layer generates relation-specific parameters which are then used as parameters for the convolutional layers. Specifically, the input to this fully connected layer is the relation embedding vector, and the output vector, after being reshaped, serves as the convolutional kernel parameters for the convolutional layers.

[0068] w = reshape(W) r v r +b r )

[0069] Where w represents the parameters of the convolutional layer, W r v represents a relation-specific learnable parameter. r The embedding vector representing the relation, b r Represents a relation-specific, learnable bias.

[0070] ② Use the generated parameters as the kernel parameters of the relation-aware convolutional layer to capture relation-specific features:

[0071] o′1=Conv(i)+b′

[0072] Where o′1 represents a relation-specific feature, and b′ represents a learnable bias;

[0073] ③ Calculate the corresponding attention value using unbiased big-kernel attention and perform point-by-point multiplication:

[0074]

[0075] o′2=o′1·A′ f

[0076] Among them, A′ f o′2 represents the feature map on the relation-aware feature extraction branch, and o′2 represents the second feature information;

[0077] After all the above steps, we obtained the fused graph structure information, local features, global features, and relation-specific first and second feature information. 2 The results of o′2 and o′2 are passed through a fully connected layer and multiplied with all entity vectors to obtain the score of each entity as a triple consisting of the tail entity, the head entity, and the relation. The higher the score, the higher the probability that the triple is a fact. The specific steps are as follows:

[0078] ① Connect the first and second feature information o2 and o′2 and quantize them:

[0079] vector = vec([o2|o′2])

[0080] Where vector represents the fusion vector;

[0081] ② The vector is mapped to the entity's vector space through a fully connected layer:

[0082] vector' = vectorW + b

[0083] Where vector′ represents the fused vector mapped to the entity's vector space, W represents the fully connected layer parameters, and b represents the bias.

[0084] ③ Perform matrix multiplication on the mapped vector and the entity matrix, and obtain the scores of all candidate triples using the sigmoid() activation function:

[0085] score = sigmoid(vector'E) T )

[0086] Where E represents the initial embedding matrix of the entity, and T represents the matrix transpose;

[0087] This invention will give a query (v h′ ,v r The triple consisting of ) and all other entities The scores are sorted from highest to lowest, and the number of golden triples (triples that are already in the triple set) in the top 10 rankings is counted. This invention adds the triples in the top 10 of a given query that are not in the golden triple set to the triple set of the knowledge graph as a supplement. Experiments show that joint triple extraction on the knowledge graphs initially constructed from the two datasets NYT and WebNLG yields an average of 9.1 and 9.4 golden triples in the top 10 of each query, respectively, indicating that the model has a good ability to identify golden triples.

[0088] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for constructing and completing knowledge graphs based on joint extraction and link prediction, characterized in that, include: S1: Obtain a public dataset, process the large amount of text data in the dataset into sentences that can be processed by BERT, and collect the necessary relations from the corpus; S2: Triple extraction is performed using a joint triple extraction model based on latent relation detection and conditional entity mapping to construct a preliminary knowledge graph; S3: Treat the entities in the triples of the knowledge graph as nodes in the graph and the relations as edges in the graph, forming an adjacency matrix that can represent the graph result of the knowledge graph; generate initial embedding matrices E and R for the entities and relations in the knowledge graph in a random manner, where each row of the matrix represents the embedding vector of an entity and a relation, respectively. S4: Split the graph into outgoing and incoming subgraphs, and generate the corresponding weighted adjacency matrix of the outgoing subgraphs. Weighted adjacency matrix of inbound subgraph The initial entity embedding E and two adjacency matrices are input into a multi-weighted directed graph convolutional neural network to perform message passing of features between nodes, resulting in a new set of entity embedding vectors rich in graph structure information. ; S5: Embed new entities rich in graph structure information into vector sets The initial embedding R of the relation is used as the input to the decoder model, and the corresponding head entity vector and relation vector are reshaped into the input graph of the two-dimensional convolutional neural network in conjunction with the set of triples; The decoder model includes: a convolution module, a non-biased large kernel attention mechanism module, and a relation-aware feature extraction branch module; The convolution module is used to learn local feature information, perform convolution operations on the input graph composed of head entities and relations, and learn its semantics. The unbiased large kernel attention module is used to learn global information. The unbiased large kernel attention consists of three 3×3 dilated convolutional layers with different dilation sizes. While maintaining the same ability to capture global features as the large kernel attention, it improves the defect of the original large kernel attention having a preference for certain location features. The relation-aware feature extraction branch module is used to learn relation-specific feature information; Embed new entities rich in graph structure information into vector sets The initial embedding R of the relation is used as the input to the decoder model. Combined with a set of triples, the corresponding head entity vectors and relation vectors are reshaped into a two-dimensional input graph for the convolutional neural network, including: Embed new entities rich in graph structure information into vector sets The initial embedding R of the relation is used as input to the decoder model. The decoder model then obtains fused graph structure information, local features, global features, and relation-specific first and second feature information. and ; The first and second feature information and After passing through a fully connected layer and multiplying with all entity vectors, we obtain the score of each entity as a triple consisting of the tail entity, the head entity, and the relation. The higher the score, the higher the probability that the triple is a fact. Given a query , will give a query The scores of the triples formed by the triples and all other entities are sorted from high to low. The number of triples in the top 10 rankings is counted as the golden triples. The golden triples are triples that were originally in the triple set, which consists of sentence entities and the relations between entities. Add the triplets in the top 10 of the given query that are not in the golden triplet set to the triplet set of the knowledge graph as completion.

2. The knowledge graph construction and completion method based on joint extraction and link prediction according to claim 1, characterized in that, The large amount of text data in the dataset is preprocessed into sentences that can be processed by BERT, and the necessary relations are collected from the corpus, including: The text is divided into sentences, and each sentence X is further divided into l tokens. ,in, Indicates the first Each sentence is marked with a [CLS] tag to indicate the beginning of the sequence, and a [SEP] tag to indicate the end of the sequence. For a specific domain, the necessary relationships in the sentences are collected manually, and these necessary relationships are the keywords of that domain.

3. The knowledge graph construction and completion method based on joint extraction and link prediction according to claim 1, characterized in that, A joint triplet extraction model based on latent relation detection and conditional entity mapping is used to extract triples to construct a preliminary knowledge graph, including: The joint triplet extraction model based on latent relation detection and conditional entity mapping includes: a non-autoregressive decoder, two different sequence markers, conditional layer normalization, a multi-head self-attention layer, and a feedforward neural network; Each preprocessed sentence X is encoded using BERT. This yields the sentence representation vector. ; A non-autoregressive decoder is used for relation detection. When a relation in the relation set can be associated with the corresponding trigger word in the sentence after passing through the decoder, the relation is regarded as a potential relation. The relation set is a set of relations collected from the corpus. Candidate entities in the sentence are labeled to obtain a candidate entity set. The BIO method (begin, inside, outside) is used to identify the label of each token in the sentence. Here, "BS" indicates that the token is the beginning of the head entity; "IS" indicates that the token is the insertion of the head entity; "BO" and "IO" represent the beginning and insertion of the tail entity, respectively. After the candidate entities are labeled, two different sequence taggers are used to identify the candidate head entities and candidate tail entities. Each candidate head entity and each potential relation are concatenated as conditions through conditional layer normalization and integrated into the sentence representation vector. In this process, we obtain the entity mapping representation; Combine entity mapping representation with multi-head self-attention layer to obtain tail entity sensitive representation; The tail entity sensitive representation is input into the feedforward neural network to obtain the tail entity label corresponding to the tail entity sensitive representation. If the tail entity label is in the candidate tail entity set, and the candidate tail entity set belongs to the candidate entity set, then the binary combination of the candidate head entity and the potential relation and the candidate tail entity represented by the label are combined into a triplet and put into the triplet set. The resulting triplet set constitutes a preliminary knowledge graph.

4. The knowledge graph construction and completion method based on joint extraction and link prediction according to claim 3, characterized in that, After candidate entity labeling is completed, two different sequence labelers are used to identify candidate head entities and candidate tail entities, including: ; ; in, and These represent the probabilities of each token in the sentence being the head entity and the tail entity, respectively. This represents the i-th token in a given sentence. and These represent the trainable weights of the two markers, and These represent the trainable biases of the two markers, respectively.

5. The knowledge graph construction and completion method based on joint extraction and link prediction according to claim 3, characterized in that, By using conditional layer normalization, each candidate head entity and each potential relation are concatenated as conditions and integrated into the sentence representation to obtain the entity mapping representation. include: ; in, This represents entity mapping representation. Let i represent the vector representation of the i-th candidate head entity. The vector representation of the j-th potential relation. Sentences can be represented by vectors. This indicates conditional layer normalization.

6. The knowledge graph construction and completion method based on joint extraction and link prediction according to claim 3, characterized in that, By combining entity mapping representation with a multi-head self-attention layer, tail-sensitive entity representations are obtained, including: ; ; in, This indicates a tail entity sensitive representation. This represents entity mapping representation. , These represent the h-th and i-th attention heads, respectively. Indicates the number of attention heads. , , , These represent the first, second, third, and fourth trainable parameters of the multi-head self-attention layer, respectively. This indicates the sentence embedding dimension.

7. The knowledge graph construction and completion method based on joint extraction and link prediction according to claim 1, characterized in that, The graph is split into outgoing and incoming subgraphs, and the corresponding weighted adjacency matrices of the outgoing subgraphs are generated. Weighted adjacency matrix of inbound subgraph ,include: ; ; in, Express the weighted adjacency matrix of the edge subgraph. This represents the weighted adjacency matrix of the inbound subgraph. Represents relation weights. Indicates entity weight, Express the adjacency matrix of relation t in the edge subgraph. Represents the identity matrix. Indicates the total number of relations. Let represent the adjacency matrix of relation t in the inbound subgraph.

8. The knowledge graph construction and completion method based on joint extraction and link prediction according to claim 1, characterized in that, The initial entity embedding E and two adjacency matrices are input into a multi-weighted directed graph convolutional neural network to perform message passing of features between nodes, resulting in a new set of entity embedding vectors rich in graph structure information. ,include: ; in, This represents a new set of entity embedding vectors rich in graph structure information. Express the weighted adjacency matrix of the edge subgraph. This represents the weighted adjacency matrix of the inbound subgraph. Indicates the initial embedding of the entity. Describes the transition matrix of the ingress subgraph. Represent the transition matrix of the edge subgraph.