Knowledge graph completion model construction method fusing entity description and graph structure in electrical safety field
By integrating entity descriptions with a knowledge graph completion model based on graph structures, the problem of information fragmentation between electrical and non-electrical hazards in electricity safety detection has been solved, enabling intelligent risk identification and decision support, and improving the efficiency and transparency of electricity safety management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- STATE GRID ANHUI ELECTRIC POWER CO LTD ELECTRIC POWER SCI RES INST
- Filing Date
- 2025-11-20
- Publication Date
- 2026-05-05
AI Technical Summary
In electrical safety inspections, information on electrical and non-electrical hazards is fragmented, hazard knowledge is difficult to express in a structured way, and there is a lack of intelligent risk identification and decision support capabilities. Existing deep learning models lack professionalism and semantic modeling capabilities, leading to difficulties in intelligent management.
A knowledge graph completion model that integrates entity description and graph structure is adopted. Entity description vectors are generated through the SBERT model, and structural relationship encoding is combined with the TransE model. The weighted fusion model GAT is used for information capture and feature integration. Finally, link prediction is performed in the decoder ConKB to construct a knowledge graph for electricity safety.
It has achieved effective integration of electrical and non-electrical hazard information, improved the intelligence level of electrical safety risk identification and early warning, provided real-time and efficient decision support, and enhanced the visualization and interpretability of safety management.
Smart Images

Figure CN121981218A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power information technology and artificial intelligence integration application technology, and in particular relates to a method for constructing a knowledge graph completion model that integrates entity description and graph structure in the field of power safety. Background Technology
[0002] In real-world scenarios involving decision-making regarding electrical safety hazards, numerous factors need to be considered during electrical safety inspections. Identification through manual data observation suffers from limitations such as limited data, blind spots in hazard identification, and incomplete decision-making. Existing deep learning models typically contain only a limited number of features, making it difficult to propose comprehensive solutions and insufficient to support the intelligent requirements for integrated safety hazard investigation. Furthermore, downstream tasks involving knowledge graphs involve complex graph operations, and traditional reasoning methods have limitations in efficiency and accuracy, resulting in limited effectiveness in comprehensively predicting electrical safety hazards.
[0003] To address the specific problem of detecting potential electrical safety hazards, an entity and relationship model of an electrical safety knowledge graph is established, encompassing safety regulations, operating procedures, electrical safety logic, and fault hazard characteristics. This aims to lay the foundation for intelligent data applications and ultimately connect to a digital integrated management platform to improve the efficiency of data management and enrich management methods.
[0004] The construction of a high-quality knowledge graph in the field of electrical safety mainly addresses the following two difficulties in the field of electrical safety testing: (1) Currently, a large amount of professional knowledge in the field of electricity safety inspection exists in the form of discrete documents, without forming a unified knowledge system and database. This makes it impossible to provide staff with convenient and efficient basic support for data query and analysis, which in turn makes it difficult to promote intelligent transformation. For example, there are a large amount of fragmented electronic documents and data in various aspects such as the daily management, standardized operation and fault diagnosis of the power distribution network. At present, these professional and accurate data have not been reasonably mined and integrated, and the professional knowledge further exacerbates the complexity of intelligent cognition of the power system.
[0005] (2) In electricity safety management, there are significant differences between electrical and non-electrical safety hazard data, constituting a typical data gap. Electrical hazards usually originate from structured data such as equipment sensors and monitoring systems, possessing clear numerical characteristics and logical relationships; while non-electrical hazards mostly involve unstructured or semi-structured information such as operating procedures, environmental factors, and personnel behavior, often existing in text form, lacking unified data standards and modeling methods. This difference in structure and semantics makes it difficult for the two types of hazard data to be interconnected and integrated in practical applications, forming information silos and severely restricting the improvement of comprehensive perception, joint analysis, and intelligent decision-making capabilities for safety risks. Therefore, how to effectively integrate electrical and non-electrical hazard data has become one of the core challenges facing intelligent management in the field of electricity safety.
[0006] Chinese invention patent application CN202310776363.3 discloses a deep learning-based method for discovering relationships in a knowledge graph within the power industry. This method involves acquiring news data in the power industry through web crawling and preprocessing it with annotations. A corpus is constructed using public domain corpora combined with power industry-specific vocabulary. A BERT model is incrementally trained to extract textual features. Entities and relationships are embedded into a low-dimensional space using stacked convolutional neural networks, and features are extracted to complete the knowledge graph. A student model obtained through knowledge distillation is then used to rearrange candidate triples, completing the knowledge graph and predicting relationships between entities. This method has the following drawbacks: 1. Lack of professionalism and diversity in data corpus construction: This technology mainly relies on news text data collected by web crawlers as the corpus source for knowledge graph construction. However, news texts are uncertain and arbitrary in expression, which cannot guarantee the professionalism and accuracy of their content. In particular, there may be problems with the non-standard use of technical terms in the field of electrical safety. At the same time, the corpus is only constructed using text data and lacks the integration of structured data, such as equipment databases, historical fault records, and semi-structured data, such as operation and maintenance logs and inspection forms. This results in the knowledge graph having a single type of entity and relationship, and a loose knowledge structure.
[0007] 2. The relation prediction model lacks semantic modeling capabilities: The stacked convolutional neural networks used in this technique primarily focus on convolutional computation after combining entity and relation vectors for feature extraction, without explicitly modeling the semantic dependencies and logical structures between entities. This type of structure is better at recognizing local spatial patterns (such as adjacency features in images) but is not suitable for handling complex relationships in text that span sentences, paragraphs, or have implicit causal relationships. Furthermore, it does not introduce graph neural networks to characterize the adjacency context features of entities in the knowledge graph, resulting in shortcomings in multi-hop reasoning and contextual semantic representation of the overall prediction model.
[0008] 3. Lack of generalization ability in entity recognition methods: This technique uses the general-purpose BERT pre-trained language model for entity feature extraction without customizing it to suit the semantic characteristics of the power industry. For example, it does not construct a dedicated entity dictionary, terminology ontology, or rule templates for the power industry, nor does it use industry expert knowledge to assist in annotating the training corpus. In practical applications, this method has a low recognition accuracy when dealing with industry-specific terms, and it is particularly difficult to handle non-standard text data with irregular naming and complex sentence structures. The model's generalization ability and practical effectiveness are limited.
[0009] Chinese invention patent application CN202410274424.0 discloses a method, system, device, and medium for constructing a power knowledge graph. The method includes: training and adjusting a selected language pre-trained large-scale model based on labeled power business data; using the trained and adjusted language pre-trained large-scale model to encode the power business data to be used in constructing the power knowledge graph, obtaining the serialized encoding of each character in the power business data and acquiring the entity label feature matrix; based on the entity label feature matrix, extracting entities and relations according to the rule of maximizing the probability of entity label combinations, generating "entity-relationship-entity" triples and storing them in a graph database to construct the power knowledge graph. This method has the following drawbacks: 1. Lack of graph ontology design and semantic structure specifications: The knowledge graph construction process relies entirely on entity and relation triples "automatically extracted" from data, without reflecting a systematic graph ontology design process. A graph ontology is the semantic foundation for building a knowledge graph, clearly defining conceptual levels, entity attributes, relational constraints, and logical rules. This patent fails to semantically model or define the ontology structure for professional knowledge in the power field (such as logical dependencies between equipment classification, operating procedures, and hazard types). This will result in a loose graph structure, poor semantic consistency, and difficulty in supporting high-level applications such as graph reasoning, question answering, or cross-domain connectivity.
[0010] 2. The entity-relation extraction model lacks interpretability and semantic constraints: This patent uses a combination of models such as BiSRU-LcCRF to extract entities and relations. While this improves the accuracy and efficiency of identification, it relies entirely on the probability-maximizing strategy to select label sequences, lacking a rule base, constraint system, or expert knowledge as supplementary measures. This "black box model" cannot explicitly detect and correct errors during the extraction process, nor can it guarantee that the generated triples are semantically logically sound. This is especially problematic in business scenarios with complex syntax or ambiguous contexts, where semantic drift and mismatches are more likely to occur. Summary of the Invention
[0011] In view of this, the present invention aims to solve the problems of the separation of electrical and non-electrical hazard information, the difficulty in expressing hazard knowledge in a structured way, and the lack of intelligent risk identification and decision support capabilities in electrical safety detection.
[0012] The technical solution provided by this invention is: a method for constructing a knowledge graph completion model that integrates entity description and graph structure in the field of electrical safety, comprising the following steps: Step 1: Obtain existing knowledge graphs in the field of electrical safety; Step 2: Obtain entity description information of the target entity from the acquired knowledge graph of the electricity safety domain, use a pre-trained SBERT model to encode the entity description text, and generate the target entity description vector; and use the TransE model to encode the structural relationship of the target entity in the knowledge graph of the electricity safety domain, and generate the initial structure vector of the target entity based on triples. Step 3: Input the generated target entity description vector and the initial structure vector based on triples into the weighted fusion model GAT for concatenation. Use the multi-layer attention mechanism to capture information and integrate features to obtain the fused entity representation. Step 4: Input the obtained fused entity representation into the decoder ConKB for link prediction to obtain the identification results of electrical safety hazards.
[0013] Furthermore, in step 1, the knowledge graph for the electrical safety domain includes entity types within the electrical safety domain and the relationships between these entity types. Entity types include: industry information, equipment information, production process, potential faults / abnormalities, regional information, and handling measures. The relationships between entity types include: inclusion, existence, and location relationships between different entity types; and the pre- or post-positional or related relationships between equipment, production processes, potential faults, and handling measures.
[0014] Furthermore, each type of entity extracted from the unstructured text is stored in a table format, where, The industry information table includes: the industry's load characteristics, industry regulation priority, industry adjustable capacity, and industry electricity consumption; The list of key equipment includes: the relevant power consumption attributes of production equipment in each production process, including the load level, load type, load characteristics, adjustable capacity and shutdown consequences of the equipment. The production process table includes: the production process in this industry, the electrical equipment used in each process, the load characteristics of the production process, the control priority, and the electricity consumption and constraints of the production process. The fault hazard table includes: fault information that may occur in the production process of the corresponding industry, including fault type, equipment and process that may be affected by the fault, responsible department, fault cause and handling method; The workshop area table includes: the floor, area, voltage, adjustable capacity and fire protection rating of each power area, and the key equipment in the production process located there; The handling suggestion form corresponds to the fault hazard form, which records the handling methods for the fault, including the responsible personnel and operational details.
[0015] Furthermore, the relationships between entity types are stored in tabular form.
[0016] Furthermore, in step 2, the SBERT model includes two BERT models with shared weights. The two BERT models process the sentence input and perform pooling operations on their respective outputs to obtain sentence vectors with fixed dimensions representing entity description information. The similarity between the two sentence vectors is calculated to obtain the similarity output between the two sentences. When the similarity is greater than a predetermined threshold, an entity description vector is generated.
[0017] Furthermore, similarity can be calculated using cosine similarity, Manhattan distance, or Euclidean distance.
[0018] Furthermore, the pooling operation employs an average pooling strategy.
[0019] Furthermore, in step 2, the BERT model is optimized using the mean squared loss function.
[0020] Furthermore, in the TransE model of step 2, the triplet satisfy:
[0021] in, t represents the head entity, r represents the tail entity, and r represents the head entity. The relationship between the tail entity r and the tail entity r.
[0022] Furthermore, step 3 includes: Step 31: For a target node in the electricity safety knowledge graph, the generated entity description vector and the initial structure vector are merged and spliced using a splicing function to form a joint entity vector; Step 32: The entity relationship features and the resulting entity joint vector are weighted and summed through the graph attention layer to obtain the feature vector of the adjacent nodes; Step 33: Calculate the importance of the feature vectors of the adjacent nodes to the target node; Step 34: The feature vectors of each neighboring node are weighted and summed through the graph attention layer; Step 35: Perform a linear transformation on the embedding vector of the relation to obtain the fused entity representation.
[0023] The present invention has the following beneficial effects: 1. Achieve integrated expression of electrical and non-electrical hazard information: By introducing a unified ontology structure and semantic modeling method, the traditionally separate electrical fault data is effectively integrated with non-electrical information such as operating procedures and environmental factors, breaking down information silos and constructing a well-structured and semantically rich electrical safety knowledge graph, thereby improving the comprehensiveness and systematic nature of the knowledge.
[0024] 2. Enhance the intelligence level of electricity safety risk identification and early warning: Based on the multi-dimensional hidden danger knowledge system built by knowledge graph, combined with graph reasoning and knowledge completion algorithms, it can realize the proactive identification, path tracing and accurate early warning of hidden danger risks, and provide real-time, efficient and intelligent decision support for operation and maintenance personnel.
[0025] 3. Achieve visualization and explainability of safety management: The graph-based knowledge representation makes hazard information, related logic, and handling measures more intuitive and easy to understand, facilitating visualization and interactive querying, thereby enhancing the user-friendliness of the system and the transparency of safety management, and helping enterprises build an explainable and traceable electricity safety prevention and control mechanism. Attached Figure Description
[0026] To more clearly illustrate the technical solutions of the specific embodiments of the present invention, the drawings used in the description of the specific embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0027] Figure 1 This is a schematic diagram of the EDF-KGC algorithm model structure of the present invention; Figure 2 This is a schematic diagram of the spatial distribution of BERT word vectors in this invention; Figure 3 This is a schematic diagram of the SBERT model of the present invention in the similarity calculation task; Figure 4 This is a schematic diagram of the entity description information vector encoding model of the present invention; Figure 5 This is a schematic diagram of the TransE model of the present invention; Figure 6 This is a schematic diagram of the weighted encoding model structure for introducing graph attention in this invention; Figure 7 This is a schematic diagram illustrating the relationship definition for constructing the atlas ontology of the present invention; Figure 8The figure is an example (partial document) of extracting relevant entities from the specified standard of this invention; Figure 9 This is a screenshot of the physical information table of some equipment in the steel industry of this invention; Figure 10 Example diagram of batch writing industry table knowledge into a graph database according to the present invention; Figure 11 This is an example diagram illustrating the batch writing of node relationship data into a graph database according to the present invention. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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.
[0029] 1. EDF-KGC model architecture integrating entity description and graph structure knowledge completion Most existing knowledge graph completion models, such as the TransE and ConvE models, only utilize the structural information of triples, lacking the mining of entity description information. In the field of power safety, entity descriptions contain important information such as industry, load characteristics, and equipment characteristics. This information is crucial for describing node features and matching similar nodes. The knowledge completion task of a domain graph essentially involves discovering analogical and potential knowledge between different nodes from existing graph knowledge through feature points. Therefore, integrating power-related entity description information from nodes into the knowledge graph completion model will inevitably improve the effectiveness of the knowledge completion task. Furthermore, by designing a model specifically for the power safety field, the completion model can be made more reasonable and accurate to meet the needs of practical applications. Building upon graph convolutional neural network-based completion models, this invention proposes a novel knowledge graph completion model that integrates entity description and structural information (EntityDescription Fusion Knowledge Graph Completion, EDF-KGC). It utilizes a BERT pre-trained model to generate entity description vectors, which are then concatenated with graph structure vectors generated by TransE. Joint training is then performed to complete the link prediction task, thereby completing the graph on the domain graph. To verify the model's effectiveness, tests were conducted on both domain datasets and general datasets, and comparisons were made with mainstream knowledge completion models, showing a significant improvement in performance.
[0030] like Figure 1As shown, the EDF-KGC model adopts the popular graph neural network encoder-decoder framework, which consists of four parts: a BERT-based entity description vector encoding model, a TransE-based triplet structure vector encoding model, an attention-based fusion encoder GAT, and a ConKB-based decoder.
[0031] First, entity description information of the target entity is obtained from the existing knowledge graph, including key information such as industry, load type, and equipment category. An improved pre-trained BERT model is used to encode the entity description text to obtain its vector representation. Simultaneously, the TransE model is used to encode the structural relationships of the entity, obtaining a triplet-based structural vector. Then, these two vector representations are fed into a weighted fusion model GAT with an attention mechanism for concatenation. A multi-layer attention mechanism is used to capture information and integrate features, which is then used as the encoder. Finally, the fused entity representation is fed into the decoder ConKB for link prediction. Through the collaborative work of entity description representation, triplet relationship representation, encoding, and decoding, the EDF-KGC model can more comprehensively represent the entity itself and the relationships between its structures, thereby improving the accuracy of the link prediction task.
[0032] 2. An improved BERT sentence vector encoding model The electrical safety domain map in the invention design contains a large amount of entity description information. For example, most key equipment nodes contain electrical safety information such as load type, load characteristics, and equipment working principle. This information can effectively reflect the differences or similarities between nodes when performing similarity prediction tasks. Therefore, incorporating entity description information into the model will significantly improve the completion task. When selecting an entity description information encoding model, conventional sentence vector encoding models such as word2vec were initially considered. However, the entity description information of nodes in the electrical safety domain is often discrete and unstructured, which makes encoding difficult and makes it hard to guarantee the accuracy of the encoded features. Research revealed that the BERT model can better encode entity description information into sentence vectors. Unlike traditional methods that directly generate sentence vectors through weighted average of word vectors, the rich semantic information built into the BERT model allows the generated feature vectors to more accurately capture the meaning of domain-specific text. Furthermore, the introduction of contextual semantics effectively avoids the case of polysemy. For electrical safety domain texts, which contain a large number of descriptive feature words, it is necessary to combine contextual semantics to form a more accurate sentence representation. This invention mainly studies the knowledge completion task of domain knowledge graphs. Therefore, regarding sentence vector generation, it focuses on the task of calculating the similarity of entity description information between different entities. The BERT model is suitable for representing sentence semantics and generating entity description sentence vectors that are beneficial for similarity comparison tasks.
[0033] In the original BERT model, sentence vector generation primarily employs two methods: one utilizes the output of CLS tokens as the sentence representation, and the other calculates the average of all token output vectors. However, these methods are not entirely suitable for precise semantic similarity calculation because the distribution of word vectors generated by BERT is uneven due to word frequency, resulting in high-frequency word vectors being more concentrated in space, while low-frequency word vectors are more dispersed, such as... Figure 2 As shown in the figure. This distribution characteristic makes similarity calculations based on the distance between these word vectors inaccurate, especially when the sentence is mainly composed of high-frequency words, the similarity estimate may be too high, and vice versa. Therefore, directly using the original BERT model to generate sentence vectors for similarity calculation may not achieve the expected accuracy.
[0034] To generate sentence vectors capable of effectively calculating semantic similarity, this invention adopts the Sentence-BERT (SBERT) model. This model is a modification of the original BERT, proposing a Siamese network and triplets network structure. It can generate semantically meaningful sentence embedding vectors; sentences with similar semantics have closer embedding vector distances, which can then be used for similarity calculation (cosine similarity, Manhattan distance, Euclidean distance). Under V100 GPU conditions, this network structure can find the most similar sentence pairs from 10,000 sentences in just 5 seconds, while the original BERT takes 65 hours, maintaining the same accuracy. The SBERT model exhibits excellent performance and accuracy in similarity calculation and binary classification tasks. Considering the importance of the accuracy of entity description vectors for generating the final joint feature vector, it is used as the encoder for entity description information.
[0035] Due to the requirements of knowledge completion tasks in the invention domain graph, the following will mainly introduce the structure and method of the SBERT model for the similarity calculation task, as shown in the figure below. Figure 3 As shown, the SBERT model employs a Siamese and triplet network structure. It uses two original BERT models as its foundation, sharing weights. The two BERT models process the sentence input separately, and then pool the two outputs to obtain sentence vectors with fixed dimensions. After obtaining the sentence vectors, the calculated cosine similarity is used as the sentence similarity output, and the mean squared loss function is used to optimize the model.
[0036] When generating sentence vectors for entity description information in the field of electrical safety, this paper adopts the pre-trained base-v2 model provided by the authors of SBERT. This model has been fine-tuned for many use cases and trained on a large and diverse dataset with more than 1 billion training pairs. The generated sentence vectors have rich semantic information and perform well in the task of calculating the similarity between sentences, which can effectively represent the entity description information in the graph of this paper.
[0037] After obtaining the sentence vectors, average pooling and max pooling strategies can be used to perform mean or maximum value operations to obtain the final sentence vectors. Considering the correlation and order between sentences, an average pooling strategy is used to generate entity description information vectors for the electricity safety knowledge graph. The specific process is as follows: Figure 4 As shown.
[0038] 3. TransE-based structural representation Considering the ontology design of the electrical safety domain graph of this invention, the defined node relationship types do not exceed 30, and there are no complex situations such as self-loops or inversions between relationships. The entity relationship triples are clear and unambiguous. Therefore, the classic TransE model is used to complete the encoding task of the triple structure of the electrical safety domain graph. The relationships between nodes in the electrical safety graph of this invention are simple, and there are no "many-to-one" or "circular" structural features. Most node relationships are in a tree structure, and the TransE model can fully meet the vector representation task of the electrical safety domain graph structure.
[0039] Compared to optimized graph structure coding models such as TransH and TransR, which are more convenient for handling complex relationships, the TransE model has lower computational complexity, fewer parameters, and can save significant computational costs. Furthermore, for tasks such as predicting electrical safety equipment attributes and predicting tail entities of potential faults in this invention, the improvement brought by using more complex models like TransH is not significant when entity description information is integrated. Moreover, for the relatively clear inter-node relationships in this invention, the simple and efficient TransE model is more suitable for the application scenarios of this invention. Figure 5 As shown.
[0040] The TransE model views relationships in a knowledge graph as a kind of translation between entities, specifically triples. The following condition must be met; incorrect triples should not satisfy this relationship, as shown below:
[0041] in, t represents the head entity, r represents the tail entity, and r represents the head entity. The relationship between the tail entity t and the tail entity t.
[0042] TransE constructs a scoring function based on the sum of the vectors of the head entity and relations, and the Euclidean distance between entities with the same tail, to evaluate the triples existing in the knowledge graph. To make and The smaller the distance between them, the better, and the higher the score, the better. Correspondingly, for incorrect triples, the larger the distance between them, the better, and the lower the score, the better.
[0043] 4. Weighted Fusion Encoding Model GAT with Attention Mechanism After obtaining the entity description information vector and the initial structure vector s of the electricity safety knowledge graph, it is necessary to consider how to concatenate the two and ensure that the concatenated joint vector can more accurately represent the entity features. Since the entity description vector and the structure vector are not simply binary, their relative importance in the joint vector is not clear. Therefore, for the task of concatenating and fusing the graph structure vector and the entity description vector, this invention adopts a weighted fusion coding model GAT with a graph attention mechanism. The attention mechanism can adjust the proportion of the entity description vector and its graph structure vector in the joint vector of the electricity safety domain. By assigning different weights to the two, the most suitable and accurate weight parameter ratio is found on the training set, allowing the model to focus on the most relevant information for the current knowledge completion task. This results in better performance and flexibility when processing various data and tasks. The implementation process of its model structure is as follows: Figure 6 As shown.
[0044] The first step is to analyze the entity description vectors of the electricity safety knowledge graph generated in Section 2. The initial structure vector s generated in Section 3 is then merged and concatenated with it using the concat function to form the connected entity vector v, as shown in the following formula:
[0045] The same concatenation operation is performed on the connected entity vectors and the initial vectors of the relationship between them and the electricity safety knowledge graph, which are then used as the input vectors for the graph attention layer.
[0046] The second step, in order to incorporate entity description information into the model, involves using a graph attention layer to perform a weighted summation of entity relationship features and entity joint vectors to obtain the feature representations of adjacent nodes. The fusion formula between entity description features and initial entity vectors is as follows:
[0047] in, This represents the fused feature vector. It is the initial vector of entity description information. This is the initial graph structure vector of the entity. ∈(0,1) are weight parameters.
[0048] The third step is to calculate. For the target node The importance of each factor determines the attention value of the two factors. The specific formula is as follows:
[0049] The above formula represents the process of performing a concatenation operation and transforming the weight matrix W and weight vector based on a linear transformation. A linear transformation is performed, followed by nonlinear activation processing using the LeakyReLU function.
[0050] The fourth step involves using a graph attention layer to perform a weighted summation of the features of each adjacent node, as shown below:
[0051] in, Attention score The weights, converted into a probability distribution, are shown in the following formula:
[0052]
[0053] in, Refers to nodes The output vector after passing through the graph attention network, and As an activation function, it is used to adjust the sensitivity of the function. This represents the fused feature vector. Indicates the node to be evaluated The neighboring nodes.
[0054] Finally, a linear transformation needs to be performed on the embedding vector R of the relation to produce the corresponding relation vector. :
[0055] in, As the transformation matrix, located at Within the space, where T represents the input dimension of the relation embedding. To preserve the initial embedding information, the initial embedding of the entity is linearly transformed and stored.
[0056]
[0057] In the above formula, H represents the initial set of vectors input to the model. In the diagram, represents the embedding transformation matrix of the initial node vector, and represents the vector representation obtained after processing by the graph attention layer. This represents the final vector representation that retains both the initial vector information and the graph attention information.
[0058] The weighted encoder used in this invention is similar to the scoring mechanism of translation models (such as the Trans series). It aims to train entity embeddings and relation embeddings to satisfy the condition h + r ≈ t, meaning that the head entity vector h + relation vector r in the knowledge graph should be close to the tail entity vector t. For a given set of valid triples... The goal is to make Through relationships as close as possible ,use The norm is defined as a distance function between the head node and the tail node, as shown below:
[0059] Meanwhile, its loss function is defined as follows:
[0060]
[0061] In the above formula, >0 indicates a positive boundary hyperparameter, where E is the complete set of entities in the graph. Let G represent the difference between E and h, and let G be the set of correct triples. It is the set of invalid triples obtained by randomly replacing the head entity or the tail entity.
[0062] The advantages of this weighted fusion coding model are mainly as follows: ① By assigning different weights to entity description information and graph structure information, the model can focus on the information most important to the current task, enhancing its focusing ability and improving its performance and accuracy. ② When facing long sequence data of entity descriptions, the attention mechanism can help the model effectively capture long-distance dependencies; even relationships between elements that are far apart in the sequence can be recognized and utilized by the model. ③ The attention mechanism enables the model to use computational resources more efficiently, concentrating computational power on key information rather than processing all inputs equally, thus reducing unnecessary computation and improving model efficiency.
[0063] 5. Design of the Electrical Safety Knowledge Graph To meet the system design requirements and the access requirements of multi-source heterogeneous data graphs, and taking into account the classification of electrical safety knowledge and the actual application requirements of the comprehensive decision-making system for fault hazards, the ontology in the knowledge graph of the electrical safety field is designed, including entity definitions and the definitions of relationships between entities.
[0064] (1) Entity definition. Six types of entities in the field of electrical safety are defined, namely industry information nodes, equipment information nodes, production process nodes, fault hazard / abnormal information nodes, regional information nodes, and disposal measures information nodes. Each type of entity contains its entity attributes, which are described in the following six tables, as shown in Tables 1-6.
[0065] Table 1 Industry Information Node Field Table
[0066] Table 2 Production Process Node Field Table
[0067] Table 3 Equipment Information Node Field Table
[0068] Table 4. Regional Information Node Field Table
[0069] Table 5. Fault Potential / Abnormal Phenomenon Node Field Table
[0070] Table 6. Node Fields for Disposal Measures
[0071] (2) Relationship Definition. Based on the entity definition, the relationships between nodes are defined. Figure 7 This refers to the relationship definition of the electrical safety knowledge graph, which includes more than 15 types of relationships between nodes. Figure 7 It clearly shows the relationships between nodes, including the inclusion, existence, and location relationships between different entity categories. It also shows the pre- and post-relationships or related relationships between equipment, production processes, potential faults, and handling measures. Pre- and post-relationships are mainly used to describe the process sequence in the operating procedures, while related relationships are mainly used to describe the mutual influence between the two.
[0072] With entity relationships defined, ontology construction is finally complete. The next step is to extract knowledge from massive amounts of documents according to the ontology framework.
[0073] 6. Knowledge extraction from unstructured text This invention addresses knowledge extraction from unstructured text. It locates and extracts corresponding knowledge fragments from textual materials within a pre-constructed knowledge framework, without needing to extract all knowledge details from the document. This differs from large-scale knowledge extraction methods using deep learning and neural networks, which require extracting a large number of entities. As an example, this invention employs a rule-based and dictionary-based named entity recognition method. Following keywords identified within the ontology knowledge framework, relevant descriptions are located from the document data. Domain entities are then extracted from the text using methods such as domain dictionary matching, word formation feature character rule matching, and part-of-speech combination feature rule matching. Entity categories are determined based on keywords and part-of-speech features, including: industry information entities, equipment information entities, production process entities, fault hazard entities, regional information entities, and handling measure entities. The extracted entities are categorized, and relationships between entities are determined using entity categories and keywords within the same sentence.
[0074] As an example, in the process of constructing an electrical safety knowledge graph, different entity recognition and relation extraction algorithms (such as BiLSTM-CRF, ERNIE, Prompt method, etc.) can be replaced according to actual application needs, or different knowledge completion and reasoning models (such as TransE, ConvE, CompGCN, etc.) can be selected to improve the completeness and reasoning ability of the graph.
[0075] For example, the AQ 2002-2004 Ironmaking Safety Regulations stipulate the technical requirements for safe production in the iron and steel industry, including industry knowledge such as ironmaking plant design, equipment manufacturing, construction and installation, and production and maintenance. Through targeted extraction from this standard text, knowledge about ironmaking plant equipment, production, and maintenance in the iron and steel industry can be obtained. The following will introduce the knowledge extraction process using a simple text example. Figure 8 It consists of document fragments and their entity extraction annotations.
[0076] When extracting knowledge from the specified document AQ 2002-2004 "Safety Regulations for Ironmaking," the industry is the steel industry, the location is an ironmaking plant, and the main equipment and main production processes are the document's first-level headings, such as "7. Feeding System," "8. Furnace Top Equipment," "9. Blast Furnace Main Structure and Operation," and "10. Pulverized Coal Injection." Extracting from these first-level headings reveals the main production equipment and processes. The content of each subsection includes corresponding safety recommendations, fault anomalies, and handling measures. After entity identification and category labeling, the relationships between entities can be clarified using simple matching rules, facilitating the formation of a "entity-relationship-entity" triplet format.
[0077] 7. Construction of Electricity Safety Map Based on Graph Database Corresponding to the entity relationships in the text design above, the data extracted from the unstructured text mainly forms six types of node tables: industry information node table, region information node table, equipment information node table, production process node table, fault and hazard information node table, and handling suggestion table. Specifically: ① The industry information table includes the industry's load characteristics, industry control priorities, industry adjustable capacity, and industry electricity consumption, providing a general overview of the industry's electricity-related characteristics. ② The production process table includes the main production processes in the industry, as well as the main electrical equipment used in each process, production process load characteristics, control priorities, production process electricity consumption, and production process constraints, providing a detailed description of each production process. ③ The key equipment table mainly includes the relevant electrical attributes of the main production equipment in each production process, including the load level, load type, load characteristics, adjustable capacity, and shutdown consequences of the electrical equipment. ④ The workshop area table provides spatial characteristics of the industry's electricity consumption, including the floor, area, area voltage, adjustable capacity, fire protection rating, etc., of each electrical area, as well as which key equipment in the production process will be placed there. ⑤ The Fault Hazard Table contains fault information that may occur during the production process in the corresponding industry, including fault type, equipment and process that may experience the fault, responsible department, fault cause, and handling method, which can provide a basis for fault hazard investigation and handling. ⑥ The Handling Suggestion Table is constructed to correspond with the Fault Hazard Table, which records the handling method of the fault in more detail, including responsible personnel, operation details, etc., and supplements the handling method in the Fault Hazard Table. These six tables constitute the text database storage of the map content. The following is a brief introduction and display of the equipment node and area tables to help readers understand the content structure of the map.
[0078] Figure 7 The screenshot shows a portion of the table of key equipment in the steel industry. As you can see, the table contains a large amount of domain knowledge, which can provide data support for the subsequent construction of the graph triplet.
[0079] Table 7 shows a partial table of workshop areas in the steel industry. It includes multiple fields such as indoor / outdoor, floor, area, and fire safety rating. When constructing knowledge graph triples, any column field can form a triple with a region node, for example: <Ironmaking workshop, fire safety rating, Level 1>. This demonstrates that the integration of the six types of node tables contains a wealth of industry knowledge. Targeted extraction of the table data allows for simple and quick formation of triples.
[0080] Table 7. Partial Table of Workshop Areas in the Steel Industry
[0081] The above is a tabular representation of electrical safety knowledge related to the steel industry. Most of the data comes from knowledge mining of unstructured text and targeted entity extraction.
[0082] As an example, the graph construction method can also be flexibly implemented based on a combination of various methods such as rule extraction, dictionary matching, and remote supervision.
[0083] 8. Knowledge Entry for Neo4j Graph Database Neo4j uses Cypher statements for command operations, supporting not only triple input but also the import of triples in tabular form. This allows tabular knowledge to be seamlessly input into the graph database for intuitive graph structure display. This section introduces the tabular knowledge writing process for graph databases. In addition to the conventional "entity-relationship-entity" triple input, entity classification and attribute data for each category also need to be written.
[0084] Taking industry information entity categories as an example, based on the electricity safety knowledge table above, and according to the attributes, categories and other information required by the map, the industry information node table is obtained after sorting and extraction, as shown in Table 8.
[0085] Table 8. Industry Information Nodes (Partial)
[0086] Running the corresponding table write statement will write the industry table knowledge. The specific statement is as follows: LOAD CSV WITH HEADERS FROM "file: / / / industryinformationtable.csv" AS line create (z:industry{ Industry_name:line.Industry_name, Load_characteristics:line.Load_characteristics, Regulation_priority:line.Regulation_priority, Electricity_consumption:line.Electricity_consumption}); After the data is written, the corresponding nodes can be visually viewed in the graph database, such as... Figure 10 As shown.
[0087] After writing the nodes for each category, the relationships between the nodes are also written in a tabular format. Taking the main equipment in the steel industry as an example, a "Industry_Equipment" relationship table is formed, as shown in Table 9.
[0088] Table 9. Partial Relationship Table of "Industry_Equipment" in the Steel Industry
[0089] Running the corresponding table write statement will connect the "Steel Industry" node and its contained "Main Equipment" nodes, with the relationship being "contains" between them. The specific statement is shown below: LOAD CSV WITH HEADERS FROM "file: / / / industry_equipment.csv" AS line match (from:Industry{Industry_name:line.from}), (to:Device{Device_name:line.to,Industry:line.from}) merge (from)-[r:contains{property:line.property}]->(to); After the data is written, the corresponding relationship links can be clearly seen in the graph database, such as... Figure 11 As shown.
[0090] By writing the electricity safety knowledge table formed by integrating the data into the graph database, you can intuitively view each node and its relationship.
[0091] 9. Experimental Verification and Result Analysis Considering the similarity of entity relationship types in publicly available datasets, this invention uses the FB15K-237 and WN18RR datasets to evaluate the model's performance. First, inverted relationships are removed from the FB15K and WN18 datasets to address the reversible relationship problem, forming subsets FB15K-237 and WN18RR respectively. Before the experiment, to ensure applicability to practical applications in the field of electrical safety, the two datasets were preliminarily processed, removing entities lacking descriptive text. The remaining entities all have entity description information, with the description length not exceeding 100 words. During the experiment, the datasets were divided into training, testing, and validation sets, as shown in Table 10 below.
[0092] Table 10. Experimental Dataset for General Domain Knowledge Graph Completion (Tail Entity Prediction)
[0093] The same experimental setup was used on both datasets. The detailed experimental environment configuration is shown in Table 11 below. Table 11 Experimental Environment Configuration Table
[0094] This experiment uses the TransE model as the encoder to initialize the representation vectors of entities and relations, with the vector dimension set to k=180. The word vector dimension of the entity description text is set to n=100, while the dimension of the integrated vector is adjusted to 200, and the dropout coefficient ρ is set to 0.4. The initial learning rate of the model is set to 0.002, and the alpha parameter of the LeakyReLU activation function is set to 0.3. To accelerate network convergence, the Adam optimizer is selected to adjust the parameters. Considering that distant nodes have a smaller impact on the target node, only second-order neighbor nodes are considered in the experiment. The output embedding dimension of the model is set to k=280, and L2 regularization is used to avoid overfitting. The dropout rate of the model is set to 0.3.
[0095] Knowledge completion is essentially a link prediction task. The goal of link prediction is to predict the missing h or t in a triple (h, r, t). This task typically involves ranking candidate entities based on a scoring function. Considering that this experiment focuses on the accuracy of tail entity prediction, three metrics were selected for evaluation: MR (Mean Rank), MRR (Mean Reciprocal Rank), and Hits@n. Each metric emphasizes different aspects of the model's predictive ability.
[0096] 1) Mean Rank (MR): The mean rank metric calculates the average ranking of the model's predictions for each correct entity in the test set. A lower MR value indicates that the model is more accurate in ranking correct entities, meaning the model's prediction accuracy is higher.
[0097] 2) MRR (Mean Reciprocal Rank): The Mean Reciprocal Rank is the average of the reciprocal rank of each query. It considers the ranking of the correct answer in the model's predictions by taking the reciprocal of its rank and then averaging this reciprocal over all queries. MRR gives higher weight to correct answers with higher rankings; therefore, MRR focuses more on the model's performance at the highest ranking position. A higher MRR value indicates that the model is more inclined to rank the correct entity higher.
[0098] 3) Hits@n: This metric measures the frequency with which the correct answer appears in the first n predicted results. For example, Hits@10 represents the proportion of correct answers appearing in the first 10 predictions. This metric provides a visual measure of how accurately the model performs in the first n predictions. A higher Hits@n value indicates better model performance.
[0099] In this section, tail entity link prediction experiments were conducted on the FB15K-237 and WN18RR datasets to evaluate and compare the performance of different models. The experimental results are presented in Tables 12-13. For comparison, we selected commonly used knowledge graph completion models, including TransE and ConvE, as benchmark models and compared them with the EDF-KGC model proposed in this study.
[0100] Table 12 Tail entity link prediction results based on the FB15K-237 dataset
[0101] Table 13 Tail entity link prediction results based on the WN18RR dataset
[0102] On the publicly available FB15K-237 dataset, the proposed completion model demonstrates superior performance across multiple evaluation metrics. Specifically, it achieves performance improvements of 1.4%, 2.7%, and 3.6% respectively on the Hit@1, Hit@3, and Hit@10 metrics compared to the KBGAT model without integrated entity descriptions. Compared to the traditional TransE model, which relies on triple information, the improvements in the Hits@n metric are 28.4%, 19.8%, and 23.2%. The MRR metric is also 2.1% higher than the KBGAT model without entity descriptions and 26.4% higher than the TransE model. These results indicate that integrating entity description information significantly enhances the model's understanding of entity and relational semantic information, enabling more accurate identification and differentiation of different entities and enriching the semantic representation of entities compared to models relying solely on triple structures.
[0103] On the WN18RR dataset, although the model achieved the best results in metrics such as MR, Hit@3, and Hit@10, improving upon the KBGAT model (which did not include entity descriptions) by 9.7% and 3.3% respectively, the improvement was lower than the experimental results on the FB15K-237 dataset. Furthermore, it did not significantly outperform other evaluation metrics. This is mainly because the relationships in the WN18RR dataset are relatively simple, the data volume is relatively sparse, and the addition of entity description information has a small impact on the link prediction task, resulting in the EDF-KGC model not fully utilizing its ability to distinguish different entities. These comparative experimental results show that the model's performance varies across different datasets.
[0104] In the actual electricity safety dataset, as detailed above, the data sources and the organization and integration of the data text were described in detail, ultimately resulting in the tabular storage of electricity safety knowledge, forming six types of node tables. Simultaneously, using a rule-based and dictionary-based entity naming and recognition method, over 300 entities related to electricity safety were extracted from unstructured text in the power sector. These entities were then cleaned, redundancy removed, and unified with entities in the structured tables, ultimately forming nearly 1000 triples, containing over 590 entities and approximately 950 entity relationships.
[0105] The tabular data of 16 industries was organized and divided into datasets to supplement professional domain knowledge.
[0106] Table 14 Experimental Dataset for Graph Completion (Tail Entity Prediction) in the Field of Electrical Safety
[0107] Since this invention relies on an electricity safety hazard investigation project, the EDF-KGC model will be practically applied to downstream tasks such as risk assessment, hazard prediction, and decision support. Therefore, its performance on specialized domain datasets is particularly important. Similar to general domain experiments, comparative experiments were conducted on domain datasets to explore the performance of the proposed model. The experimental results are summarized in Table 15 below. Common KGC models (TransE model, ConvE model) were also used as baseline models for comparative experiments with the proposed EDF-KGC model. During the experiments, key information such as load level and control priority in the entity description were embedded into the head entity of a triplet structure through vector concatenation for joint training to complete the link prediction task.
[0108] Table 15 Link prediction results based on the electricity safety dataset
[0109] The results show that the EDF-KGC model proposed in this invention achieves the best results among the domain datasets. The reasons are as follows: Data in the electrical safety domain is complex and highly dependent on entity description information. Integrating load level, priority, and other descriptive information into the training significantly enhances the richness of entity representation, enabling the model to predict tail entities more accurately. Currently, the domain dataset is not yet perfect, and the entity description information needs further optimization. In ongoing in-depth research, more key information from entity descriptions can be extracted and incorporated into the model to further improve link prediction accuracy.
[0110] As described above, this invention constructs an electrical safety knowledge graph covering safe operating procedures, equipment fault characteristics, hazard classification, and safety logic. It integrates key technologies such as ontology design, entity relationship extraction, and knowledge completion to bridge the semantic gap between multi-source heterogeneous data, improve the organization, understanding, and reasoning capabilities of electrical safety information, and provide intelligent and interpretable knowledge support for scenarios such as hazard identification, risk warning, and emergency response.
[0111] Please note that the technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. The above embodiments only illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be pointed out that those skilled in the art can make several modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for constructing a knowledge graph completion model that integrates entity description and graph structure in the field of electrical safety, characterized in that, The method includes the following steps: Step 1: Obtain existing knowledge graphs in the field of electrical safety; Step 2: Obtain entity description information of the target entity from the acquired knowledge graph of the electricity safety domain, use a pre-trained SBERT model to encode the entity description text, and generate the target entity description vector; and use the TransE model to encode the structural relationship of the target entity in the knowledge graph of the electricity safety domain, and generate the initial structure vector of the target entity based on triples. Step 3: Input the generated target entity description vector and the initial structure vector based on triples into the weighted fusion model GAT for concatenation. Use the multi-layer attention mechanism to capture information and integrate features to obtain the fused entity representation. Step 4: Input the obtained fused entity representation into the decoder ConKB for link prediction to obtain the identification results of electrical safety hazards.
2. The method as described in claim 1, characterized in that, In step 1, the knowledge graph for the electrical safety domain includes entity types and relationships between entity types in the electrical safety domain. Entity types include: industry information, equipment information, production process, potential faults / abnormalities, regional information, and handling measures. The relationships between entity types include: inclusion, existence, and location relationships between different entity types; and the pre- or post-positional or related relationships between equipment, production processes, potential faults, and handling measures.
3. The method as described in claim 2, characterized in that, Each type of entity extracted from the unstructured text is stored in a separate table, where... The industry information table includes: the industry's load characteristics, industry regulation priority, industry adjustable capacity, and industry electricity consumption; The list of key equipment includes: the relevant power consumption attributes of production equipment in each production process, including the load level, load type, load characteristics, adjustable capacity and shutdown consequences of the equipment. The production process table includes: the production process in this industry, the electrical equipment used in each process, the load characteristics of the production process, the control priority, and the electricity consumption and constraints of the production process. The fault hazard table includes: fault information that may occur in the production process of the corresponding industry, including fault type, equipment and process that may cause the fault, responsible department, fault cause and handling method; The workshop area table includes: the floor, area, voltage, adjustable capacity and fire protection rating of each power area, and the key equipment in the production process located there; The handling suggestion form corresponds to the fault hazard form, which records the handling methods for the fault, including the responsible personnel and operational details.
4. The method as described in claim 2, characterized in that, The relationships between entity types are stored in a table format.
5. The method as described in claim 1, characterized in that, In step 2, the SBERT model includes two BERT models with shared weights. The two BERT models process the sentence input and perform pooling operations on their respective outputs to obtain sentence vectors with fixed dimensions representing entity description information. The similarity between the two sentence vectors is calculated to obtain the similarity output between the two sentences. When the similarity is greater than a predetermined threshold, an entity description vector is generated.
6. The method as described in claim 5, characterized in that, Similarity can be calculated using cosine similarity, Manhattan distance, or Euclidean distance.
7. The method as described in claim 5, characterized in that, The pooling operation uses an average pooling strategy.
8. The method as described in claim 1, characterized in that, In step 2, the BERT model is optimized using the mean squared loss function.
9. The method as described in claim 1, characterized in that, In the TransE model of step 2, the triple (ℎ, r, t) satisfies: Where ℎ represents the head entity, t represents the tail entity, and r represents the relationship between the head entity ℎ and the tail entity r.
10. The method as described in claim 1, characterized in that, Step 3 includes: Step 31: For a target node in the electricity safety knowledge graph, the generated entity description vector and the initial structure vector are merged and spliced using a splicing function to form a joint entity vector; Step 32: The entity relationship features and the resulting entity joint vector are weighted and summed through the graph attention layer to obtain the feature vector of the adjacent nodes; Step 33: Calculate the importance of the feature vectors of the adjacent nodes to the target node; Step 34: The feature vectors of each neighboring node are weighted and summed through the graph attention layer; Step 35: Perform a linear transformation on the embedding vector of the relation to obtain the fused entity representation.
Citation Information
Patent Citations
Power field knowledge graph relationship discovery method based on deep learning
CN116775905A
Electric power knowledge graph construction method, system, equipment and medium
CN118193747A