A path-structure fusion-based knowledge graph completion method and system

By employing a path selection and encoding method based on Point Mutual Information (PMI) and the Mamba state-space model, the problems of noise interference and long-range dependencies in knowledge graphs are solved, achieving efficient path selection and encoding, and improving the accuracy and robustness of knowledge graph completion, especially in effectively mining complex relationship patterns in the digital protection of cultural heritage.

CN122334435APending Publication Date: 2026-07-03SOUTHWEST UNIVERSITY FOR NATIONALITIES

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SOUTHWEST UNIVERSITY FOR NATIONALITIES
Filing Date
2026-06-05
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing knowledge graph completion methods face challenges such as noise interference, low efficiency in long-range dependency modeling, and difficulties in integrating paths with graph structures when utilizing path information. These challenges make it difficult to accurately filter high-value semantics from massive paths and effectively model long-range dependencies.

Method used

We adopt a path filtering mechanism based on point mutual information (PMI), combine it with the Mamba state space model for path encoding and multi-level attention aggregation, and construct a joint modeling framework for path-level semantics and local structural information. We ensure the consistency between semantic links and graph structure through joint scoring.

Benefits of technology

It achieves efficient filtering and encoding of multi-hop paths, improves the accuracy and robustness of knowledge graph completion, and effectively mines complex relationship patterns and high-order structural semantics in the digital protection of cultural heritage, thereby enhancing the model's reasoning ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122334435A_ABST
    Figure CN122334435A_ABST
Patent Text Reader

Abstract

This invention discloses a knowledge graph completion method and system based on path-structure fusion, relating to the field of data storage technology. The method includes: at the data preprocessing level, a path filtering strategy based on PMI (Progressive Mindset Analysis) is used to accurately eliminate redundant and noisy paths by quantifying the co-occurrence correlation between entities, providing high-quality semantic context for subsequent inference. Secondly, during path modeling, the Mamba state-space model is used for path sequence modeling, and multi-level attention is used to aggregate path information. Thirdly, at the decoding and scoring level, a dual-tower architecture of path-structure is constructed, adaptively fusing and scoring global path semantic features with local graph topological features. Finally, through a mechanism of attribute completion—similar node determination—bidirectional path search, high-scoring interpretable paths are automatically mined from known entities and their similar nodes, and a hybrid scoring formula is used for comprehensive evaluation, ultimately outputting the inference link.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data storage technology, and in particular to a knowledge graph completion method and system based on path-structure fusion. Background Technology

[0002] Knowledge graphs (KGs), as a structured form of knowledge representation, have been widely applied in key fields such as healthcare, finance, recommendation systems, and cultural studies. However, limited by the dynamic evolution of real-world knowledge and the constraints of construction methods, knowledge graphs generally suffer from data sparsity and incomplete information, which severely restricts the performance of downstream reasoning tasks. Therefore, knowledge graph completion (KGC) technology, which predicts missing triples based on known facts, has become a key focus of current research in the field of knowledge graphs.

[0003] In the field of digital preservation and transmission of cultural heritage, knowledge graph completion technology is crucial for inferring missing cultural information and uncovering relationships between cultural entities. Introducing cultural path information into knowledge graph completion can enhance the accuracy of model completion, but it also faces the dual challenges of low path signal-to-noise ratio and low efficiency in long-range modeling. On the one hand, high-quality paths are scarce, and random sampling easily introduces a large amount of noise; on the other hand, RNNs in path modeling struggle to capture multi-hop long-range dependencies, while the Transformer architecture has high computational complexity and is sensitive to noise, making it difficult to balance efficiency and robustness.

[0004] Existing knowledge graph completion methods mainly include those based on Knowledge Graph Embedding (KGE) and Graph Neural Networks (GNN). KGE is computationally efficient but struggles to capture deep structural information. While GNNs can effectively aggregate local features, they face a dilemma when dealing with long-range dependencies across entities: stacking multiple layers can lead to convergent node embeddings, causing "oversmoothing," while introducing global attention mechanisms introduces quadratic increases in computational overhead and noise. Path information, as a natural semantic link, can explicitly characterize the reasoning process across multiple relationships, making it an effective way to solve this long-range dependency problem. However, existing technologies still face the following key challenges when utilizing path information: (1) How to accurately filter high-value semantics from a large number of paths and suppress noise interference: Global path search often introduces a large number of irrelevant or low-quality paths. How to filter noise and focus on key semantic paths while introducing global information is the key to improving the robustness of reasoning.

[0005] (2) How to effectively model long-range dependencies while avoiding oversmoothing and high computational overhead: Traditional GNNs are difficult to balance the acquisition of deep structural information with computational efficiency. A global information modeling mechanism that can replace Transformer and avoid the side effects of stacking GNN layers is needed.

[0006] (3) How to achieve deep integration of global path information and local graph structure information: relying solely on paths or relying solely on local neighborhoods is one-sided. How to construct a fusion architecture that integrates path semantics and topological features of graph structure in a complementary manner to achieve more accurate knowledge reasoning. Summary of the Invention

[0007] To address the aforementioned technical problems, this invention provides a knowledge graph completion method and system based on path-structure fusion.

[0008] This invention provides a knowledge graph completion method based on path-structure fusion, including: Based on Point Mutual Information (PMI), paths in the knowledge graph are filtered and sampled to obtain a set of multiple high-quality paths; Each path in the path set is encoded based on the Mamba state space model to obtain Mamba-encoded path information. Then, multi-level attention is used to aggregate the Mamba-encoded path information to obtain entity path features. A joint modeling framework for path-level semantics and local structural information is constructed, and the scores of entity path features and entity neighborhood topological features are linearly fused using the joint modeling framework to obtain a joint score. The joint score is used to complete incomplete triples in the knowledge graph, thereby ensuring the consistency between semantic links and graph structure during reasoning.

[0009] Preferably, the paths in the knowledge graph are filtered and sampled based on Point Mutual Information (PMI) to obtain a set of multiple high-quality paths, including: Traverse the triples and path information in the knowledge graph, and count the frequency of occurrence of relations, the total frequency of occurrence of all relations, the frequency of occurrence of any two relations as adjacent relation pairs, and the total frequency of occurrence of all adjacent relation pairs. Using the frequency of occurrence of the relationship, the total frequency of occurrence of all relationships, the frequency of occurrence of any two relationships as adjacent relationship pairs, and the total frequency of occurrence of all adjacent relationship pairs, calculate the point mutual information value used to measure the strength of the correlation between two relationships; Using the point mutual information value, calculate the importance value of each relation in the entire knowledge graph structure, and calculate the edge weight connecting the neighboring nodes from the center node based on the importance value, the frequency of occurrence of the relation, and the degree of the target neighboring node. By utilizing the edge weights that connect neighboring nodes from the central node, paths in the knowledge graph are filtered and sampled to obtain a set of multiple high-quality paths.

[0010] Preferably, the point mutual information value used to measure the strength of the correlation between two relations is calculated using the frequency of occurrence of the relationship, the total frequency of occurrence of all relations, the frequency of occurrence of any two relations as adjacent relation pairs, and the total frequency of occurrence of all adjacent relation pairs. Calculate the marginal probability of the relationship based on the frequency of occurrence of the relationship and the total frequency of occurrence of all relationships; Calculate the joint probability of any two relations based on the frequency of their co-occurrence as adjacent relations and the total frequency of occurrence of all adjacent relations. Based on the marginal probability of the relationship and the joint probability of any two relationships, a point mutual information value is calculated to measure the strength of the correlation between the two relationships.

[0011] Preferably, the path set of multiple high-quality paths is obtained by using the edge weights connecting neighboring nodes from the central node to filter and sample the paths in the knowledge graph, including: Based on the edge weights connecting neighboring nodes from the central node, in each hop of the path expansion, a preset number of nodes with the highest weight are retained to continue the expansion until a preset path length is reached or there are no better branches, thereby obtaining multiple candidate paths, and calculating the path score value for each candidate path. Based on the path score value of each candidate path and the preset path score threshold, multiple candidate paths with path scores exceeding the path score threshold are selected as multiple high-quality paths.

[0012] Preferably, each path in the path set is encoded based on the Mamba state-space model to obtain the Mamba-encoded path information, including: Each path in the path set is sequentially processed through basic embedding, type embedding, and position embedding to obtain a path sequence vector; The path sequence vector is encoded based on the Mamba state space model to obtain the Mamba-encoded path information.

[0013] Preferably, the Mamba-encoded path information is aggregated using multi-level attention to obtain entity path features, including: At the token level, the final vector for each path is obtained by utilizing the features of entities or relationships in the Mamba-encoded path information and the token-level attention weights. At the path level, candidate paths for the same entity are weighted and aggregated to obtain the aggregate weight of each path; The entity path features are obtained by using the final vector of each path and the aggregate weight of each path.

[0014] Preferably, it further includes: Calculate the base score of the structure tower and the global score of the path tower; The final joint score is obtained by using the basic score of the structure tower and the global score of the path tower. All candidate entities are ranked based on the final joint score, and the entity with the highest final fusion score is selected as the prediction result for completing incomplete triples in the knowledge graph.

[0015] This invention also provides a knowledge graph completion system based on path-structure fusion, comprising: The path filtering module is configured to filter and sample paths in the knowledge graph based on Point Mutual Information (PMI) to obtain a set of multiple high-quality paths. The aggregation module is configured to encode each path in the path set based on the Mamba state space model to obtain Mamba-encoded path information, and to aggregate the Mamba-encoded path information using multi-level attention to obtain entity path features. The fusion module is configured to construct a joint modeling framework for path-level semantics and local structural information, and to use the joint modeling framework to linearly fuse the scores of entity path features and entity neighborhood topological features to obtain a joint score. The completion module is configured to use the joint score to complete incomplete triples in the knowledge graph, thereby ensuring the consistency between semantic links and graph structure during inference.

[0016] This invention also provides a computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the knowledge graph completion method based on path-structure fusion.

[0017] This invention also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the path-structure fusion-based knowledge graph completion method.

[0018] The beneficial effects of the invention are as follows: (1) It can efficiently filter multi-hop paths based on PMI. This invention statistically analyzes the co-occurrence frequency of relations and adjacent relation pairs, calculates the point mutual information of relation pairs, and aggregates the global importance of each relation. During the path expansion process, it simultaneously considers relation importance, relation occurrence frequency, and the degree of the target node, scores each candidate outgoing edge, and performs local Top-B pruning according to the score during each hop expansion, thereby prioritizing the retention of multi-hop paths with high semantic information and key structural positions, effectively filtering noise and redundancy, and providing a controllable and high-quality candidate path set for subsequent encoding modules.

[0019] (2) Introducing the Selective State Space Model (Mamba) for multi-level encoding of multi-hop paths. This invention uses Mamba as the backbone in the path encoding module to model multi-hop path sequences with alternating entity relationships, avoiding the oversmoothing problem caused by too many GNN layers and the secondary complexity bottleneck of self-attention. Then, path features are obtained through subsequent token-level attention and path-level weighted aggregation, improving the model's efficiency in performing deep multi-hop reasoning on large-scale cultural knowledge graphs while maintaining long-range dependency modeling capabilities.

[0020] (3) Constructing a joint modeling framework for path-level semantics and local structural information. This invention jointly scores high-quality multi-hop paths selected by PMI and the topological features of entity neighborhoods, ensuring the consistency between semantic links and graph structure during the inference process. On the one hand, high-quality paths provide explicit evidence for multi-hop inference of the prediction results; on the other hand, graph structural information effectively constrains and supplements entity semantics. These two types of information corroborate each other in the representation space, enhancing the robustness and accuracy of the model in handling complex relationship patterns and high-order structural semantics. In particular, in the context of cultural heritage digitization, this invention can effectively mine cultural associations with long-range, multi-hop characteristics, such as "intangible cultural heritage skill inheritance relationships" and "cultural circulation historical chains," providing specialized technical support for the completion and inference of cultural knowledge graphs. Attached Figure Description

[0021] Figure 1 This is a flowchart of a knowledge graph completion method based on path-structure fusion provided by the present invention; Figure 2 This is a flowchart of the path filtering process provided by the present invention; Figure 3 This is a schematic diagram of edge weight calculation provided by the present invention; Figure 4 This is a schematic diagram of the pruning operation provided by the present invention; Figure 5 This is a flowchart of the path tower coding provided by the present invention; Figure 6 This is a flowchart of the dual-tower fusion process provided by the present invention; Figure 7 This is a schematic diagram of similar node path reasoning provided by the present invention; Figure 8 This is a schematic diagram of the completion prediction results provided by the present invention; Figure 9 This is a schematic diagram of a knowledge graph completion system based on path-structure fusion provided by the present invention. Detailed Implementation

[0022] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. In the following description, suffixes such as "module," "part," or "unit" used to denote elements are used only for the purpose of illustrative purposes and have no inherent meaning. Therefore, "module," "part," or "unit" may be used interchangeably.

[0023] This invention proposes a graph neural network model, PRGCN (Path-Relational Graph Convolutional Network), which combines path filtering and efficient modeling. (1) PRGCN proposes a path filtering mechanism based on Pointwise Mutual Information (PMI), which effectively filters high-frequency noise paths by using PMI weighting, thereby improving the quality of path information. (2) PRGCN utilizes the linear properties and multi-level aggregation mechanism of Mamba to achieve efficient and robust long-range dependency extraction. (3) PRGCN constructs a path-structure dual-tower fusion inference architecture, which improves inference accuracy by processing global path information and local structure information in parallel. (4) PRGCN designs a path mining method for similar cultural nodes in the cultural field, which improves the ability to mine cultural heritage chains and enhances the interpretability of cultural transmission.

[0024] Figure 1 This is a flowchart of a knowledge graph completion method based on path-structure fusion provided by the present invention, such as... Figure 1 As shown, it includes: Step S101: Based on Point Mutual Information (PMI), the paths in the knowledge graph are filtered and sampled to obtain a set of multiple high-quality paths; In one specific embodiment of the present invention, the paths in the knowledge graph are filtered and sampled based on Point Mutual Information (PMI) to obtain a set of multiple high-quality paths, including: Traverse the triples and path information in the knowledge graph, and count the frequency of occurrence of relations, the total frequency of occurrence of all relations, the frequency of occurrence of any two relations as adjacent relation pairs, and the total frequency of occurrence of all adjacent relation pairs. Using the frequency of occurrence of the relationship, the total frequency of occurrence of all relationships, the frequency of occurrence of any two relationships as adjacent relationship pairs, and the total frequency of occurrence of all adjacent relationship pairs, calculate the point mutual information value used to measure the strength of the correlation between two relationships; Using the point mutual information value, calculate the importance value of each relation in the entire knowledge graph structure, and calculate the edge weight connecting the neighboring nodes from the center node based on the importance value, the frequency of occurrence of the relation, and the degree of the target neighboring node. By utilizing the edge weights that connect neighboring nodes from the central node, paths in the knowledge graph are filtered and sampled to obtain a set of multiple high-quality paths.

[0025] In a specific embodiment of the present invention, the point mutual information value used to measure the strength of the correlation between two relations is calculated by utilizing the frequency of occurrence of the relationship, the total frequency of occurrence of all relations, the frequency of occurrence of any two relations as adjacent relation pairs, and the total frequency of occurrence of all adjacent relation pairs. Calculate the marginal probability of the relationship based on the frequency of occurrence of the relationship and the total frequency of occurrence of all relationships; Calculate the joint probability of any two relations based on the frequency of their co-occurrence as adjacent relations and the total frequency of occurrence of all adjacent relations. Based on the marginal probability of the relationship and the joint probability of any two relationships, a point mutual information value is calculated to measure the strength of the correlation between the two relationships.

[0026] In one specific embodiment of the present invention, the path set of multiple high-quality paths is obtained by using the edge weights connecting neighboring nodes from the central node to filter and sample paths in the knowledge graph, including: Based on the edge weights connecting neighboring nodes from the central node, in each hop of the path expansion, a preset number of nodes with the highest weight are retained to continue the expansion until a preset path length is reached or there are no better branches, thereby obtaining multiple candidate paths, and calculating the path score value for each candidate path. Based on the path score value of each candidate path and the preset path score threshold, multiple candidate paths with path scores exceeding the path score threshold are selected as multiple high-quality paths.

[0027] Step S102: Encode each path in the path set based on the Mamba state space model to obtain Mamba-encoded path information, and aggregate the Mamba-encoded path information using multi-level attention to obtain entity path features; In one specific embodiment of the present invention, each path in the path set is encoded based on the Mamba state-space model to obtain Mamba-encoded path information, including: Each path in the path set is sequentially processed through basic embedding, type embedding, and position embedding to obtain a path sequence vector; The path sequence vector is encoded based on the Mamba state space model to obtain the Mamba-encoded path information.

[0028] In a specific embodiment of the present invention, multi-level attention is used to aggregate the Mamba-encoded path information to obtain entity path features, including: At the token level, the final vector for each path is obtained by utilizing the features of entities or relationships in the Mamba-encoded path information and the token-level attention weights. At the path level, candidate paths for the same entity are weighted and aggregated to obtain the aggregate weight of each path; The entity path features are obtained by using the final vector of each path and the aggregate weight of each path.

[0029] Step S103: Construct a joint modeling framework for path-level semantics and local structural information, and use the joint modeling framework to linearly fuse the scores of entity path features and entity neighborhood topological features to obtain a joint score. Step S104: Use the joint score to complete the incomplete triples in the knowledge graph, thereby ensuring the consistency between semantic links and graph structure during the reasoning process.

[0030] In one specific embodiment of the present invention, it further includes: Calculate the base score of the structure tower and the global score of the path tower; The final joint score is obtained by using the basic score of the structure tower and the global score of the path tower. Based on the final joint score, all candidate entities are ranked, and the entity with the highest score is selected as the prediction result for completing incomplete triples in the knowledge graph.

[0031] This invention addresses the problems of existing path search methods introducing a large amount of noise and wasting computational resources due to invalid paths: Problem Analysis: Existing path reasoning methods largely rely on random walks and lack semantic and logical constraints, leading to the introduction of numerous noisy paths unrelated to the reasoning objective, interfering with model judgment. Furthermore, as the number of hops increases, the search space expands exponentially, making a full search computation infeasible. Simple random sampling, on the other hand, easily loses low-frequency but crucial reasoning clues, making it difficult to balance reasoning efficiency and accuracy.

[0032] This invention proposes a path filtering and sampling mechanism based on point mutual information constraints. This mechanism eliminates paths irrelevant to the reasoning objective logic by quantifying the semantic dependencies between relationships. The pseudocode of the algorithm is shown in Algorithm 1, as follows: Algorithm 1: Path Selection and Sampling Constrained by PMI Input: Knowledge Graph Entity Set Max Hops Branch Limit Path Count Decay Factor ; Output: Entity-wise Sampled Paths ; 1 Compute and for allrelations and entities ; 2 Function DFS ; 3 | if ≥ 2 then; 4 │ └ Add to ; 5 | if = then; 6 │ └ return; 7 │ ; 8 │ for do; 9 │ │ ; 10 │ │ DFS ; 11 for do; 12 │ ; 13 │ ; 14 │ for do; 15 │ │ DFS ; 16 │ Sort by score in descending order; 17 │ ; 18 return .

[0033] First, in the preprocessing stage, to capture global semantic relationships, the algorithm calculates relation frequency, node degree, mutual information between relations, and relation importance all at once by statistical frequency analysis (see line 1 of Algorithm 1). These metrics quantify the relationship importance when relations... When it appears, the subsequent succession relationship The probability gain provides a global logical constraint for path expansion.

[0034] In the specific process of path expansion (see the DFS function), when the algorithm attempts to explore outwards from the current entity, it does not employ a random walk, but rather a heuristic scoring strategy. For each candidate neighbor node, the algorithm first comprehensively considers the importance of the relationship, the frequency of the relationship, and the degree of the target node to calculate the basic weight (see line 7 of Algorithm 1) to avoid getting stuck on high-frequency but uninformative supernodes. Subsequently, the algorithm considers the preceding relations... Relationship with current candidates The PMI value is added to the path score (see line 9 of Algorithm 1) to ensure the semantic coherence of the path.

[0035] To preserve the most valuable clues with limited computational resources, the algorithm employs a strict pruning strategy. In each hop of expansion, only the top-B highest-scoring neighbors are recursively searched (see line 8 of Algorithm 1). Ultimately, this results in the generation of specific entities. When determining the path set, the algorithm employs a global Top-K filtering strategy: First, it initializes the candidate pool and traverses all high-order first-order outgoing edges of the entity, performing a depth-first search and merging all discovered valid paths into a unified global candidate set (see lines 13-15 of Algorithm 1). Subsequently, all paths in this set are globally sorted in descending order based on their cumulative scores (see line 16 of Algorithm 1), and the top K non-repeating paths are directly selected as the final result (see line 17 of Algorithm 1). This ensures both comprehensive reasoning coverage and precise identification of high-quality reasoning clues.

[0036] This invention addresses the problems of high computational complexity of Transformer and difficulty in capturing long-range dependencies by RNN: Problem Analysis: Traditional RNN / LSTM suffers from poor parallelism due to its sequential computation and the problem of long-range forgetting, failing to effectively capture the beginning and end dependencies of long paths; while Transformer can solve the long-range problem, its... The computational complexity is too high when dealing with massive numbers of paths.

[0037] This invention proposes an efficient path encoding method based on the Mamba state-space model. This encoding method first utilizes Mamba's selective scanning mechanism to maintain linear computational complexity. Simultaneously, it achieves global modeling of the first and last entities and their contexts in long paths. The pseudocode of the algorithm is shown in Algorithm 2, as follows: Algorithm 2: Mamba-based path encoding algorithm Input: Batch of sampled paths ;

[0038] Output: Aggregated Entity Representation ; 1 for each path do; 2 │ Construct token sequence of entities and relations in with type and position information; 3 │ ; 4 end; 5 for all ; 6 for all ; 7 for each path sequence do; 8 │ for all tokens ; 9 │ over ; 10 │ ; 11 │ ; 12 │ ; 13 │ ; 14 end; 15 over paths; 16 ; 17 return .

[0039] In the sequence construction and representation stage, to fully preserve the structural information of the path, the algorithm treats the path as a sequence composed of alternating entities and relations. For each node in the path, the algorithm not only extracts its semantic embedding but also overlays type embedding and position embedding to enhance the model's ability to perceive the role of the node in the path (see lines 1-4 of Algorithm 2). This step ensures that the input sequence... It contains all the heterogeneous features required for reasoning.

[0040] In the sequence modeling stage, the algorithm uses the Mamba module for encoding. First, it adjusts the feature dimensions through linear layers. Then, it leverages Mamba to efficiently transmit latent state information in long sequences. After layer normalization, it captures global dependencies in a single forward pass, generating a sequence representation rich in contextual information. (See lines 5-6 of Algorithm 2).

[0041] Finally, to extract the final entity representation from the encoded sequence, the algorithm employs a hierarchical attention aggregation strategy. First, at the token level, the algorithm calculates the weight of each token in the sequence using an attention mechanism. The variable-length sequence is compressed into a fixed-dimensional path vector by performing a weighted sum of all tokens in the sequence based on their weights. (See lines 7-10 of Algorithm 2). Subsequently, at the path level, the algorithm combines non-linear scoring with length prior to calculate a confidence score for each path. (See lines 11-13 of Algorithm 2). Finally, the algorithm performs a weighted summation of the features of multiple paths based on this score to obtain an entity representation that incorporates multi-hop reasoning semantics. (See lines 15-16 of Algorithm 2), thus providing robust feature support for subsequent link prediction.

[0042] This invention addresses the problem that existing models struggle to simultaneously consider global path semantics and local graph structural features: Problem Analysis: GNN-based methods suffer from the "oversmoothing" problem, making it difficult to capture deep, long-range semantics; while path-based methods often ignore dense local topological structures, resulting in poor performance for sparse entities. Existing fusion methods mostly employ simple static concatenation, failing to adaptively adjust the weights of local structure and global semantics according to query intent. This makes it difficult for the two types of features to achieve efficient complementarity, limiting the performance of complex link prediction.

[0043] This invention proposes a dual-tower fusion mechanism based on relation-aware modulation. This mechanism runs a local structural encoder and a global semantic retrieval unit in parallel, achieving complementary fusion of two types of features at the decision layer. The pseudocode of the algorithm is shown in Algorithm 3 below: Algorithm 3: Dual-Tower Fusion Based on Relation-Aware Modulation Input: Subject entity Query relation Graph Mamba cache ; Output: Final prediction scores ; 1 Initialize entity embeddings and relation embeddings ; 2 for to do ; 3 │ ; 4 end; 5 ; 6 ; 7 ; 8 if Score function is DistMult then ; 9 │ ; 10 │ ; 11 else; 12 │ ; 13 end; 14 ; 15 ; 16 ; 17 ; 18 ; 19 ; 20 if then ; 21 │ ; 22 end; 23 else; 24 │ ; 25 end; 26 return .

[0044] First, in the local structure coding tower, the algorithm utilizes a relation-gated graph convolutional network to aggregate neighbor structures. For example, for query triples... The algorithm uses graph convolutional layers for iterative aggregation. The process explicitly utilizes the topological structure of the knowledge graph to generate an entity embedding matrix containing rich local neighborhood features, based on local information (see lines 2-4 of Algorithm 3). Head entity vector and relation vectors (See lines 5-7 of Algorithm 3), which effectively solves the problem of insufficient information for sparse entities in simple path search.

[0045] Meanwhile, in the global semantic retrieval tower, the algorithm utilizes computed Mamba context path information to introduce a global perspective. This invention employs a relation-based Feature Linear Modulation (FiLM) strategy, leveraging the relation embedding of the current query. Generate regulatory factors and global context of the head entity Scaling and offset transformations are performed (see lines 14-17 of Algorithm 3) to enable the model to dynamically focus on the relevant parts of the global context and suppress irrelevant path semantics based on the specific reasoning intent.

[0046] During the scoring phase, the algorithm employs a bilinear scoring fusion strategy. The algorithm first uses a multilayer perceptron to fuse the modulated global context... With relational embedding After concatenation, it is mapped to a query vector. (See line 18 of Algorithm 3). Subsequently, the model calculates the structure score based on local features. (Usually using scoring functions such as DistMult, see lines 8-13 of Algorithm 3) and semantic scores based on global features. (See line 19 of Algorithm 3). Finally, by introducing a balance coefficient... The two scores are then weighted and summed (see lines 20-25 of Algorithm 3). This fusion approach not only preserves the robustness of graph neural networks in handling complex graph structures, but also supplements long-range inference capabilities through Mamba's global perspective, thereby improving the model's performance in complex link prediction tasks.

[0047] The technical solution of the present invention will be further described below, and corresponding specific implementation methods or specific embodiments will be provided, which should be described in conjunction with the accompanying drawings.

[0048] Example 1: Path Mining and Filtering Based on PMI Based on PMI, paths in the knowledge graph are filtered and sampled, such as Figure 2 As shown, the specific steps include the following: Step 1: Co-occurrence frequency statistics; By reading a pre-built knowledge graph Iterate through the triples and path information in the knowledge graph, and count the frequency of occurrence of relations and adjacent pairs.

[0049] (1) Statistical relationship Frequency of occurrence That is, the statistical knowledge graph contains this relationship. The total number of triples.

[0050] (2) Count the total frequency of all relations. This refers to the total number of triples in the knowledge graph (the sum of all edges).

[0051] (3) Statistical analysis of any two relations and The frequency of co-occurrence as an adjacency relationship .

[0052] The "adjacent pair" mentioned here refers to two consecutive relationships connected by a common entity in the knowledge graph topology. Specifically, if a path exists in the knowledge graph... (i.e., relationship) The tail entity is also a relation If the head entity is determined, then it is judged. and They form an adjacent pair.

[0053] (4) Count the total number of co-occurrences of all relation pairs. This refers to the total number of connected paths of length 2 in the knowledge graph.

[0054] Step 2: Calculate the marginal probabilities and joint probabilities; (1) Regarding the relation Its marginal probability Defined as the ratio of the frequency of this relation to the total frequency of all relations, which is (1) / (2) in step 1: ; (2) For any relation pair Their joint probability Defined as the ratio of the frequency of co-occurrence of this relation pair to the total number of co-occurrences of all relation pairs, which is (3) / (4) in step 1: ; Step 3: PMI calculation; Using the probability values ​​calculated in step 2, calculate the relationship. and The point mutual information value (PMI), as shown in the formula, is used to measure the strength of the correlation between two relationships.

[0055] ; Step 4: Calculate the importance of the relationship; The PMI value is obtained from step 3. This step is used to assess the importance of each relationship in the overall map structure, such as the relationship... The importance value is for all [unclear] and [unclear]. Sum the PMI values ​​of the relational pairs: ; in, The value represents the importance of the relationship; the higher the value, the stronger the relationship. It can form strong semantic associations with more types of relationships and has a stronger semantic bridging ability; Step 5: Define candidate edge weights; Next, during the path expansion (DFS search) process starting from the central node, for each candidate edge (containing relationship) extending from the current node... and neighboring nodes ), calculate the edge weight of neighboring edges according to the edge weight calculation formula. , ; in, From step 4, From step 1, Neighboring nodes The degree; such as Figure 3As shown, the edge weights connecting neighboring nodes (entity V1, entity V2, entity V3, entity V4) are calculated starting from the central node U, where r a r b r c r d For relations, V5 to V13 are entities.

[0056] Step 6: Top-B branch pruning; Next, a path search is performed starting from the central node U. In the expansion of each hop, the edge weights are obtained according to step 5. Sort all candidate edges, and only keep the B branches with the highest weights to continue the next hop search; the remaining branches are truncated. Example: Figure 4 As shown, if the branch threshold is set to B=3, the path branch (u,a,v4) is truncated.

[0057] If the path expansion does not reach the set maximum number of hops, subsequent path expansions will repeat steps 5 and 6 until the maximum number of hops is reached, at which point the path will be saved. .

[0058] Step 7: Calculate the path score; Each path obtained in step 6 Calculate its score according to the formula: ; in, For path, For path length, As a length penalty term, among which Attenuation factor Therefore A negative value is used to suppress excessively long paths that may contain noise. For path The PMI value of the relationship pair is obtained from step 1. The path score is obtained by summing the PMI values ​​of all relations along the path. .

[0059] Step 8: Path filtering.

[0060] Perform a final filter on all saved paths: (1) Candidate collection: Collect all valid paths obtained from the starting entity through steps 5 and 6.

[0061] (2) Global sorting: All candidate paths are merged into a unified set, based on the path scores calculated in step 7. Perform a global sort from highest to lowest.

[0062] (3) Path Filtering: Paths are selected sequentially according to the sorting results until the K highest-scoring paths are selected as the final set. If there are fewer than K candidate paths, all paths are retained. The final K selected paths will be serialized and stored, with each path sequence in the following form: ; in For nodes, For the relationship.

[0063] Example 2: Mamba-based Path Tower Coding This step leverages the Mamba state-space model's ability to process long sequences, encoding the path mined in Example 1 and extracting the global semantic features of entities. The flowchart is as follows. Figure 5 As shown, it includes the following steps: Step 1: Serialization and Embedding; The sampled path is converted into a token sequence, and then embedded and superimposed in three dimensions: (1) Basic embedding: Vectors corresponding to entity ID and relation ID.

[0064] (2) Type embedding: Distinguish whether the current Token is an entity (Type=0) or a relationship (Type=1).

[0065] (3) Position embedding: Identifies the sequence position of the token in the path.

[0066] Finally, the path of the node obtained in Example 1 will be... After the above three embedding steps are combined, it is transformed into a sequence vector. ,in A vector representing a single node or relation, for the th node in a path sequence. Each position, its comprehensive vector representation The calculation formula is as follows: ; in: Indicates the first in the path The ID index of each token, This is the corresponding vector. Indicates the type identifier; when the Token is an entity. When it is a relation , Type embedding is used to distinguish whether the current node is an entity or a relation. This indicates a positional embedding, identifying the absolute position of the token within the path sequence.

[0067] Step 2: Mamba modeling; The path sequence processed in step 1 The path is input into the Mamba module, where it is encoded to obtain the path representation. The specific formula is as follows: ; in, For the Mamba module being called, Features of the encoded entity or relation.

[0068] Step 3: Multi-level attention convergence; This step aggregates the Mamba-encoded path information from step 2 at both the token and path levels: (1) At the token level, attention weights are used to measure the contribution of different entities and relations to the path semantics, and the sequence is compressed into a vector representation of a single path. : ; in This refers to token-level attention weights, which are the weights of entities or relationships. It is a two-layer perceptron. For temperature coefficient, Based on the features of the entities or relationships obtained in step 2, the final path representation is obtained. .

[0069] (2) At the path level, K candidate paths of the same entity are weighted and integrated, and prior constraints are introduced.

[0070] ; in For the first The final aggregate weight of each path, Indicates the first The characteristics of the path This indicates a path scoring network. This represents the path prior based on PMI's reliability and length penalties. It is a hyperparameter that balances learning scores and priors. This represents the number of paths.

[0071] (3) Final entity global path representation By all Vector of the path Based on the calculated weights Weighted sum.

[0072] ; Example 3: Relationship-Gated GCN Structure Tower Coding This step aims to utilize an improved Graph Convolutional Neural Network (GCN) to process the local topology of knowledge graphs. By introducing location awareness and gating mechanisms, it addresses the issues of information oversmoothing and noise interference in traditional GCNs when processing multi-relationship graphs.

[0073] Step 1: Relationship position encoding; To enhance the model's ability to perceive the relative positions of different relations in the graph semantic space, this invention incorporates relation embedding during structural aggregation. Introducing a global position vector And fused through linear mapping: ; Embed the original relation vector. The position projection matrix, It is a learnable relation position embedding matrix, and finally the relation embedding after fusion position is obtained. .

[0074] Step 2: Learnable relationship gating; In message passing, for each relationship Embedded Introduce a learnable gating parameter By combining various interaction modes of entities and relationships (such as subtraction, multiplication, etc.), the intensity of information transmission under different relationships is dynamically adjusted through gating.

[0075] ; express neighboring nodes entity vectors, The current edge obtained in step 1 The vector, This indicates a combination of operations (such as subtraction or multiplication). It is a transformation matrix in a specific direction. Gating. Generated by the Sigmoid activation function, it is used to suppress non-informative relationships while emphasizing semantically valuable relationships, ultimately yielding results from neighboring nodes. Through relationships Passed to the central node News .

[0076] Step 3: Multi-channel adaptive fusion; This step automatically adjusts the importance of three types of information—incoming edges, outgoing edges, and self-loops—in inference through learnable fusion coefficients, achieving adaptive fusion of topological features in different directions.

[0077] ; in, , , These correspond to the information weights of the incoming edge, outgoing edge, and self-loop, respectively. , , These represent the incoming edge message, outgoing edge message, and self-loop message calculated and aggregated in step 2, respectively, resulting in the final fused aggregated feature. .

[0078] Step 4: Update; After message aggregation is completed, the aggregation features will be... Updates are performed using normalization and nonlinear functions, while relational embeddings are also iteratively updated to gradually integrate global information through multi-layer propagation. ; in, This indicates a batch normalization operation. To prevent overfitting, As a bias term, the final entity neighborhood topological features are obtained. .

[0079] Example 4: Dual-Tower Fusion and Scoring Prediction This step aims to organically combine the structure tower (Example 3) and the path tower (Example 2). To enable the path context to flexibly adapt to different query relation semantics, the model introduces a Feature-wise Linear Modulation (FiLM) mechanism and employs a linear weighting strategy to derive the final prediction result. The process is as follows: Figure 6 As shown, it specifically includes: Step 1: Generate path scores based on FiLM; To enable the path context representation to adapt to different relational semantics, the model utilizes relation vectors. Global path features output by the path tower Perform conditional modulation: ; in, For relation embedding vectors, The path features of the entity obtained in Example 3.2 include those from... Departure route information. and It is a learnable projection matrix. This indicates that the sigmoid activation function ensures that the gating factor is between (0,1). This represents element-wise product. The modulated context representation retains historical path information while incorporating the semantic tendency of the current query relationship.

[0080] Modulated context representation With relational embedding Together, a query vector is generated and matched with candidate entities to obtain the final path tower score. ; in This represents the concatenation of the subject context and relation embeddings for relation awareness. Indicates candidate entities The path global features. MLP, as a nonlinear projector, maps the combinatorial representation to... The same potential space.

[0081] Step 2: Merge the two towers; PRGCN employs a dual-tower fusion strategy, linearly combining the basic score of the structure tower (capturing local structural information) with the global score of the path tower (capturing global inference logic) to obtain the final prediction score. The overall framework is shown in Algorithm 2. (1) Structure Tower: The basic score of the structure tower is obtained by the decoder through the topological features of the entity neighborhood output by the relation-gated GCN in Example 3. .

[0082] (2) Path Tower: The global path score of the path tower is obtained through step 1 above.

[0083] (3) Final score formula: ; in The structural tower foundation score is calculated by the relation-gated GCN. It is the global path score derived from the path tower.

[0084] (4) Based on the final fusion score Sort all candidate entities and select the entity with the highest score as the prediction result for the query (u, r, ?).

[0085] Example 5: Similar Node Path Reasoning This step aims to construct an enhanced atlas based on the model's prediction results and provide interpretability for the prediction results by searching for connection paths between target entities and semantically similar nodes. The process is as follows: Figure 7 As shown, it includes: Step 1: Attribute completion; (1) Input: Input the triple (u,r,?) with missing attributes into PRGCN for completion, where the central node u is the known entity, r is the prediction relation, and ? is the entity to be predicted.

[0086] (2) PRGCN reasoning: such as Figure 8 As shown, through the head entity (v3) and relation (r) c ), calculate the score distribution of all candidate tail entities (n tail entities: v9, v10, v11...), select the node with the highest score as the prediction result (v12); then use it as incremental knowledge to fill the graph to form an enhanced graph.

[0087] Step 2: Similarity node determination; (1) Vector extraction: Extract vector representations of all entities from the model.

[0088] (2) Cluster center calculation: Map all entity vectors to the vector space and calculate their average vector as the semantic center of the cluster. : ; in, For the total number of entities, This is the entity embedding vector.

[0089] (3) Similarity calculation: Calculate the cosine similarity between each entity vector and the cluster center vector. Nodes with the same score are judged as similar nodes. Find the entity v with the same score as the center node u.

[0090] Step 3: Explainable path reasoning; (1) Bidirectional path search: Based on the enhanced graph constructed in step 1, bidirectional expansion is performed starting from the two similar nodes found in step 2 to discover the connection path between similar nodes.

[0091] (2) Hybrid scoring: A hybrid scoring formula is used to evaluate each jump path: ; The semantic prediction score of the model for the validity of the triple; The mutual information between the two jumps is obtained from the example section in 3.1; As a truthfulness bias, if the edge is an existing true edge in the graph and not the edge completed in step 1, a reward is given to ensure the reliability of the reasoning. and For hyperparameter weights; (3) Optimal path output: Sort the paths according to the total score and output the path chain with the highest score as the final reasoning result.

[0092] In summary, the technical solutions provided by the embodiments of this invention are particularly applicable to the field of digital protection and inheritance of cultural heritage. For example, when dealing with the typical cultural knowledge completion task of "What is the inheritor (relationship) of a certain traditional craft (head entity)? (tail entity)", this invention can use PMI to screen out key paths related to cultural inheritance (such as "apprenticeship -> influence -> representative works"), utilize Mamba to efficiently model long-range dependencies, and finally accurately predict the missing inheritor entity through dual-tower fusion.

[0093] Figure 9 This is a schematic diagram of a knowledge graph completion system based on path-structure fusion provided by the present invention, such as... Figure 9 As shown, it includes: The path filtering module is configured to filter and sample paths in the knowledge graph based on Point Mutual Information (PMI) to obtain a set of multiple high-quality paths. The aggregation module is configured to encode each path in the path set based on the Mamba state space model to obtain Mamba-encoded path information, and to aggregate the Mamba-encoded path information using multi-level attention to obtain entity path features. The fusion module is configured to construct a joint modeling framework for path-level semantics and local structural information, and to use the joint modeling framework to linearly fuse the scores of entity path features and entity neighborhood topological features to obtain a joint score. The completion module is configured to use the joint score to complete incomplete triples in the knowledge graph, thereby ensuring the consistency between semantic links and graph structure during inference.

[0094] The present invention also provides a computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the knowledge graph completion method based on path-structure fusion.

[0095] The present invention also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the path-structure fusion-based knowledge graph completion method.

[0096] In summary, this invention first introduces a path filtering strategy based on Point Mutual Information (PMI) at the data preprocessing level. By quantifying the co-occurrence correlation between entities, it accurately eliminates redundant and noisy paths, providing high-quality semantic context for subsequent inference. Second, it innovatively employs the Mamba state-space model for path sequence modeling during path modeling, efficiently capturing long-distance sequence dependencies and aggregating path information using multi-level attention. Third, at the decoding and scoring level, it constructs a "path-structure" dual-tower architecture, adaptively fusing and scoring global path semantic features with local graph topological features, thereby improving the expressive power and robustness in complex link prediction tasks. Finally, at the graph reasoning and application level, through a mechanism of "attribute completion—similar node determination—bidirectional path search," it automatically mines high-scoring interpretable paths from known entities and their similar nodes, and uses a hybrid scoring formula for comprehensive evaluation, ultimately outputting the inferred link. Overall, this invention not only significantly improves the accuracy of link prediction but also provides a reliable and interpretable technical basis for cross-entity association mining in the field of digital protection and inheritance of cultural heritage.

[0097] The preferred embodiments of the present invention have been described above with reference to the accompanying drawings, but this does not limit the scope of the invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and spirit of the present invention should be within the scope of the present invention.

Claims

1. A knowledge graph completion method based on path-structure fusion, characterized in that, include: Based on Point Mutual Information (PMI), paths in the knowledge graph are filtered and sampled to obtain a set of multiple high-quality paths; Each path in the path set is encoded based on the Mamba state space model to obtain Mamba-encoded path information. Then, multi-level attention is used to aggregate the Mamba-encoded path information to obtain entity path features. A joint modeling framework for path-level semantics and local structural information is constructed, and the scores of entity path features and entity neighborhood topological features are linearly fused using the joint modeling framework to obtain a joint score. The joint score is used to complete incomplete triples in the knowledge graph, thereby ensuring the consistency between semantic links and graph structure during reasoning.

2. The method according to claim 1, characterized in that, Based on Point Mutual Information (PMI), paths in the knowledge graph are filtered and sampled to obtain a set of multiple high-quality paths, including: Traverse the triples and path information in the knowledge graph, and count the frequency of occurrence of relations, the total frequency of occurrence of all relations, the frequency of occurrence of any two relations as adjacent relation pairs, and the total frequency of occurrence of all adjacent relation pairs. Using the frequency of occurrence of the relationship, the total frequency of occurrence of all relationships, the frequency of occurrence of any two relationships as adjacent relationship pairs, and the total frequency of occurrence of all adjacent relationship pairs, calculate the point mutual information value used to measure the strength of the correlation between two relationships; Using the point mutual information value, calculate the importance value of each relation in the entire knowledge graph structure, and calculate the edge weight connecting the neighboring nodes from the center node based on the importance value, the frequency of occurrence of the relation, and the degree of the target neighboring node. By utilizing the edge weights that connect neighboring nodes from the central node, paths in the knowledge graph are filtered and sampled to obtain a set of multiple high-quality paths.

3. The method according to claim 2, characterized in that, Using the frequency of occurrence of the aforementioned relationship, the total frequency of occurrence of all relationships, the frequency of occurrence of any two relationships as adjacent relationship pairs, and the total frequency of occurrence of all adjacent relationship pairs, the point mutual information value used to measure the strength of the correlation between two relationships is calculated as follows: Calculate the marginal probability of the relationship based on the frequency of occurrence of the relationship and the total frequency of occurrence of all relationships; Calculate the joint probability of any two relations based on the frequency of their co-occurrence as adjacent relations and the total frequency of occurrence of all adjacent relations. Based on the marginal probability of the relationship and the joint probability of any two relationships, a point mutual information value is calculated to measure the strength of the correlation between the two relationships.

4. The method according to claim 2, characterized in that, By utilizing the edge weights connecting neighboring nodes from the central node, paths in the knowledge graph are filtered and sampled to obtain a set of multiple high-quality paths, including: Based on the edge weights connecting neighboring nodes from the central node, in each hop of the path expansion, a preset number of nodes with the highest weight are retained to continue the expansion until a preset path length is reached or there are no better branches, thereby obtaining multiple candidate paths, and calculating the path score value for each candidate path. Based on the path score value of each candidate path and the preset path score threshold, multiple candidate paths with path scores exceeding the path score threshold are selected as multiple high-quality paths.

5. The method according to claim 4, characterized in that, Each path in the path set is encoded based on the Mamba state-space model to obtain the Mamba-encoded path information, including: Each path in the path set is sequentially processed through basic embedding, type embedding, and position embedding to obtain a path sequence vector; The path sequence vector is encoded based on the Mamba state space model to obtain the Mamba-encoded path information.

6. The method according to claim 5, characterized in that, The Mamba-encoded path information is aggregated using multi-level attention to obtain entity path features, including: At the token level, the final vector for each path is obtained by utilizing the features of entities or relationships in the Mamba-encoded path information and the token-level attention weights. At the path level, candidate paths for the same entity are weighted and aggregated to obtain the aggregate weight of each path; The entity path features are obtained by using the final vector of each path and the aggregate weight of each path.

7. The method according to claim 1, characterized in that, Also includes: Calculate the base score of the structure tower and the global score of the path tower; The final joint score is obtained by using the basic score of the structure tower and the global score of the path tower. All candidate entities are ranked based on the final joint score, and the entity with the highest final fusion score is selected as the prediction result for completing incomplete triples in the knowledge graph.

8. A knowledge graph completion system based on path-structure fusion, characterized in that, include: The path filtering module is configured to filter and sample paths in the knowledge graph based on Point Mutual Information (PMI) to obtain a set of multiple high-quality paths. The aggregation module is configured to encode each path in the path set based on the Mamba state space model to obtain Mamba-encoded path information, and to aggregate the Mamba-encoded path information using multi-level attention to obtain entity path features. The fusion module is configured to construct a joint modeling framework for path-level semantics and local structural information, and to use the joint modeling framework to linearly fuse the scores of entity path features and entity neighborhood topological features to obtain a joint score. The completion module is configured to use the joint score to complete incomplete triples in the knowledge graph, thereby ensuring the consistency between semantic links and graph structure during inference.