A method, system, device and storage medium for automatically constructing industrial knowledge graph

By automatically building knowledge graphs in enterprises, the problems of data silos and low utilization are solved, efficient integration and sharing of data are achieved, and the commercial value of data is improved.

CN119397038BActive Publication Date: 2025-03-25LUCULENT SMART TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510014496.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-06
Publication Date
2025-03-25
Estimated Expiration
2045-01-06

AI Technical Summary

Technical Problem

Enterprises face the problems of data silos and low data utilization, and are unable to effectively utilize complex, multi-source heterogeneous data, and lack automated methods to convert data into structured knowledge graphs.

Method used

By establishing an embedding layer, unstructured data is converted into word vectors, entities and categories are extracted using feedforward neural networks, and the first knowledge graph is constructed; for structured data, triples are used to map them into ontologies and relationships, and the second knowledge graph is constructed; data grabbing tasks are performed regularly, dynamic knowledge fusion, update and optimize knowledge graphs.

Benefits of technology

It realizes the automated construction of from unstructured and structured data to knowledge graphs, breaks down data silos, improves data utilization, and reduces the needs of manual labeling and generation processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119397038B_ABST
    Figure CN119397038B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, system, device and storage medium for automatically constructing an industrial knowledge graph, including: establishing an embedding layer for unstructured data to map words to word vectors, obtaining entities and categories in the word vectors through a feedforward neural network, and constructing a first knowledge graph after judging and extracting the relationship between each entity; using triples for structured data to map the data structure to ontology and relationship, and constructing a second knowledge graph after obtaining the relationship structure between entities according to the mapping relationship; regularly executing data crawling tasks, detecting updated data, and updating and optimizing the first knowledge graph and the second knowledge graph after dynamic knowledge fusion. The present invention can realize the conversion of structured data to ternary relationships, reduce a large amount of manual annotation and knowledge graph generation process; and can realize the customized construction of enterprise-level data knowledge graphs, which is conducive to data mining and analysis, so as to realize the combination of multiple systems and the integration and sharing of data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of knowledge graph construction, and specifically to a method, system, device and storage medium for automatically constructing an industrial knowledge graph. Background Art

[0002] At present, more and more enterprises have realized the importance of informatization and have established a large number of customized systems based on their own characteristics and business needs. These systems have helped enterprises optimize operations and improve efficiency while also accumulating massive data assets. However, with the continuous development of enterprises, the utilization rate of these data has always been low, and their potential business value cannot be fully utilized. The main reasons for this problem include the following: ① The data quality is uneven, and the data is incomplete, inaccurate, repeated or inconsistent, resulting in unreliable analysis results and wrong decisions; ② The lack of professional talents within the enterprise makes it difficult to conduct in-depth data analysis and mining. Those who understand the business do not understand the data very well, and those who understand the data do not understand the business very well; ③ The problem of data islands between departments and systems is common, and the data between different departments and systems is isolated, resulting in the inability to integrate and share data.

[0003] As an advanced knowledge representation tool, knowledge graph provides a new way to manage and display data through structured and semantic methods. By organizing information in the form of nodes and edges, knowledge graph can effectively reveal and display entities (such as people, places, events, etc.) and their relationships, helping enterprises to understand and use data more intuitively.

[0004] However, how to automatically transform the complex, multi-source and heterogeneous data in an enterprise into a structured knowledge graph to break data silos and improve data utilization is a major technical challenge currently faced by enterprises. The present invention aims to solve this technical problem and provide a method and system that can efficiently and intelligently transform enterprise data into a knowledge graph that can be used for business applications, thereby improving the overall utilization of data. Summary of the invention

[0005] In view of the above existing problems, the present invention is proposed.

[0006] Therefore, the present invention provides a method, system, device and storage medium for automatically constructing an industrial knowledge graph to solve the problem of how to automatically convert the complex, multi-source and heterogeneous data in an enterprise into a structured knowledge graph to break data silos and improve data utilization.

[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0008] In a first aspect, the present invention provides a method for automatically constructing an industrial knowledge graph, comprising: establishing an embedding layer for unstructured data to map words into word vectors, obtaining entities and categories in the word vectors through a feedforward neural network, and constructing a first knowledge graph after judging and extracting the relationships between entities; for structured data, using triples to map the data structure of the structured data into ontology and relationships, and constructing a second knowledge graph after obtaining the relationship structure between entities based on the mapping relationship; regularly executing data crawling tasks, detecting updated data and performing dynamic knowledge fusion, and updating and optimizing the first knowledge graph and the second knowledge graph based on the results of the dynamic knowledge fusion.

[0009] As a preferred solution of the method for automatically constructing an industrial knowledge graph according to the present invention, the step of establishing an embedding layer to map words into word vectors includes:

[0010] Based on the industrial knowledge dictionary, each word in the unstructured data is randomly mapped to a multi-dimensional vector. For the input text sequence X=[x1,x2,…,x n ] for each word in the search for the corresponding embedding matrix to obtain the corresponding vector representation e n , that is, the input text sequence X=[x1,x2,…,x n ] is mapped to a word vector sequence E=[e1,e2,…,e n ], where x n Represents the nth word in the input text sequence;

[0011] Each word in the unstructured data is positionally encoded by the sine and cosine function generation method. The length of the input text sequence is set to L, and the dimension of the word vector is set to d. Then, the value of the code P corresponding to the word at the posth position in the i-th dimension is represented by the sine and cosine function as follows:

[0012] When i is an even number (i=2k): ,

[0013] When i is an odd number (i=2k+1): ,

[0014] The position code P corresponding to the nth word is expressed as [ , , , , ... , , ];

[0015] A vector sequence Z combining word semantics and position information is obtained by adding the word vector sequence and the position code, and the vector sequence Z serves as the initial input of subsequent multi-layer attention mechanisms and feedforward neural networks.

[0016] As a preferred solution of the method for automatically constructing an industrial knowledge graph according to the present invention, the method of obtaining entities and categories in the word vector by a feedforward neural network includes:

[0017] Set the number of attention heads of the multi-head attention mechanism and randomly initialize the weight matrix W using the Xavier method Q , W k , W v , taking the vector sequence Z as the input sequence and calculating through the initialized weight matrix, and then mapping it into a query vector Q, a key vector K and a value vector V;

[0018] Calculate the attention score and use the query vector Q and key vector K T The dot product between them measures the similarity, where the key vector K T is the key vector K of another word under the same model; when the dot product between the query vector Q and a key vector K is large, it means that the two words are similar or related in the feature space; when the dot product between the query vector Q and a key vector K is small, it means that the relationship between the two words is weak;

[0019] Applying a softmax function to normalize the attention score into a probability distribution so that the sum of all attention weights is 1, and obtaining similarity weights between the current word and other words, and using the similarity weights to perform weighted summation on the value vector V to obtain the final representation of each query vector;

[0020] The outputs of multiple heads in the multi-head attention mechanism are concatenated and input into the feedforward neural network for concatenation and normalization to obtain the output vector h;

[0021] Perform a softmax operation on the output vector h to obtain the probability distribution of each tag belonging to each entity tag, select the tag with the highest probability as the final predicted tag of each tag, that is, obtain the entity and category in the word vector sequence according to the final predicted tag of each tag, perform cross entropy loss judgment on the final predicted tag and the true tag, calculate the gradient of the cross entropy loss relative to logits by the chain rule, and then calculate the gradient of the loss function relative to the model parameters, repeatedly iterate the above process, and use the gradient descent optimization method to optimize and adjust the weight matrix W Q , W k , W v , the iteration ends when the cross entropy loss reaches convergence.

[0022] As a preferred solution of the method for automatically constructing an industrial knowledge graph according to the present invention, the judgment and extraction of the relationship between entities includes:

[0023] The relationship between each entity pair is calculated based on the entities and categories in the word vector sequence obtained. For entity pairs e1 and e2, their starting and ending positions in the sequence are (s1, e1) and (s2, e2), respectively, where s1 and e1 represent the token index of the starting and ending positions of an entity in the sentence, respectively. The pre-trained language model BERT is used to calculate the representation of the entity pair from the output:

[0024] ,

[0025] Among them, h i Represents the hidden state of the token from the starting position s1 to the ending position e1, represents the sum of all token hidden states from position s1 to e1, Represents the normalization factor used to calculate the average value of the token hidden state.

[0026] As a preferred solution of the method for automatically constructing an industrial knowledge graph according to the present invention, the construction of the first knowledge graph includes:

[0027] The representations of the two entity pairs are concatenated, and a fully connected layer is used to classify the concatenated entity pair representations. The probability of each relationship category in the classified entity pairs is calculated by the softmax function, and the entity pairs and relationships corresponding to the category with the highest predicted relationship label are sequentially imported into the knowledge graph to obtain the first knowledge graph based on the current text sequence.

[0028] As a preferred solution of the method for automatically constructing an industrial knowledge graph according to the present invention, the construction of the second knowledge graph includes:

[0029] For structured data, each type of data entity in the database is defined as an ontology, and each piece of data is defined as an entity. The system automatically retrieves database data according to the configuration, and builds the entity object corresponding to the current ontology according to the data table data corresponding to the ontology. Each piece of data represents a corresponding knowledge graph entity, and each field of each piece of data is the attribute information of the current entity. The corresponding field configuration and data are used to fill in the entity attributes to complete the generation of the corresponding knowledge graph node;

[0030] According to the ontology, other ontologies that have maintained custom relationships with the current ontology are searched, and the relationship between entities is constructed through the primary and foreign key relationships. According to the relationship between entities, a second knowledge graph is constructed. If there are two ontology defects and ontology equipment, and there is a relationship between the equipment and the defect, that is, it is determined that the equipment has defects, then there may be multiple defect record entities in the corresponding specific equipment table. At this time, the corresponding equipment and defect relationship is automatically generated through the primary and foreign key relationships.

[0031] As a preferred solution of the method for automatically constructing an industrial knowledge graph according to the present invention, the detecting updated data and performing dynamic knowledge fusion includes:

[0032] Provides visual retrieval and revision functions for knowledge graphs. Users can perform fuzzy retrieval of knowledge graphs by entity name, ontology name, and attribute keywords, and view entity objects and the relationships between entities through visual operations.

[0033] The underlying system uses Neo4j as a knowledge graph database to store and manage knowledge graph data. The development tool class manages the connection with Neo4j to realize the encapsulation of query, modification, deletion, and addition operations.

[0034] AntV-G6 was selected as the front-end visualization framework for the display of graph data.

[0035] As a preferred solution of the method for automatically constructing an industrial knowledge graph according to the present invention, the updating and optimizing of the first knowledge graph and the second knowledge graph includes:

[0036] Scan new data through entity recognition, compare the new entity with existing entities when a new entity is recognized, assign a globally unique identifier to the new entity if the new entity is different from the existing entity, extract the relationship between the new entity and the existing entity based on the attributes of the new entity, and integrate the new entity into the first knowledge graph or the second knowledge graph;

[0037] If the new entity is a duplicate of an existing entity, detect attribute changes of the existing entity, locate the corresponding existing entity in the first knowledge graph or the second knowledge graph, update the attributes of the entity, and create a historical record for the changed attributes;

[0038] A deep learning model is used to identify new relationships between entities from new data. If the new relationship does not exist in the first knowledge graph or the second knowledge graph, the type and attributes of the new relationship are normalized and the new relationship is integrated into the first knowledge graph or the second knowledge graph.

[0039] As a preferred solution of the method for automatically constructing an industrial knowledge graph according to the present invention, the updating and optimizing of the first knowledge graph and the second knowledge graph further comprises:

[0040] If the new relationship already exists in the first knowledge graph or the second knowledge graph, detect the weight and attribute changes of the existing relationship, locate the corresponding existing relationship in the first knowledge graph or the second knowledge graph, and update the existing relationship attributes and weights. The weight update of the relationship is expressed as,

[0041] ,

[0042] in, represents the updated relationship weight, represents the weight of the existing relationship, represents the learning rate that controls the step size of weight updates, represents the magnitude of the weight change, The threshold value indicating the magnitude of change, represents the confidence calculated based on the gating, Represents the parameter that adjusts the influence of confidence on weight update.

[0043] In a second aspect, the present invention provides a system for automatically constructing an industrial knowledge graph, comprising:

[0044] A first knowledge graph construction unit is used to establish an embedding layer for unstructured data to map words into word vectors, obtain entities and categories in the word vectors through a feedforward neural network, and construct a first knowledge graph after judging and extracting the relationship between each entity;

[0045] A second knowledge graph construction unit is used to map the data structure of the structured data into an ontology and a relationship using triples for the structured data, and to construct a second knowledge graph after acquiring the relationship structure between entities according to the mapping relationship;

[0046] An update optimization unit is used to periodically execute data crawling tasks, detect updated data and perform dynamic knowledge fusion, and update and optimize the first knowledge graph and the second knowledge graph according to the results of the dynamic knowledge fusion.

[0047] In a third aspect, the present invention provides a computing device, comprising:

[0048] Memory and processor;

[0049] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method are implemented.

[0050] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions, which implement the steps of the method when executed by a processor.

[0051] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention provides a method for quickly constructing a knowledge graph from structured business data, which can realize the automated construction of the knowledge graph and the transformation of structured data into ternary relationships, and can reduce a large amount of manual annotation and the generation process of the knowledge graph; and the present invention can be customized based on the historical data of the enterprise to realize the customized construction of the enterprise-level data knowledge graph, which is more targeted and accurate than the common sense knowledge graph, and is more conducive to data mining and analysis by the enterprise, and realizes the combination of multiple systems and the integration and sharing of data; in addition, the construction process from structured data to the knowledge graph does not involve any industry dependency, and this method can be used to improve decision-making efficiency and quality in other scenarios where similar recommendation decisions are needed. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0053] Figure 1 This is an overall flow chart of a method for automatically constructing an industrial knowledge graph according to an embodiment of the present invention;

[0054] Figure 2 This is an implementation block diagram of a system for automatically constructing an industrial knowledge graph according to an embodiment of the present invention;

[0055] Figure 3 A schematic diagram of automatically generating graph database data for a method for automatically constructing an industrial knowledge graph according to an embodiment of the present invention;

[0056] Figure 4 A schematic diagram of a power plant graph entity of a method for automatically constructing an industrial knowledge graph according to an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0058] Example 1

[0059] Reference Figure 1~Figure 2 As an embodiment of the present invention, a method for automatically constructing an industrial knowledge graph is provided to help users quickly integrate existing data assets, realize the construction of enterprise knowledge graphs, assist users in iterative optimization of knowledge graphs, and ultimately help enterprises realize the mining and utilization of data value. Specifically, the following steps are included:

[0060] S100: Establish an embedding layer for unstructured data to map words into word vectors, obtain entities and categories in the word vectors through a feedforward neural network, judge and extract the relationship between each entity, and then build a first knowledge graph;

[0061] In the embodiment of the present application, establishing an embedding layer to map words into word vectors includes:

[0062] Based on the industrial knowledge dictionary, each word in the unstructured data is randomly mapped to a 512-dimensional vector. For the input text sequence X=[x1,x2,…,x n ] for each word in the search for the corresponding embedding matrix to obtain the corresponding vector representation e n , that is, input text sequence X=[x1,x2,…,x n ] is mapped to a word vector sequence E=[e1,e2,…,e n ], where x n Represents the nth word in the input text sequence;

[0063] Furthermore, since the codes generated by the sine and cosine functions are smooth and periodic, they help the model learn position information. In this embodiment, the sine and cosine function generation method is used to perform position encoding on each word in the unstructured data. The length of the input text sequence is set to L, and the dimension of the word vector is set to d. Then, the code P corresponding to the word at the posth position in the i-th dimension is represented by the sine cosine function as follows:

[0064] When i is an even number (i=2k): ,

[0065] When i is an odd number (i=2k+1): ,

[0066] The position code P corresponding to the nth word is expressed as [ , , , , ... , , ];

[0067] By adding the word vector sequence and the position code, we get a vector sequence Z that combines the word semantics and position information. This vector sequence Z is used as the initial input of the subsequent multi-layer attention mechanism and feedforward neural network to determine the entity label of each word.

[0068] In an embodiment of the present application, obtaining entities and categories in word vectors through a feedforward neural network includes:

[0069] Since industrial knowledge is relatively standardized and unified, it does not require particularly strong expression ability. In order to avoid overfitting and reduce performance loss, the number of attention heads of the multi-head attention mechanism is set to 8, and the weight matrix W is randomly initialized using the Xavier method. Q , W k , W v , where the matrix W Q , W k , W v The dimensions are all set to (512, 64). The vector sequence Z is used as the input sequence and then mapped to the query vector Q, key vector K and value vector V after calculation through the initialized weight matrix, which is expressed as:

[0070] ,

[0071] ,

[0072] ,

[0073] Further, the attention score is calculated and the query vector Q and key vector K are used T The dot product between (the key vector K of another word under the same model) measures the similarity, that is:

[0074] ,

[0075] It should be noted that when the dot product between the query vector Q and a key vector K is large, it means that the two words are similar or related in the feature space, and when the dot product between the query vector Q and a key vector K is small, it means that the relationship between the two words is weak; among them, a larger dot product means that the directions of the two vectors in the feature space are closer, indicating that the words or concepts they represent are similar or highly related in some sense, and a smaller dot product means that the directions of the two vectors in the feature space are quite different, suggesting that the correlation between the words or concepts they represent is weak.

[0076] Furthermore, the softmax function is applied to normalize the attention score into a probability distribution so that the sum of all attention weights is 1, and the similarity weights between the current word and other words are obtained, which is expressed as:

[0077] ,

[0078] The final representation of each query vector is obtained by weighted summing of the value vector V using the similarity weight, which is expressed as:

[0079] ,

[0080] The outputs of multiple heads in the multi-head attention mechanism are concatenated and input into the feedforward neural network for concatenation and normalization to obtain the output vector h, which is expressed as:

[0081] MultiHead(Q,K,V)=[head1,…,head h ]W O ,

[0082] FFN(x)=ReLU(xW1+b1)W2+b 2,

[0083] LayerNorm(x+Sublayer(x)),

[0084] Furthermore, a softmax operation is performed on the output vector h to obtain the probability distribution of each tag belonging to each entity tag, and the tag with the highest probability is selected as the final predicted tag of each tag, that is, the entity and category in the word vector sequence are obtained according to the final predicted tag of each tag;

[0085] It should be noted that the cross entropy loss is judged for the final predicted label and the true label, and the gradient of the cross entropy loss relative to logits is calculated by the chain rule, and then the gradient of the loss function relative to the model parameters is calculated. The above process is iterated repeatedly, and the weight matrix W is optimized and adjusted using the gradient descent optimization method. Q , W k , W v , the iteration ends when the cross entropy loss reaches convergence.

[0086] In the embodiment of the present application, judging and extracting the relationship between each entity and constructing the first knowledge graph includes:

[0087] The relationship between each entity pair is calculated based on the entities and categories in the obtained word vector sequence. For entity pairs e1 and e2, their starting and ending positions in the sequence are (s1, e1) and (s2, e2), respectively, where s1 and e1 represent the token index of the starting and ending positions of an entity in the sentence, respectively. The pre-trained language model BERT is used to calculate the representation of the entity pair from the output:

[0088] ,

[0089] Among them, hi Represents the hidden state of the token from the starting position s1 to the ending position e1, represents the sum of all token hidden states from position s1 to e1, Represents the normalization factor, which is used to calculate the average value of the token hidden state;

[0090] Concatenate the representations of two entity pairs:

[0091] ,

[0092] in, ;

[0093] Use a fully connected layer to classify the concatenated entity pair representations:

[0094] ,

[0095] Where W is the weight matrix, , used to map the input vector to the output vector. It is a trainable parameter that is constantly adjusted during the training process to minimize the loss function. b is the bias vector, which is the bias parameter in the network. K is the number of relationship categories, and z is the result of linear transformation;

[0096] The probability of each relationship category in the classified entity pairs is calculated through the softmax function, and the entity pairs and relationships corresponding to the category with the highest predicted relationship label are imported into the knowledge graph in turn to obtain the first knowledge graph based on the current text sequence.

[0097] S200: Mapping the data structure of the structured data into ontology and relationship using triples, and constructing a second knowledge graph after acquiring the relationship structure between entities according to the mapping relationship;

[0098] In the embodiment of the present application, constructing the second knowledge graph includes:

[0099] For structured data, each type of data entity in the database is defined as an ontology, and each piece of data is defined as an entity. The system automatically retrieves database data according to the configuration, and builds the entity object corresponding to the current ontology according to the data table data corresponding to the ontology. Each piece of data represents a corresponding knowledge graph entity, and each field of each piece of data is the attribute information of the current entity. The corresponding field configuration and data are used to fill in the entity attributes to complete the generation of the corresponding knowledge graph node;

[0100] Based on the ontology, other ontologies that have maintained custom relationships with the current ontology are searched, and the relationship between entities is constructed through the primary and foreign key relationships. Based on the relationship between entities, a second knowledge graph is constructed. If there are two ontology defects and ontology equipment, and there is a relationship between the equipment and the defect, that is, the equipment is deemed to have defects, then there may be multiple defect record entities in the corresponding specific equipment table. At this time, the corresponding equipment and defect relationship is automatically generated through the primary and foreign key relationships.

[0101] It should be noted that in the knowledge graph, triples are usually used to represent the relationship between nodes. The format is (subject, predicate, object). The subject represents the starting node of the relationship, the predicate represents the type of relationship, and the object represents the end node of the relationship. At the same time, each entity will have some attribute information.

[0102] It should be noted that in standard database design, entities, attributes, relationships and their constraints are first determined through tools such as ER diagrams. At the same time, the third normal form is followed to convert the conceptual model into a logical model. Usually, a relational model is used to define important keys such as primary keys and foreign keys, and finally form the corresponding data structure. Each entity in the database ER diagram represents a type of data in real life, which is different from each data in the knowledge graph as an entity. We define each type of data entity in the database as an ontology, and each piece of data as an entity. The entity can inherit the relationship and structure of the ontology, but the corresponding attributes and relationships are filled in by its specific data.

[0103] S300: regularly executing data crawling tasks, detecting updated data and performing dynamic knowledge fusion, and updating and optimizing the first knowledge graph and the second knowledge graph according to the results of the dynamic knowledge fusion;

[0104] In the embodiment of the present application, a visual retrieval and revision function of the knowledge graph is provided. The user can perform fuzzy retrieval of the knowledge graph through entity name, ontology name, and attribute keywords. The entity objects and the relationship between entities can be viewed through visual operations to support revision processing. The overall quality of the knowledge graph can be improved through continuous revision. The underlying system uses Neo4j as the knowledge graph database to store and manage knowledge graph data. The development tool class management is connected to Neo4j to implement the encapsulation of query, modification, deletion, and new addition operations, and provide corresponding methods for upper-level and third-party calls. AntV-G6 is selected as the front-end visualization framework for the display of graph data, and the visual display of the knowledge graph is implemented on the front end, including the rendering and layout of nodes and edges, and supports user interactive operations such as query, modification, deletion, and update.

[0105] In an embodiment of the present application, updating and optimizing the first knowledge graph and the second knowledge graph includes:

[0106] Scan new data through entity recognition. When a new entity is recognized, compare the new entity with the existing entity. If the new entity is different from the existing entity, assign a globally unique identifier to the new entity, extract the relationship between the new entity and the existing entity based on the attributes of the new entity, and integrate the new entity into the first knowledge graph or the second knowledge graph;

[0107] Further, if the new entity is a duplicate of an existing entity, detect attribute changes of the existing entity, locate the corresponding existing entity in the first knowledge graph or the second knowledge graph, update the attributes of the entity, and create a historical record for the changed attributes;

[0108] Furthermore, a deep learning model is used to identify new relationships between entities from the new data. If the new relationship does not exist in the first knowledge graph or the second knowledge graph, the type and attributes of the new relationship are normalized and the new relationship is integrated into the first knowledge graph or the second knowledge graph.

[0109] Furthermore, if the new relationship already exists in the first knowledge graph or the second knowledge graph, the weight and attribute changes of the existing relationship are detected, the corresponding existing relationship is located in the first knowledge graph or the second knowledge graph, and the existing relationship attributes and weights are updated. The weight update of the relationship is expressed as,

[0110] ,

[0111] in, represents the updated relationship weight, represents the weight of the existing relationship, represents the learning rate that controls the step size of weight update, represents the magnitude of the weight change, The threshold value indicating the magnitude of change, represents the confidence calculated based on the gating, Represents the parameter that adjusts the influence of confidence on weight update.

[0112] From the above, it can be seen that the present invention provides a method for quickly constructing a knowledge graph from structured business data, which can realize the automatic construction of the knowledge graph and the conversion of structured data into ternary relationships, and can reduce a large amount of manual annotation and knowledge graph generation process; and the present invention can be customized based on the company's historical data to realize the customized construction of the enterprise-level data knowledge graph, which is more targeted and accurate than the common sense knowledge graph, and is more conducive to data mining and analysis by the enterprise, and realizes the combination of multiple systems and the integration and sharing of data; in addition, the construction process from structured data to the knowledge graph does not involve any industry dependency, and this method can be used to improve decision-making efficiency and quality in other scenarios where similar recommendation decisions are needed.

[0113] The above is a schematic scheme of a method for automatically constructing an industrial knowledge graph in this embodiment. It should be noted that the technical scheme of the system for automatically constructing an industrial knowledge graph and the technical scheme of the method for automatically constructing an industrial knowledge graph are of the same concept. For details not described in detail in the technical scheme of the system for automatically constructing an industrial knowledge graph in this embodiment, please refer to the description of the technical scheme of the method for automatically constructing an industrial knowledge graph.

[0114] like Figure 2 As shown, this embodiment also provides a system for automatically constructing an industrial knowledge graph, including:

[0115] The first knowledge graph construction unit 400 is used to establish an embedding layer for unstructured data to map words into word vectors, obtain entities and categories in the word vectors through a feedforward neural network, and construct a first knowledge graph after judging and extracting the relationship between each entity;

[0116] The second knowledge graph construction unit 500 is used to map the data structure of the structured data into ontology and relationship using triples for the structured data, and to construct the second knowledge graph after acquiring the relationship structure between entities according to the mapping relationship;

[0117] The update optimization unit 600 is used to periodically execute data crawling tasks, detect updated data and perform dynamic knowledge fusion, and update and optimize the first knowledge graph and the second knowledge graph according to the results of the dynamic knowledge fusion.

[0118] The above-mentioned unit modules may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to the above-mentioned modules.

[0119] This embodiment also provides a computing device, which includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for automatically constructing an industrial knowledge graph is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the housing of the computer device, or an external keyboard, touchpad or mouse.

[0120] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method proposed in the above embodiment is implemented.

[0121] The storage medium proposed in this embodiment and the method proposed in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0122] Through the above description of the implementation mode, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course can also be implemented by hardware, but in many cases the former is a better implementation mode. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer's floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of various embodiments of the present invention.

[0123] Example 2

[0124] Reference Figure 3~Figure 4 Based on the previous embodiment, this embodiment provides an application example of a method, system, device and storage medium for automatically constructing an industrial knowledge graph to verify and illustrate the technical effects used in this method.

[0125] This example is based on the analysis of equipment data and equipment maintenance manuals of a thermal power plant, where structured data includes physical equipment information, logical equipment information, and defect records, and unstructured data is the equipment maintenance manual, which contains equipment information instructions, maintenance methods, etc. First, determine the scope of the knowledge graph data to be constructed, organize the data according to actual business, perform preliminary cleaning, merge the required structured data, and store it in the database for persistence;

[0126] For unstructured data, on-site users analyze and select the required document information, and import the corresponding text data into the system in batches. The system automatically generates a fill-in graph database and generates a knowledge graph of related equipment.

[0127] For structured data, sort out the database ER relationship, perform ontology abstraction based on business and data ER relationship, and abstract multiple entities such as physical devices, logical devices, components, defects, etc. Figure 4 The figure shows the power plant graph entity, configures the relevant table mapping, clarifies the final ontology of the final knowledge graph, and confirms the attributes of each ontology and the relationship between ontologies; configures the relevant ontology information in the system, and the system automatically extracts and constructs each entity object from the data table through the relevant ontology configuration, and inherits the relationship between ontologies, realizes the structural association between entities through the primary and foreign key relationship, and generates the relevant equipment knowledge graph through the automatic generation of graph database data;

[0128] Finally Figure 3 The number of nodes and edges of the generated graph database is 115289 and 185637 respectively.

[0129] Through the program page, you can search and view the knowledge graph, perform data crawling tasks regularly, detect updated data, and perform dynamic knowledge fusion to update and optimize the first knowledge graph and the second knowledge graph.

[0130] From the above, it can be seen that the present invention can realize the automatic construction of knowledge graphs and the transformation of structured data into ternary relationships, which can reduce a large amount of manual annotation and knowledge graph generation process; and the present invention can perform customized construction based on enterprise historical data to realize customized construction of enterprise-level data knowledge graphs, which are more targeted and accurate than common sense knowledge graphs, and are more conducive to data mining and analysis by enterprises, and realize the combination of multiple systems and the integration and sharing of data; in addition, the construction process from structured data to knowledge graphs does not involve dependence on any industry, and this method can be used to improve decision-making efficiency and quality in other scenarios where similar recommendation decisions are needed.

[0131] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

[0132] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The schemes in the embodiments of the present application may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.

[0133] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0134] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps for the functions specified in one or more boxes.

[0136] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0137] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for automatically constructing an industrial knowledge graph, characterized in that: include, For unstructured data, an embedding layer is established to map words into word vectors, entities and categories in the word vectors are obtained through a feedforward neural network, and the relationship between each entity is judged and extracted to construct the first knowledge graph; The establishment of an embedding layer to map words into word vectors includes: Based on the industrial knowledge dictionary, each word in the unstructured data is randomly mapped to a multi-dimensional vector. For the input text sequence X = [x1, x2, ..., x n ] to find the corresponding embedding matrix for each word in the text to obtain the corresponding vector representation e n , that is, the input text sequence X = [x1, x2, ..., x n ] is mapped to a word vector sequence E = [e1, e2, …, e n ], where x n Represents the nth word in the input text sequence; Each word in the unstructured data is positionally encoded by the sine and cosine function generation method. The length of the input text sequence is set to L, and the dimension of the word vector is set to d. Then, the value of the code P corresponding to the word at the posth position in the i-th dimension is represented by the sine cosine function as follows: When i is an even number: When i is an odd number: The position code P corresponding to the nth word is expressed as A vector sequence Z combining word semantics and position information is obtained by adding the word vector sequence and the position code, and the vector sequence Z is used as the initial input of the subsequent multi-layer attention mechanism and feedforward neural network; The obtaining of entities and categories in the word vector by a feedforward neural network includes: Set the number of attention heads of the multi-head attention mechanism and randomly initialize the weight matrix W using the Xavier method Q , W k , W v , taking the vector sequence Z as the input sequence and calculating through the initialized weight matrix, and then mapping it into a query vector Q, a key vector K and a value vector V; Calculate the attention score and use the query vector Q and key vector K T The dot product between them measures the similarity, where the key vector K T is the key vector K of another word under the same model; Applying a softmax function to normalize the attention score into a probability distribution so that the sum of all attention weights is 1, and obtaining the similarity weights between the current word and other words, and using the similarity weights to perform weighted summation on the value vector V to obtain the final representation of each query vector; The outputs of multiple heads in the multi-head attention mechanism are concatenated and input into the feedforward neural network for concatenation and normalization to obtain the output vector h; Perform a softmax operation on the output vector h to obtain the probability distribution of each tag belonging to each entity tag, select the tag with the highest probability as the final predicted tag of each tag, that is, obtain the entity and category in the word vector sequence according to the final predicted tag of each tag, perform cross entropy loss judgment on the final predicted tag and the true tag, calculate the gradient of the cross entropy loss with respect to logits by the chain rule, and then calculate the gradient of the loss function with respect to the model parameters; Repeatedly iterate the processing flow of the multi-head attention mechanism and feedforward neural network, and use the gradient descent optimization method to optimize and adjust the weight matrix W Q , W k , W v , the iteration ends when the cross entropy loss reaches convergence; The judgment and extraction of the relationship between each entity includes: The relationship between each entity pair is calculated based on the entities and categories in the word vector sequence obtained. For entity pairs e1 and e2, their starting and ending positions in the sequence are (s1, e1) and (s2, e2), respectively, where s1 and e1 represent the token index of the starting and ending positions of an entity in the sentence, respectively. The pre-trained language model BERT is used to calculate the representation of the entity pair from the output: Among them, h i Represents the hidden state of the token from the starting position s1 to the ending position e1, represents the sum of all token hidden states from position s1 to e1, Represents the normalization factor, which is used to calculate the average value of the token hidden state; The constructing of the first knowledge graph includes: The representations of the two entity pairs are concatenated, and the concatenated entity pair representations are classified using a fully connected layer. The probability of each relationship category in the classified entity pairs is calculated using a softmax function, and the entity pairs and relationships corresponding to the category with the highest predicted relationship label are sequentially imported into the knowledge graph to obtain a first knowledge graph based on the current text sequence. For structured data, a triple is used to map the data structure of the structured data into an ontology and a relationship, and a second knowledge graph is constructed after the relationship structure between entities is obtained according to the mapping relationship; The constructing of the second knowledge graph includes: For structured data, each type of data entity in the database is defined as an ontology, and each piece of data is defined as an entity. The system automatically retrieves database data according to the configuration, and builds the entity object corresponding to the current ontology according to the data table data corresponding to the ontology. Each piece of data represents a corresponding knowledge graph entity, and each field of each piece of data is the attribute information of the current entity. The corresponding field configuration and data are used to fill in the entity attributes to complete the generation of the corresponding knowledge graph node; Searching for other ontologies that have maintained custom relationships with the current ontology based on the ontology, and constructing relationships between entities through primary and foreign key relationships, and constructing a second knowledge graph based on the relationships between entities; Regularly execute data crawling tasks, detect updated data and perform dynamic knowledge fusion, and update and optimize the first knowledge graph and the second knowledge graph according to the results of the dynamic knowledge fusion; The detecting updated data and performing dynamic knowledge fusion includes: Provides visual retrieval and revision functions for knowledge graphs. Users can perform fuzzy retrieval of knowledge graphs by entity name, ontology name, and attribute keywords, and view entity objects and the relationships between entities through visual operations. The underlying system uses Neo4j as a knowledge graph database to store and manage knowledge graph data. The development tool class manages the connection with Neo4j to realize the encapsulation of query, modification, deletion, and addition operations. AntV-G6 was selected as the front-end visualization framework for displaying graph data; The updating and optimizing of the first knowledge graph and the second knowledge graph includes: Scan new data through entity recognition, compare the new entity with existing entities when a new entity is recognized, assign a globally unique identifier to the new entity if the new entity is different from the existing entity, extract the relationship between the new entity and the existing entity based on the attributes of the new entity, and integrate the new entity into the first knowledge graph or the second knowledge graph; If the new entity is a duplicate of an existing entity, detect attribute changes of the existing entity, locate the corresponding existing entity in the first knowledge graph or the second knowledge graph, update the attributes of the entity, and create a historical record for the changed attributes; Using a deep learning model to identify new relationships between entities from new data, if the new relationship does not exist in the first knowledge graph or the second knowledge graph, normalizing the type and attributes of the new relationship and integrating the new relationship into the first knowledge graph or the second knowledge graph; If the new relationship already exists in the first knowledge graph or the second knowledge graph, detect the weight and attribute changes of the existing relationship, locate the corresponding existing relationship in the first knowledge graph or the second knowledge graph, and update the existing relationship attributes and weights. The weight update of the relationship is expressed as, Among them, W u represents the updated relationship weight, W c represents the weight of the existing relationship, λ represents the learning rate that controls the step size of the weight update, ΔW represents the magnitude of the weight change, τ represents the threshold of the magnitude of the change, and σ(γ·G i ) represents the confidence calculated according to the gating, and γ represents the parameter that adjusts the influence of the confidence on the weight update.

2. A system for automatically constructing an industrial knowledge graph, using the method for automatically constructing an industrial knowledge graph as claimed in claim 1, characterized in that: include, A first knowledge graph construction unit is used to establish an embedding layer for unstructured data to map words into word vectors, obtain entities and categories in the word vectors through a feedforward neural network, and construct a first knowledge graph after judging and extracting the relationship between each entity; A second knowledge graph construction unit is used to map the data structure of the structured data into an ontology and a relationship using triples for the structured data, and to construct a second knowledge graph after acquiring the relationship structure between entities according to the mapping relationship; as well as, An update optimization unit is used to periodically execute data crawling tasks, detect updated data and perform dynamic knowledge fusion, and update and optimize the first knowledge graph and the second knowledge graph according to the results of the dynamic knowledge fusion.

3. An electronic device, comprising a memory and a processor, characterized in that: The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method according to claim 1 are implemented.

4. A computer-readable storage medium having computer-executable instructions stored thereon, characterized in that: When the computer executable instructions are executed by a processor, the steps of the method according to claim 1 are implemented.

Citation Information

Patent Citations

  • Multi-source heterogeneous network security knowledge graph construction method and device

    CN112131882A

  • Knowledge extraction method, apparatus, electronic device, and storage medium

    WO2021212682A1