Knowledge graph construction method, storage medium, electronic device and computer program product

By combining pattern extraction tasks based on different entity types with large language models, the construction process of professional domain knowledge graphs is simplified, the universality and efficiency of the construction scheme are improved, and the problem of complex pattern design is solved.

WO2026001682A1PCT designated stage Publication Date: 2026-01-02ZTE CORP

Patent Information

Application Number
PCT/CN2025/100434
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-06-26
Filing Date
2025-06-11
Publication Date
2026-01-02

AI Technical Summary

Technical Problem

In the construction of knowledge graphs in professional fields, the pattern design is complex and the construction scheme has poor universality.

Method used

By designing pattern extraction tasks based on different entity types and using large language models to construct knowledge graphs, the design and orchestration of pattern extraction tasks are simplified, making them more applicable to various fields and scenarios.

Benefits of technology

It reduces the complexity of pattern design, improves the universality and efficiency of knowledge graph construction, and reduces the training costs and time consumption for specific professional fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025100434_02012026_PF_FP_ABST
    Figure CN2025100434_02012026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a knowledge graph construction method, a storage medium, an electronic device and a computer program product. The method comprises: acquiring text to be processed and a plurality of schema extraction tasks of different entity types; on the basis of the plurality of schema extraction tasks, extracting a plurality of pieces of entity schema information from said text; converting the plurality of pieces of entity schema information into a plurality of triples; and constructing a knowledge graph on the basis of the plurality of triples.
Need to check novelty before this filing date? Find Prior Art

Description

A knowledge graph construction method, storage medium, electronic device and computer program product

[0001] Cross-reference to Related Applications

[0002] The present disclosure is based on Chinese Patent Application CN202410839807.8 entitled "A knowledge graph construction method, storage medium, electronic device and computer program product" filed on June 26, 2024, and claims priority to the patent application, the disclosure of which is incorporated herein by reference in its entirety. TECHNICAL FIELD

[0003] The present disclosure relates to the field of communication, in particular, to a knowledge graph construction method, storage medium, electronic device and computer program product. BACKGROUND

[0004] A knowledge graph is a structured semantic knowledge base that visualizes and organizes complex knowledge, enabling machines to better understand, store and reason about knowledge. A knowledge graph typically consists of entities, relationships and attributes, forming a network structure. Entities are various objects in the real world, relationships describe the connections between entities, and attributes provide additional information about entities.

[0005] In traditional knowledge graph construction work, entity recognition is a core step. Entity recognition refers to identifying entities in a knowledge graph from text, usually relying on natural language processing (NLP) technology, especially named entity recognition (NER). NER technology can identify meaningful fragments from unstructured text, such as names, places, organizations, etc. There are many methods for entity recognition, including rule-based methods, statistical models, and deep learning-based methods.

[0006] In professional fields, the definition of entities may be more complex, as entities may include specific attributes in addition to specific names, which is referred to as schema design in the field of knowledge graph. The design of schema varies for different fields or scenarios, which is determined by the characteristics of the field or scenario itself.

[0007] Therefore, there is an urgent need for a knowledge graph construction tool with high usability and applicability for professional knowledge graph construction. SUMMARY

[0008] Embodiments of the present disclosure provide a knowledge graph construction method, a storage medium, an electronic device and a computer program product to at least solve the problem of complex mode design of a professional field knowledge graph and poor generality of a knowledge graph construction scheme in the related art.

[0009] According to an embodiment of the present disclosure, a knowledge graph construction method is provided, which includes: obtaining a to-be-processed text and a plurality of mode extraction tasks of different entity types; extracting a plurality of entity mode information from the to-be-processed text according to the plurality of mode extraction tasks; converting the plurality of entity mode information into a plurality of triples; and constructing a knowledge graph according to the plurality of triples. Embodiments of the present disclosure are based on designing mode extraction tasks for different entity types respectively, simplifying complex modes of the knowledge graph, and making mode arrangement simpler, thereby solving the problem of complex mode design of a professional field knowledge graph and poor generality of a knowledge graph construction scheme in the related art.

[0010] According to another embodiment of the present disclosure, a computer-readable storage medium is also provided, which stores a computer program, and when the computer program is run by a processor, the steps in any of the method embodiments described above are performed.

[0011] According to another embodiment of the present disclosure, an electronic device is also provided, which includes a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the method embodiments described above.

[0012] According to another embodiment of the present disclosure, a computer program product is also provided, which includes a computer program, and when the computer program is run by a processor, the steps in any of the method embodiments described above are implemented. BRIEF DESCRIPTION OF DRAWINGS

[0013] FIG. 1 is a hardware structure block diagram of a knowledge graph construction method according to an embodiment of the present disclosure;

[0014] FIG. 2 is a flowchart of a knowledge graph construction method according to an embodiment of the present disclosure;

[0015] FIG. 3 is a structural schematic diagram of a knowledge graph according to an embodiment of the present disclosure;

[0016] FIG. 4 is a flowchart of a plurality of mode extraction tasks according to an embodiment of the present disclosure;

[0017] FIG. 5 is a schematic diagram of a relationship reasoning task according to an embodiment of the present disclosure;

[0018] FIG. 6 is a schematic diagram of a basic unit that can be arranged according to an embodiment of the present disclosure;

[0019] FIG. 7 is a schematic diagram of an overall flow of knowledge graph construction according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] Hereinafter, the embodiments of the present disclosure will be described in detail with reference to the accompanying drawings and in conjunction with embodiments.

[0021] It should be noted that the terms "first", "second" and the like in the description and claims of the present disclosure and the above drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence.

[0022] The method embodiments provided in the embodiments of the present disclosure can be executed in a mobile terminal, a computer terminal or similar computing device. Taking the case of running on a computer terminal, Fig. 1 is a hardware structure block diagram of the knowledge graph construction method of the embodiments of the present disclosure, as shown in Fig. 1, the hardware single board can include one or more (only one is shown in Fig. 1) processors 12 (the processor 12 can include but not limited to a processing device such as a microprocessor or programmable logic device) and a memory 14 for storing data, wherein the above computer terminal can also include a transmission device 16 for communication function and an input and output device 18. Those skilled in the art can understand that the structure shown in Fig. 1 is only schematic, which does not limit the structure of the above computer terminal. For example, the computer terminal can also include more or less components than those shown in Fig. 1, or have a different configuration from that shown in Fig. 1.

[0023] The memory 14 can be used to store computer programs, for example, software programs of application software and modules, such as the computer program corresponding to the knowledge graph construction method in the embodiments of the present disclosure, and the processor 12 executes various functions and the knowledge graph construction method by running the computer program stored in the memory 14, that is, implements the above method. The memory 14 can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 14 can further include a memory remotely arranged with respect to the processor 12, which can be connected to the computer terminal through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0024] The transmission device 16 is used to receive or send data via a network. The specific examples of the above network can include a wireless network provided by a communication provider. In one example, the transmission device 16 includes a network adapter (Network Interface Controller, NIC) which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 16 can be a radio frequency (Radio Frequency, RF) module which is used to communicate with the Internet in a wireless manner.

[0025] In an embodiment of the present disclosure, a knowledge graph construction method is provided. FIG. 2 is a flowchart of the knowledge graph construction method according to an embodiment of the present disclosure. As shown in FIG. 2, the flow includes the following steps:

[0026] In step S202, a plurality of schema extraction tasks of different entity types are obtained from the to-be-processed text.

[0027] In step S204, a plurality of entity schema information are extracted from the to-be-processed text according to the plurality of schema extraction tasks.

[0028] In step S206, the plurality of entity schema information are converted into a plurality of triples.

[0029] In step S208, a knowledge graph is constructed according to the plurality of triples.

[0030] In the field of knowledge graph, schema is a structured model used to describe entities, relationships and attributes in a knowledge graph. Schema defines entity types, relationship types and attribute types in a knowledge graph, as well as the associations and constraints between them.

[0031] In this embodiment, the schema extraction task is designed based on entity types. In the to-be-processed text, the same entity type can correspond to multiple different entities, and each entity can correspond to at least one structured information of relationship and attribute. Each schema extraction task in the present disclosure can extract schema information of a specified entity type from the to-be-processed text.

[0032] In this embodiment, a knowledge graph construction method is designed, which supports splitting schema extraction tasks of complex knowledge graphs, and respectively arranging corresponding schema extraction tasks based on different entity types. The implementation is simpler and more applicable, thereby solving the problems of complex schema design of professional knowledge graphs and poor generality of knowledge graph construction schemes in related technologies.

[0033] In some embodiments, each schema extraction task includes a schema of an entity type, wherein the schema includes a preset entity type, an entity name and at least one entity attribute.

[0034] In an exemplary embodiment, for the operation and maintenance field, the preset entity types can include faults, root causes, solutions, etc. The entity name is a preset fixed key name (key), and the entity attribute is one or more preset attribute key names that can be designed as needed. The schema extraction task is to extract key values corresponding to the key names associated with the specified entity type from the to-be-processed text.

[0035] In an example embodiment, the schema can include: preset entity type; entity name: "format of key value of entity name"; key name of entity attribute 1: "format of key value of entity attribute 1";...; key name of entity attribute n: "format of key value of entity attribute n". The format of key value can be set as a string or a list.

[0036] In some embodiments, the schema can further include a relevant description of each key name, so as to facilitate the extraction of the key value corresponding to the key name from the to-be-processed text by the large language model. For example, if the preset entity type is fault, the schema can include: fault; entity name: "relevant description, returned in string format"; diagnosis rule: "relevant description, returned in string format"; fault root cause: "relevant description, returned in list format". The diagnosis rule and the fault root cause are key names of entity attributes, which are set in advance when the schema extraction task is arranged.

[0037] In some embodiments, step S204 can include the following step: step S2042, extracting the entity name and the entity attribute of at least one entity corresponding to the preset entity type from the to-be-processed text according to each schema extraction task respectively, to obtain a plurality of entity schema information, wherein each entity schema information includes a key value pair of the entity name and the entity attribute, and the number of key value pairs of the entity attribute is greater than or equal to 1.

[0038] In an example embodiment, the entity schema information can include: key value of entity name; key name of entity attribute 1: key value;...; key name of entity attribute n: key value. The format of key value can be set as a string or a list in advance when the schema is arranged, and if the format of key value is a list, it means that the key name of the entity attribute can extract multiple key values. For example, if the preset entity type is fault and the key names of preset attributes are diagnosis rule and fault root cause, the entity schema information can include: server fault; diagnosis rule: server alarm; fault root cause: hardware damage, system crash, software conflict, etc. Wherein, the server fault is the key value of the entity name corresponding to the fault extracted from the to-be-processed text, but the present disclosure is not limited thereto, and each entity type can have multiple corresponding entities. For example, the entity name corresponding to the entity type of fault can also include: database fault, hardware fault, network fault, etc.

[0039] In some embodiments, the method further includes: step S203, determining the dependency relationship between the plurality of schema extraction tasks. Further, the dependency relationship between the tasks can be pre-configured or automatically determined according to the content of the schema extraction task.

[0040] In some embodiments, step S203 can include the following steps:

[0041] Step S2032, determining whether there is a target entity attribute with the same key name in each of the plurality of schema extraction tasks, wherein the target entity type is any one of the plurality of preset entity types, and the target entity attribute is any one of the plurality of entity attributes.

[0042] Step S2034, in the case of a positive determination, determining that the schema extraction task corresponding to the target entity type depends on the schema extraction task corresponding to the target entity attribute.

[0043] In an exemplary embodiment, if the key name of the target entity attribute in the schema of task 1 is fault root cause, and the key name of the target entity type in the schema of task 2 is also fault root cause, it can be determined that task 2 depends on task 1, and task 1 is a prerequisite task of task 2.

[0044] In some embodiments, step S204 can include the following steps:

[0045] Step S2044, determining the execution order of the plurality of schema extraction tasks according to the dependency relationship;

[0046] Step S2046, executing each of the schema extraction tasks on the to-be-processed text in sequence according to the execution order, to obtain the plurality of entity schema information.

[0047] In some embodiments, step S2044 can include the following steps:

[0048] Step S2044-2, constructing a directed acyclic graph according to the plurality of schema extraction tasks and the dependency relationship, taking the input of the to-be-processed text as a starting node, wherein each of the schema extraction tasks corresponds to a node in the directed acyclic graph, and the dependency relationship corresponds to a plurality of directed edges of the directed acyclic graph.

[0049] Step S2044-4, topologically sorting the directed acyclic graph to obtain the execution order.

[0050] In this embodiment, all schema extraction tasks are performed on the to-be-processed text, so the "input of the to-be-processed text" can be regarded as a starting node, and also a prerequisite task that all schema extraction tasks depend on.

[0051] In this embodiment, all edges in the directed acyclic graph (DAG) are directional, and there is no loop, and the topological sorting is a linear ordering of all nodes in the DAG, so that for each directed edge (u, v), node u is arranged in front of node v in the ordering. Further, the algorithm for topological sorting can include the following processes: 1, find the node with an in-degree of 0; 2, record the node in an ordered list (such as a queue) and delete all outgoing edges of the node; 3, update the in-degree of the remaining nodes (decrease the in-degree of the nodes pointed to by the node by 1); 4, repeat steps 1 to 3 until all nodes are traversed.

[0052] In this embodiment, by finding the node with an in-degree of 0, the task that does not depend on other tasks can be executed first. If the initial in-degree of the node is not 0, and the updated in-degree is 0, it indicates that the pre-task on which the task depends has been executed, and the task can be executed.

[0053] Through the embodiments of the present disclosure, multiple pattern extraction tasks can be automatically sorted without manual arrangement, simplifying the complexity of pattern extraction task design and arrangement, and at the same time ensuring the normal operation of the entire knowledge graph knowledge extraction task.

[0054] In some embodiments, step S204 can further include constructing a prompt sentence of the pattern extraction task according to the dependency relationship, and processing the prompt sentence through a preset language model to obtain the entity pattern information.

[0055] In some embodiments, constructing a prompt sentence of the pattern extraction task according to the dependency relationship, and processing the prompt sentence through a preset language model to obtain the entity pattern information can include the following steps:

[0056] Step S2042', determining whether the current pattern extraction task depends on a pre-task according to the dependency relationship, wherein the pre-task is one of the multiple pattern extraction tasks;

[0057] Step S2044', constructing a prompt sentence of the pattern extraction task according to the pattern of the current entity type and the text to be processed in the case where the current pattern extraction task does not depend on the pre-task;

[0058] Step S2046', constructing a prompt sentence of the pattern extraction task according to the execution result of the pre-task, the pattern of the current entity type, and the text to be processed in the case where the current pattern extraction task depends on the pre-task, wherein the execution result is the entity pattern information extracted by the pre-task;

[0059] In step S2048', the prompt sentence of the schema extraction task is input into the preset large language model, and the entity schema information output by the large language model is obtained.

[0060] In this embodiment, a large language model (LLM) is a type of artificial intelligence model that can be used in multiple fields and tasks. It has strong generalization ability and can complete multiple scene tasks without fine-tuning or with a small amount of fine-tuning. The preset large language model can include, but is not limited to, a generative pre-trained transformer (GPT) model, a bidirectional encoder representation transformer (BERT) model, etc.

[0061] In this embodiment, using a large language model can conveniently complete a knowledge extraction task in a specific field. The knowledge extraction model has better universality and does not need to retrain a traditional neural network model for a specific field. This universality makes the process of building a knowledge graph more efficient and flexible, and can be applied to various fields and scenarios, providing more possibilities for the application and expansion of the knowledge graph.

[0062] In some embodiments, in step S2046', if the current schema extraction task depends on the previous task, the prompt sentence of the schema extraction task is constructed according to the execution result of the previous task, the schema of the current entity type, and the to-be-processed text. It can include the following steps: if the current schema extraction task depends on the previous task, the key-value pair of the target entity attribute is obtained from the execution result of the previous task; the prompt sentence is constructed according to the key-value pair of the target entity attribute, the schema, and the to-be-processed text.

[0063] In this embodiment, the format of the key-value pair of the target entity attribute can be set as a string or a list, where each entry in the list is a key-value pair corresponding to the target entity attribute. If the key-value format is a list, the number of key-value pairs of the target entity attribute extracted in the previous task can be greater than 1.

[0064] In some embodiments, the prompt sentence can also be constructed according to the key-value pair of the target entity attribute, the schema, and the to-be-processed text. If the number of key-value pairs of the target entity attribute is greater than 1, the multiple key-value pairs of the target entity attribute are traversed, and one prompt sentence is constructed according to each key-value pair of the target entity attribute, the schema, and the to-be-processed text.

[0065] In an example embodiment, the prompt template of the pattern extraction task can be set as the following two templates according to whether the task depends on a preceding task:

[0066] Template 1, not dependent on a preceding task, the prompt template of the pattern extraction task can be set as the following content: “Assuming you are an expert in a certain professional field, please extract relevant information from the given text and output the results in the following preset format and its interpretation: preset format; {specific content of the pattern}; if the information cannot be found, the corresponding value in the preset format text is empty; text: {specific content of the text to be processed}”.

[0067] Template 2, dependent on a preceding task, the prompt template of the pattern extraction task can be set as the following content: “Assuming you are an expert in a certain professional field, please extract the relevant attributes of the entity {head_name}’{head_entity}’ from the given text and output the results in the following preset format and its interpretation: preset format; {specific content of the pattern}; if the information cannot be found, the corresponding value in the preset format text is empty; text: {specific content of the text to be processed}”.

[0068] In the embodiments of the present disclosure, although the input text to be processed can be regarded as a starting task, since all pattern extraction tasks need to be processed after this node, it can also be regarded as a trigger node of the entire pattern extraction process. In the embodiments, the case where each node only takes “input text to be processed” as a preceding task is excluded when judging whether the task depends on a preceding task.

[0069] In the embodiments, the preset format can be set as JSON format or other data format, which is not limited in the present disclosure. In pattern 2, head_name is both the entity type of the current task and the key name of the entity attribute of the preceding task, and head_entity is the key value (which can be one or more) of the entity attribute determined according to the extraction result of the preceding task.

[0070] In some embodiments, step S206 can include: converting each key-value pair of the entity attribute in the entity pattern information into a relationship element and a tail element in one of the triples, and taking the key value of the corresponding entity name in the entity pattern information as the head element in the triple, to obtain the triple, wherein each triple includes one head element, one relationship element, and one tail element.

[0071] In an example embodiment, the triple can be expressed as (head, relation, tail), wherein the head element (head) corresponds to an entity (Entity) in the knowledge graph, the relation element (relation) corresponds to a relationship (Relationship) in the knowledge graph, and the tail element (tail) corresponds to an attribute (Attribute) in the knowledge graph.

[0072] Further, the key value of the entity name is converted into the head element in the triple, the key name of the entity attribute is converted into the relation element in the triple, and the key value of the entity attribute is converted into the relation element in the triple.

[0073] In some embodiments, after step S206, the method further comprises step S207 of knowledge fusion, which can specifically include the following steps:

[0074] Step S2072, determining the similarity between a plurality of head elements or a plurality of tail elements in the plurality of triples;

[0075] Step S2074, merging a plurality of head elements or a plurality of tail elements with a similarity greater than a preset threshold.

[0076] In an example embodiment, step S2072 can evaluate the similarity between each element based on a string similarity or semantic similarity algorithm. If two head elements are similar, the head elements are merged, and the tail elements associated with the two head elements are associated with the merged head element. If two tail elements are similar, the tail elements are merged, and the head elements associated with the two tail elements are associated with the merged tail element.

[0077] In some embodiments, the method further comprises step S209 of knowledge reasoning, which can specifically include the following steps:

[0078] Step S2092, obtaining a preconfigured relationship reasoning task, wherein the relationship reasoning task includes the key name of two target attributes;

[0079] Step S2094, determining a prerequisite task of the relationship reasoning task from the plurality of schema extraction tasks according to the key name of each target attribute, and determining the key value pair of the corresponding target attribute from the execution result of the prerequisite task;

[0080] Step S2096, constructing a prompt sentence of the relationship reasoning task according to the key value pair of the two target attributes;

[0081] Step S2098, inputting the prompt sentence of the relationship reasoning task into a preset large language model to obtain a relationship reasoning result output by the large language model.

[0082] In this embodiment, the relationship reasoning task can also be a preconfigured task type for reasoning whether there is an association relationship between the key names of two specified target attributes. The key names of the target attributes are pre-set when the relationship reasoning task is arranged, and the key values of the target attributes are obtained from the extraction results of the preceding task. If the preceding task extracts multiple key value pairs of target attributes from the text, the relationship reasoning task will iterate through each key value of the target attribute, respectively generate a corresponding prompt statement, and process the prompt statement through a large language model to obtain the relationship reasoning result between each pair of target attribute key values.

[0083] In an example embodiment, the prompt statement template of the relationship reasoning task can be set as "Assuming you are an expert in a certain professional field, do you think {head_name}'{head_entity}' and {tail_name}'{tail_entity}' have a relationship? First answer yes or no, and then give an analysis". Wherein, head_name is the key name of the first target attribute, head_entity is the key value of the first target attribute, tail_name is the key name of the second target attribute, and tail_entity is the key value of the second target attribute.

[0084] In the embodiment of the present disclosure, a knowledge graph construction method is designed, which supports the splitting of the mode extraction task of a complex knowledge graph, and arranges corresponding mode extraction tasks based on different entity types, so that the implementation is simpler and more applicable, thereby solving the problem of complex mode design of professional knowledge graphs and poor generality of knowledge graph construction schemes in related technologies. Through the mode extraction process and graph construction process in the embodiment of the present disclosure, the complexity of mode design can be reduced, and the logic of the mode extraction task can be simplified. By using a large language model for knowledge extraction and relationship reasoning, the generality of the knowledge graph construction scheme can be improved, and the need to train a special neural network model for a professional field in the traditional knowledge graph construction scheme can be avoided, thereby reducing the cost and time consumption of constructing a knowledge graph.

[0085] The knowledge graph construction method in the present disclosure will be described in detail below based on the three entity types of fault, root cause, and solution in the operation and maintenance scenario. However, the application scenarios and entity types involved in the present disclosure are not limited thereto.

[0086] FIG. 3 is a structural schematic diagram of a knowledge graph in an embodiment of the present disclosure, as shown in FIG. 3, the knowledge graph contains three entity types of fault, root cause, and solution.

[0087] In this embodiment, from the node pointing relationship in the graph, the next-level node of a fault should be the root cause, and the next-level node of a root cause is the solution. For a given fault, there are generally one or more possible candidate root causes, while for a root cause, there is generally only one candidate solution in a single document. There are certain relationships between the three entity types of fault, root cause, and solution. Root cause can be an attribute of fault, and solution can be an attribute of root cause. Furthermore, one fault can correspond to multiple different root causes, and one root cause corresponds to one solution.

[0088] In this embodiment, the patterns for different entity types can be designed as preset structures as needed. Each pattern includes a preset entity type, an entity name, and at least one entity attribute.

[0089] In one exemplary embodiment, the fault schema is designed as follows:

[0090] Fault_schema={

[0091] "name": "Fault name, returned as a string".

[0092] ...(Other relevant attributes omitted here)

[0093] "confirm_rule": "Confirmation rule, describing the rule for diagnosing the existence of the fault. Set to empty if none exists. Returns as a string."

[0094] "root_cause": "Root cause names, returned as a list".

[0095] }

[0096] In this embodiment, "Fault_schema" is the preset entity type, "name" is the key name of the entity name, and "confirm_rule" and "root_cause" are the key names of the entity attributes.

[0097] In one exemplary embodiment, the root cause schema is designed as follows:

[0098] RootCause_schema={

[0099] "name": "Root cause name, returned as a string".

[0100] ...(Other relevant attributes omitted here)

[0101] "confirm_rule": "Diagnosis rule, refers to the judgment rule of whether the root cause is confirmed. If the existing information is not enough to support the judgment, further information collection may be needed for judgment. Returned in string form",

[0102] "solution": "Solution name, returned in string form"

[0103] }

[0104] In an example embodiment, the schema of Solution is designed as follows:

[0105] Solution_schema = {

[0106] "name": "Solution name, returned in string form",

[0107] ...... (other related attributes are omitted)

[0108] "description": "Solution description. Detailed description of the solution, including manual intervention processing or automatic repair scenarios. Returned in string form",

[0109] "repair_rule": "Repair rule, refers to the specific and operable rule for repairing the fault, and needs to give clear operation actions. Returned in string form"

[0110] }

[0111] In this embodiment, the above series of schema define the related attributes of the three types of entities of fault, root cause and solution. The attributes can be given in JSON string or python dict (dictionary) form, the English key name represents the specific attribute, and the Chinese string after the key name is used to explain the specific meaning of the attribute.

[0112] In the embodiments of the present disclosure, the schema design of fault, root cause and solution and the subordinate relationship among them can be configured according to the preset configuration rule to configure the schema extraction task and the dependency relationship among the tasks.

[0113] In some embodiments, the configuration rule can include: a start node set as start, indicating that the input text to be processed starts the entire schema extraction process; a node name of each task is used to represent the specific purpose and meaning of the operation, for example, "fault" represents extracting fault-related information, and { "head": "name"} after the node name indicates the primary key of the schema, so as to facilitate the subsequent conversion of the extracted results into triples for deduplication or knowledge fusion. The edge name is designed as a string structure of "node name->node name", which is used to facilitate the upstream and downstream dependent tasks of marking specific operations, for example, "fault->root_cause" indicates further extracting root cause-related information from fault-related information. The key value after the edge name is the information to be stored on the edge, which can be set as a dictionary (dict) or a pure string to represent different basic operations, wherein the dict represents the schema to be extracted, and the string represents a specific attribute to be extracted (and traversed).

[0114] In an exemplary embodiment, the schema extraction tasks (i.e., nodes) are designed as follows:

[0115] In this embodiment, "head": "name" is used to indicate the primary key of the schema, indicating that the value of the name field in the extraction result of the task will be used as the head element to construct triples subsequently.

[0116] In an exemplary embodiment, the dependency relationship between the schema extraction tasks (i.e., the directed edge connecting two nodes) is designed as follows:

[0117] In this embodiment, the arrow points from start to fault, indicating that the start task needs to be executed first to input the text to be processed, and then the fault task is executed to extract the schema information of the fault, that is, the start task is the pre-task of the fault task, and the fault task depends on the start task.

[0118] In this embodiment, the node "fault" has only one incoming edge "start->fault", and the key value after "start->fault" is Fault_schema, which means that only the original text to be processed needs to be input into the start node to extract the fault-related information according to the text and Fault_schema. Pattern extraction can be realized through a large language model, and the specific prompt statement can refer to other method embodiments in this disclosure, which will not be repeated here.

[0119] In this embodiment, the node "root_cause" has two incoming edges or two front nodes (parent nodes). The names and key values of the two incoming edges are "start->root_cause": RootCause_schema and "fault->root_cause": "root_cause", which indicates that to obtain the root_cause-related information, there are two front dependencies. One is "start->root_cause": RootCause_schema, which represents the original text to be processed and RootCause_schema. The other is the fault node, which represents the extracted entity pattern information of the fault node in the previous step. The specific composition of this information can refer to the Fault_schema in the previous embodiment. In the Fault_schema, there is an attribute called "root_cause". Therefore, the meaning of "fault->root_cause": "root_cause" is to traverse the specific value of the "root_cause" attribute from the Fault-related information (the root cause needs to be traversed because there is more than one root cause, and the "root_cause" attribute in the Fault_schema requires a list to be returned), and to be used for root_cause-related information extraction.

[0120] In this embodiment, the edge "fault->root_cause": "root_cause" indicates that the root cause needs to be traversed from the fault node, and the root cause is the extraction object here. The edge "start->root_cause": RootCause_schema indicates that the original text to be processed and the pattern of the root cause are needed to complete the knowledge extraction.

[0121] In this embodiment, based on the configuration content of the above nodes and edges, the specific operation of each pattern extraction task in the knowledge extraction process and the dependency relationship between each pattern extraction task can be determined, and the technical effects of simplifying the configuration and reducing the complexity of the knowledge extraction task can be achieved.

[0122] In some embodiments, the dependency relationship between the above-mentioned schema extraction tasks can be manually configured or automatically generated according to the specific content of the schema.

[0123] In this embodiment, Fault_schema, RootCause_schema, Solution_schema indicate that the task attributes are given in the form of dict (dictionary), and schema extraction needs to be performed according to the corresponding schema. "root_cause", "solution" indicate that the task attributes are given in the form of string, and schema extraction needs to be performed according to the specified key value (i.e. one or more strings) in the pre-task extraction result.

[0124] FIG. 4 is a flowchart of multiple schema extraction tasks in an embodiment of the present disclosure. As shown in FIG. 4, based on the above-mentioned schema extraction tasks and the dependency relationship between the above-mentioned schema extraction tasks, schema extraction can be performed according to the following steps:

[0125] Step S401, start, input the text to be processed;

[0126] Step S402, fault, extract the entity schema information of the fault;

[0127] Step S403, root_cause, extract the entity schema information of the root cause;

[0128] Step S404, solution, extract the entity schema information of the solution.

[0129] In this embodiment, the node-by-node execution of the flowchart can be converted into a traversal problem of a directed acyclic graph, and the execution order between the nodes can be automatically generated by a topological sorting algorithm without manual configuration.

[0130] In some embodiments, topological sorting is a graph algorithm for sorting a directed acyclic graph according to the dependency order to obtain a linear execution order of the tasks that satisfies the precedence condition, which is widely used in scenarios that need to consider the dependency relationship, such as compilers and project management. The specific implementation can include the following steps: 1, find the node with an in-degree of 0; 2, record the node in an ordered list and delete the outgoing edge of the node; 3, update the in-degree of the remaining nodes to indicate that the pre-dependency of the node has been solved; 4, repeat steps 1 to 3 until the traversal of all nodes is completed.

[0131] In this embodiment, when performing the pattern extraction task, only the nodes in the ordered list generated by the topological sorting algorithm need to be completed in sequence according to the order of the nodes (i.e., the execution order described above). For example, the traversal order of the nodes in FIG. 4 is “start”->“fault”->“root_cause”->“solution”, which is consistent with the hierarchical structure between entities and the normal thinking process. The flowchart only explicitly details the specific dependency relationship between them.

[0132] In this embodiment, the start of the entire pattern extraction task process can be triggered by inputting the text to be processed. After inputting the document, the first thing to be extracted is the basic attributes of the fault and its possible root causes. Then the extracted root causes need to be traversed to extract the basic attributes of these root causes and the solutions. Finally, the solutions extracted in the previous step are traversed to extract the basic attributes of the solutions. After all the pattern extraction tasks are executed, the extraction results of each task can be associated and integrated according to the root causes and solutions.

[0133] In the embodiments of the present disclosure, each pattern extraction task can be implemented based on a large language model. According to whether each pattern extraction task depends on other pattern extraction tasks, the prompt statement of the pattern extraction task can be constructed according to the following two preset prompt statement templates:

[0134] Template 1, not dependent on other pattern extraction tasks, the prompt statement template of the pattern extraction task can be set as follows: “Assuming you are an expert in a certain professional field, please extract relevant information from the given text and output the results in the following preset format and its interpretation: preset format; {specific content of the pattern}; if the information cannot be found, the corresponding value in the preset format text is empty; text: {specific content of the text to be processed}”.

[0135] Template 2, dependent on other pattern extraction tasks, the prompt statement template of the pattern extraction task can be set as follows: “Assuming you are an expert in a certain professional field, please extract the relevant attributes of the entity {head_name}’{head_entity}’ from the given text and output the results in the following preset format and its interpretation: preset format; {specific content of the pattern}; if the information cannot be found, the corresponding value in the preset format text is empty; text: {specific content of the text to be processed}”.

[0136] In an example embodiment, the fault type pattern extraction task only depends on the start node and does not depend on other pattern extraction tasks, the attribute type is a dictionary, the attribute is Fault_schema, and the following prompt statement can be generated based on the above template 1:

[0137] Assuming you are an expert in wired networking, please extract relevant information from the given text and output the results in the following JSON format along with its interpretation:

[0138] JSON;

[0139] {Fault_schema={

[0140] "name": "The fault name, returned as a string".

[0141] ...(Other relevant attributes omitted here)

[0142] "confirm_rule": "Confirmation rule, describing the rule for diagnosing the existence of the fault. Set to empty if none exists. Returns as a string."

[0143] "root_cause": "Root cause names, returned as a list".

[0144] }};

[0145] If no information is found, the corresponding value in the preset format text is left blank;

[0146] text:

[0147] {The specific content of the text to be processed}

[0148] In this embodiment, after interacting with the large language model using this prompt statement, a JSON string will be returned. Parsing this returned result will yield the entity pattern information of the fault.

[0149] In another example embodiment, the root cause pattern extraction task depends not only on the starting node but also on the fault pattern extraction task. The attribute type between the root cause and the starting node is a dictionary with the attribute "RootCause_schema," while the attribute type between the root cause and the fault node is a string with the attribute "root_cause." This means that the root cause pattern extraction task requires the key-value pairs corresponding to the key name "root_cause" in the fault entity pattern information. Since "root_cause" in the fault pattern is in list form, multiple corresponding key-value pairs may be obtained in the extraction results. When executing the root cause pattern extraction task, it is necessary to iterate through each key-value pair of the root cause in the fault task extraction results.

[0150] Furthermore, if one of the root causes in the extraction results is XXX, then based on the above template 2, the following prompt statement for the root cause pattern extraction task can be generated:

[0151] Assuming you are an expert in wired networking, please extract the relevant attributes of the entity '{root_cause}' from the given text and output the results in the following JSON format along with their interpretations:

[0152] JSON;

[0153] {RootCause_schema={

[0154] "name": "Root cause name, returned as a string".

[0155] ...(Other relevant attributes omitted here)

[0156] "confirm_rule": "A diagnostic rule, which is a rule for confirming whether a cause has been identified. If the existing information is insufficient to support a judgment, further information may be needed for assessment. Returned as a string."

[0157] "solution": "Solution name, returned as a string".

[0158] }};

[0159] If no information is found, the corresponding value in the preset format text is left blank;

[0160] text:

[0161] {The specific content of the text to be processed}

[0162] In this embodiment, after interacting with the large language model using this prompt statement, a JSON string will be returned. Parsing this returned result will yield the entity schema information of the root cause XXX.

[0163] Figure 5 is a schematic diagram of a relational reasoning task in one embodiment of the present disclosure. As shown in Figure 5, the relational reasoning task can be configured in this disclosure.

[0164] In this embodiment, the relation_prediction node has two incoming edges, the contents of which are the strings "root_cause" and "step". This node is not directly associated with start. This reasoning behavior is defined as traversing all the key values ​​of the root cause of the failure and the step of the solution, and using a large language model to infer whether there is a causal relationship between them, that is, whether a certain root cause is associated with a certain step of the solution.

[0165] In an example embodiment, the prompt sentence template of the relationship reasoning task can be set as "Assuming you are an expert in a certain professional field, do {head_name}'{head_entity}' and {tail_name}'{tail_entity}' have a relationship? First answer yes or no, and then give an analysis". Wherein, head_name is the key name of the first target attribute, head_entity is the key value of the first target attribute, tail_name is the key name of the second target attribute, and tail_entity is the key value of the second target attribute.

[0166] Further, if the root cause (root_cause) is XXX and the step (step) is YYY in the extraction result of the pre-task, the prompt sentence of the relationship reasoning task between the root cause and the step can be generated based on the prompt sentence template of the relationship reasoning task as follows: "Assuming you are an expert in the field of wired networks, do {root_cause}'{XXX}' and {step}'{YYY}' have a relationship? First answer yes or no, and then give an analysis".

[0167] In the embodiments of the present disclosure, the relationship reasoning of the attributes of the specified entities in the knowledge graph can be performed by the large language model, without training a special neural network model, and the generality is stronger.

[0168] FIG. 6 is a schematic diagram of a basic unit that can be arranged in an embodiment of the present disclosure. As shown in FIG. 6, the present disclosure can arrange the mode extraction task and the relationship reasoning task of the entire knowledge graph by arranging the basic unit.

[0169] In the present embodiment, the basic unit includes the following three types:

[0170] Task 1, a mode extraction task that does not depend on other mode extraction tasks;

[0171] Task 2, a mode extraction task that depends on other mode extraction tasks;

[0172] Task 3, a relationship reasoning task.

[0173] In the present embodiment, each basic unit can correspond to a task of an entity type. The information that needs to be arranged for each basic unit includes the following contents:

[0174] Task 1, the mode of the entity type needs to be arranged;

[0175] Task 2, the mode of the entity type and the key name of the entity attribute associated with a certain pre-task need to be arranged;

[0176] Task 3, the key names of the two entity attributes that need to be subjected to relationship reasoning need to be arranged.

[0177] In the embodiment, the edge between task 1 and task 2 stores a dictionary (dict) representing a preconfigured pattern of an entity type, and the edge between task 2 and task 3 stores a string representing a corresponding field (key value) in the extraction result of the previous task that needs to be taken out according to the string (key name). If there are multiple corresponding key values, iteration is also needed.

[0178] According to the embodiments of the present disclosure, the pattern extraction task of a complex knowledge graph can be divided into multiple schedulable basic units, the complexity of the pattern and the pattern extraction task is simplified, and the overall configuration process of the knowledge graph is simpler and more flexible.

[0179] FIG. 7 is a schematic diagram of an overall process of constructing a knowledge graph according to an embodiment of the present disclosure. As shown in FIG. 7, the process includes the following steps:

[0180] Step S701, document cleaning;

[0181] Step S702, document splitting;

[0182] Step S703, pattern extraction process;

[0183] Step S704, knowledge fusion;

[0184] Step S705, constructing a knowledge graph.

[0185] In the embodiment, the target document in a professional field can be cleaned into a preset format, such as MD (Markdown) format, through document cleaning, but the present disclosure is not limited thereto.

[0186] In the embodiment, in order to improve the document processing speed, the document can be split according to a preset granularity. For example, the document can be split according to chapter granularity, and each sub-chapter content can be taken as a to-be-processed text, and the corresponding pattern extraction process is performed.

[0187] In the embodiment, the specific content of the pattern extraction process can refer to the steps in the above-mentioned method embodiments, and the skilled in the art can configure the pattern extraction task of different entity types in advance, which will not be described herein. After the pattern extraction process, each to-be-processed text can obtain a structured text, which can include entity pattern information of multiple entities. The pattern of each entity is preconfigured based on the entity type, and the patterns of multiple entities of the same type are also the same.

[0188] In some embodiments, when the configuration mode extraction task is configured, a structure similar to "fault": {"head": "name"} is stored on each task node, which indicates that the value of the "name" field in the fault extraction result is taken as the head element (head) to form a triple. Wherein, "fault" is the name of the entity type, which can be replaced by the name of other entity types such as "solution", and the present disclosure does not limit this.

[0189] Further, the triple is composed of a head element (head), a relation element (relation), and a tail element (tail), which correspond to the key value of the entity name, the key name of the entity attribute, and the key value of the entity attribute in the entity pattern information, respectively.

[0190] In an exemplary embodiment, the entity pattern information extracted in step S703 can represent:

[0191] Taking "name" as the head element, the above entity pattern information can be converted into the following multiple triples:

[0192] In this embodiment, using the interpretation rule of head+relation->tail in the triple, the first triple can be interpreted as the diagnosis rule of XXX being AAA, and the second triple can be interpreted as the reason of XXX being BBB, which is consistent with the original knowledge.

[0193] In this embodiment, step S704 exists as a post-processing task of the pattern extraction process, which is to fuse multiple structured texts into one structured text through knowledge fusion, and to merge the relationships and attributes of similar entities. In order to facilitate processing, knowledge fusion can occur after the entity pattern information is converted into triples.

[0194] In this embodiment, string similarity or semantic similarity can be used to merge all head elements and tail elements in step S704. If the string similarity of two strings is very high, it is considered that they are one string, and one of the strings is replaced by the other. Through knowledge fusion, incomplete nodes can also be merged, accompanied by the merging of their attributes. From the perspective of graph, this step completes the merging of nodes, and from the perspective of knowledge graph, it is the fusion of knowledge points. In this way, a knowledge graph with high-density knowledge and complex associations between knowledge points can be finally obtained.

[0195] In this embodiment, constructing a knowledge graph can be converting each entity pattern information in the structured text into a triple-form knowledge graph, or further constructing a graphical knowledge graph based on the triple.

[0196] By the embodiments of the present disclosure, a user only needs to input a professional document to be analyzed, and configure a simple basic unit, so as to automatically process the document and realize construction of a complex knowledge graph. The entire processing procedure can be automatically run in the background, and the construction of the entire knowledge graph is completed without the user's awareness, thereby improving user experience.

[0197] The embodiments of the present disclosure further provide a computer readable storage medium, which stores a computer program. When the computer program is run by a processor, steps in any of the method embodiments described above are performed.

[0198] In an example embodiment, the computer readable storage medium described above can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.

[0199] The embodiments of the present disclosure further provide an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor is configured to run the computer program to perform steps in any of the method embodiments described above.

[0200] In an example embodiment, the electronic device described above can further include a transmission device and an input / output device. The transmission device is connected to the processor, and the input / output device is connected to the processor.

[0201] The embodiments of the present disclosure further provide a computer program product, which includes a computer program. When the computer program is executed by a processor, steps in any of the method embodiments described above are implemented.

[0202] In an example embodiment, the computer program product can include a computer readable storage medium, which stores a computer program. When the computer program is run by a processor, steps in any of the method embodiments described above are performed. Further, the computer readable storage medium is a non-volatile storage medium.

[0203] Specific examples in the present embodiment can refer to examples described in the above embodiments and example implementations, which will not be described herein again.

[0204] It is apparent that those skilled in the art should understand that the modules or steps of the present disclosure described above can be realized by general computing devices, which can be centralized on a single computing device or distributed on a network composed of multiple computing devices, and can be realized by program codes executable by the computing devices, so that they can be stored in storage devices and executed by the computing devices, and in some cases, the steps shown or described can be executed in different orders, or they can be respectively manufactured into individual integrated circuit modules, or multiple modules or steps among them can be manufactured into a single integrated circuit module. Thus, the present disclosure is not limited to any specific combination of hardware and software.

[0205] The above merely shows exemplary embodiments of the present disclosure and is not intended to limit the present disclosure. The present disclosure can have various modifications and changes for those skilled in the art. Any modification, equivalent replacement, improvement, etc. within the principles of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A knowledge graph construction method, the method comprising: Acquire the text to be processed and multiple pattern extraction tasks of different entity types; Based on the multiple pattern extraction tasks, extract multiple entity pattern information from the text to be processed; The multiple entity pattern information is converted into multiple triples; A knowledge graph is constructed based on the multiple triples.

2. The method according to claim 1, wherein, Each of the pattern extraction tasks includes a pattern of an entity type, wherein the pattern includes a preset entity type, an entity name, and at least one entity attribute.

3. The method according to claim 2, wherein, Extracting multiple entity pattern information from the text to be processed based on the multiple pattern extraction tasks includes: According to each of the pattern extraction tasks, the entity name and entity attribute of at least one entity corresponding to the preset entity type are extracted from the text to be processed to obtain the plurality of entity pattern information, wherein each entity pattern information includes a key-value pair of the entity name and a key-value pair of the entity attribute, and the number of key-value pairs of the entity attribute is greater than or equal to 1.

4. The method according to claim 2, wherein, The method further includes: Determine the dependencies between the multiple pattern extraction tasks.

5. The method according to claim 4, wherein, Extracting multiple entity pattern information from the text to be processed based on the multiple pattern extraction tasks includes: The execution order of the multiple pattern extraction tasks is determined based on the dependencies. According to the execution order, each of the pattern extraction tasks is executed sequentially on the text to be processed to obtain the multiple entity pattern information.

6. The method according to claim 5, wherein, Determining the execution order of the multiple pattern extraction tasks based on the dependencies includes: Starting with the input text to be processed as the starting node, a directed acyclic graph is constructed based on the multiple pattern extraction tasks and the dependency relationships, wherein each pattern extraction task corresponds to a node in the directed acyclic graph, and the dependency relationships correspond to multiple directed edges in the directed acyclic graph; The execution order is obtained by performing a topological sort on the directed acyclic graph.

7. The method according to claim 4, wherein, Determining the dependencies between the multiple pattern extraction tasks includes: Determine whether there is a target entity attribute with the same key name as the target entity type in each of the multiple pattern extraction tasks, wherein the target entity type is any one of the multiple preset entity types, and the target entity attribute is any one of the multiple entity attributes; If the determination result is yes, the pattern extraction task corresponding to the target entity type depends on the pattern extraction task corresponding to the target entity attribute.

8. The method according to claim 4, wherein, Extracting multiple entity pattern information from the text to be processed based on the multiple pattern extraction tasks includes: Based on the dependency relationship, it is determined whether the current pattern extraction task depends on the preceding task, wherein the preceding task is one of the plurality of pattern extraction tasks; When the current pattern extraction task does not depend on the preceding task, a prompt statement for the pattern extraction task is constructed based on the pattern of the current entity type and the text to be processed. When the current pattern extraction task depends on the preceding task, a prompt statement for the pattern extraction task is constructed based on the execution result of the preceding task, the pattern of the current entity type, and the text to be processed, wherein the execution result is the entity pattern information extracted by the preceding task. The prompt statement for the pattern extraction task is input into a preset large language model to obtain the entity pattern information output by the large language model.

9. The method according to claim 8, wherein, When the current pattern extraction task depends on the preceding task, a prompt statement for the pattern extraction task is constructed based on the execution result of the preceding task, the pattern of the current entity type, and the text to be processed, including: When the current mode extraction task depends on the preceding task, the key-value pairs of the target entity attributes are obtained from the execution result of the preceding task; The prompt statement is constructed based on the key-value pairs of the target entity's attributes, the pattern, and the text to be processed.

10. The method according to claim 9, wherein, Constructing the prompt statement based on the key-value pairs of the target entity attributes, the pattern, and the text to be processed includes: If the number of key-value pairs of the target entity attribute is greater than 1, iterate through multiple key-value pairs of the target entity attribute and construct a prompt statement based on each key-value pair of the target entity attribute, the pattern, and the text to be processed.

11. The method according to claim 3, wherein, The multiple entity pattern information is converted into multiple triples, including: Each key-value pair of entity attribute in the entity schema information is converted into a relation element and a tail element in a triple, and the key value of the corresponding entity name in the entity schema information is used as the head element in the triple to obtain the triple, wherein each triple includes a head element, a relation element and a tail element.

12. The method according to claim 11, wherein, After converting the multiple entity pattern information into multiple triples, the method further includes: Determine the similarity between the head elements or tail elements of the plurality of triples. Multiple head elements or multiple tail elements whose similarity is greater than a preset threshold are merged.

13. The method according to claim 3, wherein, The method further includes: Obtain a pre-configured relational reasoning task, wherein the relational reasoning task includes the key names of two target attributes; Based on the key name of each target attribute, determine the prerequisite task of the relation reasoning task from the plurality of pattern extraction tasks, and determine the corresponding key-value pair of the target attribute from the execution result of the prerequisite task; The prompt statement for constructing the relational reasoning task based on the key-value pairs of the two target attributes; The prompts for the relational reasoning task are input into a preset large language model to obtain the relational reasoning results output by the large language model.

14. A computer-readable storage medium, wherein, The storage medium stores a computer program, wherein the computer program is executed by a processor to perform the method described in any one of claims 1 to 13.

15. An electronic device comprising a memory and a processor, wherein, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 13.

16. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the steps of the method described in any one of claims 1 to 13.

Citation Information

Patent Citations

  • Knowledge graph construction method and device, computing equipment and storage medium

    CN112434811A

  • Knowledge graph construction method and device, electronic equipment, storage medium and product

    CN117033647A

  • Knowledge graph construction method based on IE-Triple

    CN117252258A

  • Fault knowledge graph construction method and apparatus

    WO2023045417A1

Cited By

  • Fault root cause positioning method, device and equipment and readable storage medium

    CN121998105A