An emergency plan case reasoning method and system based on graph edit distance
Patent Information
- Application Number
- CN202611479855.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-22
- Publication Date
- 2026-10-30
AI Technical Summary
[0006]本申请的目的就在于为了解决现有应急预案案例推理过程中案例结构信息利用不充分,在历史案例库规模较大并持续更新的情况下,相似案例检索准确性和处理效率难以兼顾的问题,而提供一种基于图编辑距离的应急预案案例推理方法及系统
[0059]本申请通过对历史应急案例文本进行要素抽取和关系抽取,并建立包括节点属性和边属性的历史案例图,能够同时表征案例中的事件、资源、处置措施、责任部门等要素及其因果、依赖、时序等关联关系,避免将应急案例简单扁平化处理,提高案例表示的完整性和结构化程度;基于节点属性和边属性设置图编辑操作代价,并计算案例图之间的图编辑距离近似值,能够从节点和关系的插入、删除及替换等结构变化角度度量案例差异,使案例结构相似度更准确地反映不同应急事件之间的处置逻辑和要素关联差异。
Smart Images

Figure CN123014211A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of retrieval technology, and more specifically, to an emergency response plan case reasoning method and system based on graph edit distance. Background Technology
[0002] With the continuous improvement of information technology in emergency management, various accident reports, handling records, and emergency plans are constantly accumulating. Providing handling references for newly occurring events based on historical cases has become an important way to support emergency decision-making. Existing case reasoning usually involves first extracting features from historical cases, then using keyword matching, text similarity, or fixed-dimensional feature vectors for retrieval, and finally selecting relevant plans based on the retrieval results.
[0003] However, emergency response cases typically contain multiple elements, including events, resources, response measures, responsible departments, response objectives, and constraints. These elements also exhibit complex relationships such as causality, dependency, temporality, hierarchy, collaboration, and constraints. Comparisons based solely on text frequency, semantic vectors, or preset feature fields can easily fragment the interconnected response logic within a case, failing to accurately reflect the impact of element additions / reductions, relationship changes, and local structural differences on case similarity. While some methods incorporate knowledge graphs or graph representation techniques, they often compress the overall structure into a fixed-dimensional representation. Fine-grained topological differences remain difficult to fully reflect in similarity calculations, potentially leading to incorrect matching of cases with similar surface descriptions but different response conditions, or the omission of historical cases with different textual expressions but similar event structures and response logics.
[0004] In practical applications, historical case databases are typically in a state of continuous growth and updating. When the number of cases is large, performing complex similarity calculations on each new event and all historical cases would incur high computational costs, making it difficult to meet the retrieval response speed requirements of emergency scenarios. On the other hand, using only low-complexity coarse-grained matching would further weaken the correspondence between the retrieval results and the actual structure of the new event. As new cases are continuously added, the original case representations, retrieval organization methods, and model parameters may fail to adapt to changes in case distribution in a timely manner, thus reducing the stability of retrieval results. Retrieval biases will also continue to propagate to subsequent contingency plan reuse stages, resulting in recommended content lacking sufficient historical case evidence.
[0005] Therefore, the main technical problem faced by existing technologies is: under the conditions that historical emergency cases are complex in structure, large in scale and continuously updated, how to conduct accurate, stable and acceptable case reasoning for newly occurring emergency events, so as to provide a reliable case basis for emergency plan recommendations. Summary of the Invention
[0006] The purpose of this application is to address the problem that existing emergency response plan case reasoning processes do not fully utilize case structure information, and that it is difficult to balance the accuracy and efficiency of similar case retrieval when the historical case database is large and continuously updated. Therefore, this application provides an emergency response plan case reasoning method and system based on graph edit distance.
[0007] This application provides an emergency response plan case reasoning method based on graph edit distance, including the following steps:
[0008] Extract elements and relationships from the text of each historical case in the historical case library to create a historical case graph that includes node attributes and edge attributes.
[0009] Based on the node attributes and edge attributes, calculate the approximate graph edit distance between the two case graphs, and calculate the case structure similarity based on the approximate graph edit distance.
[0010] The graph embedding model is trained using the approximate graph edit distance between historical case graphs as supervised information. The graph embedding model generates embedding vectors for historical case graphs, and a multidimensional binary search tree index is constructed based on the embedding vectors of historical case graphs.
[0011] A query graph is constructed for newly occurring emergency events. The query graph is retrieved based on a graph embedding model, case structure similarity, and a multidimensional space binary search tree index to obtain a final set of similar cases. The emergency plans associated with the cases in the final set of similar cases are weighted and combined to obtain a recommended plan.
[0012] When a new case is added to the historical case library, the multidimensional space binary search tree index is updated, and the graph embedding model is updated according to the distribution changes of the historical case graph.
[0013] Furthermore, methods for creating historical case study diagrams include:
[0014] Text preprocessing is performed on accident reports, response records, and contingency plan texts from historical cases to obtain a preprocessed sentence sequence;
[0015] Elements are extracted from the preprocessed sentence sequence, and corresponding nodes and node attributes are generated based on the category and update time of each element.
[0016] Relationships between elements are extracted from the preprocessed sentence sequence. Based on the relationship type and establishment time of each relationship, directed edges connecting the corresponding nodes and edge attributes are generated.
[0017] A historical case graph is built based on the generated nodes, node attributes, directed edges, and edge attributes.
[0018] Furthermore, methods for obtaining preprocessed sentence sequences include:
[0019] The accident reports, response records, and contingency plan texts are processed using a unified character encoding and a unified character width to obtain a standardized text set.
[0020] The normalized text set is segmented into sentences according to periods, question marks, exclamation marks, and paragraph boundaries to obtain a normalized sentence sequence;
[0021] The normalized sentence sequence is subjected to reference resolution and synonym normalization to obtain the preprocessed sentence sequence.
[0022] Furthermore, methods for calculating case structural similarity include:
[0023] Set up editing operations and calculate the cost of editing operations; the cost of editing operations includes node insertion cost, node deletion cost, node replacement cost, cost of inserting while inserting, cost of deleting while deleting, and cost of replacing while replacing;
[0024] Perform greedy weighted matching on the two case graphs to determine matching pairs of nodes and edges, and identify unmatched nodes and edges as insertion or deletion operations;
[0025] Based on the node replacement cost of all matching node pairs, the edge replacement cost of all matching edge pairs, and the insertion and deletion costs of all unmatched nodes and edges, an approximate value of the graph editing distance is calculated.
[0026] The sum of the number of nodes and edges in the two case graphs is used as a normalization factor. The graph editing distance approximation is divided by the normalization factor, then one is added and the reciprocal is taken to obtain the case structure similarity.
[0027] Furthermore, methods for setting the cost of editing operations include:
[0028] Calculate the node type difference cost, node semantic difference cost, and node importance difference cost based on node attributes; calculate the relationship type difference cost and relationship strength difference cost based on edge attributes.
[0029] The node replacement cost is obtained by adding the node type difference cost, the node semantic difference cost, and the node importance difference cost; the edge replacement cost is obtained by adding the relation type difference cost and the relation strength difference cost.
[0030] The cost of inserting a node and the cost of deleting a node are equal, and are both obtained by multiplying the preset node importance weight and the preset node basic cost parameter of the corresponding node.
[0031] The cost of inserting and deleting an edge is equal, and both are obtained by multiplying the preset relation strength weight of the corresponding edge by the preset edge basic cost parameter.
[0032] Furthermore, methods for constructing multidimensional binary search tree indexes include:
[0033] The initial node representation is obtained by concatenating the node semantic feature vector in the node attributes, the one-hot node type vector corresponding to the node type, and the preset node importance weight, and then performing a fully connected mapping.
[0034] The graph embedding model includes graph isomorphic networks and attention pooling networks. The graph isomorphic network starts with the initial node representation and aggregates the representations of neighboring nodes layer by layer to update the representation of each node, thus obtaining the final representation of all nodes.
[0035] The attention pooling network calculates the attention weight of each node based on the preset initial attention parameter vector, and sums the final representations of all nodes according to the attention weights to obtain the embedding vector of the historical case graph.
[0036] A median-based partitioning strategy is used to recursively divide the embedding vectors of multiple historical case graphs, and a multidimensional binary search tree index is constructed.
[0037] Furthermore, methods for obtaining recommended contingency plans include:
[0038] Following the same process as building historical case graphs, element extraction and relation extraction are performed on the query text of newly occurring emergency events to construct query graphs;
[0039] The embedding vector of the query graph is calculated based on the graph embedding model, and the final set of similar cases is determined based on the embedding vector of the query graph and the multidimensional space binary search tree index.
[0040] The emergency response plans associated with the cases in the final set of similar cases are weighted and combined to obtain the recommended plan.
[0041] Furthermore, methods for determining the final set of similar cases include:
[0042] The embedding vector of the query graph is calculated using the graph embedding model. Nearest neighbor search is performed on the multidimensional space binary search tree index. Historical cases that are sorted from smallest to largest by Euclidean distance to the embedding vector of the query graph and whose number does not exceed the preset number of candidate cases are returned to form a candidate case set.
[0043] For each candidate case in the candidate case set, the case structure similarity between the query graph and the historical case graph is calculated using the graph edit distance approximation.
[0044] The structural similarity of cases is weighted by time-sensitivity decay based on the duration of the cases, resulting in a time-sensitivity weighted comprehensive score.
[0045] All cases in the candidate case set are sorted from largest to smallest by time-weighted comprehensive score, and the cases that are ranked first and whose number is equal to the preset final number of similar cases are selected to form the final similar case set.
[0046] Furthermore, methods for weighted combination of emergency response plans to obtain recommended plans include:
[0047] Divide the time-sensitive weighted composite score of each case by the sum of the time-sensitive weighted composite scores of all cases in the final set of similar cases to obtain the combined weight of the emergency plan associated with the corresponding case;
[0048] Each emergency plan is broken down into plan content units. The combined weights of similar plan content units are added together to obtain the cumulative support weight. The plan content units of various types are combined according to the cumulative support weight to obtain the recommended plan.
[0049] Furthermore, methods for updating multidimensional binary search tree indexes and graph embedding models include:
[0050] When a new case is added to the historical case library, an embedding vector of the historical case graph of the new case is generated and inserted as a new data point into the multidimensional space binary search tree index;
[0051] The distribution difference is calculated based on the embedding vector of the historical case graph. When the distribution difference is greater than the preset drift threshold, the graph embedding model is fine-tuned and the multidimensional space binary search tree index is reconstructed.
[0052] This application provides an emergency response plan case reasoning system based on graph edit distance, used to execute the aforementioned emergency response plan case reasoning method based on graph edit distance; the system includes:
[0053] The case modeling module extracts elements and relationships from the text of each historical case in the historical case library, and builds a historical case graph including node attributes and edge attributes.
[0054] The similarity calculation module calculates an approximate graph edit distance between two case graphs based on the node attributes and edge attributes, and calculates the case structure similarity based on the approximate graph edit distance.
[0055] The index building module trains a graph embedding model using the approximate graph edit distance between historical case graphs as supervised information. The graph embedding model generates embedding vectors for historical case graphs, and a multi-dimensional binary search tree index is built based on the embedding vectors of historical case graphs.
[0056] The retrieval and recommendation module constructs a query graph for newly occurring emergency events, retrieves the query graph based on the graph embedding model, case structure similarity, and multidimensional space binary search tree index, obtains a final set of similar cases, and performs a weighted combination of emergency plans associated with the cases in the final set of similar cases to obtain recommended plans.
[0057] The case maintenance module updates the multidimensional space binary search tree index when a new case is added to the historical case library, and updates the graph embedding model according to the distribution changes of the historical case graph.
[0058] The beneficial effects of this application are as follows:
[0059] This application extracts elements and relationships from historical emergency case texts and establishes historical case graphs including node attributes and edge attributes. This allows for the simultaneous representation of elements such as events, resources, response measures, and responsible departments in the cases, as well as their causal, dependent, and temporal relationships. This avoids simply flattening emergency cases and improves the completeness and structure of case representation. Based on node and edge attributes, the application sets the cost of graph editing operations and calculates approximate graph editing distances between case graphs. This allows for the measurement of case differences from the perspective of structural changes such as the insertion, deletion, and replacement of nodes and relationships. This makes the case structural similarity more accurately reflect the differences in response logic and element relationships between different emergency events.
[0060] This application trains a graph embedding model using graph edit distance approximation as supervised information and constructs a multidimensional binary search tree index based on the embedding vectors of historical case graphs. This reduces the number of cases requiring graph edit distance calculation during large-scale historical case database retrieval while preserving case structural similarity information, thus improving the efficiency of similar case retrieval. Candidate cases are initially screened through the index, and then retrieved and ranked based on case structural similarity. Furthermore, emergency response plans associated with similar cases are weighted and combined, improving the matching degree between similar case selection and recommended plans and newly occurring emergency events, providing more targeted case evidence for emergency response. When new cases are added to the historical case database, the multidimensional binary search tree index and graph embedding model are updated, enabling the case reasoning system to adapt to continuous changes in the number and distribution of cases, maintaining the stability and scalability of case retrieval and plan recommendation. Attached Figure Description
[0061] Figure 1 This is a flowchart illustrating an emergency response plan case reasoning method based on graph editing distance, as described in this application.
[0062] Figure 2 This is an example diagram illustrating the calculated structural similarity of cases in this application;
[0063] Figure 3 This is a module example diagram of an emergency response plan case reasoning system based on graph editing distance, as described in this application. Detailed Implementation
[0064] The subject matter described herein will now be discussed with reference to exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and implement the subject matter described herein, and changes may be made to the function and arrangement of the elements discussed without departing from the scope of this specification. Various processes or components may be omitted, substituted, or added as needed in the examples. Furthermore, features described in some examples may be combined in other examples.
[0065] An emergency response plan case reasoning method and system based on graph edit distance includes the following embodiments:
[0066] Example 1:
[0067] An emergency response plan case reasoning method based on graph edit distance is proposed. This method consists of five processing stages: case graph modeling, graph edit distance similarity calculation, graph embedding index construction, two-stage retrieval and plan recommendation, and maintenance of a historical case database. Specifically, as follows... Figure 1 As shown, steps 100 to 500 are included.
[0068] In this embodiment, the training and validation sets are divided according to case identifiers. Case pairs and training triples generated from the same case are only included in one dataset to avoid information from the same case entering both the training and validation processes simultaneously. In this embodiment, the process of determining preset parameters from candidate values is completed before the system performs the retrieval. Candidate values are generated within the value constraints of the corresponding parameters and cover the value range of the corresponding statistics in the training samples. For integer parameters, feasible integers are enumerated one by one. For real number parameters, candidate values are first generated at equal intervals within the feasible range, and then the interval is narrowed around the candidate value that is optimal for the current validation metric, and the validation is repeated until the parameters selected in two adjacent validations are the same. Unless otherwise specified in the following selection rules, when multiple candidate values correspond to the same validation metric, the numerical parameter with the smallest value is selected, and the vector dimension or capacity parameter with the least storage is selected. When multiple parameters form a candidate combination, the aforementioned rules are applied item by item according to the order in which the parameters appear in the text. Thus, each preset parameter can be determined by the corresponding training data or validation data and the selection metrics recorded in the text, without the need to specify them temporarily during the retrieval process.
[0069] Step 100: Extract elements and relationships from the text of each historical case in the historical case library to create a historical case graph that includes node attributes and edge attributes.
[0070] In this embodiment, the domain knowledge graph uses the same node and relation types as the case graph. When constructing the domain knowledge graph, nodes and edges are extracted from the historical case graph that has passed the review, and the domain rules confirmed by the reviewers are converted into knowledge triples composed of a starting node, relation type, and ending node. Nodes with the same node type and normalized name are merged into the same knowledge node, and knowledge triples with the same starting knowledge node, ending knowledge node, and relation type are merged into the same knowledge relation. Each knowledge node and knowledge relation saves the source text, review status, and update time. Only knowledge nodes and knowledge relations with a passed review status are used for dictionary generation and query graph completion. In this embodiment, the case graph is a general term for the historical case graph and the query graph. The historical case graph is an attribute-directed graph built based on the accident reports, handling records, and contingency plan texts of historical cases, and the query graph is an attribute-directed graph built based on the text of newly occurring emergency events. The historical case graph and the query graph use the same node type, relation type, and attribute structure, but they represent historical cases and newly occurring emergency events respectively, and are not different references to the same object.
[0071] The domain knowledge graph and case graph use the same node and relationship types, enabling knowledge nodes and relationships to be directly used for domain dictionary generation and query graph completion without the need for type conversion; the source text and review status are saved, allowing the completed content to be traced back to the source and limited to approved knowledge.
[0072] Step 100 is used to convert each historical case in the historical case library into a corresponding historical case graph, so as to obtain a structured historical case representation for subsequent similarity calculation, graph embedding model training and index construction. The historical case library stores a limited number of historical cases, historical case graphs corresponding to each historical case, and associated emergency plans. The number of historical cases included in the historical case library is called the total number of historical cases. For each historical case, elements and the relationships between elements are extracted from accident reports, handling records and emergency plan texts, and a corresponding historical case graph is built accordingly.
[0073] Before extracting the execution elements, text preprocessing is performed on the accident report, handling record, and contingency plan texts respectively. First, unified character encoding processing is performed, decoding the three types of texts into character sequences according to their respective source character encodings, and then uniformly converting them to UTF-8 character encoding and storing them in UTF-8 character encoding. In this embodiment, unified character encoding refers to UTF-8 character encoding. Subsequently, unified character width processing is performed, converting full-width English letters, Arabic numerals, spaces, and Western punctuation marks with half-width counterparts into their corresponding half-width forms, uniformly retaining Chinese sentence-ending punctuation marks in full-width form, and merging consecutive spaces into a single half-width space. In this embodiment, unified character width means that the same type of English letters, Arabic numerals, spaces, and Western punctuation marks all adopt the aforementioned half-width form, and the same type of Chinese sentence-ending punctuation marks all adopt the aforementioned full-width form. During the unified character encoding processing and unified character width processing, the mapping relationship between each processed character and the corresponding character position in the source text is recorded. After completing the unified character encoding processing and unified character width processing, the resulting standardized source texts are combined into a standardized text set.
[0074] Accident reports, handling records, and contingency plan texts provide the facts of the incident, the actual handling process, and the standardized handling requirements, respectively. All three are used as inputs, so that the historical case diagram simultaneously contains event, execution, and standard information. Unified character encoding and character width ensure that the same characters are represented consistently, and the correspondence between the extracted results and the source text is preserved through character position mapping.
[0075] Sentence segmentation is performed according to the periods, question marks, exclamation marks, and paragraph boundaries of each normalized source text in the normalized text set. For each segmented sentence, the source text type, source paragraph number, sentence number, and the character position of the sentence in the source text are recorded. Sentences in historical cases are arranged in the order of accident report, response record, and contingency plan text. Sentences in the same normalized source text are arranged according to the source paragraph number, sentence number, and character position. When a newly occurring emergency event only includes query text, it is arranged according to the source paragraph number, sentence number, and character position in the query text, thus obtaining a normalized sentence sequence. The source text type is used to indicate that the corresponding sentence comes from the accident report, response record, contingency plan text, or query text. The source paragraph number, sentence number, and character position are used to locate the subsequent extraction results to the source text according to the aforementioned mapping relationship.
[0076] The normalized sentence sequence undergoes a substitution resolution process. During this process, a domain dictionary is first used to pre-identify candidate elements. Then, following the text order in the normalized sentence sequence, a candidate element is searched for that precedes the pronoun, has the same node type constraint, and has the fewest interval sentences between its current sentence and the sentence containing the pronoun. The pronoun is then replaced with the normalized name of this candidate element, resulting in a resolved sentence sequence. If multiple candidate elements with the same number of interval sentences exist, or if no candidate element exists, the sentence containing the pronoun and its source text location are submitted to reviewers to determine the referred element, and the replacement is completed according to the review results. Subsequently, the resolved sentence sequence undergoes synonym normalization. A thesaurus is used to map synonymous element names to the same normalized name, resulting in a preprocessed sentence sequence. The preprocessed sentence sequence is then preserved. The source text type, source paragraph number, sentence number, and character position of each sentence serve as inputs for subsequent element extraction, relation extraction, and evidence localization. The thesaurus and the domain dictionary, built according to six node types (event, resource, measure, department, goal, and constraint), are all created by reviewers after extracting names, node types, and synonym relationships from approved historical cases and domain knowledge graphs. New entries are added to the corresponding dictionary after their names, node types, and synonym relationships are confirmed through review, and the dictionary version is recorded. A normalized sentence sequence that maintains text order is used as input for referential resolution, enabling pronouns to be associated with prior elements according to node type and sentence intervals. Synonym normalization is performed to map different text names of the same element to the same normalized name, preventing the same element from being created as multiple nodes.
[0077] Subsequently, using the preprocessed sentence sequence as input for feature extraction, the domain dictionary is used to identify candidate features in the preprocessed sentence sequence, and a sequence labeling model trained on the labeled emergency text is used to supplement the identification of candidate features not matched by the domain dictionary. The sequence labeling model outputs the node type for each word unit, and uses the node type of each word unit in the labeled corpus as supervision information. Training is completed by minimizing the cross-entropy loss between the predicted node type and the labeled node type. For candidate features with the same character content or the same normalized feature name and the same node type, they are merged into the same node. For candidate features with the same normalized feature name but different node types, they are retained as different nodes. Each node uses a case identifier, node type, and normalized feature name to generate a unique node identifier.
[0078] During relation extraction, candidate elements obtained from feature extraction and their corresponding preprocessed sentence sequences are used as input. First, intra-sentence relations between two candidate elements within the same sentence are located using causal trigger words, dependency trigger words, temporal trigger words, membership trigger words, collaboration trigger words, and constraint trigger words. Then, a relation classification model trained on labeled element pairs is used to determine the relation type. For cross-sentence element pairs, the sentences containing the two elements and their intermediate sentences are arranged in the order of the preprocessed sentence sequence to form the input to the relation classification model. The relation classification model uses the relation type of the element pairs as supervision information and completes training by minimizing the cross-entropy loss between the predicted relation type and the labeled relation type. During relation classification, the relation label with the highest output probability is selected. When output probabilities are the same, the relation with the highest probability is selected according to a fixed order: causal, dependency, temporal, membership, collaboration, constraint, and no relation. The direction of causal relations is from the cause element to the result element, and dependency... The direction of a relationship is from the preceding element to the element that depends on it; the direction of a temporal relationship is from the element that executes first to the element that executes last; the direction of a subordinate relationship is from the superior element to the subordinate element; the direction of a collaborative relationship is from the element that initiates the collaboration to the element that responds to the collaboration; and the direction of a constraint relationship is from the constraint condition to the constrained element. Relationships with the same starting node, ending node, and relationship type are merged into a single edge, and all evidence sentences are retained. Each edge uses a case identifier, starting node identifier, ending node identifier, and relationship type to generate a unique edge identifier. After extraction, nodes and edges are located to evidence sentences in the source text based on the source text type, source paragraph number, sentence number, and character position saved in the preprocessed sentence sequence. Nodes and edges that cannot be located to evidence sentences in the source text are deleted, and the node type, relationship type, and relationship direction are confirmed by the reviewer to ensure that the historical case graph and the query graph use the same extraction rules.
[0079] Various relation trigger words are obtained by reviewers marking words expressing corresponding relations in evidence sentences that have already been labeled with relations, summarizing them according to relation type and removing duplicates; newly added trigger words are written into the corresponding trigger word set after the relation type is confirmed by review, and the version of the trigger word set is recorded; when calculating cross-entropy loss, for each training sample, the probability output by the model as the manual label of that training sample is obtained, the natural logarithm of the probability is calculated and the negative number is taken, and then the corresponding results of all training samples are added together to obtain the cross-entropy loss of the corresponding model.
[0080] Both the sequence labeling model and the relation classification model use the pre-trained language model as the text encoder, and the parameters of the text encoder are fixed during the extraction model training. The sequence labeling model segments each sentence in the preprocessed sentence sequence into a sequence of word units, and inputs the output vector of each word unit into a fully connected classification layer to obtain the output values of seven word unit labels: event, resource, measure, department, goal, constraint, and non-feature. Then, the output probability of each word unit label is obtained through normalized exponent calculation. For each word unit, the word unit label with the highest output probability is selected. When the output probabilities are the same, the earlier one is selected according to the fixed order of event, resource, measure, department, goal, constraint, and non-feature. Word units with the same and consecutive labels in the same sentence are merged into a candidate element. When the dictionary recognition result and the sequence labeling result overlap in the position of the preprocessed sentence sequence, the candidate element with the most covered word units is retained. When the number of covered word units is the same, the candidate element with the most covered word units is retained. Prioritize retaining the domain dictionary recognition results; the relation classification model adds element boundary markers before and after the two candidate elements, respectively, and inputs the output vector of the sentence-initial classification marker into another fully connected classification layer to obtain the output values of seven relation markers: causality, dependency, temporal sequence, membership, cooperation, constraint, and no relation. Then, the output probability of each relation marker is obtained through normalized exponential calculation; the weight matrices of the two fully connected classification layers are initialized according to the generation method of the preset initial weight matrix in step 300, and all components of the bias vector are initialized to zero. The gradient descent method in step 300 is used to reduce the cross-entropy loss of word unit markers and the cross-entropy loss of relation markers, respectively. The training ends using the preset training termination condition in step 300; after triggering the termination condition, the parameters saved when the cross-entropy loss of the corresponding validation set reaches the minimum are restored to obtain the extracted model parameters after training is completed; no edge is generated when the relation classification result is no relation, and no node is generated when the sequence labeling result is non-feature.
[0081] In an optional embodiment, when there is no labeled emergency text that can divide the training set and validation set, only the domain dictionary is used to identify candidate elements, and only relation trigger words are used to determine candidate element pairs. The sequence labeling model and relation classification model are not enabled. After the reviewers confirm the node type of the candidate elements, the relation type of the candidate element pairs, and the relation direction, nodes and edges are generated, and the confirmation results are written into the labeled corpus. After the labeled corpus reaches the condition that it can divide the training set and validation set according to the case identifier, the sequence labeling model and relation classification model are trained according to the aforementioned method.
[0082] The domain dictionary is used to identify existing standardized names, the sequence labeling model is used to identify context elements not covered by the domain dictionary, relation trigger words are used to provide candidate relation positions, and the relation classification model is used to determine relation types. The combination of these four components can simultaneously handle known and unrecorded expressions. The training of the extraction model includes labeled sample input, text encoding, classification probability calculation, cross-entropy loss calculation, gradient update, validation set checking, and parameter recovery. The text encoder parameters are fixed so that the sequence labeling model and the relation classification model are trained in the same text semantic space, and the training updates are concentrated on two fully connected classification layers.
[0083] Each case graph includes a set of nodes, a set of directed edges, a node labeling function, and an edge labeling function. Each node in the node set represents an element in a corresponding historical case or a newly occurring emergency event. The categories of elements represented by nodes include event type, emergency resources, response measures, responsible departments, response objectives, or constraints. The number of nodes in the node set is called the node count. Each edge in the directed edge set has a starting node and a ending node, used to represent the relationship from the element corresponding to the starting node to the element corresponding to the ending node. This relationship can be causal, dependent, temporal, hierarchical, collaborative, or constraint. The node labeling function maps each node to its node attributes, and the edge labeling function maps each edge to its edge attributes.
[0084] The node attributes include node type, node semantic feature vector, preset node importance weight, and node timeliness marker. The node type is determined from six types: event, resource, measure, department, target, and constraint. When the node type is event, the node attributes also include event classification and event occurrence time. The event classification is used to determine the main type of candidate cases. The node semantic feature vector is obtained by encoding the node's text description using a pre-trained language model. In this embodiment, a bidirectional encoder based on a transformer is used to represent the pre-trained language model for encoding, converting the node text description into a real-valued vector of preset node semantic feature dimensions. The preset node semantic feature dimensions are determined based on the output dimension of the selected pre-trained language model and remain consistent during the encoding process of the historical case graph and the query graph. The preset node importance weight is a value within a closed interval of zero to one. When determining the preset node importance weight, the reviewers will assess the elements represented by the node. Necessity, consequences of absence, and irreplaceability are evaluated in a tiered manner, with each tier including at least two levels. Starting from the lowest level, levels are sequentially numbered from zero. The corresponding level number is divided by the total number of levels minus one to obtain the mapping value of that evaluation within the closed interval of zero to one. The arithmetic mean of the three mapping values given by the same reviewer is taken first, followed by the arithmetic mean of all reviewers' values. The result is used as the preset node importance weight. Therefore, as the necessity, consequences of absence, or irreplaceability of the corresponding evaluation level increases, the preset node importance weight increases accordingly. The node's timeliness is marked by a positive real-valued timestamp recording the last update time of the corresponding element. All timestamps are generated using the same epoch start and the same time unit. When the original text does not record the element's update time, the last verification time of the case is used as the node's last update time; when the case has not yet been verified, the case creation time is used as the node's last update time.
[0085] This embodiment employs a transformer-based bidirectional encoder to represent the pre-trained language model. First, the input text is segmented into a sequence of word units. Then, this sequence is processed through a multi-layer self-attention network and a feedforward network to obtain the output vector corresponding to each word unit. The output vector corresponding to the sentence-first classification label is used as the node semantic feature vector describing the node text. The vocabulary and model parameters of the selected pre-trained language model remain unchanged during the encoding of the historical case graph and query graph. When multiple candidate pre-trained language models exist, a validation set is formed using manually labeled node text pairs that are semantically identical or semantically different. The normalized semantic distance between the unit semantic vectors obtained by each candidate model is calculated, and the candidate model that minimizes the sum of squared errors between the normalized semantic distance and the manually labeled semantic differences is selected. When the number of word units corresponding to a node text exceeds the input length allowed by the selected pre-trained language model, the node text is segmented into multiple text segments not exceeding the input length according to the sentence boundaries. The sentence-first classification label output vector of each text segment is calculated, and the arithmetic mean of the output vectors of all text segments is taken dimension-wise to obtain the node semantic feature vector.
[0086] In self-attention processing, the input vector is first linearly transformed to obtain the self-attention query matrix, self-attention key matrix, and self-attention value matrix. Then, the self-attention query matrix is multiplied by the transpose of the self-attention key matrix, and each element of the resulting matrix is divided by the square root of the key vector dimension. Next, a normalized exponentiation operation is performed row-by-row on the resulting matrix. Finally, the normalized attention matrix is multiplied by the self-attention value matrix to obtain the self-attention processing result. The normalized exponentiation operation calculates the power of each component in the input vector, with the natural constant as the base and the component as the exponent, and then divides this power by the sum of the powers of all components in the input vector, thus ensuring that the sum of all components is one after processing. A bidirectional encoder based on a transformer is used to represent the pre-trained language model, enabling the output vector of any word unit in the node text to combine information from its preceding and following word units. Self-attention processing is used to aggregate contextual information according to the correlation between word units, resulting in a node semantic feature vector that represents the contextual semantics of the node text.
[0087] Edge attributes include relation type, preset relation strength weight, and relation establishment timestamp. Relationship type is determined from six types: causal, dependency, temporal, membership, collaboration, and constraint. The preset relation strength weight is a value within a closed interval of zero to one. When determining the preset relation strength weight, reviewers evaluate the relationship's frequency of co-occurrence in historical processing records, the degree of constraint enforcement, and the consequences of relation interruption. Each ordered evaluation includes at least two levels. Starting from the lowest level, levels are sequentially numbered from zero. The difference between the corresponding level number and the total number of levels minus one yields the mapping value of that evaluation within the closed interval of zero to one. This process is first performed on the same reviewer. The arithmetic mean of the three mapping values given by the staff is taken, and then the arithmetic mean of the arithmetic mean of all the staff is taken. The result is used as the preset relationship strength weight. Therefore, when the common occurrence frequency, execution constraint degree or relationship interruption consequences increase, the preset relationship strength weight increases accordingly. The relationship establishment timestamp is a positive real number timestamp that records the establishment time of the corresponding relationship, and adopts the same epoch start point and time unit as the node time-out mark. When the original text does not record the relationship establishment time, the earliest processing record time that can simultaneously locate the elements at both ends of the relationship and the relationship type is taken as the relationship establishment time. If the time still cannot be obtained, the case creation time is used.
[0088] Node type, node semantic feature vector, and preset node importance weight represent element category, text semantics, and node importance, respectively. Node time stamp is used to record the update time of the element. Relationship type and preset relationship strength weight represent the relationship category and relationship strength between elements, respectively. Relationship establishment timestamp is used to record the formation time of the relationship. The above attributes are used to describe the case graph, so that the graph editing cost and graph embedding calculation can distinguish between category differences, semantic differences, node importance differences, and relationship structure differences, and retain the time basis through node time stamp and relationship establishment timestamp.
[0089] After performing the above modeling process on a single historical case, a historical case graph corresponding to that historical case is obtained; after performing the above modeling process on all historical cases in the historical case library, a set of historical case graphs is obtained, and each historical case graph in the set of historical case graphs is stored in the graph database; step 100 directly outputs the set of historical case graphs during the initialization phase of the historical case library; step 200 reads the historical case graphs to be compared from the set of historical case graphs to calculate the case structure similarity required for training; step 300 uses the set of historical case graphs as input for graph embedding model training and index construction; step 400 establishes a query graph for newly occurring emergency events according to the same modeling process specified in step 100.
[0090] In an optional embodiment, if no node of type event is formed after feature extraction and relation extraction, the corresponding case graph is marked as a case graph to be reviewed, and the case graph to be reviewed is not entered into step 200, step 300 or step 400; after the reviewer supplements the node of type event according to the source text and confirms its node attributes, the case graph to be reviewed is removed from the mark, and then the case graph is entered into the subsequent steps; thereby ensuring that each case graph entering graph editing distance calculation, graph embedding model training, index construction and case retrieval includes at least one node of type event.
[0091] Step 200: Based on the node attributes and edge attributes, calculate the approximate graph edit distance between the two case graphs, and calculate the case structure similarity based on the approximate graph edit distance, specifically as follows: Figure 2 As shown.
[0092] Step 200 is used to set the cost of graph editing operations based on the node attributes and edge attributes specified in step 100, and to approximate the graph editing distance between two case graphs using a greedy weighted matching algorithm, thereby obtaining the case structure similarity. During the graph embedding model training phase, both case graphs are historical case graphs selected from the historical case graph set output in step 100. During the candidate reordering phase, the first case graph is the query graph established in step 400, and the second case graph is the historical case graph corresponding to the candidate case. In the following text, the first case graph and the second case graph refer to the two case graphs input in the aforementioned order in a single graph editing distance calculation.
[0093] The graph edit distance between two case graphs is the minimum sum of edit operation costs required to transform the first case graph into the second case graph. Edit operations include node insertion, node deletion, node replacement, edge insertion, edge deletion, and edge replacement. The costs of each edit operation include the costs of node insertion, node deletion, node replacement, edge insertion, edge deletion, and edge replacement. In specific calculation, all sequences of edit operations that can transform the first case graph into the second case graph are first determined. Then, for each sequence of edit operations, the costs of each edit operation in that sequence are added together to obtain the sum of the edit operation costs for that sequence. Finally, the minimum value among the sums of all edit operation costs is selected as the graph edit distance between the two case graphs. Since accurately calculating the graph edit distance is a nondeterministic polynomial-hard problem, this embodiment uses the following approximate algorithm for estimation.
[0094] The node replacement cost is obtained by adding the node type difference cost, the node semantic difference cost, and the node importance difference cost. When calculating the node type difference cost, first determine if the two nodes to be replaced have the same node type; if the node types are different, take one; if they are the same, take zero. Then multiply the obtained value by a preset node type weight coefficient. When calculating the node semantic difference cost, first calculate the vector norm of the semantic feature vectors of the two nodes respectively, and divide each node semantic feature vector by its own norm to obtain two unit semantic vectors. When the norm of a node semantic feature vector is zero, set all components of the corresponding unit semantic vector to zero. Then calculate the difference between the two unit semantic vectors dimension by dimension, square the difference in each dimension, add all the squares, and then take the arithmetic square root of the sum to obtain the Euclidean distance between the two unit semantic vectors. Since the Euclidean distance between the two unit semantic vectors lies within the zero-to-two closed interval, divide the Euclidean distance by two to obtain the normalized semantic distance within the zero-to-one closed interval. Then multiply the normalized semantic distance by the preset node semantic feature vector... The weighting coefficients are used to calculate the cost of node importance differences. First, the absolute value of the difference between the preset node importance weights of two nodes is calculated, and then this absolute value is multiplied by the preset node importance weight coefficient. Since the preset node importance weights are within a closed interval of zero to one, this absolute value is also within a closed interval of zero to one. The absolute values of node type difference, normalized semantic distance, and the difference in node importance weights are all within a closed interval of zero to one, and their values are consistent. Therefore, under the constraint that the sum of the preset node type weight coefficient, the preset node semantic feature vector weight coefficient, and the preset node importance weight coefficient is one, the node replacement cost is within a closed interval of zero to one. The preset node type weight coefficient, the preset node semantic feature vector weight coefficient, and the preset node importance weight coefficient are all non-negative, and their sum is one. The values of these three coefficients are obtained by traversing the candidate coefficient combinations that satisfy the aforementioned constraints on the historical case validation set labeled with case similarity order, calculating the case ranking results corresponding to each candidate coefficient combination, and selecting the candidate coefficient combination with the largest number of case pairs consistent with the labeled similarity order.
[0095] The edge replacement cost is obtained by adding the relation type difference cost and the relation strength difference cost. When calculating the relation type difference cost, first determine if the two edges to be replaced have the same relation type; if the relation types are different, take one; if they are the same, take zero. Then multiply the resulting value by a preset relation type weight coefficient. When calculating the relation strength difference cost, first calculate the absolute value of the difference between the preset relation strength weights of the two edges, then multiply this absolute value by the preset relation strength weight coefficient. Since the preset relation strength weights are located in a closed interval between zero and one, this absolute value is also located in a closed interval between zero and one. The relation type difference value is equal to the difference in relation strength weights. The absolute values are all within a closed interval of zero to one, and their value ranges are consistent. Therefore, under the constraint that the sum of the preset relation type weight coefficient and the preset relation strength weight coefficient is one, the edge replacement cost is within a closed interval of zero to one. The preset relation type weight coefficient and the preset relation strength weight coefficient are both non-negative numbers, and their sum is one. The values of the two are obtained by traversing the candidate coefficient combinations that satisfy the aforementioned constraints on the historical case verification set labeled with the rationality of relation replacement, calculating the relation replacement cost corresponding to each candidate coefficient combination, and selecting the candidate coefficient combination with the largest number of edge pairs whose relation replacement cost ranking is consistent with the labeling order.
[0096] The node replacement cost uses node type, node semantic feature vector and preset node importance weight simultaneously, so that node matching is constrained by feature category, text semantics and node importance at the same time; the edge replacement cost uses relation type and preset relation strength weight simultaneously, so that edge matching is constrained by relation category and relation strength at the same time; each difference is normalized to a closed interval of zero to one, so that the costs corresponding to different attributes can be added according to preset weight coefficients.
[0097] The insertion cost and deletion cost of the same node are equal. When calculating either cost, the node's preset node importance weight is multiplied by the preset node base cost parameter. The preset node base cost parameter is positive. It is obtained by calculating the sum of the node insertion cost and node deletion cost corresponding to the candidate parameter on historical case graph pairs with manually annotated editing paths, and selecting the candidate parameter that minimizes the absolute value of the difference between the sum of these costs and the manually annotated node editing cost. The insertion cost and deletion cost of the same edge are equal. When calculating either cost, the edge's preset relationship strength weight is multiplied by the preset edge base cost parameter. The preset edge base cost parameter is positive. It is obtained by calculating the sum of the edge insertion cost and edge deletion cost corresponding to the candidate parameter on historical case graph pairs with manually annotated editing paths, and selecting the candidate parameter that minimizes the absolute value of the difference between the sum of these costs and the manually annotated edge editing cost. Therefore, when the preset node importance weight or preset relationship strength weight increases, the insertion cost and deletion cost of the corresponding node or edge also increase.
[0098] Based on the above editing costs, a greedy weighted matching is performed on the two case graphs. During the construction of the node cost matrix, the nodes of the first case graph are set to the nodes corresponding to each row of the matrix, and the nodes of the second case graph are set to the nodes corresponding to each column of the matrix. The node replacement cost is calculated for any row node and any column node, and the obtained node replacement cost is written into the corresponding row and column positions. Thus, a node cost matrix with the number of rows equal to the number of nodes in the first case graph and the number of columns equal to the number of nodes in the second case graph is obtained.
[0099] During the greedy node matching process, among the elements in the rows and columns of the node cost matrix that are not yet occupied, the element with the smallest replacement cost for the current node is selected, and the two nodes corresponding to this element are identified as a node matching pair. The corresponding row and column are marked as occupied. If there are multiple minimum elements with the same value, they are first sorted according to the unique node identifier of the row nodes, then according to the unique node identifier of the column nodes, and the element with the first sorted value is selected. This process is repeated until there are no valid elements in either row or column that are not occupied. All node matching pairs together constitute the node matching pair set. In the first case graph, nodes that do not enter the node matching pair set are identified as node deletion operations, and in the second case graph, nodes that do not enter the node matching pair set are identified as node insertion operations.
[0100] During edge matching and edge cost calculation, the edges in the two case graphs are checked based on the set of matching node pairs. Only when the starting nodes and ending nodes of two edges match each other are the two edges identified as a mappable edge pair. An edge cost matrix is constructed according to the matrix rows corresponding to the edges in the first case graph and the matrix columns corresponding to the edges in the second case graph. The edge replacement cost is calculated for the mappable edge pairs and written into the corresponding elements, while the remaining elements are marked as invalid. Subsequently, the same minimum cost selection process as the greedy node matching is performed only on the valid elements that are not occupied in both rows and columns to obtain the set of matching edge pairs. When there are multiple minimum elements with the same value, they are sorted in sequence according to the starting node identifier, ending node identifier, and relation type of the first edge and the starting node identifier, ending node identifier, and relation type of the second edge, and the element with the first sorted value is selected. Edges in the first case graph that do not enter the set of matching edge pairs are identified as edge deletion operations, and edges in the second case graph that do not enter the set of matching edge pairs are identified as edge insertion operations.
[0101] The approximate graph edit distance is obtained by adding six cost components: the sum of node replacement costs for all matching node pairs, the sum of node deletion costs for all unmatched nodes in the first case graph, the sum of node insertion costs for all unmatched nodes in the second case graph, the sum of edge replacement costs for all matching edge pairs, the sum of edge deletion costs for all unmatched edges in the first case graph, and the sum of edge insertion costs for all unmatched edges in the second case graph. The maximum value between the number of nodes and edges in the two case graphs is denoted as the graph size. When the implementation method of sorting the node cost elements and edge cost elements and then sequentially executing the row and column occupancy is adopted, the upper bound of the asymptotic time complexity of this approximation algorithm is determined by the product of the square of the graph size and the logarithm of the graph size. Greedy weighted matching is adopted so that the approximate calculation of the graph edit distance does not require enumerating all edit operation sequences. The node cost matrix and edge cost matrix provide a unified cost comparison basis for candidate matching and can map edge pair constraints so that edge matching retains the correspondence between the starting node and the ending node.
[0102] The case structure similarity is calculated by normalizing the graph edit distance approximation. First, the number of nodes and edges of the two case graphs are added together to obtain the normalization factor. Since each case graph includes at least one node representing the event type, the sum of the number of nodes and edges of the two case graphs is not less than two, so the normalization factor is always positive and will not result in a division by zero. Then, the graph edit distance approximation is divided by the normalization factor, and one is added to the quotient. Finally, the reciprocal of the result is taken as the case structure similarity between the two case graphs. The case structure similarity is greater than zero and does not exceed one, and its value decreases monotonically as the graph edit distance approximation increases. When the graph edit distance approximation is zero, the case structure similarity is one. For two input case graphs, step 200 outputs the corresponding graph edit distance approximation and case structure similarity. When both input case graphs are historical case graphs, the obtained graph edit distance approximation and case structure similarity are used by step 300 to generate training labels. When the two input case graphs are the query graph and the historical case graph corresponding to the candidate case, respectively, the obtained case structure similarity is used by step 400 for candidate re-sorting.
[0103] For example, the structural similarity of the above cases can be represented as:
[0104] ;
[0105] ;
[0106] in, This represents the first case study diagram. This represents the second case diagram. and They represent The set of nodes and the set of edges, and They represent The set of nodes and the set of edges, , , and These represent the number of elements in the corresponding set. This represents the normalization factor obtained by adding the number of nodes and edges in the two case graphs. This represents the approximate graph edit distance obtained using the greedy weighted matching algorithm described above. express and The structural similarity between the cases.
[0107] Step 300: Train the graph embedding model using the graph edit distance approximation between historical case graphs as supervised information. The graph embedding model generates embedding vectors for historical case graphs. Construct a multidimensional binary search tree index based on the embedding vectors of historical case graphs.
[0108] Step 300 uses the set of historical case graphs output in Step 100 as input to train the graph embedding model. Each historical case graph is mapped to a low-dimensional Euclidean space, so that the Euclidean distance between the embedding vectors of two historical case graphs approximates the graph edit distance calculated in Step 200. A multi-dimensional binary search tree index is constructed using the embedding vectors of all historical case graphs in the historical case library for candidate retrieval in Step 400. The graph edit distance approximation is used as supervision information to enable the graph embedding model to learn the distance relationships corresponding to the node attributes, edge attributes, and connection structures of the case graphs. After converting the case graphs into embedding vectors, the candidate retrieval can first compare the vector distances and then calculate the graph edit distance approximation only for the candidate cases.
[0109] To preserve node type and preset node importance weights in the initial node representation, the node type is first converted into a six-component one-hot node type vector, with the corresponding component of the node type set to one and the remaining components set to zero. Then, the node semantic feature vector, the one-hot node type vector, and the preset node importance weights are concatenated and input into the node attribute fully connected mapping. The output dimension of the node attribute fully connected mapping is equal to the preset node semantic feature dimension. Its weight matrix is initialized according to the method for generating the preset initial weight matrix below, and each component of the bias vector is set to zero. It is then used as a learnable parameter for training the graph embedding model. The output of the node attribute fully connected mapping is used as the initial node representation for the first layer of the graph isomorphic network. When calculating the preset initial scalar parameters below, the node's own representation uses this initial node representation, and the neighbor messages use the neighbor messages generated by the first-layer fully connected mapping based on this initial node representation and the corresponding edge attribute vector. The learnable scalar parameters of each layer of the graph isomorphic network are then initialized with the same preset initial scalar parameters.
[0110] Candidate graph embedding dimensions are generated sequentially from positive integers one to preset node semantic feature dimensions, and the preset graph embedding dimensions are determined from them according to the following verification method; candidate leaf node capacities are generated sequentially from positive integers one to the total number of historical cases when building the index, and the preset leaf node capacities are determined from them according to the following nearest neighbor query verification method; for each training triple, the graph edit distance between the negative example case and the anchor case is subtracted from the graph edit distance between the positive example case and the anchor case, and the resulting positive difference is used as a candidate marginal parameter, and the preset marginal parameter is determined from the candidate marginal parameters according to the following sorting error number; during the construction of the multidimensional space binary search tree index, when the number of cases included in the current tree node is odd, the middle case of the sorted sequence is selected as the splitting case, and when the number of cases is even, the case with the higher sorting position among the two middle cases is selected as the splitting case; in this embodiment, the median of the remaining positions is calculated by taking the middle value when the number of cases is odd and the arithmetic mean of the two middle values when the number of cases is even, and rounding is performed when an integer result is required later.
[0111] To preserve edge attributes in neighbor aggregation, the relation type is first converted into a six-component one-hot relation vector, with the component corresponding to the relation type set to one and the rest set to zero. Then, the preset relation strength weight and the direction label of the edge relative to the current node are concatenated after the one-hot relation vector to obtain the edge attribute vector. The direction label includes two components: when the current node is the starting node of the edge, the first component is set to one and the second component is set to zero; when the current node is the ending node of the edge, the first component is set to zero and the second component is set to one. For each associated edge of the current node, the representation of the neighbor node connected to the edge in the previous layer is concatenated with the edge attribute vector of the edge. Through a fully connected mapping with an output dimension equal to the dimension of the representation of the current node in the previous layer, the neighbor message corresponding to the associated edge is obtained. When the same neighbor node is connected to the current node through multiple edges, each edge generates a neighbor message. The weight matrix of each fully connected mapping is initialized according to the generation method of the preset initial weight matrix below, and the components of the bias vector are set to zero and used as learnable parameters of the graph embedding model for training. The sum of the representations of all neighbor nodes of the current node below refers to the sum of the neighbor messages corresponding to all associated edges of the current node.
[0112] In this embodiment, a graph embedding model is used to map each input case graph to a real-valued embedding vector of a preset graph embedding dimension. The input case graphs in the graph embedding model training and index building stages are historical case graphs, while the input case graph in the retrieval stage of step 400 is the query graph. The preset graph embedding dimension is obtained by setting multiple candidate dimensions, training the corresponding graph embedding models respectively, calculating the average absolute error between the Euclidean distance and the graph edit distance approximation value of the embedding vectors in the historical case validation set, and then selecting the candidate dimension with the smallest index storage from the candidate dimensions with the smallest average absolute error.
[0113] The graph embedding model is composed of a graph isomorphic network and an attention pooling network. The graph isomorphic network updates the representation of each node by aggregating the representations of neighboring nodes layer by layer. For any current node, its neighboring nodes include the terminal nodes connected by the edges starting from the current node and the starting nodes connected by the edges ending from the current node. When the same neighboring node is connected to the current node through multiple edges, the number of edges is counted repeatedly in the aggregation. When determining the preset number of network layers of the graph isomorphic network, each historical case graph is temporarily regarded as an undirected graph. The path with the fewest edges between any two nodes in the same connected component is calculated, and the maximum number of edges in all paths is determined as the graph diameter of the corresponding historical case graph. Candidate layers are generated one by one from the positive integer one to the maximum graph diameter of all historical case graphs. When all historical case graphs only include isolated nodes, only the positive integer one is used as the candidate layer. Then, the layer with the minimum regression loss of the validation set graph editing distance is selected from the candidate layers.
[0114] For any layer, the learnable scalar parameter of that layer is incremented by one, and the result is multiplied by the representation of the current node in the previous layer. Then, all neighbor messages of the current node in the previous layer are summed, and the sum is added to the aforementioned product. Finally, the resulting vector is input into the multilayer perceptron of that layer to obtain the representation of the current node in that layer. The initial value of the learnable scalar parameter of each layer is a preset initial scalar parameter. For each node in the training set, the vector norm of the node's own representation and the vector norm of the sum of all neighbor messages of that node are calculated. The ratio of the latter vector norm to the former non-zero vector norm is decremented by one, and the median of the results corresponding to all nodes with non-zero self-representation vector norms is determined as the preset initial scalar parameter. When there are no nodes with non-zero self-representation vector norms in the training set, the preset initial scalar parameter is set to zero. The preset initial scalar parameter is updated during model training. The initial node representation used in the first layer is the output of the fully connected mapping of node attributes.
[0115] A multilayer perceptron is a feedforward neural network consisting of fully connected layers from input to intermediate representation, fully connected layers from intermediate representation to output, and a modified linear activation function. The first fully connected layer multiplies the first weight matrix with the input vector and adds the first bias vector, then performs modified linear activation on the resulting vector component by component. The second fully connected layer multiplies the second weight matrix with the modified linear activation result and adds the second bias vector to obtain the output of the multilayer perceptron. The weight matrix and bias vector of each fully connected layer are learnable parameters, with initial values of a preset initial weight matrix and a preset initial bias vector, respectively. For any fully connected layer where the number of input components equals the input dimension and the number of output components equals the output dimension, the initialization boundary is obtained by dividing the sum of the input and output dimensions by six and taking the square root. Elements of each matrix are independently extracted from a uniform distribution with the opposite of this initialization boundary as the lower boundary and the initialization boundary as the upper boundary, resulting in the preset initial weight matrix. All components in the preset initial bias vector are set to zero. The weight matrix and bias vector are updated during model training. For the modified linear activation, each input component is compared to zero, and the maximum value is used as the output. Therefore, negative components are set to zero, while non-negative components remain unchanged. The multilayer perceptrons used in each layer of the graph isomorphic network employ a network dimension configuration with preset input dimensions, preset intermediate representation dimensions, and preset output dimensions. The preset input dimension of the first layer's multilayer perceptron is consistent with the preset node semantic feature dimension in step 100. The preset input dimension of subsequent layers' multilayer perceptrons is consistent with the preset output dimension of the previous layer's multilayer perceptron, and the preset output dimension of each layer's multilayer perceptron is consistent with the preset graph embedding dimension. For each layer's multilayer perceptron, the minimum value between the preset input dimension and preset output dimension is used as the lower boundary of the candidate dimension, and the maximum value is used as the upper boundary. Integer dimensions are selected sequentially between these boundaries, and the model is trained accordingly. The candidate dimension with the minimum regression loss in the validation set graph edit distance is then determined as the preset intermediate representation dimension of that layer.
[0116] For example, the graph isomorphic network can be... The process of updating the node representation at each layer is represented as follows:
[0117] ;
[0118] in, Indicates the current network layer number. , Indicates the preset number of network layers. Indicates the current node, Represents a node In the Layer representation, Represents a node The initial node representation, Indicates the first Learnable scalar parameters of the layer Represents nodes A multiset consisting of associated edges. express One of the related edges in the middle, Representing an edge Connected nodes The neighboring nodes, This indicates that the neighbor node is at the 1st rank. Layer representation, Representing an edge The edge attribute vector, This represents the vector concatenation operation. and They represent the first The weight matrix and bias vector of the fully connected mapping of layer neighbor messages, where the vector in square brackets represents an edge. For nodes The generated neighbor messages Indicates the first Multilayer perceptron.
[0119] The learnable attention parameter vector is a model parameter used in the attention pooling network to convert the final representation of each node into an attention score. The dot product of the final representation of a node and this vector is called the attention score of the corresponding node. The number of its components is equal to the preset graph embedding dimension. Each component corresponds to the component with the same position in the final representation of the node, and all components participate in the calculation of the attention score. A single component does not correspond to any node type among event, resource, measure, department, goal, or constraint. For the same graph embedding model, all case graphs input during model training, index construction, and case retrieval share the same learnable attention parameter vector. This vector is not generated temporarily based on a certain input case graph, nor is it assigned by the reviewer.
[0120] When determining the learnable attention parameter vector, first divide by six and take the square root to obtain the attention initialization boundary. Then, independently extract each component from a uniform distribution with the opposite of this attention initialization boundary as the lower boundary and the same boundary as the upper boundary to obtain a preset initial attention parameter vector. At the start of model training, the preset initial attention parameter vector is assigned to the learnable attention parameter vector. During each training iteration, the total loss is backpropagated along the calculation process of the case graph embedding vector and attention weights to obtain the gradient of the total loss relative to the learnable attention parameter vector. Following the gradient descent method described below, the product of the preset model training learning rate and this gradient is subtracted from the learnable attention parameter vector before the update to obtain the updated learnable attention parameter vector. After triggering the preset training termination condition, the learnable attention parameter vector saved when the total loss of the validation set reaches its minimum is restored to obtain the learned attention parameter vector after training. Therefore, the learnable attention parameter vector is updated by gradient driven by the training set, and the retained training result is determined by the total loss of the validation set.
[0121] After processing by a graph isomorphic network with a preset number of layers to obtain the final representations of all nodes, the attention pooling network aggregates the final representations of all nodes into the embedding vector of the entire case graph. For each node, the dot product of the learnable attention parameter vector and the final representation vector of that node is calculated first, and the resulting dot product is used as the attention score of that node. Then, the attention score is raised to the power of the natural constant. The learnable attention parameter vector of the current iteration is used during model training, and the trained learnable attention parameter vector is used for index construction and case retrieval after model training. The power corresponding to that node is divided by the sum of the powers corresponding to all nodes to obtain the attention weight of that node. When the attention scores of other nodes remain unchanged, when As the attention score of the preceding node increases, the attention weight of the current node increases monotonically. Subsequently, the final representation of each node is multiplied by its attention weight, and all product vectors are summed to obtain the embedding vector of the entire case graph. The attention weight is obtained by operating on the learnable attention parameter vector and the final representation of the corresponding node according to the normalized exponent above. The attention weights of all nodes are non-negative and their sum is one. A graph isomorphic network is used so that the node representation includes neighbor messages and edge attributes within a preset network layer range. An attention pooling network is used so that case graphs with different numbers of nodes are converted into embedding vectors of a preset graph embedding dimension, and the contribution of each node's final representation to the embedding vector is determined by the trained attention weights.
[0122] For example, the embedding vector of the above case graph can be represented as:
[0123] ;
[0124] ;
[0125] ;
[0126] in, This represents any input example image. Example diagram The set of nodes, This represents the node currently calculating attention weights or embedding vector weights. This represents the nodes traversed during the normalization and summation of attention weights. Represents a node go through The final representation obtained after processing by a layered graph isomorphic network. Represents a node go through The final representation obtained after processing by a layered graph isomorphic network. This represents the learnable attention parameter vector. This represents the vector transpose operation. Represents the learnable attention parameter vector and nodes The final representation of the vector dot product between them, This represents an exponential function with the natural constant as its base. Represents a node In the case study Attention weights in Example diagram Embedded vector, Indicates the preset graph embedding dimension. express A real vector space.
[0127] The graph embedding model is trained jointly using triplet loss and graph edit distance regression loss. First, any two different historical case graphs from the training historical case graph set are combined into an unordered case graph pair. The graph edit distance approximation algorithm in step 200 is used to calculate the approximate graph edit distance value for each unordered case graph pair, and this approximate graph edit distance value is used as the training label for the corresponding unordered case graph pair, thus forming the training set. In the following text, the unordered case graph pair will be referred to simply as a case pair during the graph embedding model training process. Then, a training triplet consisting of an anchor case, a positive case, and a negative case is constructed. The approximate graph edit distance between a positive case and an anchor case does not exceed a preset positive threshold, and the approximate graph edit distance between a negative case and an anchor case is not less than a preset negative threshold. For each anchor case, each case in its positive case set is combined with each case in its negative case set to obtain all training triplets corresponding to that anchor case. Anchor cases lacking positive or negative cases are... Examples are not used to construct training triples, but case pairs formed by examples and other examples are still used to calculate the graph edit distance regression loss. The preset positive example threshold is a non-negative number and is strictly less than the preset negative example threshold. The two thresholds are determined by statistically analyzing the distribution of graph edit distance approximations in the training set. The upper boundary of the graph edit distance approximation corresponding to case pairs that are manually confirmed as similar cases is determined as the preset positive example threshold, and the lower boundary of the graph edit distance approximation corresponding to case pairs that are manually confirmed as dissimilar cases is determined as the preset negative example threshold. When the two boundaries overlap, each graph edit distance approximation in the training set is used as a candidate boundary value in turn. The two boundary values that minimize the number of classification errors of case pairs and satisfy the aforementioned size relationship are selected. When the manual confirmation results do not yet include both similar and dissimilar case pairs, the triple loss is not calculated, and the graph embedding model is trained only with the graph edit distance regression loss. After both types of manual confirmation results are formed, the preset positive example threshold and the preset negative example threshold are determined and joint training is enabled.
[0128] To calculate the triplet loss for a training triplet, first calculate the Euclidean distance between the anchor case embedding vector and the positive case embedding vector, then calculate the Euclidean distance between the anchor case embedding vector and the negative case embedding vector. Subtract the second Euclidean distance from the first, and add a preset marginal parameter to the difference. Then compare this result with zero and take the maximum of the two. Sum the above calculation results for all training triplets to obtain the triplet loss. The preset marginal parameter is a positive number. Multiple candidate marginal parameters are set to train the graph embedding model separately, and the candidate marginal parameter that minimizes the number of misordered positive and negative cases in the validation set is selected.
[0129] For example, the construction conditions for training triples and the triple loss can be expressed as:
[0130] ;
[0131] ;
[0132] in, This represents the training triple set. This represents a historical case graph corresponding to the anchored case. This represents a historical case graph corresponding to a positive example. This represents a historical case graph corresponding to negative examples. This indicates the preset positive example threshold. , This indicates the preset negative example threshold. This represents the triplet loss corresponding to all training triplet pairs. , and These represent the embedding vectors of the corresponding historical case graphs. Describes the Euclidean norm of a vector. Indicates the preset marginal parameters and , This indicates the operation of taking the maximum value from the listed values.
[0133] When calculating the graph edit distance regression loss, for each pair of cases in the training set, first calculate the Euclidean distance between the embedding vectors of the two case graphs, then subtract the approximate graph edit distance of the pair from this Euclidean distance, and calculate the square of the difference. Sum the squared results for all pair of cases to obtain the graph edit distance regression loss. The total loss equals the sum of the triplet loss and the graph edit distance regression loss weighted by the preset regression loss weights. The preset regression loss weights are non-negative, and the graph embedding model is trained separately by setting multiple candidate regression loss weights. For the validation results corresponding to all candidate regression loss weights, the number of case ranking errors for each candidate result is divided by the maximum number of case ranking errors to obtain the normalized number of case ranking errors, and then the graph edit distance of each candidate result is used as the normalized number of errors. The regression error is divided by the maximum graph edit distance regression error to obtain the normalized graph edit distance regression error; when the maximum value is zero, the corresponding normalization result is set to zero; the two normalization results are added together, and the candidate regression loss weight with the smallest sum is selected; when the results are manually confirmed not to include both similar and dissimilar case pairs and therefore the triplet loss is not calculated, the preset regression loss weight is set to one, so that the total loss equals the graph edit distance regression loss; the triplet loss is used to constrain the distance order of positive and negative cases relative to the anchor case, and the graph edit distance regression loss is used to constrain the numerical relationship between the Euclidean distance of the embedding vector and the graph edit distance approximation; the two losses are used together so that the trained embedding vectors simultaneously retain the case ranking relationship and the distance scale of the graph edit distance approximation.
[0134] For example, the graph editing distance regression loss and the total loss can be expressed as:
[0135] ;
[0136] ;
[0137] in, This represents the unordered set of case graph pairs consisting of training history case graphs. and express Any unordered case diagram in the dataset contains two different historical case diagrams. and These represent the indices of the two historical case diagrams in this case diagram pair. This represents the graph edit distance regression loss. express and Approximate graph edit distance between them This represents the total loss of the graph embedding model. Indicates the preset regression loss weights and When the triplet loss is not calculated, Take zero and Choose one.
[0138] The gradient descent method is used to iteratively reduce the total loss. In each iteration, the total loss is calculated using all case pairs and all training triples in the training set according to the aforementioned method. Then, the gradient of the total loss relative to each learnable parameter is calculated through backpropagation. The updated learnable parameters are obtained by subtracting the product of the preset model training learning rate and the corresponding gradient from the learnable parameters before the update. This completes one round of training. The total loss of the validation set is calculated after each round of training. The preset model training learning rate is a real number greater than zero and not exceeding one. Candidate learning rates are generated within this range, and model training is performed on each candidate rate. The rate that makes the learning rate most effective within the same number of iterations is selected. The candidate learning rate with the minimum total loss of the validation set and no divergence in the total loss value during the training process is selected. The preset training termination condition is that the total loss of the validation set does not decrease within a preset number of consecutive checks, or the number of training iterations reaches a preset maximum number of iterations. The preset number of checks and the preset maximum number of iterations are determined based on the distribution of training epochs in which the total loss of the validation set first reaches its minimum value for each candidate learning rate. The preset number of checks is taken as the median of the distribution of training epochs, and the preset maximum number of iterations is taken as the maximum value of the distribution of training epochs. After the termination condition is triggered, the model parameters saved when the total loss of the validation set is minimum are restored, and the trained graph embedding model is obtained.
[0139] After training, the graph embedding model is used to calculate the embedding vector of each historical case graph in the historical case library for the preset graph embedding dimension. A multi-dimensional binary search tree index is constructed using the embedding vectors of all historical case graphs. This index recursively partitions the embedding vectors using a median partitioning strategy, and the tree layers and embedding vector dimensions are numbered starting from zero. At any level of the tree, the vector dimension corresponding to the remainder obtained by dividing the current level number by the preset graph embedding dimension is determined as the current partitioning dimension. The embedding vectors of the cases included in the current tree node are sorted in ascending order according to their components on this partitioning dimension. If the components are the same, they are sorted according to the case identifier. The case in the middle position after sorting is stored as the partition case of the current tree node. The component of this case on the current partitioning dimension is determined as the partition value. Cases ranked before the partition case are assigned to the left subset, and cases ranked after the partition case are assigned to the right subset. The left and right subtrees are then recursively constructed. When the number of cases in a subset does not exceed a certain threshold... The partitioning stops when the preset leaf node capacity is reached, and all cases in the subset are stored in the corresponding leaf node. The preset leaf node capacity is a positive integer. Multiple candidate leaf node capacities are set to build indexes and execute nearest neighbor queries on the validation set. The candidate leaf node capacity with the shortest average query time is selected from those that can recall all manually labeled similar cases corresponding to each validation query. If there is no candidate leaf node capacity that meets all recall conditions, the one with the largest number of manually labeled similar cases is selected first, and then the one with the shortest average query time is selected from those with the same number of recalls. Step 300 outputs the trained graph embedding model and multidimensional space binary search tree index for use in step 400. The median partitioning strategy is adopted to ensure that the number of cases on both sides of the partition case is equal or differs by one when the index is built, forming an index structure for layer-by-layer positioning and backtracking pruning of nearest neighbor search. The preset leaf node capacity is used to control the stopping partitioning condition so that the recall results and query time can be determined by the validation set.
[0140] Step 400: Construct a query graph for newly occurring emergency events, retrieve the query graph based on the graph embedding model, case structure similarity, and multidimensional space binary search tree index to obtain a final set of similar cases, and perform weighted combination of emergency plans associated with cases in the final set of similar cases to obtain recommended plans.
[0141] Step 400 is used to construct a query graph for newly occurring emergency events, and sequentially completes candidate retrieval, candidate re-ranking, timeliness attenuation weighting, final similar case selection, weighted combination of contingency plans, and confidence assessment to obtain recommended contingency plans and their confidence levels.
[0142] Before each retrieval, the total number of current historical cases is compared with the predetermined number of final similar cases. If the total number of current historical cases is not less than two but less than the predetermined number of final similar cases, the predetermined number of final similar cases is updated to the total number of current historical cases. This ensures that the selection of subsequent final similar cases and the calculation of confidence scores use the same updated value. The predetermined candidate expansion coefficient and the predetermined confidence threshold are then re-determined according to the following determination method. Before both parameters are updated, the recommended plans are subject to manual confirmation and direct output is not enabled.
[0143] In this embodiment, the type of contingency plan element is determined by the content type of the contingency plan content unit, the normalized disposal object, the normalized execution action, and the normalized parameter name. Contingency plan content units with the same four elements belong to the same contingency plan element type, and contingency plan content units with any different element belong to different contingency plan element types. When a contingency plan content unit does not include parameters, its normalized parameter name is recorded as a null value.
[0144] First, the text of newly occurring emergency events is used as the query text. The query text is processed according to step 100, which involves unified character encoding and unified character width processing. The resulting normalized query text is used as the unique normalized source text in the normalized text set. Then, a preprocessed sentence sequence is obtained by processing sentence segmentation, pronoun resolution, and synonym normalization according to step 100. This preprocessed sentence sequence is used as input, and a query graph is built by processing element extraction, relation extraction, attribute generation, and verification according to step 100, consisting of a node set, a directed edge set, node labeling functions, and edge labeling functions. The query is then checked based on the essential node type set and essential relation type set corresponding to the main type of emergency event. The main type of an emergency event is determined by querying the event classification of nodes whose node type is "event" in the graph. When multiple event nodes exist, the earliest occurrence time is used; if occurrence times are the same, the nodes are sorted by their unique identifiers. If no event node exists in the graph, the query text is submitted to the reviewer for event classification confirmation, and automatic completion is not performed. The essential node type set and essential relationship type set are determined by the common node types and relationship types in historical cases of the same emergency event main type that have passed review. If no historical cases of the same emergency event main type exist in the historical case library, the event is identified as an essential node type, and the essential relationship type set is set to empty. When a graph lacks any essential node type or essential relation type, it is determined that the query graph has missing elements or relations. For the missing node type, starting from an existing node in the query graph, candidate knowledge nodes that can be connected through essential relation types are searched in the domain knowledge graph. For the missing relation type, candidate knowledge relations that can connect existing node pairs in the query graph are searched in the domain knowledge graph. Candidate knowledge nodes with the same normalized name and node type as existing nodes in the query graph are merged into a single node, and candidate knowledge relations are added according to the relation direction specified in step 100. When multiple mutually exclusive candidate contents exist or the domain knowledge graph does not contain corresponding content, the candidate content and source are... The text and query text are submitted to the reviewers together, who select content consistent with the query text. Content that cannot be obtained from the query text or confirmed external information is marked as unknown, and no nodes or edges without supporting evidence are generated. After completion, node attributes and edge attributes are generated according to the attribute structure in step 100 to obtain the completed query graph, which serves as the input for candidate quick filtering. Mutually exclusive candidate content refers to candidate knowledge nodes that are of the same type but have different normalized names, and cannot be used as the completion result of the same essential node type based on the mutual exclusion relationship in the domain knowledge graph. Confirmed external information refers to external records whose source, time, and content are confirmed by the reviewers to be consistent with the query event.
[0145] The first stage involves rapid candidate screening. If the total number of current historical cases is less than two, automatic case recommendation is not performed. Instead, a message indicating insufficient historical cases is output through the recommendation result output interface, and the query graph and its source text are submitted to the reviewers. No recommendation plan is generated for this query. If the total number of current historical cases is not less than two, the graph embedding model trained in step 300 is used to calculate the embedding vector of the query graph. A nearest neighbor search is performed on the multidimensional binary search tree index to return the historical cases with the shortest Euclidean distance to the query graph embedding vector in the embedding space, forming a candidate case set. The preset number of candidate cases is equal to the product of the preset final similar case number and the preset candidate expansion coefficient. When this product exceeds the total number of current historical cases, the preset number of candidate cases is determined as the total number of current historical cases. The preset final similar case number is an integer greater than one and not exceeding the total number of historical cases. When determining the preset final similar case number, for each query case on the historical case validation set, the number of similar cases is increased according to the timeliness. The weighted comprehensive score is used to sequentially increase the number of similar cases used for contingency plan combination, and the change in the set of contingency plan element types after each increase is recorded. The number of cases corresponding to the first time the set of contingency plan element types reaches the set of contingency plan element types obtained by using all historical cases is determined as the number of similar cases required for the query case. The median of the number of similar cases required for all query cases is rounded to the nearest integer, and the rounding result is limited to an integer range greater than one and not exceeding the total number of historical cases, to obtain the preset final number of similar cases. The preset candidate expansion coefficient is a positive integer. By performing full database case structure similarity calculation and timeliness attenuation weighting on each query case in the historical case verification set, the candidate expansion coefficient is increased sequentially until the candidate case set can include all the preset final similar cases determined by sorting according to the full database timeliness weighted comprehensive score. The candidate expansion coefficient that first meets this condition is then determined as the preset candidate expansion coefficient. The increase stops when the candidate case set has included all historical cases.
[0146] Nearest neighbor search starts from the root node. At each level, it compares the components of the query graph embedding vector in the current segmentation dimension with the current segmentation value, and traverses down to the corresponding leaf node based on the comparison result. If they are equal, it first traverses the left subtree. During the traversal, it calculates the Euclidean distance between the query graph embedding vector and the segmentation case embedding vector, and adds the segmentation case to the nearest neighbor set. After reaching the leaf node, it calculates the Euclidean distance between the query graph embedding vector and the embedding vectors of each case in the leaf node, and maintains a nearest neighbor set with no more than the preset number of candidate cases according to the Euclidean distance from smallest to largest. If the Euclidean distances are the same, they are sorted by case identifier. Then, it backtracks to calculate the components of the query graph embedding vector in the current segmentation dimension and the current segmentation value. The search algorithm calculates the absolute value of the difference between cut values, representing the distance from the query point to the split hyperplane. If the number of cases in the nearest neighbor set is less than the preset number of candidate cases, it proceeds to the other subtree. If the nearest neighbor set has reached the preset number of candidate cases, the hyperplane distance is compared with the maximum Euclidean distance in the nearest neighbor set; if the hyperplane distance is not greater than this maximum Euclidean distance, it proceeds to the other subtree. After the search, historical cases from the nearest neighbor set are returned. When the preset graph embedding dimension and the preset number of candidate cases are fixed and the index remains balanced, the average time complexity of this search increases logarithmically with the total number of historical cases. When all nodes need to be accessed, the time complexity increases linearly with the total number of historical cases.
[0147] The second stage involves candidate reordering. For each candidate case in the candidate case set, the historical case graph corresponding to that candidate case is read from the graph database, and the graph edit distance approximation algorithm from step 200 is used to calculate the approximate graph edit distance between the query graph and the historical case graph. Subsequently, the number of nodes, edges, nodes, and edges of the query graph, the historical case graph, and the historical case graph are added together to obtain the normalization factor for the corresponding candidate case. The graph edit distance approximation is divided by the normalization factor, and one is added to the quotient before taking the reciprocal to obtain the case structure similarity between the query graph and the historical case graph. The two-stage retrieval outputs the candidate case set and the case structure similarity corresponding to each candidate case, which serve as input for the timeliness decay weighted processing.
[0148] The first stage uses embedding vectors and multidimensional space binary search tree indexes to limit the historical cases for which the graph edit distance approximation value needs to be calculated to the candidate case set. The second stage uses node attributes, edge attributes, and connection structure to reorder the candidates to correct the distance error caused by the graph embedding mapping. As a result, the graph edit distance approximation algorithm changes from executing all historical cases one by one to executing only a preset number of candidate cases, while the final ranking is still based on the case structural similarity.
[0149] When generating the actual decay sequence of historical cases at different durations, each case's entry into the final similar case set is treated as a case reuse record, and grouped according to the preset duration unit to which the case's duration at the corresponding recommendation time belongs; the number of successfully reused case reuse records in each group is divided by the total number of case reuse records in that group to obtain the reuse success rate corresponding to each duration, and these are arranged in chronological order to form the actual decay sequence; the method for determining successful reuse is consistent with step 500; a set of cases with at least two durations and each... When the total number of case reuse records for all durations is not zero in the actual decay sequence, time-sensitive decay weighting is not enabled, and the time-sensitive decay weight of each candidate case is set to one. After the actual decay sequence is formed, the preset basic decay rate and preset adjustment coefficient are determined according to the following method, and time-sensitive decay weighting is enabled. The actual decay sequence is generated using case reuse records, and the preset basic decay rate and preset adjustment coefficient are determined based on the actual reuse results of historical cases at different durations. When the sample conditions are not met, the time-sensitive decay weight is set to one to avoid changing the case structural similarity due to incomplete decay sequences.
[0150] The timeliness decay weighting adjusts the case structure similarity based on the case's duration. For each candidate case, if a final verification time exists, it is determined as the timeliness start time; otherwise, the creation time is determined as the timeliness start time. The case duration is obtained by subtracting the timeliness start time from the current time and converting it according to the preset duration unit. If the current time is earlier than the timeliness start time due to time recording errors, the case duration is set to zero. The preset duration unit is determined based on the statistical period used for updating the domain knowledge of historical cases to ensure that the domain change degree and the case duration use the same time unit. The case's decay rate is then multiplied by the case duration, the product is inversely multiplied, and the result is calculated as a power of the natural constant with the inverse as the exponent. The result is used as the timeliness decay weight.
[0151] The decay rate of each candidate case is adaptively determined based on its primary type. The primary type of a candidate case is determined according to the event category corresponding to nodes of type "event" in the historical case graph corresponding to that candidate case. When there are multiple nodes of type "event", the event occurrence time corresponding to each node of type "event" in the original case text is read. The node with the earliest event occurrence time is selected from the nodes of type "event" that have recorded event occurrence time. If the event occurrence times are the same, they are sorted according to their unique identifiers and the node with the earliest sorting time is selected. When none of the nodes of type "event" have recorded event occurrence time, they are sorted according to their unique identifiers and the node with the earliest sorting time is selected. The event category corresponding to the selected node of type "event" is determined as the primary type of the candidate case. Specifically, the change degree of the domain corresponding to the primary type of the candidate case is first multiplied by a preset adjustment coefficient, one is added to the product, and then the sum is multiplied by a preset base decay rate to obtain the decay rate of the candidate case. The domain change degree is obtained by statistically analyzing the number of times knowledge entries are added, modified, and expired in the corresponding domain within a preset duration unit before the current time. The number of operations is obtained by summing the three types of counts and dividing by the total number of valid knowledge entries in the domain at the end of the statistical window. Multiple operations on the same knowledge entry within the statistical window are counted separately. When the total number of valid knowledge entries in the domain is zero, the domain variability is set to zero to avoid division by zero. The domain variability is a dimensionless ratio obtained by comparing the sum of update counts within a unit time window with the total number of knowledge entries. The preset base decay rate has the dimension of the reciprocal of the preset duration unit. The decay rate obtained by multiplying the two is multiplied by the case duration, resulting in a dimensionless exponent, thus ensuring consistency in the exponential calculation dimension of the timeliness decay weight. Under otherwise unchanged conditions, an increase in the number of knowledge updates per unit time leads to an increase in domain variability; an increase in domain variability leads to an increase in the case decay rate. The preset base decay rate is positive, and the preset adjustment coefficient is non-negative. Both are obtained by generating an actual decay sequence based on the reuse success rate of historical cases at different durations, and selecting the candidate parameter combination that minimizes the sum of squared errors between the calculated timeliness decay weight and the actual decay sequence from among the candidate parameter combinations that satisfy the aforementioned value constraints.
[0152] For each candidate case, its case structural similarity is multiplied by the timeliness decay weight to obtain the timeliness-weighted comprehensive score of the candidate case. All cases in the candidate case set are sorted from the largest to the smallest according to the timeliness-weighted comprehensive score. If the timeliness-weighted comprehensive scores are the same, they are sorted according to the case identifier. The cases that are ranked first and whose number is equal to the preset final number of similar cases are selected to form the final similar case set. Each case in this set retains its timeliness-weighted comprehensive score, which is used as input for the weighted combination of the plan and the confidence assessment.
[0153] For each case in the final set of similar cases, the emergency response plan associated with that case is extracted. When calculating the combined weight of the emergency response plan associated with any case, the time-weighted comprehensive score of that case is divided by the sum of the time-weighted comprehensive scores of all cases in the final set of similar cases. The case structure similarity and time-effect decay weights are both greater than zero, so the sum of the time-weighted comprehensive scores is greater than zero. Each combined weight obtained in this way is located in a closed interval between zero and one, and the sum of all combined weights is one.
[0154] Before weighted combination of emergency plans, each emergency plan is broken down into plan content units. Initial segmentation is performed according to clause numbers, paragraph boundaries, and trigger words for actions within the emergency plan text. Clauses containing expressions of time, quantity, or units of measurement are identified as numerical structured elements; clauses containing responsible departments, targets, and actions but without numerical parameters are identified as categorical structured elements; clauses containing multiple parallel resource or measure names are identified as aggregate structured elements; clauses that cannot be structurally identified are identified as textual content. Each plan content unit records the content type, text, category, aggregate members, target, responsible department, action, preconditions, subsequent actions, parameter name, parameter value, unit of measurement, and source case identifier. Records unrelated to the content type of the plan content unit are recorded as null values. A unique content unit identifier is generated using the source case identifier, content type, normalized target, normalized responsible department, normalized action, normalized parameter name, and their sequential number in the source plan. Content types include textual content, categorical structured elements, aggregate structured elements, and aggregate structured elements. The system employs both composite and numerical structured elements. Numerical structured elements include time parameters, quantity parameters, and other numerical parameters with units of measurement. The same synonym normalization process as in step 100 is applied to the disposal object, responsible department, execution action, and parameter name. Contingency plan content units with the same content type and identical normalized disposal object, responsible department, execution action, and parameter name are identified as similar contingency plan content units. For each similar contingency plan content unit, the combined weights corresponding to the cases including that content unit are summed to obtain the cumulative support weight of that content unit. For each temporal relationship formed by preconditions and subsequent actions, the combined weights corresponding to the cases including that temporal relationship are summed to obtain the cumulative support weight of that temporal relationship. Emergency plans are broken down into contingency plan content units, allowing text, categories, set members, and numerical parameters to be combined according to their respective data formats. Normalized disposal objects, normalized execution actions, and normalized parameter names are used to identify similar contingency plan content units, enabling contingency plan content units expressing the same disposal content from different source cases to accumulate combined weights.
[0155] For text-based content, the text with the highest combined weight of source cases is selected from each similar plan content unit as the retained text; when the combined weights are the same, the text with the first sorted source case identifier is selected; the retained text is topologically sorted according to the temporal relationship between the preconditions and subsequent actions, and the text is concatenated according to the topological sorting result; when there are multiple plan content units with zero in-degree in the same round of topological sorting, the one with the highest cumulative support weight is selected first, and when the cumulative support weights are the same, the one with the first sorted unique content unit identifier is selected; when there is a circular temporal relationship, the temporal relationship with the lowest cumulative support weight in the ring is deleted, and when the cumulative support weights are the same, the one with the second sorted unique content unit identifier at both ends of the relationship is deleted, and then the topological sorting is re-executed; this avoids execution order conflicts caused by concatenating only the case order.
[0156] In an optional embodiment, when a ring-shaped time sequence relationship exists, the time sequence relationship in the ring is not automatically deleted. Instead, the plan content units constituting the ring-shaped time sequence relationship, the cumulative support weight of each time sequence relationship, and the source case identifier are submitted to the reviewers. Based on the review results, the time sequence relationships that are confirmed not to be retained are deleted, and then topological sorting is performed on the remaining time sequence relationships. Before the review is completed, the recommended plan that includes the ring-shaped time sequence relationship is not directly output.
[0157] For categorical structured elements, the cumulative support weight of the corresponding plan content units for each candidate category is calculated, and the category with the largest cumulative support weight is determined as the recommended category. When the cumulative support weights are the same, the category used by the source case with the largest combined weight is selected. If they are still the same, they are sorted according to the normalized name of the category and the one with the first ranking is selected. For aggregate structured elements, the members of each candidate set are arranged from largest to smallest according to the cumulative support weight. When the cumulative support weights are the same, they are sorted according to the normalized name and added to the recommended set in turn. When adding a member of a candidate set would violate the constraint relationship corresponding to another member that has already been added, the one with the larger cumulative support weight value is retained. If the values are the same, the one with the first normalized name ranking is retained.
[0158] For each similar numerical structured element, first sum the combined weights of the source cases that include that numerical structured element to obtain the total parameter weights. Then, divide the combined weights of each source case by the total parameter weights to obtain the parameter fusion weights for each source value. Since at least one source case includes the numerical structured element to be fused, the total parameter weights are greater than zero. For time parameters, parameters expressed in absolute time are converted into time intervals relative to the event start time. Parameters already expressed in duration or relative time intervals are directly retained as time intervals. Then, similar time parameters are converted to the same unit of measurement and multiplied by their corresponding parameter fusion weights before being summed to obtain the recommended time interval. When the query plan requires absolute time, the recommended time interval is restored to the recommended absolute time based on the start time of the query event. For quantity parameters, first convert each quantity parameter to the same unit of measurement, then multiply them by their corresponding parameter fusion weights and sum them. The summation result is rounded to the nearest integer, and the rounded result is restricted to the range of resource quantity constraints confirmed for the query event to obtain the recommended quantity parameters. The range of resource quantity constraints confirmed for the query event is determined by the lower or upper limit of the quantity that has a constraint relationship with the corresponding resource, identified from the query text according to the same feature extraction and relationship extraction rules as in step 100. When both a lower and upper limit exist, the resource quantity constraint range is formed by the corresponding lower to upper limit. When only a lower or upper limit exists, a one-sided constraint is formed by the corresponding lower or upper limit. For other numerical structured elements that can be converted to the same unit of measurement, the converted parameter values are multiplied by the corresponding parameter fusion weights and added together to obtain the fusion value. When the unit of measurement cannot be unified or conflicting constraints do not have a common feasible value, no weighting is applied to the corresponding parameters. They are marked as parameters to be confirmed and output along with the source values.
[0159] After completing the above combined processing, a recommendation plan is generated, consisting of a text-based content sequence, a categorical structured element set, a set of aggregate structured elements, and a numerical structured element set. All retained text, arranged according to the aforementioned topological sorting results, is sequentially concatenated and written into the text-based content sequence. Each recommendation category obtained for the categorical structured elements is associated with its corresponding disposal object, responsible department, execution action, preconditions, and subsequent actions, and written into the categorical structured element set. Each recommendation set obtained for the aggregate structured elements is associated with its corresponding disposal object, responsible department, execution action, preconditions, and subsequent actions. The results of textual content, categorical structured elements, aggregate structured elements, and numerical structured elements are linked and written into a set of aggregate structured elements. Each recommendation time interval or absolute recommendation time, each recommendation quantity parameter, and each fusion value obtained for numerical structured elements are associated with the corresponding disposal object, responsible department, execution action, preconditions, subsequent actions, parameter name, and unit of measurement, and written into the set of numerical structured elements. For parameters to be confirmed, the confirmation mark and each source value are retained in the corresponding numerical structured elements. Thus, the processing results of textual content, categorical structured elements, aggregate structured elements, and numerical structured elements are written into the components with the same name in the recommendation plan.
[0160] The confidence level of the recommended contingency plan is determined by the average time-weighted composite score of similar cases and the distribution of combined weights. First, the time-weighted composite scores of all cases in the final set of similar cases are summed and then divided by the preset number of final similar cases to obtain the average time-weighted composite score. Then, the mean of the combined weights is calculated. The mean of the combined weights is equal to the sum of all combined weights divided by the preset number of final similar cases. Since the sum of all combined weights is one, this mean is also equal to one divided by the preset number of final similar cases.
[0161] When calculating the variance of the combined weights, subtract the mean of the combined weights from each combined weight, square the difference, sum all the squares, and then divide by the preset number of final similar cases to obtain the variance of the combined weights. The maximum possible value of the variance of the combined weights is obtained by subtracting one from the preset number of final similar cases and then dividing by the square of the preset number of final similar cases. This maximum possible value corresponds to the case where all combined weights are concentrated in a single case. Subsequently, divide the variance of the combined weights by this maximum possible value and subtract the quotient from one to obtain the weight distribution coefficient. Finally, multiply the average time-weighted comprehensive score by the weight distribution coefficient to obtain the confidence level of the recommendation plan. The average time-weighted comprehensive score is used to represent the degree of structural and time-sensitivity matching between the final similar cases and the query event, and the weight distribution coefficient is used to represent whether the recommended content is supported by multiple final similar cases. Multiplying the two together ensures that the confidence level of the recommendation plan is constrained by both the degree of case matching and the distribution of source support.
[0162] For example, the calculation process of the confidence level of the above recommended contingency plan can be expressed as follows:
[0163] ; ;
[0164] ; ; ; ;
[0165] ;
[0166] in, Indicates the preset final number of similar cases and , This indicates the final similar case number corresponding to the current calculation of the portfolio weights or portfolio weight variance. This represents the final similar case number traversed during the normalized summation of combined weights. Indicates the first The time-weighted composite score of the final similar cases, Indicates the first The time-weighted composite score of the final similar cases, Indicates the first The combined weight of emergency response plans associated with each final similar case This represents the average time-weighted composite score. This represents the average weight of the portfolio. This represents the variance of the portfolio weights. This represents the maximum possible value of the portfolio weight variance. Represents the weight distribution coefficient. This indicates the confidence level of the recommended contingency plan.
[0167] The pre-set reliability threshold is achieved by combining the confidence levels of historical recommendation results with the manual confirmation results of reviewers to form a verification sample. The confidence levels of each verification sample are then used as candidate confidence thresholds. When the manual confirmation result indicates that the recommended plan cannot be directly implemented, but its confidence level is not less than the candidate confidence threshold, the corresponding sample is counted as an erroneous direct output sample. When the sample confidence level is less than the candidate confidence threshold, the corresponding sample is counted as a sample requiring manual confirmation. The candidate confidence threshold that minimizes the sum of the number of erroneous direct output samples and the number of samples requiring manual confirmation is selected. If the sums are the same, the candidate confidence threshold with the largest value is selected. A pre-set reliability threshold is set. Before a validation sample including manual confirmation results is formed, all recommended plans are subject to manual confirmation and direct output is not enabled. After a validation sample is formed and the pre-set reliability threshold is determined, the confidence level of the recommended plan is compared with the pre-set reliability threshold. If the recommended plan does not include the parameter to be confirmed and the confidence level is not less than the pre-set reliability threshold, the recommended plan and its confidence level are directly output. If the recommended plan includes the parameter to be confirmed or the confidence level is less than the pre-set reliability threshold, the recommended plan, confidence level, and parameter to be confirmed are output and submitted to the reviewer for manual confirmation. Step 400 outputs the recommended plan and its confidence level.
[0168] Step 500: When a new case is added to the historical case library, update the multidimensional space binary search tree index and update the graph embedding model according to the distribution changes of the historical case graph; the user feedback corresponding to a recommendation is associated with all the final similar case identifiers used in this recommendation, and the same user feedback is counted in the feedback record of each final similar case.
[0169] By associating user feedback with all final similar case identifiers, the results of a single recommendation can be written back to each source case and used as the basis for calculating the user feedback score and the number of successful reuses for the corresponding case.
[0170] Step 500 is used to manage the timeliness of the historical case library and perform incremental index maintenance to ensure the quality of the historical case library. When a new case is added, the multidimensional space binary search tree index obtained in step 300 is updated, and the graph embedding model is updated when distribution drift is detected, so that the retrieval and recommendation in step 400 are continuously performed based on the updated historical case library. In this embodiment, a new case refers to a case that has been formed into an accident report, handling record, and contingency plan text and has been approved for addition to the historical case library, but the historical case graph modeling and index update have not yet been completed. This step includes case quality assessment and cleaning, incremental index update, and distribution drift detection and model fine-tuning.
[0171] During the case quality assessment and cleanup process, a comprehensive quality score is calculated for each case in the historical case database. When a case enters the final similar case set and its associated emergency response plan participates in the generation of recommended plans, a reuse record is established for that case. When the recommended plan is confirmed to be executable by the reviewers, or when the recommended plan is directly output according to step 400 and obtains valid user feedback indicating that the recommended plan is executable, the corresponding case participating in this recommendation is recorded as successfully reused once. When the recommended plan is confirmed to be unexecutable, or when valid user feedback indicating that it is unexecutable is obtained, the number of successful reuses of the corresponding case is not increased. The normalized frequency of case retrieval and reuse is obtained by dividing the number of times the case is successfully reused in the current preset cleanup period by the maximum number of times a single case in the historical case database is successfully reused in the same preset cleanup period. When all cases are not successfully reused, the normalized frequency of each case retrieval and reuse is set to zero. The user feedback score is obtained by mapping the user's evaluation results of the effectiveness, completeness, and executability of the recommendation results to a closed interval between zero and one and then taking the arithmetic mean. Specifically, the lowest rating in the evaluation system is mapped to zero, and the highest rating is mapped to one. Intermediate ratings are mapped at equal intervals according to the order of the evaluation levels. When multiple valid user feedbacks correspond to the same case, the arithmetic mean of the scores for each user feedback is taken. When no valid user feedback exists, the arithmetic mean of the user feedback scores for cases with the same main type and valid user feedback in the historical case library is used first. If no cases with the same main type and valid user feedback exist, the arithmetic mean of the user feedback scores for all cases with valid user feedback in the historical case library is used. If no valid user feedback exists in the historical case library, the user feedback score is set to zero. In this embodiment, valid user feedback refers to feedback that can be associated with a corresponding recommendation record and includes feedback results indicating whether the recommendation plan can be executed, as well as evaluations of the validity, completeness, and executability of the recommendation result. Feedback results indicating that the recommendation plan can be executed are determined as valid user feedback indicating that the recommendation plan can be executed; feedback results indicating that the recommendation plan cannot be executed are determined as valid user feedback indicating that the recommendation plan cannot be executed.
[0172] At the cleanup time, the timeliness decay weight of each case is recalculated according to the timeliness decay weight calculation method in step 400, where the current time is the cleanup time. First, the normalized frequency of case retrieval and reuse, the recalculated timeliness decay weight, and the user feedback score are multiplied by the preset reuse frequency weight coefficient, the preset timeliness weight coefficient, and the preset user feedback weight coefficient, respectively. Then, the three products are added together to obtain the comprehensive quality score of the case. The preset reuse frequency weight coefficient, the preset timeliness weight coefficient, and the preset user feedback weight coefficient are all non-negative numbers, and the sum of the three is one. The three preset weight coefficients are obtained by traversing the candidate coefficients that satisfy the aforementioned constraints on the historical case verification set with manually labeled quality scores. The system combines candidate coefficients to calculate the overall quality score for each combination, and selects the candidate coefficient combination that minimizes the sum of squared errors between the calculated overall quality score and the manually labeled quality score. If no manually labeled quality score exists, the three preset weight coefficients are all set to the same value when their sum equals one. After forming a historical case validation set with manually labeled quality scores, the three preset weight coefficients are updated using the aforementioned method. The normalized frequency of case reuse, the timeliness decay weight, and the user feedback score represent the actual reuse result, timeliness, and recommendation execution evaluation of the case, respectively. All three are used as inputs to the overall quality score, ensuring that case cleanup is not determined by a single evaluation source.
[0173] The historical case database is cleaned according to a preset cleanup cycle. The preset cleanup cycle is obtained by statistically analyzing the positive time interval from the most recent successful verification of a historical case to its first manual determination to require archiving, and taking the median of all positive time intervals. If no positive time interval has been formed, the statistical cycle of knowledge entry update records is used as the preset cleanup cycle. Preset quality score thresholds and preset timeliness thresholds are obtained by using historical cases manually marked as retained or archived as verification samples. Candidate combinations of the two thresholds are generated sequentially using the comprehensive quality score and timeliness decay weight of each verification sample, and the candidate combination that minimizes the sum of the number of incorrectly retained cases and the number of incorrectly archived cases is selected. If no verification sample simultaneously includes both retention and archiving labels, the preset quality score threshold and preset timeliness threshold are uncertain, automatic archiving is not performed, and historical cases are submitted to reviewers for determination of retention or archiving during cleanup, thus forming verification samples. After forming the two thresholds, the comprehensive quality score of each case is compared with the preset quality score threshold, and the timeliness decay weight of that case is compared with the preset timeliness threshold. If the comprehensive quality score is not small... Cases with a preset quality score threshold or a timeliness decay weight not less than a preset timeliness threshold are retained in the updated historical case library. Only when the overall quality score is less than the preset quality score threshold and the timeliness decay weight is less than the preset timeliness threshold are the corresponding cases removed from the historical case library. Removed cases are stored in the archive library and no longer participate in case retrieval, but are retained for statistical analysis. After a case is moved to the archive library, the corresponding embedding vector is located in the multidimensional space binary search tree index according to the case identifier and deleted. When a leaf node data point is deleted, it is directly removed from the leaf node. If the leaf node is empty after deletion, the leaf node is deleted, but the segmented cases stored in its parent node are retained. When a segmented case is deleted, all remaining cases in the subtree where the segmented case is located are collected. If the number of remaining cases does not exceed the preset leaf node capacity, they are stored in a leaf node. If the number of remaining cases exceeds the preset leaf node capacity, the median segmentation process in step 300 is re-executed, and the atomic tree is replaced with the obtained leaf node or subtree. This ensures that other cases in the index are not lost due to archive deletion and that archived cases are no longer returned by nearest neighbor search.
[0174] During the incremental index update process, when a new case is added to the historical case database, the accident report, handling record, and emergency plan text of the new case are first used as input for step 100. Following the text preprocessing, element extraction, relationship extraction, attribute generation, and review processes in step 100, a historical case graph corresponding to the new case is created. Then, the new case, its corresponding historical case graph, and the associated emergency plan are written into the historical case database and the graph database, making the new case a historical case. Subsequently, the historical case graph is used as input to the graph embedding model trained in step 300 to obtain the embedding vector of the historical case graph. This embedding vector is then used as a new data point and inserted into the multidimensional space binary search tree index. The insertion process starts from the root node, proceeding at each level based on the current segmentation. The dimension and segmentation value determine the downward direction; when the component of the embedding vector of the historical case graph in the current segmentation dimension is equal to the segmentation value, the downward direction is determined according to the sorting result of the case identifier and the segmentation case identifier of the corresponding historical case; after reaching the corresponding leaf node, the embedding vector of the historical case graph is written to the leaf node; when the number of cases included in the leaf node after writing exceeds the preset leaf node capacity, the median segmentation process in step 300 is re-executed for all cases in the leaf node, and the original leaf node is replaced with the generated subtree; under the condition that the index remains balanced, the time complexity of inserting a single new case increases logarithmically with the total number of historical cases before insertion; when the index degenerates into a single-branch structure, the time complexity increases linearly with the total number of historical cases before insertion.
[0175] After insertion, the balance factor of each internal node is calculated layer by layer from the inserted leaf node to the root node. When an internal node has both a left and a right subtree, the balance factor is equal to the minimum of the number of data points in the two subtrees divided by the maximum. Since the maximum value is not less than one, the division by zero will not occur. When an internal node has only one subtree, the balance factor is set to zero. When the number of new cases since the last reconstruction is not less than the preset reconstruction threshold, the entire index corresponding to the root node is reconstructed. When there is an internal node with a balance factor less than the preset balance factor threshold, the internal node closest to the root node along the insertion path is selected, and this internal node is... The cases including all descendant nodes are reprocessed using the median splitting step 300, and the reconstructed subtrees are used to replace the atomic trees. The preset reconstruction number threshold is a positive integer, and the preset balance factor threshold is a value within a closed interval of zero. Both are tested by querying and reconstructing the historical index under different numbers of new cases and different balance factor states. The average query time and single reconstruction time of each candidate combination are divided by the corresponding maximum value in all candidate combinations to obtain two normalized results. When the corresponding maximum value is zero, the corresponding normalized result is set to zero. The threshold candidate combination that minimizes the sum of the two normalized results is then selected.
[0176] In an optional embodiment, when importing new cases in batches, the aforementioned historical case graph modeling and storage processing is first performed on each new case. Historical cases that have been stored but whose index updates have not yet been completed, along with their historical case graphs, are stored in a buffer case set to be updated in batches. When the number of historical cases included in this set is not less than a preset batch update quantity threshold, each historical case graph is used as input to the graph embedding model trained in step 300, and the embedding vectors of each historical case graph are calculated in batches. For the embedding vector of each historical case graph, the leaf node to which it will enter is located according to the index segmentation dimension and segmentation value. All newly added historical cases located at the same leaf node are merged with the original historical cases in that leaf node into a local case set. Then, the median segmentation processing in step 300 is performed on the local case set, and the original leaf node is replaced with the resulting subtree. When a batch update involves multiple leaf nodes, each leaf node is replaced separately, and the subtree corresponding to its common ancestor node is reconstructed according to the aforementioned balance factor calculation method. Before the case retrieval begins in step 400, if the buffer case set still includes historical cases, regardless of their Whether the quantity reaches the preset batch update threshold, the index update is completed according to the aforementioned batch update method to ensure that historical cases already added to the historical case library can participate in this retrieval. The preset batch update threshold is a positive integer. By performing batch updates with different candidate numbers of new cases, the average update time of a single case corresponding to each candidate number is calculated, and the candidate number with the shortest average update time of a single case that can complete the index update before the start of the next case retrieval is determined as the preset batch update threshold. The computational amount of a batch update is jointly determined by the index positioning processing of newly added historical cases and the reconstruction processing of each local case set. Incremental insertion is used so that when a single new case is added and the condition for rebuilding the entire index is not triggered, the positioning, writing, and balance check are completed along the index path it passes through. Batch updates are performed using a buffer case set so that newly added historical cases entering the same leaf node are merged and local reconstruction is performed. Neither update method requires rebuilding the entire multidimensional space binary search tree index when each new case is added to the library, and ensures that historical cases already added to the library are included in the index before the retrieval begins.
[0177] During distribution drift detection and model fine-tuning, a new historical case set is formed by adding historical cases to the historical case library since the last distribution drift detection but not yet archived, and a baseline historical case set is formed by including historical cases that already existed in the historical case library before this detection but not yet archived. Distribution drift detection is not performed if the new historical case set or the baseline historical case set is empty. First, the difference between the embedding distribution of the new historical cases and the baseline historical case embedding distribution is calculated. For both the new and baseline historical case sets, the mean and standard deviation are calculated for each dimension of the embedding vectors. When calculating the mean of any set in any dimension, the components of all embedding vectors in that set in that dimension are summed and then divided by the number of historical cases included in that set. When calculating the corresponding variance, the square of the difference between each component and the mean is calculated, and the sum of all squares is divided by the number of historical cases included in that set. We take the square root of the variance to obtain the corresponding standard deviation; from this, we obtain the mean vector of the new historical cases, the standard deviation vector of the new historical cases, the mean vector of the benchmark historical cases, and the standard deviation vector of the benchmark historical cases; when the set includes only one historical case, the standard deviation of each dimension is zero; we use the standard deviation vector instead of the variance vector to ensure that the standard deviation vector and the mean vector have the same dimensions in each dimension, thus ensuring that the dimensions are consistent when the two Euclidean distances are added subsequently; we calculate the difference between the mean vector of the new historical cases and the mean vector of the benchmark historical cases dimension by dimension, square the difference in each dimension and add them, and then take the square root of the sum to obtain the Euclidean distance between the mean vectors; we calculate the Euclidean distance between the standard deviation vector of the new historical cases and the standard deviation vector of the benchmark historical cases in the same way; we add the two Euclidean distances to obtain the distribution difference between the embedding distribution of the new historical cases and the embedding distribution of the benchmark historical cases.
[0178] The preset drift threshold is a non-negative number. First, the reviewers confirm the continuous historical time windows in which the business distribution has not changed, based on the business classification system, data collection rules, and records where the proportion of the main case type has not changed. Then, they calculate the distribution difference of each time window and determine the maximum value of the obtained distribution difference as the preset drift threshold. If there is no confirmed continuous historical time window, automatic fine-tuning is not enabled. The distribution difference calculated each time and the corresponding set of newly added historical cases are submitted for review until a historical time window that can determine the preset drift threshold is formed.
[0179] When the distribution difference exceeds a preset drift threshold, the graph embedding model is fine-tuned using a newly added set of historical cases and a stratified sampling set of historical cases obtained from the baseline historical case set. Stratified sampling extracts historical cases of the same proportion of each primary type from the baseline historical case set, ensuring that the number of extracted baseline historical cases equals the number of newly added historical cases. If the number of baseline historical cases of a certain primary type is insufficient but not zero, existing baseline historical cases of that primary type are sampled with replacement to make up the corresponding number. If no historical cases of that primary type exist in the baseline historical case set, sampling with replacement is performed from all historical cases in the baseline historical case set to make up the corresponding number. Each time… During gradient descent updates, the gradient of the total loss relative to each parameter of the graph embedding model is first calculated according to the total loss calculation method in step 300. Then, this gradient is multiplied by a preset fine-tuning learning rate. Finally, the product is subtracted from the model parameters before the update to obtain the updated model parameters. The preset fine-tuning learning rate is a real number greater than zero and not exceeding the preset model training learning rate. Multiple candidate learning rates are generated within this range, and fine-tuning is performed on each rate. The candidate learning rate that minimizes the total loss of the validation set and does not increase the total loss of the historical case validation set within the same number of updates is selected. The fine-tuning process ends when the preset training termination condition in step 300 is met. Since updating the parameters of the graph embedding model changes the embedding vector of any historical case graph, after fine-tuning, the updated graph embedding vector is used... The model recalculates the embedding vectors of all unarchived historical case graphs in the historical case library, and reconstructs the entire multidimensional binary search tree index according to the median segmentation strategy in step 300. Distribution differences are calculated using mean vectors and standard deviation vectors, allowing distribution drift detection to simultaneously compare the central position and dispersion of each dimension of the newly added historical cases with the baseline historical cases in the embedding space. During fine-tuning, both the newly added historical case set and the baseline historical case sampling set are input simultaneously to adapt the model parameters to the distance relationships of the newly added historical cases, while maintaining the distance relationships of existing cases through the baseline historical cases. Stratified sampling is performed according to the case's main type to ensure that the proportion of the main type in the baseline historical case sampling set is consistent with that of the newly added historical case set. Specifically, the newly added historical case set and the... The baseline historical case sampling set is merged to form a fine-tuning case set; following the method of generating case pairs in step 300, unordered case graph pairs are generated from different historical case graphs in the fine-tuning case set, and the graph edit distance approximation algorithm of step 200 is used to calculate the graph edit distance approximation value of each case graph pair as distance supervision information in the fine-tuning stage; when the preset positive example threshold and preset negative example threshold have been formed, the method of determining positive example cases, negative example cases and anchor cases in step 300 is used to form fine-tuning training triplets; when the corresponding positive example threshold and negative example threshold have not yet been formed, only graph edit distance regression loss is used to perform fine-tuning; the case graph pairs, the corresponding graph edit distance approximation values and the training triplets formed therefrom are used as the training input for this model fine-tuning.
[0180] After maintenance in step 500, the updated historical case library, multidimensional space binary search tree index, and graph embedding model are obtained, which serve as the basis for subsequent query processing, thus ensuring that the retrieval and recommendation in step 400 are continuously based on the historical case library that has undergone quality control and timely updates.
[0181] Example 2:
[0182] See Figure 3 As shown, an emergency response plan case reasoning system based on graph edit distance is provided for executing the aforementioned emergency response plan case reasoning method based on graph edit distance. The system includes:
[0183] The case modeling module 101 extracts elements and relationships from the text of each historical case in the historical case library to create a historical case graph that includes node attributes and edge attributes.
[0184] The similarity calculation module 102 calculates the approximate graph edit distance between two case graphs based on the node attributes and edge attributes, and calculates the case structure similarity based on the approximate graph edit distance.
[0185] The index building module 103 trains a graph embedding model with the graph edit distance between historical case graphs as the supervised information. The graph embedding model generates embedding vectors of historical case graphs and builds a multi-dimensional binary search tree index based on the embedding vectors of historical case graphs.
[0186] The retrieval and recommendation module 104 constructs a query graph for newly occurring emergency events, retrieves the query graph based on the graph embedding model, case structure similarity, and multidimensional space binary search tree index, obtains a final set of similar cases, and performs a weighted combination of emergency plans associated with the cases in the final set of similar cases to obtain recommended plans.
[0187] The case maintenance module 105 updates the multidimensional space binary search tree index when a new case is added to the historical case library, and updates the graph embedding model according to the distribution changes of the historical case graph.
[0188] The embodiments of this application have been described above, but these embodiments are not limited to the specific implementation methods described above. The specific implementation methods described above are merely illustrative and not restrictive. Those skilled in the art can make more equivalent embodiments based on the guidance of these embodiments, and all of them are within the protection scope of these embodiments.
Claims
1. A method for emergency response plan case reasoning based on graph edit distance, characterized in that, Includes the following steps: Extract elements and relationships from the text of each historical case in the historical case library to create a historical case graph that includes node attributes and edge attributes. Based on the node attributes and edge attributes, calculate the approximate graph edit distance between the two case graphs, and calculate the case structure similarity based on the approximate graph edit distance. The graph embedding model is trained using the approximate graph edit distance between historical case graphs as supervised information. The graph embedding model generates embedding vectors for historical case graphs, and a multidimensional binary search tree index is constructed based on the embedding vectors of historical case graphs. A query graph is constructed for newly occurring emergency events. The query graph is retrieved based on a graph embedding model, case structure similarity, and a multidimensional space binary search tree index to obtain a final set of similar cases. The emergency plans associated with the cases in the final set of similar cases are weighted and combined to obtain a recommended plan. When a new case is added to the historical case library, the multidimensional space binary search tree index is updated, and the graph embedding model is updated according to the distribution changes of the historical case graph.
2. The emergency response plan case reasoning method based on graph edit distance according to claim 1, characterized in that, Methods for creating historical case diagrams include: Text preprocessing is performed on accident reports, response records, and contingency plan texts from historical cases to obtain a preprocessed sentence sequence; Elements are extracted from the preprocessed sentence sequence, and corresponding nodes and node attributes are generated based on the category and update time of each element. Relationships between elements are extracted from the preprocessed sentence sequence. Based on the relationship type and establishment time of each relationship, directed edges connecting the corresponding nodes and edge attributes are generated. A historical case graph is built based on the generated nodes, node attributes, directed edges, and edge attributes.
3. The emergency response plan case reasoning method based on graph edit distance according to claim 2, characterized in that, Methods for obtaining preprocessed sentence sequences include: The accident reports, response records, and contingency plan texts are processed using a unified character encoding and a unified character width to obtain a standardized text set. The normalized text set is segmented into sentences according to periods, question marks, exclamation marks, and paragraph boundaries to obtain a normalized sentence sequence; The normalized sentence sequence is subjected to reference resolution and synonym normalization to obtain the preprocessed sentence sequence.
4. The emergency response plan case reasoning method based on graph edit distance according to claim 2, characterized in that, Methods for calculating case structural similarity include: Set up editing operations and calculate the cost of editing operations; the cost of editing operations includes node insertion cost, node deletion cost, node replacement cost, cost of inserting while inserting, cost of deleting while deleting, and cost of replacing while replacing; Perform greedy weighted matching on the two case graphs to determine matching pairs of nodes and edges, and identify unmatched nodes and edges as insertion or deletion operations; Based on the node replacement cost of all matching node pairs, the edge replacement cost of all matching edge pairs, and the insertion and deletion costs of all unmatched nodes and edges, an approximate value of the graph editing distance is calculated. The sum of the number of nodes and edges in the two case graphs is used as a normalization factor. The graph editing distance approximation is divided by the normalization factor, then one is added and the reciprocal is taken to obtain the case structure similarity.
5. The emergency response plan case reasoning method based on graph edit distance according to claim 4, characterized in that, Methods for setting the cost of editing operations include: Calculate the node type difference cost, node semantic difference cost, and node importance difference cost based on node attributes; calculate the relationship type difference cost and relationship strength difference cost based on edge attributes. The node replacement cost is obtained by adding the node type difference cost, the node semantic difference cost, and the node importance difference cost; the edge replacement cost is obtained by adding the relation type difference cost and the relation strength difference cost. The cost of inserting a node and the cost of deleting a node are equal, and are both obtained by multiplying the preset node importance weight and the preset node basic cost parameter of the corresponding node. The cost of inserting and deleting an edge is equal, and both are obtained by multiplying the preset relation strength weight of the corresponding edge by the preset edge basic cost parameter.
6. The emergency response plan case reasoning method based on graph edit distance according to claim 1, characterized in that, Methods for constructing a multidimensional binary search tree index include: The initial node representation is obtained by concatenating the node semantic feature vector in the node attributes, the one-hot node type vector corresponding to the node type, and the preset node importance weight, and then performing a fully connected mapping. The graph embedding model includes graph isomorphic networks and attention pooling networks. The graph isomorphic network starts with the initial node representation and aggregates the representations of neighboring nodes layer by layer to update the representation of each node, thus obtaining the final representation of all nodes. The attention pooling network calculates the attention weight of each node based on the preset initial attention parameter vector, and sums the final representations of all nodes according to the attention weights to obtain the embedding vector of the historical case graph. A median-based partitioning strategy is used to recursively divide the embedding vectors of multiple historical case graphs, and a multidimensional binary search tree index is constructed.
7. The emergency response plan case reasoning method based on graph edit distance according to claim 6, characterized in that, Methods for obtaining recommended contingency plans include: Following the same process as building historical case graphs, element extraction and relation extraction are performed on the query text of newly occurring emergency events to construct query graphs; The embedding vector of the query graph is calculated based on the graph embedding model, and the final set of similar cases is determined based on the embedding vector of the query graph and the multidimensional space binary search tree index. The emergency response plans associated with the cases in the final set of similar cases are weighted and combined to obtain the recommended plan.
8. The emergency response plan case reasoning method based on graph edit distance according to claim 7, characterized in that, Methods for determining the final set of similar cases include: The embedding vector of the query graph is calculated using the graph embedding model. Nearest neighbor search is performed on the multidimensional space binary search tree index. Historical cases that are sorted from smallest to largest by Euclidean distance to the embedding vector of the query graph and whose number does not exceed the preset number of candidate cases are returned to form a candidate case set. For each candidate case in the candidate case set, the case structure similarity between the query graph and the historical case graph is calculated using the graph edit distance approximation. The structural similarity of cases is weighted by time-sensitivity decay based on the duration of the cases, resulting in a time-sensitivity weighted comprehensive score. All cases in the candidate case set are sorted from largest to smallest by time-weighted comprehensive score, and the cases that are ranked first and whose number is equal to the preset final number of similar cases are selected to form the final similar case set.
9. The emergency response plan case reasoning method based on graph edit distance according to claim 8, characterized in that, Methods for obtaining recommended emergency response plans by weighting and combining them include: Divide the time-sensitive weighted composite score of each case by the sum of the time-sensitive weighted composite scores of all cases in the final set of similar cases to obtain the combined weight of the emergency plan associated with the corresponding case; Each emergency plan is broken down into plan content units. The combined weights of similar plan content units are added together to obtain the cumulative support weight. The plan content units of various types are combined according to the cumulative support weight to obtain the recommended plan.
10. The emergency response plan case reasoning method based on graph edit distance according to claim 1, characterized in that, Methods for updating multidimensional binary search tree indexes and graph embedding models include: When a new case is added to the historical case library, an embedding vector of the historical case graph of the new case is generated and inserted as a new data point into the multidimensional space binary search tree index; The distribution difference is calculated based on the embedding vector of the historical case graph. When the distribution difference is greater than the preset drift threshold, the graph embedding model is fine-tuned and the multidimensional space binary search tree index is reconstructed.
11. An emergency response plan case reasoning system based on graph edit distance, characterized in that, The system is used to execute an emergency response plan case reasoning method based on graph editing distance as described in any one of claims 1-10; the system includes: The case modeling module extracts elements and relationships from the text of each historical case in the historical case library, and builds a historical case graph including node attributes and edge attributes. The similarity calculation module calculates an approximate graph edit distance between two case graphs based on the node attributes and edge attributes, and calculates the case structure similarity based on the approximate graph edit distance. The index building module trains a graph embedding model using the approximate graph edit distance between historical case graphs as supervised information. The graph embedding model generates embedding vectors for historical case graphs, and a multi-dimensional binary search tree index is built based on the embedding vectors of historical case graphs. The retrieval and recommendation module constructs a query graph for newly occurring emergency events, retrieves the query graph based on a graph embedding model, case structure similarity, and a multidimensional space binary search tree index, obtains a final set of similar cases, and performs a weighted combination of emergency plans associated with the cases in the final set of similar cases to obtain recommended plans. The case maintenance module updates the multidimensional space binary search tree index when a new case is added to the historical case library, and updates the graph embedding model according to the distribution changes of the historical case graph.
