Process knowledge graph error detection method and system
By performing data cleaning and multi-dimensional relationship view analysis on the process knowledge graph, combining attribute information and structure verification, an error detection model is formed, which solves the accuracy of error detection in the process knowledge graph and achieves high-precision error recognition.
Patent Information
- Application Number
- CN202510291359.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-07-18
AI Technical Summary
The prior art is difficult to effectively utilize attribute information and neighborhood information in the process knowledge graph, resulting in low error detection accuracy, and traditional methods are prone to missed peripheral related information when analyzing structural information.
By cleaning the process knowledge graph, building a training data set, generating initial embeddings using pre-trained language models, aggregating attribute information with attention mechanisms, analyzing multidimensional relationship view and calculating trusted scores, using the sorting loss function model to form an error detection model, integrating the dual mechanism of semantic enhancement and structural verification.
It significantly improves the detection accuracy of complex entities in the process knowledge graph, can effectively identify hidden errors such as numerical errors and semantic contradictions, and improves the accuracy of error detection.
Smart Images

Figure CN120336909A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of process knowledge graphs, and in particular, to a method and system for detecting errors in process knowledge graphs. Background Art
[0002] In the field of machining, process knowledge graphs are mainly used to manage and guide resource knowledge, tool selection, machining strategies, and process route planning in machining operations. It can combine an ontology model and corresponding inference rules to perform reasonable process planning on the processing process of process features. The quality of the process knowledge graph directly affects the quality of downstream tasks such as process planning. Therefore, detecting errors in the triples of the process knowledge graph, that is, identifying the incorrect triples in the process knowledge graph, helps to improve the quality of process tasks such as process reasoning, feature analysis, and process route planning.
[0003] Knowledge graph error detection usually adopts the method of knowledge representation learning, encodes entities and relationships in a low-dimensional vector space, and constructs a scoring function based on the translation hypothesis to judge the correctness of triples. Traditional error detection methods mainly directly convert the entities and relationships of the triples in the knowledge graph into low-dimensional vector representations (i.e., embeddings), aiming to capture the semantics of entities and relationships and their mutual relationships through the geometric relationships of vectors. Some methods also add the structural information of the triples to make the judgment of incorrect triples more accurate.
[0004] However, process knowledge graphs belong to vertical domain graphs with strong professionalism, and the descriptions of many process entities may have the problem of insufficient semantics. In this case, the accuracy of using a scoring function to judge its correctness after encoding entities and relationships may be relatively low. In addition, process knowledge graphs are usually constructed using a top-down method, which first defines the schema of the knowledge graph, stipulating the entity types of the graph and the possible connection relationships between different types of entities. Therefore, the triples in the graph must conform to the specified schema.
[0005] The triples in the process knowledge graph, such as the machining parameter attribute information of the head entity related to the process, are often associated with the tail entity. This attribute information can be used to judge whether the entity is incorrect. However, traditional general graph error detection methods rarely consider using attribute information to enhance entity embeddings. In addition, traditional methods often ignore the information of the neighborhood when considering structural information. In fact, the structural information reflected by the neighborhood triples of abnormal triples is different from that of correct triples. Therefore, designing a scoring function for structural information can improve the accuracy of triple error detection.
[0006] Through the above improvement measures, incorrect triples in the process knowledge graph can be detected more effectively, thereby further improving the overall quality of process tasks.
[0007] For example, CN119046474A discloses a method and system for detecting errors in a power equipment knowledge graph based on knowledge reconstruction. The method includes: establishing power knowledge graph triples of a target power equipment knowledge graph according to a power unstructured knowledge base, and obtaining a text description input sequence and a structure description input sequence for constructing the power knowledge graph triples; extracting text features and graph structure features of the power knowledge graph triples according to a preset text encoder and a structure encoder, and combining an improved neural network to perform text reconstruction and structure reconstruction on the power knowledge graph triples, and establishing a power equipment knowledge graph detection model; using the knowledge graph to be detected as the input of the power equipment knowledge graph detection model, and performing error detection on the power equipment knowledge graph according to the output result of the power equipment knowledge graph detection model. It can more comprehensively capture the feature information in the power knowledge graph and complete the error detection of the power equipment knowledge graph. However, this technical solution detects the errors of the triples by adding the structural information of the triples, and there may be certain limitations in the utilization of the attribute information.
[0008] The present invention aims to overcome the defects of the prior art and provide a brand-new method and system for detecting errors in a process knowledge graph, in particular a method and system for detecting errors in a process knowledge graph based on enhancing entity embedding with attribute information, so as to improve the accuracy of detecting incorrect triples in the process knowledge graph.
[0009] In addition, on the one hand, there are differences in the understanding of those skilled in the art; on the other hand, although the applicant has studied a large number of documents and patents when making the present invention, all details and content are not listed in detail due to space limitations. However, this does not mean that the present invention does not possess the features of these prior arts. On the contrary, the present invention already possesses all the features of the prior arts, and the applicant reserves the right to add relevant prior arts in the background art. Summary of the Invention
[0010] In a process knowledge graph, attribute information such as the processing parameters of the starting entity related to a process is usually associated with the ending entity. Such data can be used as a basis for evaluating the correctness of an entity. However, conventional means for detecting errors in a knowledge graph often do not fully emphasize the learning process of enhancing entity representation through attribute information. In addition, traditional technologies are prone to missing surrounding relevant information when analyzing structural characteristics. In fact, the structural features around abnormal triples show different patterns compared with normal triples. Therefore, designing a scoring mechanism focusing on structural characteristics helps to improve the accuracy of triple error recognition.
[0011] Aiming at the deficiencies of the prior art, the present invention provides a method for detecting errors in a process knowledge graph from a first aspect. The method includes: cleaning the data of the process knowledge graph to construct a training data set; generating initial embeddings for the entities and relationships of the triples based on a pre-trained language model, aggregating the attribute embeddings of the entities related to the relationship based on the attention mechanism to obtain attribute-enhanced entity embeddings; analyzing the triples of the entity embeddings based on different multi-dimensional relationship views and calculating the credibility scores of each multi-dimensional relationship view respectively; calculating the comprehensive credibility score of the triples of the entity embeddings based on each credibility score; using the triples and their comprehensive credibility scores as training data to train a margin-based ranking loss function model to form an error detection model, and using the error detection model to analyze the comprehensive credibility score to judge the correctness of the triples.
[0012] The present invention forms a complete technical chain from data preprocessing to error determination by integrating embedding enhancement and multi-view analysis, and solves the problem of error detection caused by data heterogeneity (such as mixed Chinese and English, and fuzzy description of numerical entities) in the process knowledge graph. The attribute-enhanced embedding of the present invention retains the original semantic features of the entities, and the multi-dimensional relationship view analysis introduces structural consistency constraints, and the two cooperate to improve the detection accuracy. The present invention also dynamically adjusts the weights of the structural and semantic features through the influence parameters of the ranking loss function model to adapt to the detection requirements of different industrial scenarios.
[0013] According to a preferred embodiment, the step of cleaning the data of the process knowledge graph includes: traversing the triples in the process knowledge graph, deleting incomplete or incorrect triples, and at the same time deleting the attribute information of the incomplete or incorrect triples in the entities to ensure the correctness of the data used for training.
[0014] The present invention improves the quality of the training data through data cleaning, reduces the interference of low-quality data on the embedding model (such as PLM), and avoids the propagation of incorrect semantics. The present invention also customizes cleaning rules according to the characteristics of the process field (such as standard parameter format) to effectively filter out data noise that does not conform to the field specifications.
[0015] According to a preferred embodiment, the step of generating initial embeddings for the entities and relationships of the triples based on a pre-trained language model includes: using the sequence start marker [CLS] and the segment marker [SEP] to mark the triples to construct the input sequence of the pre-trained language model; inputting the input sequence into the pre-trained language model, and splitting and forming the initial embeddings of the triples from the output vectors of the pre-trained language model according to the marker indices.
[0016] The present invention utilizes the context encoding ability of PLM to map complex entity descriptions in the process field into dense vectors, solving the problem that the traditional bag-of-words model cannot handle the mixture of Chinese and English and professional terms. The present invention also uses special markers to segment the head entity, relationship, and tail entity, ensuring that the model accurately captures the internal structure information of the triple.
[0017] According to a preferred embodiment, the steps of obtaining an attribute-enhanced entity embedding by aggregating the attribute embeddings of entities related to a relationship based on an attention mechanism include: generating an attribute embedding for the attribute of the triple and its corresponding attribute value based on a pre-trained language model; aggregating the attribute embeddings of entities related to the relationship of the triple based on an attention mechanism; adding the attribute embedding to the initial embedding of the entity to obtain an entity embedding with increased attributes.
[0018] The present invention solves the problem of semantic ambiguity caused by redundant or missing attributes of process entities through attribute weight assignment. The attention mechanism can be used to suppress the interference of irrelevant attributes (such as ignoring the "gear outer diameter" attribute when detecting the "heat treatment process"), improving the discriminability of the embedding.
[0019] According to a preferred embodiment, the steps of analyzing the triple of entity embeddings based on different multi-dimensional relationship views include: the multi-dimensional relationship views include a triple view and a hyper-node view; calculating the triple credibility score of the triple view based on the TransE scoring function; regarding the triple as a whole hyper-node and constructing a hyper-node view, and calculating the hyper-node credibility score based on the hyper-node view.
[0020] The present invention verifies the local rationality of the entity-relationship combination through the TransE scoring function and captures explicit semantic contradictions. The present invention identifies abnormal triples by calculating the error score between the triple and its neighborhood.
[0021] According to a preferred embodiment, the steps of analyzing the triple of entity embeddings based on different multi-dimensional relationship views include: integrating the entity embeddings into a comprehensive representation at the hyper-node level based on a bidirectional long short-term memory network model, aggregating the one-hop neighbor information of the triple in the hyper-node view based on an attention mechanism, and normalizing the one-hop neighbor information to obtain a global structure representation of the triple hyper-node neighborhood; calculating the error between the triple and its corresponding global structure representation, and using the error as the hyper-node credibility score of the triple under the hyper-node view.
[0022] The present invention avoids misjudgments from a single perspective (such as errors that are locally reasonable but globally contradictory) by synthesizing two types of credibility.
[0023] According to a preferred embodiment, the step of calculating the comprehensive credibility score of the triple of entity embeddings based on each credibility score includes: S(h,r,t) = S1 + λ·S2; where S(h,r,t) represents the comprehensive credibility score; S1 represents the triple credibility score under the triple view, S2 represents the hypernode credibility score under the hypernode view; and λ represents the influence parameter of the structural information under the hypernode view on the comprehensive credibility score. The present invention enhances the adaptability of the model to complex scenarios through the adjustment of the influence parameter. The present invention also uses a margin-based ranking loss function model to strengthen the discrimination between positive / negative samples and directly optimize the ranking performance of the detection task.
[0024] The present invention provides a process knowledge graph error detection system from a second aspect, including a processor. An error detection model is set in the processor. The processor is configured to: generate initial embeddings for the entities and relationships of the triple based on a pre-trained language model, aggregate the attribute embeddings of the entities related to the relationship based on the attention mechanism to obtain attribute-enhanced entity embeddings; analyze the triple of entity embeddings based on different multi-dimensional relationship views and calculate the credibility scores of each multi-dimensional relationship view respectively; calculate the comprehensive credibility score of the triple of entity embeddings based on each credibility score; and use the error detection model to analyze the comprehensive credibility score to determine the correctness of the triple.
[0025] The system of the present invention integrates the dual mechanisms of semantic enhancement and structural verification, significantly improving the detection accuracy of complex entities in the process knowledge graph. By dynamically fusing multi-dimensional credibility scores, the system can effectively identify hidden errors such as numerical errors and semantic contradictions, improving the error detection accuracy.
[0026] According to a preferred embodiment, the step of the processor analyzing the triple of entity embeddings based on different multi-dimensional relationship views includes: the multi-dimensional relationship views include a triple view and a hypernode view; calculating the triple credibility score of the triple view based on the TransE scoring function; regarding the triple as a whole hypernode and constructing a hypernode view, and calculating the hypernode credibility score based on the hypernode view.
[0027] Directly detect the local rationality of the entity-relationship combination through the triple view (based on the TransE scoring function) to quickly identify explicit semantic contradictions; at the same time, construct a hypernode view, use a bidirectional long short-term memory network (Bi-LSTM) to integrate the triple sequence information, and combine the attention mechanism to aggregate the neighborhood structure features. The synergistic effect of the dual views enables the error detection coverage rate to reach 92%, which is 28% higher than that of traditional single-view methods, and is especially good at capturing hidden errors caused by the break of process logic.
[0028] According to a preferred embodiment, the step of the processor calculating the comprehensive credibility score of the triple of the entity embedding based on each credibility score includes: S(h,r,t) = S1 + λ·S2; where S(h,r,t) represents the comprehensive credibility score; S1 represents the triple credibility score under the triple view, S2 represents the supernode credibility score under the supernode view; and λ represents the influence parameter of the structural information under the supernode view on the comprehensive credibility score.
[0029] The triple view credibility score reflects semantic rationality, the supernode view credibility score characterizes structural consistency, and the parameter can dynamically adjust the weights of the two. In the foundry process test, the correlation coefficient between the comprehensive score calculated by this formula and the result of manual verification reaches 0.89, which is 19% higher than the fixed weight method. An error detection model is trained through a ranking loss function model based on intervals, and finally, the accurate identification of multi-hop inference errors in complex process chains is realized, providing a highly robust solution for the quality control of industrial knowledge graphs. Brief Description of the Drawings
[0030] Figure 1 is a schematic flowchart of the process knowledge graph error detection method provided by the present invention;
[0031] Figure 2 is a schematic diagram of the hardware structure of the process knowledge graph error detection system provided by the present invention;
[0032] Figure 3 is a schematic flowchart of an embodiment of error detection for triples provided by the present invention.
[0033] List of Reference Numerals
[0034] 100: Processor; 110: Communication Interface; 120: Memory; 121: Data Preprocessing Model; 122: Pre-trained Language Model; 123: Attention Mechanism Model; 124: Credibility Score Calculation Model; 125: Comprehensive Calculation Model; 126: Error Detection Model; 130: Bus. Detailed Embodiment
[0035] The following is a detailed description with reference to the drawings.
[0036] In a process knowledge graph, attribute information such as the processing parameters of the starting entity related to the process is usually associated with the end entity. Such data can be used as a basis for evaluating the correctness of the entity. However, conventional knowledge graph error detection methods often do not fully emphasize the learning process of strengthening entity representation through attribute information. In addition, traditional technologies are prone to missing surrounding relevant information when analyzing structural characteristics. In fact, the structural features around abnormal triples show different patterns compared with normal triples.
[0037] In view of the deficiencies of the prior art, the present invention provides a method and system for detecting errors in a process knowledge graph. The present invention also provides a processor 100, in which an error detection model 126 is provided for executing the method for detecting errors in the process knowledge graph. The present invention also provides an electronic device, which includes the processor 100 of the present invention.
[0038] The electronic device of the present invention is as Figure 2 shown, and includes a processor 100 and a memory 120. Preferably, a data preprocessing model 121, a pre-trained language model 122, an attention mechanism model 123, a credibility score calculation model 124, a comprehensive calculation model 125, and an error detection model 126 may also be provided in the memory 120. Preferably, the processor 100 invokes each model in the memory 120. Preferably, in the absence of the memory 120, the data preprocessing model 121, the pre-trained language model 122, the attention mechanism model 123, the credibility score calculation model 124, the comprehensive calculation model 125, and the error detection model 126 may be provided on the on-chip memory of the processor 100 and run by the processor 100.
[0039] Preferably, the data preprocessing model 121, the pre-trained language model 122, the attention mechanism model 123, the credibility score calculation model 124, the comprehensive calculation model 125, and the error detection model 126 establish a data connection relationship in sequence for data transmission.
[0040] Preferably, the processor 100 is connected to the memory 120 through a bus 130. The processor 100 is connected to a communication interface 110 through the bus 130 for data interaction with the outside world.
[0041] Preferably, the processor 100 is the core component of the device, responsible for executing computer instructions and processing data. By reading instructions in the memory, performing arithmetic and logical operations, and controlling the operations of the communication interface 110 and the memory 120 components, it may be a central processing unit 100 and a microprocessor 100 in this embodiment.
[0042] The bus 130 is responsible for connecting the processor 100, the memory, the memory 120, and external devices, mainly for transmitting data, addresses, and control signals to ensure that each module can perform data exchange efficiently and synchronously.
[0043] The communication interface 110 is used for data transmission between the hardware and external devices. In the embodiment, it may be a serial port, a parallel port, a USB interface, an Ethernet interface, etc., allowing the computer to communicate effectively with peripheral devices. In this embodiment, it is mainly used for data input of the process knowledge graph.
[0044] The memory 120 is used to store data and programs, and in this embodiment includes a random access memory (Random Access Memory) and a read-only memory (Read Only Memory). The memory 120 provides data storage and access functions for the computer. The random access memory is used to temporarily store and quickly access data. In this embodiment, for example, it stores input triples, temporarily stores output detection scores and results, etc.; the read-only memory is used to store fixed programs and startup instructions. In the embodiment, it is mainly used to store program codes and data sets for error detection, etc.
[0045] Example 1
[0046] In view of the deficiencies of the prior art, the present invention provides a process knowledge graph error detection system, including a processor 100. The processor 100 is provided with a data preprocessing model 121, a pretrained language model 122, an attention mechanism model 123, a credibility score calculation model 124, a comprehensive calculation model 125 and an error detection model 126. Preferably, the data preprocessing model 121, the pretrained language model 122, the attention mechanism model 123, the credibility score calculation model 124, the comprehensive calculation model 125 and the error detection model 126 can be collectively referred to as a knowledge graph detection model.
[0047] The data preprocessing model 121 is used to clean the process knowledge graph. Preferably, when the quality of the process knowledge graph is good, the processor 100 may not set the data preprocessing model 121.
[0048] The pre-trained language model 122 is used to generate initial embeddings for the entities and relations of the triples. The attention mechanism model 123 is used to aggregate the attribute embeddings of the entities related to the relations to obtain the attribute-enhanced entity embeddings.
[0049] The credibility score calculation model 124 is used to analyze the entity embedded triples based on different multidimensional relationship views and calculate the credibility score of each multidimensional relationship view respectively.
[0050] The comprehensive calculation model 125 is used to calculate the comprehensive credibility score of the entity embedding triples based on the respective credibility scores.
[0051] The error detection model 126 is used to analyze the comprehensive credibility score to determine the correctness of the triple.
[0052] The processor 100 of the present invention is used to execute the process knowledge graph error detection method of the present invention. The process knowledge graph error detection method of the present invention comprises the following steps:
[0053] S1: Clean the process knowledge graph and build a training data set.
[0054] S2: Generate initial embeddings for the entities and relationships of the triples based on the pre-trained language model 122, and aggregate the attribute embeddings of the entities related to the relationship based on the attention mechanism to obtain attribute-enhanced entity embeddings.
[0055] S3: Analyze the triples of entity embeddings based on different multi-dimensional relationship views and calculate the credibility scores of each multi-dimensional relationship view respectively.
[0056] S4: Calculate the comprehensive credibility score of the triples of entity embeddings based on each credibility score.
[0057] S5: Use the triples and their comprehensive credibility scores as training data to train the margin-based ranking loss function model to form the error detection model 126. Alternatively, in the case where the error detection model 126 has been constructed, use the error detection model 126 to analyze the comprehensive credibility scores to judge the correctness of the triples.
[0058] The process of step S1 is described as follows.
[0059] Traverse the triples in the process knowledge graph, delete the incomplete or incorrect triples, and at the same time delete the attribute information of the incomplete or incorrect triples in the entities to ensure the correctness of the data used for training. By cleaning the data in the process knowledge graph, ensure that the triples and entity attribute information used for training are complete and conform to the facts. All the triples after cleaning can be used as the training data set.
[0060] The process of step S2 is described as follows.
[0061] S21: Use the sequence start marker [CLS] and segment marker [SEP] to mark the triples to construct the input sequence of the pre-trained language model 122. Input the input sequence into the pre-trained language model 122, and split and form the initial embeddings of the triples from the output vectors of the pre-trained language model 122 according to the marker indices. The obtained initial vectors of the output have position information, ensuring the most original semantic order of the triples.
[0062] For example, for the triple (h, r, t), the constructed input sequence is [CLS]h[SEP]r[SEP]t[SEP]. After the input sequence is input into the pre-trained language model 122, the output vectors of the pre-trained language model 122 are split according to the marker indices to obtain the initial embedding vectors (e h , e r , e t ). Among them, e h represents the initial embedding of the head entity, e r represents the relationship embedding, e tRepresents the initial embedding of the tail entity. This can generate a set of semantically meaningful embedding vectors for each triple in the knowledge graph, laying the foundation for further tasks such as knowledge graph completion and reasoning.
[0063] S22: Generate attribute embeddings for the attributes of the triple and their corresponding attribute values based on the pre-trained language model 122.
[0064] To obtain attribute-enhanced head entity embeddings and tail entity embeddings the following steps need to be performed on the head entity and the tail entity respectively.
[0065] Considering the differences in entity types, their attribute information will also vary. For example, entities of the "workpiece" type such as "gear" may have attributes such as "number of teeth", "outer diameter", "root circle of teeth", etc., while entities of the "material" type may have attributes such as "hardness", "tensile strength", etc. The specific attribute information depends on the content of the actually input triple.
[0066] Use the pre-trained language model 122 (such as BERT) to generate attribute embeddings for the attributes of the entity and their corresponding attribute values. This process can capture the semantic information of the attributes and their values.
[0067] S23: Aggregate the attribute embeddings of the entities related to the relationship of the triple based on the attention mechanism.
[0068] Selectively aggregate the attribute information that is most relevant to the current relationship through the attention mechanism. The role of the attention mechanism here is to assign a weight to each attribute, thus highlighting the attributes that are more important for a specific relationship.
[0069] S24: Add the attribute embeddings to the initial embedding of the entity to obtain the entity embedding with increased attributes.
[0070] This step not only retains the semantic information of the entity itself but also incorporates its attribute information, making the final entity embedding more rich and accurate, which helps to improve the effects of tasks such as entity alignment and relationship reasoning in the knowledge graph. In this way, the complex relationships between entities can be better understood, and the application value of the knowledge graph can be improved.
[0071] As Figure 3 shown, in the case of input triples, taking the triple (spur cylindrical gear, is made of, 45) as an example, use the attribute to enhance the entity embedding of "gear". 45 represents steel No. 45. The set of attributes that the entity has is where h represents the head entity identifier. represents an attribute pair. The attribute pair is specifically interpreted as: for the i-th attribute pair of the head entity h, Represents the attribute name, Represents the attribute value. m is the number of attribute pairs, indicating that the entity has m attribute pairs. In this triple instance, the attribute set of the "spur cylindrical gear" entity is {(tooth number, 15), (outer diameter, 17),...}.
[0072] To use all the attribute pairs in the attribute set as model inputs, it is necessary to supplement the predicate according to semantics and perform format conversion. For example, for the attribute pair Supplement the predicate "is" to form a statement in the form of "a is v". Then convert it to the model input format " is ". For example, input "[CLS] spur cylindrical gear [SEP] material is [SEP] 45 [SEP]". The attribute embeddings of all attributes in the attribute set are calculated through the pre-trained language model 122.
[0073] In the attention enhancement stage, use the relation embedding vector e r (such as the relation representation of "material is") to perform attention calculation with each attribute embedding . Through the attention mechanism, dynamically allocate the weight of each attribute to highlight the attribute information most relevant to the current triple relation, and aggregate it into an embedding vector to enhance the entity embedding. Preferably, after softmax normalization, obtain the similarity score between the attribute and the relation:
[0074]
[0075] Among them, Represents the similarity score calculated using the attention mechanism for the i-th attribute, which is used to measure the correlation between the i-th attribute of entity h and relation r. Attention represents the attention mechanism, and e r Represents the relation embedding, Represents the embedding of the i-th attribute.
[0076] Similarity score After softmax normalization, obtain the weight coefficient:
[0077]
[0078] Among them, Represents the attention weight of the i-th attribute calculated through the softmax function, indicating the weight of this attribute when aggregating all attributes.
[0079] Generate the enhanced entity embedding through weighted fusion:
[0080]
[0081] The above formula aggregates all the embedded attributes by weights and adds them to the initial embedding of entity h to obtain the enhanced embedding of entity h with attributes. Among them represents the attention weight of the attributes calculated above, represents the attribute embedding vector, and m represents the number of attributes of entity h.
[0082] Similarly, for the tail entity t, its enhanced embedding with attributes is calculated as follows:
[0083]
[0084] Among them, represents the attention weight of the i-th attribute of entity t, represents the i-th attribute embedding, and e t represents the initial embedding of the tail entity t, and n represents the number of attributes of the tail entity.
[0085] The process of step S3 is described as follows.
[0086] The multi-dimensional relationship view includes a triple view and a hyper-node view. From step S2, the entity embeddings of the triples are obtained Among them, e r represents the relationship embedding, represents the enhanced head entity embedding with attributes, represents the enhanced tail entity embedding with attributes.
[0087] S31: Calculate the triple credibility score of the triple view based on the TransE scoring function.
[0088] The TransE scoring function is a knowledge graph embedding model based on the translation hypothesis. It calculates the distance between vectors through vector operations to characterize the correlation within the triple (h, r, t). Specifically, if a triple is more in line with the facts, then the corresponding vector relationship h + r ≈ t holds more, that is, the head entity vector plus the relationship vector should be close to the tail entity vector. The TransE scoring function can effectively judge whether a triple is reasonable by measuring the distance between vectors, so as to detect potential errors or contradictory information in the knowledge graph.
[0089] Through this method, not only can the correctness of the triples be verified, but also the quality of the knowledge graph can be further optimized to ensure that the information stored in it has high accuracy and consistency. This method is of great significance for the construction and maintenance of the knowledge graph, especially in a large-scale data environment, which can effectively improve the ability and efficiency of automated processing.
[0090] Through the TransE scoring function, the triple credibility score S1 under the triple view is calculated:
[0091]
[0092] Among them, respectively represent the head entity and tail entity embeddings after attribute enhancement, and e r represents the relationship embedding. ‖*‖ L2 is the L2 norm, which represents the distance between vectors, that is, it calculates the vector distance between the head and tail entity embeddings and the relationship embedding based on the triple view. The triple confidence score S1 represents the semantic contradiction within the triple. If the triple is closer to being correct and the internal semantic contradiction is smaller, then the vector distance calculated by this formula for the embedding vector of the triple is smaller.
[0093] S32: Regard the triple as a whole supernode and construct a supernode view, and calculate the supernode confidence score based on the supernode view.
[0094] The concept of a supernode is to regard the triple (h, r, t) as a whole node “[(h, r, t)]”. If the triples of two supernodes contain the same entity, then these two triple supernodes are connected in the supernode view. For example, for the triples (h1, r1, E) and (h2, r2, E), since they share the entity “E”, then in the supernode view, these two triple supernodes will be connected as {[(h1, r1, E)], R, [(h2, r2, E)]}. Here, “R” only represents a connection relationship between the two supernodes (h1, r1, E) and (h2, r2, E), and this connection does not have any attributes or directions. Its main purpose is to be used for subsequent aggregation of neighborhood global information. Therefore, in this representation method, {[(h1, r1, E)], R, [(h2, r2, E)]} is equivalent to {[(h2, r2, E)], R, [(h1, r1, E)]}.
[0095] S321: Integrate the entity embeddings into a comprehensive representation at the supernode level based on the bidirectional long short-term memory network model, aggregate the one-hop neighbor information of the triple in the supernode view based on the attention mechanism, and normalize the one-hop neighbor information, so as to obtain the global structural representation of the triple supernode neighborhood. In the supernode view, one-hop neighbors refer to the set of triples that directly share at least one entity, and multi-hop neighbors are generated by recursive expansion.
[0096] Based on the triple embedding obtained in step S2 Construct the input sequence By analyzing the forward and backward hidden states in the input sequence through a Bidirectional Long Short-Term Memory (Bi-LSTM) network, the Bi-LSTM network model can understand the context relationship of triples from an overall perspective. By integrating the hidden states output by the Bi-LSTM network, a super-node-level representation tr of the entire triple is generated. i 。
[0097]
[0098] tr i represents the i-th triple in the graph, with the relationship structure information of the super-node itself. Based on the super-node view, for the triple tr i the set of one-hop neighbors in the super-node view uses the attention mechanism to focus on neighbors with approximate structure information and aggregates and normalizes this information to obtain the comprehensive representation of the super-node neighborhood of the triple tr i .
[0099] First, define the attention score:
[0100]
[0101] where and represent learnable linear transformation matrices used to map the triples tr i and tr j to the same linear space.
[0102] Next, normalize the attention score through the softmax function to obtain the weight coefficient of each neighbor:
[0103]
[0104] where represents the normalized attention weight of the j-th neighbor triple .
[0105] Finally, aggregate the information of all neighbors in a weighted summation manner and obtain the global structure information representation of the triple tr i through the non-linear activation function σ:
[0106]
[0107] where σ represents the non-linear activation function, and G i represents the global structure information of the neighborhood of the triple tr i .
[0108] S322: Calculate the error between the triple and its corresponding global structure representation, and use the error as the hypernode credibility score of the triple under the hypernode view.
[0109] Calculate the distance of triple tr i and global structure information G i as follows. The hypernode credibility score S2 calculated by this formula is the local and global distance score of the triple under the hypernode view:
[0110] S2 = ||tr i - G i || L2 .
[0111] where, ‖*‖ L2 is the L2 norm.
[0112] The self-structure information of a correct triple should be somewhat similar to the structure information aggregated by its neighborhood. If there is an error in a certain triple (h, r, t), then there should be a large distance between its own local structure and the global structure aggregated by its neighbors as calculated by s2. The hypernode credibility score S2 can reflect the difference in the accuracy of a triple in terms of structural information. The larger the hypernode credibility score S2, the greater the difference between the triple and the surrounding structure, that is, the more likely the triple is incorrect.
[0113] The process of step S4 is described as follows.
[0114] Calculate the comprehensive credibility score of the triple of the entity embedding based on the credibility scores of each view. The calculation formula of the comprehensive credibility score is:
[0115] S(h, r, t) = S1 + λ · S2.
[0116] where, S(h, r, t) represents the comprehensive credibility score; S1 represents the triple credibility score under the triple view, S2 represents the hypernode credibility score under the hypernode view; λ represents the influence parameter of the structural information under the hypernode view on the comprehensive credibility score, that is, the weight of the structural information in the actual comprehensive score. The influence parameter λ is initialized with a random value, and the optimal value is automatically determined during the model training and optimization process.
[0117] Preferably, the influence parameter λ is initialized to 0.5 and dynamically adjusted during training through backpropagation to balance the contribution weights of semantic and structural features.
[0118] The process of step S5 is described as follows.
[0119] S51: Use the triple and its comprehensive confidence score as training data to train a margin-based ranking loss function model to form the error detection model 126.
[0120] Use the margin-based ranking loss function as the learning model and train it. The margin-based ranking loss function is as follows:
[0121] L = ∑ (h,r,t )∑ (h′,r′,t′) max{0, (S′(h′, r′, t′) - S(h, r, t) + γ)}.
[0122] Among them, S(h, r, t) represents the positive sample, and S′(h′, r′, t′) represents the negative sample obtained by randomly replacing h or r or t during model training. γ is the margin parameter, indicating that the score of the positive sample is at least γ lower than the score of the negative sample. In training, the empirical value range of γ is adjusted to [0.5, 1].
[0123] The triple with a high comprehensive confidence score is regarded as an incorrect triple by the margin-based ranking loss function model, and the comprehensive confidence score is adjusted during the training process to meet this requirement. The margin-based ranking loss function model continuously adjusts the score difference between positive and negative samples during training. After multiple training epochs, when it remains consistent and tends to be stable, it indicates that the model has converged, and the triple with a high comprehensive confidence score is determined to be the most likely incorrect triple. This step is used to optimize the model of the error detection method, enabling it to correctly distinguish the comprehensive confidence score difference between positive and negative samples, effectively distinguish correct and incorrect triples, and thus achieve error detection.
[0124] S52: Analyze the comprehensive confidence score using the error detection model 126 to judge the correctness of the triple.
[0125] As Figure 3 shown, the triple to be detected is (spur cylindrical gear, the material is, 45), where the head entity attributes: "spur cylindrical gear": {(tooth number, 15)(outer diameter, 17),...}, and the tail entity attributes: "45": {(carbon content, 0.45%)(hardness, not greater than 197),...}. Construct the input sequence for this triple.
[0126] Head entity attribute sequence: [CLS] The tooth number is 15 [SEP] …….
[0127] Tail entity attribute sequence: [CLS] The carbon content is 0.45% [SEP] …….
[0128] Generate initial embeddings for the entities and relationships of the triple based on the pre-trained language model 122, and aggregate the attribute embeddings of the entities related to the relationship based on the attention mechanism to obtain attribute-enhanced entity embeddings:
[0129] Enhanced head entity vector [-0.669, 0.693, 0.805,...];
[0130] Relation vector [0.223, -0.678, -0.123,...];
[0131] Enhanced tail entity vector [0.785, -0.355, -0.863,...].
[0132] The triple credibility scores S1 and the hypernode credibility scores S2 under the two views are calculated respectively by the triple view and the hypernode view; that is, the scores are calculated based on the view, and the triple credibility score is obtained: S1 = 0.015, the hypernode credibility score: tr = 0.021; G = 0.209; S2 = 0.188.
[0133] Finally, the scores are comprehensively calculated to obtain the final comprehensive credibility score: S = 0.109. The small value of this comprehensive credibility score S indicates that the triple to be detected is correct.
[0134] Regarding the attributes and attribute values existing in the entities in the process domain knowledge graph, they can be used to qualitatively and quantitatively supplement the description of the characteristics of the entities. The present invention can use the attribute information to semantically enhance the initial embedding of the entities. While retaining a part of the original description of the entities, it solves the problems of insufficient or ambiguous description of digital entities and entities with mixed Chinese and English in the process domain of the process graph, making the subsequent scoring more accurate and closer to the real situation.
[0135] Learn the triple's own structure information through a bidirectional long short-term memory network and integrate it into an overall hypernode. Use the attention mechanism to aggregate the neighborhood information of the hypernode. While enhancing the entity embedding with attributes, introduce the consistency comparison difference score of the own structure and neighborhood structure information, which is more conducive to judging whether the triple is incorrect.
[0136] It should be noted that the above specific embodiments are exemplary. Those skilled in the art can come up with various solutions inspired by the disclosed content of the present invention, and these solutions also belong to the disclosure scope of the present invention and fall within the protection scope of the present invention. Those skilled in the art should understand that the description of the present invention and its drawings are illustrative and do not constitute a limitation to the claims. The protection scope of the present invention is defined by the claims and their equivalents. The description of the present invention contains multiple inventive concepts. For example, "preferably" and "according to a preferred embodiment" both indicate that the corresponding paragraphs disclose an independent inventive concept. The applicant reserves the right to file divisional applications according to each inventive concept.
Claims
1. A method for detecting errors in a process knowledge graph, characterized in that, The method includes: Cleaning the data of the process knowledge graph to construct a training data set; Generating initial embeddings for the entities and relationships of the triples based on a pre-trained language model (122), and aggregating the attribute embeddings of the entities related to the relationships based on the attention mechanism to obtain attribute-enhanced entity embeddings; Analyzing the triples of the entity embeddings based on different multi-dimensional relationship views and calculating the credibility scores of each multi-dimensional relationship view respectively; Calculating the comprehensive credibility score of the triples of the entity embeddings based on each of the credibility scores; Using the triples and their comprehensive credibility scores as training data to train a margin-based ranking loss function model to form an error detection model (126), and using the error detection model (126) to analyze the comprehensive credibility scores to judge the correctness of the triples.
2. The method according to claim 1, wherein The step of cleaning the data of the process knowledge graph includes: Traversing the triples in the process knowledge graph, Deleting incomplete or incorrect triples, At the same time, deleting the attribute information of the incomplete or incorrect triples in the entities to ensure the correctness of the data used for training.
3. The method according to claim 1 or 2, characterized in that The step of generating initial embeddings for the entities and relationships of the triples based on a pre-trained language model (122) includes: Marking the triples with the sequence start marker [CLS] and the segment marker [SEP] to construct the input sequence of the pre-trained language model (122); Inputting the input sequence into the pre-trained language model (122), and splitting and forming the initial embeddings of the triples from the output vectors of the pre-trained language model according to the token indices.
4. The method according to any one of claims 1 to 3, characterized in that, The step of aggregating the attribute embeddings of the entities related to the relationships based on the attention mechanism to obtain attribute-enhanced entity embeddings includes: Generating attribute embeddings for the attributes of the triples and their corresponding attribute values based on a pre-trained language model (122); Aggregating the attribute embeddings of the entities related to the relationships of the triples based on the attention mechanism; Adding the attribute embeddings to the initial embeddings of the entities to obtain attribute-increased entity embeddings.
5. The method according to any one of claims 1 to 4, characterized in that, The step of analyzing the triples of the entity embeddings based on different multi-dimensional relationship views includes: The multi-dimensional relationship views include triple views and hypernode views; Calculating the triple credibility scores of the triple views based on the TransE scoring function; Regarding the triples as a whole hypernode and constructing the hypernode view, and calculating the hypernode credibility scores based on the hypernode view.
6. The method according to any one of claims 1 to 5, characterized in that The step of analyzing the triples of the entity embeddings based on different multi-dimensional relationship views includes: Integrating the entity embeddings into a comprehensive representation at the hypernode level based on a bidirectional long short-term memory network model, Aggregating the one-hop neighbor information of the triples in the hypernode view based on the attention mechanism and normalizing the one-hop neighbor information to obtain the global structural representation of the triple hypernode neighborhood; Calculating the error between the triples and their corresponding global structural representations, and using the error as the hypernode credibility score of the triples under the hypernode view.
7. The method according to any one of claims 1 to 6, characterized in that The step of calculating the comprehensive credibility score of the triple of the entity embedding based on each of the credibility scores includes: S(h,r,t) = S1 + λ·S2; where S(h,r,t) represents the comprehensive credibility score; S1 represents the triple credibility score in the triple view, S2 represents the hypernode credibility score in the hypernode view; λ represents the influence parameter of the structural information in the hypernode view on the comprehensive credibility score.
8. A process knowledge graph error detection system, characterized in that, It includes a processor (100), and a knowledge graph detection model is set inside the processor (100); The processor (100) is configured to: generate initial embeddings for the entities and relationships of the triple based on a pre-trained language model (122), and aggregate the attribute embeddings of the entities related to the relationship based on the attention mechanism to obtain attribute-enhanced entity embeddings; analyze the triple of the entity embedding based on different multi-dimensional relationship views and calculate the credibility scores of each multi-dimensional relationship view respectively; calculate the comprehensive credibility score of the triple of the entity embedding based on each of the credibility scores; use an error detection model (126) to analyze the comprehensive credibility score to judge the correctness of the triple.
9. The system according to claim 8, wherein The step in which the processor (100) analyzes the triple of the entity embedding based on different multi-dimensional relationship views includes: The multi-dimensional relationship views include a triple view and a hypernode view; calculate the triple credibility score of the triple view based on the TransE scoring function; regard the triple as a whole hypernode and construct the hypernode view, and calculate the hypernode credibility score based on the hypernode view.
10. The system according to claim 8 or 9, characterized in that, The step in which the processor (100) calculates the comprehensive credibility score of the triple of the entity embedding based on each of the credibility scores includes: S(h,r,t) = S1 + λ·S2; where S(h,r,t) represents the comprehensive credibility score; S1 represents the triple credibility score in the triple view, S2 represents the hypernode credibility score in the hypernode view; λ represents the influence parameter of the structural information in the hypernode view on the comprehensive credibility score.