A knowledge graph construction method fusing a fast fourier transform knowledge extraction model
By integrating the BERT-DFC model with Fast Fourier Transform, the feature extraction capability of the BERT model is optimized, the problem of insufficient knowledge extraction performance in specific domains is solved, and the quality and accuracy of the knowledge graph are improved.
Patent Information
- Application Number
- CN202310332143.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2043-03-31
AI Technical Summary
Existing technologies have insufficient model performance in knowledge extraction in specific domains, making it difficult to effectively utilize domain data and resulting in low-quality knowledge graphs.
We employ a BERT-DFC model that integrates Fast Fourier Transform (FFT). By combining a pre-trained BERT model with FFT and amplitude-frequency characteristic calculations, we adjust the amplitude-frequency adaptive weight coefficients, optimize model feature extraction, and extract entity relationships using rule templates to construct a knowledge graph.
It improves the quality of knowledge graphs and the accuracy of knowledge extraction models, and enhances the model's adaptability to domain data and its feature extraction capabilities.
Smart Images

Figure CN116244451B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and knowledge graph technology, specifically to a method for constructing a knowledge graph for advanced maintenance of high-speed trains; Background Technology
[0002] Knowledge graph construction can be divided into bottom-up, top-down, and a combination of both. The bottom-up approach first extracts domain knowledge as the data layer, then summarizes and organizes this knowledge, gradually transforming it into ontology concepts as the schema layer. The top-down approach first constructs and refines the ontology of the schema layer, then uses the extracted knowledge as the data layer to match and fill the schema layer ontology.
[0003] Knowledge extraction is the most crucial step in knowledge graph construction, directly impacting its quality. Knowledge extraction models based on pre-trained BERT models exhibit powerful performance. Reference 1, "SOUZA F, NOGUEIRA R, LOTU FORD, et al. Portuguese named entity recognition using BERT-CRF[J].arXiv:1909.10649,2019," combines the transferability of BERT with the structured prediction capability of CRF and applies it to the NER task in Portuguese. Reference 2, "Liu Xinliang, Zhang Mengqi, Gu Qing, et al. Named entity recognition in the fresh egg supply chain based on BERT-CRF model[J]. Transactions of the Chinese Society for Agricultural Machinery, 2021, 52(S1):519-525," uses the BERT model as a foundation and connects a CRF model as a classifier at the model's output, improving model accuracy and meeting the requirements of named entity recognition tasks, demonstrating good named entity recognition performance. Performance; The BERT-FLAT model proposed in reference 3, “Zheng Limin, Ren Lele. Named entity recognition in the field of nutrition and health by using fusion rules and BERT-FLAT model [J]. Transactions of the Chinese Society of Agricultural Engineering, 2021, 37(20): 211-218”, solves the problem of long-distance text information extraction in the BERT named entity recognition model when the data has a large number of complex entities, and fully considers lexical information and location information; For knowledge extraction in specific fields, a large amount of industry data or strong model transfer learning and generalization ability is required. Data in specific fields is usually not available in large quantities, so the ability of the model to extract knowledge in different fields and the performance of the model urgently need to be improved; Summary of the Invention
[0004] Based on the above, the present invention provides a method for rapidly constructing a knowledge graph, which automatically extracts entities from a dataset through a deep learning model, automatically matches the relationships between entities based on rule templates, automatically merges entities, and stores knowledge through a graph database to construct a knowledge graph.
[0005] The technical solution provided by this invention is: a method for constructing a knowledge graph by integrating a fast Fourier transform knowledge extraction model, which extracts a knowledge ontology of high-speed train advanced maintenance by processing high-speed train advanced maintenance data, and is used for high-speed train advanced maintenance knowledge question and answer, including the following steps:
[0006] Step 1: Process the high-speed train advanced maintenance dataset, deleting data without clear semantics, and removing missing or erroneous data; label the high-speed train advanced maintenance data using BIOES annotation method; annotate the high-speed train advanced maintenance dataset, and proportionally divide the labeled dataset into training, validation, and test sets; analyze the dataset and construct a knowledge ontology; preprocess the dataset, specifically as follows:
[0007] (1) Fill in the missing values in the dataset; entities refer to words that describe specific things. Data labels are made for the first character of an entity word, each character in the middle of an entity word, the last character of an entity word, and non-entity words.
[0008] The data is labeled using the BIOES method. Specifically, the data is labeled in the form of XY, where X is one of the letters B, I, O, E, and S. B represents the first part of an entity, I represents the middle part of an entity, E represents the last part of an entity, O represents a word outside an entity, and S represents a single word that can represent an entity on its own. Y represents the entity category.
[0009] (2) Define the preprocessed dataset as I nput The dataset is divided into a training set, a validation set, and a test set.
[0010] Step 2: Build a knowledge extraction model, train the model, and automatically extract entities. The specific steps are as follows:
[0011] A BERT-DFC model was built using two pre-trained Chinese BERT models. The hidden layer dimension of the model is M, and the number of attention heads is n, with n ranging from 6 to 12. One of the models incorporates a Fast Fourier Transform and amplitude-frequency characteristic calculation layer to extract data features. The specific implementation is as follows:
[0012] Using the data I obtained in step 1 nput Knowledge is extracted using the BERT-DFC model; BERT-DFC uses two pre-trained Chinese BERT models as sub-models, referred to as the first BERT and the second BERT model respectively; the hidden layer dimension of each BERT model is M, and the multi-head attention mechanism has n heads; the data I obtained in step 1 is processed... nput Input the first BERT model, output H F The dimension of the fully connected layer is reduced to N, where T represents the total number of categories of entities to be classified in the model, and N ranges from T to 2T, resulting in the output tensor H. NThe second BERT model has the same input as the first BERT model, and its output is H. O ;
[0013] H F =BERT1(I nput )
[0014] H O =BERT2(I nput )
[0015] H N =softmax(W f ·H F +b f )
[0016] In the formula: W f and b f These are the dimensionality reduction matrix and the bias, respectively.
[0017]
[0018] In the formula, e i Represents feature data in one dimension.
[0019] The obtained output H N It can be viewed as a discrete digital signal with a period of N, for H N Perform a Fast Fourier Transform operation to obtain H N Frequency domain information represents H FFT FFT(·) represents the Fast Fourier Transform operation on a discrete signal, and then H... FFT Calculating H using the modulus of the real and imaginary parts FFT The amplitude-frequency response of H represents E ;
[0020] H FFT =FFT(H N )
[0021] H E =|H FFT |
[0022] Define the amplitude-frequency adaptive weighting coefficient θ, and use θ to explicitly or implicitly reduce H. E Feature representation ability: When the model performance is high, the influence of amplitude frequency features on the model is increased by amplifying the amplitude frequency adaptive weight coefficient θ, which further improves the model's ability to extract domain features; when the model performance is low, the influence of amplitude frequency features on the model is reduced by decreasing the amplitude frequency adaptive weight coefficient θ, so that the second BERT model learns domain features first and trains the model accordingly.
[0023] H' E =θ·(H E·W e )+b e
[0024] Among them, W e and b e Let F be the linear transformation matrix and bias, and F be the model evaluation parameters. To improve the model's feature fusion effect on high-level maintenance data of EMU trains, the model features are concatenated using a nonlinear transformation, and an amplitude-frequency adaptive weighting coefficient θ is introduced, which is defined as follows:
[0025]
[0026] If the model's precision is P and its recall is R, then:
[0027]
[0028] Where TP represents true positives, FP represents false positives, and FN represents false negatives, the F1 score is calculated as follows.
[0029]
[0030] Define the model evaluation parameter F. When F1 > 0.37, then:
[0031] F = F1
[0032] When F1 ≤ 0.37, then:
[0033] F = 0.37
[0034] H' E and H O Concatenate the data using Concat(·) to obtain the model output H. L The fully connected layers are used for final entity prediction and classification.
[0035] H L =Concat(H O ,H' E )=[H O ,h' E ]
[0036] BERT-DFC is trained via backpropagation. In multi-class classification tasks, the model's loss L is calculated using the multi-class cross-entropy loss function, and the model is optimized using an adaptive learning rate gradient descent algorithm. The optimization objective is to minimize the loss L. The multi-class cross-entropy loss function is as follows. The model is trained via gradient backpropagation. When the model's loss no longer decreases significantly after multiple rounds of training, model training is stopped.
[0037]
[0038] In the formula: N is the total number of entities to be classified; BERT-DFC output H L The fully connected layers reduce the dimensionality to N. In the reduced word vectors, the column index of the maximum value determines the category of the i-th observed sample. If the i-th observed sample is correctly classified (i.e., classified as the true class c), then y... ic It takes the value 1, otherwise it is 0; p ic This represents the probability that the i-th observed sample is predicted to be the true class c;
[0039] Step 3: Perform entity fusion on the extracted entities. If a total of p entities are extracted, process the p entities through the model's output vector {H}. L1 H L2 H L3 …H Lp Perform a linear transformation to transform it into a vector {H'} with a mean of 0 and a covariance matrix that is an identity matrix. L1 ,H' L2 ,H' L3 …H' Lp Take any two entity word vectors W1 and W2, calculate the cosine similarity of the word vectors, and obtain the cosine similarity α, with the result ranging from 0 to 1; set a similarity threshold β, with a value ranging from 0 to 1; compare the α similarity with the threshold β. If α is greater than the threshold β, then merge the entities and merge them into the one with the shorter word length. If α is less than the threshold, it means that the two entities cannot be merged.
[0040] The method for calculating the cosine similarity of entity word vectors is as follows:
[0041]
[0042] Step 4: Extract the relationships between pairs of entities in the dataset based on the rule template to achieve pairwise matching of entities; based on the textual representation of the EMU bogie and its corresponding maintenance process, and based on the EMU maintenance ontology relationship constraints, use the rule template relationship extraction method to extract the relationships between pairs of entities and construct entity inclusion relationship templates for maintenance, inspection, measurement, and replacement; in the relationship extraction, matching is performed based on the above templates; the rule templates are formulated based on the dataset, and are supplemented or deleted after manual screening, and finally the rule templates are compiled according to the data syntax structure;
[0043] Step 5: Store entities and relations as triples and construct a knowledge graph using a graph database; store entities and relations as subject-verb-object triples and import them into a graph database; in the graph data, nodes represent entities, and the lines between two entities represent the relationships between entities, thus building a knowledge graph.
[0044] The innovation of this invention is reflected in:
[0045] This paper proposes a knowledge extraction model BERT-DFC that integrates Fast Fourier Transform (FFT). The model employs an amplitude-frequency adaptive weight coefficient θ, which either explicitly or implicitly enhances the representational ability of amplitude-frequency features derived from FFT. When model performance is high, the amplitude-frequency adaptive weight coefficient θ is amplified to increase the influence of amplitude-frequency features on the model, further improving its ability to extract domain-specific features. When model performance is low, the amplitude-frequency adaptive weight coefficient θ is reduced to minimize the influence of amplitude-frequency features, allowing the second BERT model to prioritize learning domain-specific features and adjusting the pre-trained model. This method effectively improves model performance. Experimental results validate the model's performance in accordance with reference 4, "Xu L, Tong Y, Dong Q, et al. CLUENER2020: Fine-grained Named Entity Recognition Dataset and Benchmark for...". Chinese:,10.48550 / arXiv.2001.04351[P].2020.” Compared to BERT-based models, BERT-DFC shows a significant improvement in F1 score on the dataset in Reference 4, reaching 1.65%;
[0046] Beneficial effects:
[0047] Compared with the prior art, the present invention has the following beneficial effects:
[0048] (1) This invention proposes a method to integrate Fast Fourier Transform into a deep learning model and improve the model’s feature extraction capability; the proposed BERT-DFC deep learning model optimizes the generalization capability of the BERT model and can quickly and accurately extract domain data knowledge, thereby improving the utilization rate of knowledge.
[0049] (2) The knowledge graph construction method proposed in this invention can better adapt to the characteristics of small domain datasets, thereby improving the quality of knowledge graphs and increasing the accuracy of knowledge extraction models. Attached Figure Description
[0050] Figure 1This is a flowchart illustrating the specific implementation of the present invention. The main process is as follows: First, ontology construction is performed. Data is analyzed in collaboration with domain experts to extract the hierarchical structure of entities, and an ontology library is built using Protégé. Then, the data is preprocessed by labeling the data according to the annotation method and dividing the dataset into training, validation, and test sets. Next, the BERT-DFC model is built by feeding the preprocessed dataset into the model and training it. The trained model is then used to automatically extract entities. Then, based on the data syntax structure and domain characteristics, relation extraction rules are constructed. Template matching is performed between the extracted entities and the dataset to extract the relationships between entities. After knowledge extraction, entity similarity knowledge fusion is performed to improve knowledge quality. Finally, entities and relations are saved as triples, and a knowledge graph is built using a graph database, where nodes represent entities and edges represent relationships between entities. Figure 2 This invention presents the BERT-DFC model structure, which consists of two pre-trained Chinese BERT models, referred to as the first BERT and the second BERT. The BERT models employ a self-attention mechanism to extract features. The output of the second BERT is connected to a Fourier transform-amplitude-frequency characteristic calculation module. Each Fourier transform-amplitude-frequency characteristic calculation module consists of a fully connected layer, a Fast Fourier Transform (FFT) layer, and a spectrum-amplitude-frequency characteristic calculation layer. The model concatenates the output of the first BERT and the output of the Fourier transform-amplitude-frequency characteristic calculation module to obtain a new feature vector, which is then used for entity prediction and classification through a fully connected layer. Detailed Implementation
[0051] To facilitate understanding of the objectives and technical solutions of this invention, a detailed explanation is provided through an implementation example of constructing a knowledge graph of advanced maintenance processes for high-speed trains. The implementation specifically includes the following steps:
[0052] Step 1: Inspect the high-speed train advanced maintenance dataset, deleting data with unclear semantics, missing data, or errors; label the high-speed train advanced maintenance data using BIOES annotation, with an example of: Inspection / O Check / O Structure / B-parts Framework / E-parts Defects, When O / Structure / B-parts Framework / E-parts Defect O / Defect O / ...; The high-speed train advanced maintenance dataset contains 746 labeled data. Divide the labeled dataset into training, validation, and test sets in an 8:1:1 ratio, using these as input data. nput There are 10 categories of entities to be identified in the data;
[0053] Step 2: Build the BERT-DFC model using two pre-trained Chinese BERT models; the hidden layer dimension is 768, and the attention mechanism has 12 heads; one of the models incorporates a Fast Fourier Transform and amplitude-frequency characteristic calculation layer to extract data features. The specific steps are as follows:
[0054] Using the data I obtained in step 1 nput Knowledge is extracted using the BERT-DFC model; BERT-DFC uses two pre-trained Chinese BERT models as sub-models, referred to as the first BERT and the second BERT model respectively; each BERT model has a hidden layer dimension of 768 and a multi-head attention mechanism with 12 heads; the data I obtained in step 1 is then processed. nput Input the first BERT model, output H F By connecting the fully connected layers, the dimensionality is reduced to 10, resulting in the output tensor H. N The second BERT model has the same input as the first BERT model, and its output is H. O ;
[0055] H F =BERT1(I nput )
[0056] H O =BERT2(I nput )
[0057] H N =softmax(W f ·H F +b f )
[0058] In the formula: W f and b f These are the dimensionality reduction matrix and the bias, respectively, and the features are subjected to linear transformation.
[0059]
[0060] In the formula, e i Represents feature data in one dimension.
[0061] The obtained output H N It can be viewed as a discrete digital signal with a period of 10, for H N Perform a Fast Fourier Transform operation to obtain H N Frequency domain information represents H FFT FFT(·) represents the Fast Fourier Transform operation on a discrete signal, and then H... FFT Calculating H using the modulus of the real and imaginary parts FFT The amplitude-frequency response of H represents E ;
[0062] H FFT =FFT(H N )
[0063] H E =|H FFT |
[0064] Calculate the amplitude-frequency adaptive weighting coefficient θ. When the F1 value is 0.5, calculate the amplitude-frequency adaptive weighting coefficient θ according to the formula.
[0065]
[0066] The adaptive weighting coefficient θ is obtained as 0.78; and H' is calculated based on this. E
[0067] H' E and H O Concatenate the data using Concat(·) to obtain the model output H'. E The fully connected layers are used for final entity prediction and classification.
[0068] H L =Concat(H O ,H' E )=[H O ,H' E ]
[0069] BERT-DFC is trained via backpropagation. In multi-class classification tasks, the model's loss L is calculated using the multi-class cross-entropy loss function, and the Adam optimizer is used to optimize the model. The optimization objective is to minimize the loss L. The multi-class cross-entropy loss function is as follows. The model is trained via gradient backpropagation. After 6 rounds of training, the model loss is 0.26539, and after 8 rounds, the model loss is 0.26475, at which point training stops.
[0070]
[0071] In the formula: BERT-DFC output H L The dimensionality is reduced to 10 by using a fully connected layer. In the reduced-dimensional word vectors, the column index of the maximum value in the column vector determines the category of the i-th observed sample. If the i-th observed sample is correctly classified (i.e., classified as the true class c), then y... ic It takes the value 1, otherwise it is 0; p ic This represents the probability that the i-th observed sample is predicted to be the true class c;
[0072] BERT-DFC is used to train and predict the processed data to improve the model's accuracy, and then the model is used to automatically extract entities from the dataset.
[0073] Step 3: Entity fusion is performed on the extracted entities, resulting in a total of 476 entities. These 476 entities are then processed through the model's output vector {H}. L1 H L2 H L3 …H LpPerform a linear transformation to transform it into a vector {H'} with a mean of 0 and a covariance matrix that is an identity matrix. L1 ,H' L2 ,H' L3 …H' Lp Take any two entity word vectors, W1 and W2, and calculate the cosine similarity of the word vectors to obtain the cosine similarity α, with the result ranging from 0 to 1; set a similarity threshold β, β = 0.8; compare the α similarity threshold β, if α is greater than the threshold β, then merge the entities, merging them into the one with the shorter word length, if it is less than the threshold, then the two entities cannot be merged; the cosine similarity calculation method is as follows.
[0074]
[0075] Step 4: Extract the pairwise relationships between entities in the dataset based on the rule template. Based on the textual representation of the EMU bogie and its corresponding maintenance process, such as the correspondence between maintenance components and their measurement limits, and the inclusion relationship between maintenance locations and their associated components, construct an entity inclusion relationship template for [bogie location] maintenance, inspection / measurement / replacement of [bogie location]. In the relationship extraction, matching is performed based on the above template. For example, in the text "When performing frame maintenance work, check the brake caliper...", the relationship between "frame" and the component "brake caliper" can be extracted, where the former includes the latter.
[0076] Step 5: Save the extracted knowledge in the form of triples. Use Py2neo to write an import script. First, import entities into the Neo4j graph database, and then import the relationship data between pairs of entities. In the graph data, nodes represent entities, and the lines between two entities represent the relationships between entities. Construct a knowledge graph.
[0077] The table below demonstrates the implementation effects of this invention, comparing the knowledge extraction model proposed in this invention with other models.
[0078] Table 1 Performance comparison of BERT-DFC on the advanced maintenance dataset for high-speed trains
[0079] Tab.1 Performance comparison of BERT-DFC
[0080]
[0081] As shown in the table above, using BERT-DFC to perform Chinese named text recognition on the high-speed train advanced maintenance dataset improves the model's accuracy, recall, and F1 score. This demonstrates that after performing Fast Fourier Transform on the hidden layer output of the BERT model, more feature information about the word can be obtained. Using this information for the model's named text recognition task can improve the overall performance of the model.
Claims
1.A method for constructing a knowledge graph by fusing a fast Fourier transform knowledge extraction model, characterized by Comprise the following steps: Step 1, processing EMU senior repair data set, deleting the data without clear semantics, missing, error; Mark EMU senior repair data, the annotation method is BIOES; The data set is annotated, and the annotated data set is divided into training set, validation set and test set according to the proportion; Analyze the data set, build the knowledge ontology; The data set is preprocessed, and the specific processing method is: (1) fill in the null value in the data set; Entity refers to the word describing a specific thing, and the first word of the entity, every word in the entity, the last word of the entity, and the non-entity word are marked; The data is marked according to the BIOES method, and the specific method is: mark the data as X-Y, where X is one of B, I, O, E and S, B represents the beginning of the entity, I represents the middle of the entity, E represents the end of the entity, O represents the word outside the entity, and S represents a single word that can represent an entity; Y is the entity category; (2) The data set of the EMU after pretreatment and senior repair is defined as I nput , and is divided into a training set, a validation set and a test set; Step 2, build knowledge extraction model, train model, automatically extract entity, the specific steps are as follows: Build BERT-DFC model, use two pre-trained Chinese BERT models; The model hidden layer dimension is M, the number of attention mechanism heads is n, n is in the range of 6-12; One of the models adds a fast Fourier transform and amplitude frequency characteristic calculation layer to extract data features, and the specific method is: Using the data I obtained in step 1 nput , extract knowledge using the BERT-DFC model; BERT-DFC uses two pre-trained Chinese BERT models as sub-models, respectively called the first BERT and the second BERT models; the hidden layer dimension of each BERT model is M, and the multi-head attention mechanism has n heads; input the data I nput obtained in step 1 into the first BERT model, and output H F ; connect the full connection layer dimension reduction to N, T represents the total number of classified entity categories of the model, and N takes the value range of T~2T, and obtain the output tensor H N ; the second BERT model input is the same as the first BERT model, and the output is H O ; H F = BERT1(I nput ) H O = BERT2(I nput ) H N = softmax(W f ·H F +b f ) where: W f and b f are respectively a dimension reduction matrix and a bias, wherein e i represents a characteristic data of a certain dimension, The obtained output H N It can be viewed as a discrete digital signal with a period of N, for H N Perform a Fast Fourier Transform operation to obtain H N Frequency domain information represents H FFT FFT(·) represents the Fast Fourier Transform operation on a discrete signal, and then H... FFT Calculating H using the modulus of the real and imaginary parts FFT The amplitude-frequency response of H represents E ; H FFT = FFT(H N ) H E = |H FFT | The amplitude-frequency adaptive weight coefficient θ is defined, and the H is highlighted or weakened using θ E Characterization ability of features: when the model performance is high, the influence of the amplitude-frequency feature on the model is improved by amplifying the amplitude-frequency adaptive weight coefficient θ, and the extraction ability of the model to the domain feature is further improved; when the model performance is low, the influence of the amplitude-frequency feature on the model is reduced by reducing the amplitude-frequency adaptive weight coefficient θ, the second BERT model is made to preferentially learn the domain feature, and the model performance is improved through model training; H' E = θ · (H E · W e )+ b e ; where W e and b e are linear transformation matrix and bias, F is the model evaluation parameter, the amplitude-frequency adaptive weight coefficient θ is introduced to optimize the feature fusion effect, and θ is defined as follows: If the model precision is P and the recall is R, then: Where TP is the true positive, FP is the false positive, and FN is the false negative, then the F1 value is calculated as follows, Define the model evaluation parameter F, when F1>0.37, then: F=F1 When F1≤0.37, then: F=0.37 H E and H O Concat(·) to obtain the model output H L , connect the fully connected layer to make the final entity prediction classification; H L = Concat(H O ,H' E ) = [H O ,H E ] BERT-DFC obtains training through back propagation, in the multi-classification task, the loss L of the model is calculated using the multi-classification cross entropy loss function, and the gradient descent algorithm with adaptive learning rate is used for model optimization, and the optimization goal is to minimize the loss L; The multi-classification cross entropy loss function is as follows, the model is trained through gradient back propagation, when the loss of the model is not obviously decreased after multiple rounds of training, the model training is stopped, In the formula: N is the total number of entities to be classified; BERT-DFC output H L Connect the full connection layer to N, and take the column sequence number of the maximum value of the column vector in the reduced dimension word vector to determine the class of the i th observation sample. If the i th observation sample is correctly classified, that is, it is judged to be the true class c, then y ic The value is 1, otherwise 0; p ic Indicates the probability that the i th observation sample is predicted as the true class c. Step 3, the extracted entities are fused, if p entities are extracted, the p entities are linearly transformed by the output vector of the model {H L1 ,H L2 ,H L3 …H Lp} into a vector {H' L1 ,H' L2 ,H' L3 …H' Lp} with a mean of 0 and a covariance matrix of a unit matrix; taking any two entity word vectors W1 and W2, calculating the word vector cosine similarity to obtain the cosine similarity a, the result range is 0-1; setting the similarity threshold value β, the value range is 0-1; comparing the a similarity with the threshold value β, if a is greater than the threshold value β, the entities are fused, and are fused into the one with shorter word length, if a is less than the threshold value, the two entities cannot be fused; The entity word vector cosine similarity calculation method is: Step 4, extract the relationship between two entities in the data set according to the rule template, realize the matching between two entities; According to the text representation method of EMU bogie and its corresponding repair process, based on the ontology relationship constraint of EMU repair, the relationship extraction method of rule template is used to extract the relationship between two entities, and the entity relationship template of repair, inspection, measurement and replacement is constructed; In the relationship extraction, matching is carried out based on the above template; The rule template is formulated according to the data set, and is supplemented or deleted after manual screening, and finally the rule template is compiled according to the data syntax structure; Step 5, store the entity and relationship according to the triple relationship, and use the graph database to build the knowledge graph; Store the entity and relationship according to the subject-predicate-object triple relationship, and import the graph database; The node in the graph data represents the entity, and the connection between two entities represents the relationship between the entities, and the knowledge graph is built.