Knowledge graph retrieval method and device for private railway official document and electronic equipment

By building a tree index structure on the blockchain, distinguishing between plaintext and ciphertext keywords, and realizing dynamic update and pruning search, the problems of low retrieval efficiency and insufficient privacy protection in the railway official document knowledge graph are solved, and the retrieval efficiency and privacy protection capabilities are improved.

CN120705298APending Publication Date: 2025-09-26INST OF COMPUTING TECH CHINA ACAD OF RAILWAY SCI +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510916226.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-03
Publication Date
2025-09-26

Smart Images

  • Figure CN120705298A_ABST
    Figure CN120705298A_ABST
Patent Text Reader

Abstract

The invention relates to a privacy railway official document-oriented knowledge graph retrieval method and device and electronic equipment. The method comprises the following steps: receiving keyword data subjected to classification processing; constructing a tree index structure based on the received keywords; in response to the data deletion request, marking the target data as a deletion state, and updating a filtering structure and a hash value of the associated node from bottom to top; receiving a query request containing a public keyword plaintext and a non-public keyword authorization voucher, traversing the index tree, performing pruning search through filtering structure comparison, and returning a matched knowledge graph sub-graph set and verification information; and generating verification information for verifying the query result. According to the method, privacy grading protection is realized, efficient incremental maintenance is ensured, the retrieval efficiency is remarkably improved, a verifiable closed loop is formed, sensitive information protection requirements and ten thousand-level data retrieval performance of a railway official document scene are considered, and meanwhile, a tamper-proof audit link is constructed through a block chain, a hash chain and a verification packet.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain data retrieval technology, and in particular to a knowledge graph retrieval method, device, and electronic equipment for private railway documents. Background Art

[0002] With the advancement of smart railway construction, the railway document knowledge graph, as the core data carrier for the structured processing of railway documents in multiple fields, is facing an increasingly urgent need for efficient retrieval and secure sharing. Blockchain technology, due to its decentralized trust, data immutability, and full traceability, has been applied to railway document data sharing scenarios. However, the following technical bottlenecks still exist: Traditional blockchain systems primarily support simple queries based on block height or transaction hashes. Semantic-based searches for multiple keywords within the railway document knowledge graph require traversing the entire chain, resulting in high query latency, high resource consumption, and low on-chain search efficiency.

[0003] Railway documents contain a large amount of sensitive information, requiring strict access control. The transparent storage nature of blockchain leads to the exposure of private data in plain text on distributed nodes, resulting in insufficient protection of private data.

[0004] To improve retrieval efficiency, keywords must be stored in plain text on the chain, but this sacrifices privacy. Privacy protection schemes often destroy the data structure, making it impossible to support efficient retrieval, and efficiency and privacy cannot be reconciled. Summary of the Invention

[0005] Based on this, it is necessary to provide a knowledge graph retrieval method, device and electronic equipment for privacy railway documents that takes into account both efficient retrieval and privacy protection in order to address the above technical issues.

[0006] The present invention provides a knowledge graph retrieval method for private railway documents, characterized by being executed by a blockchain system, and comprising: receiving keyword data that has been classified, wherein public keywords are input in plain text and non-public keywords are input in cipher text; Build a tree index structure based on the received keywords, where the leaf nodes store the keyword filtering structure, knowledge graph subgraph data and data hash values, and the non-leaf nodes store the aggregated value of the child node filtering structure and the parent node hash value generated based on the child node hash; In response to a data deletion request, mark the target data as deleted and update the filter structure and hash value of the associated nodes from bottom to top; Receive query requests containing public keyword plaintext and non-public keyword authorization credentials, traverse the index tree, perform pruning search through filter structure comparison, and return the matching knowledge graph subgraph set and verification information; Generate verification information for query results, including: correctness verification data to prove that the subgraph data contains all query keywords; completeness verification data to prove that no subgraphs are missing; and index integrity verification data to prove that the result comes from the current on-chain index.

[0007] In one embodiment, constructing a tree index structure includes: Generate fingerprint values ​​based on data hash for leaf nodes; The filter structure aggregate value of the non-leaf node is recursively calculated, where the aggregate value is the bitwise sum operation result of the filter structures of all child nodes.

[0008] In one embodiment, in response to a data deletion request, marking the target data as deleted and updating the filter structure and hash value of the associated nodes from bottom to top include: When data deletion is detected, the target leaf node is located and marked as deleted; The filter structure aggregation value of the path node is recursively updated from the bottom up to remove the deleted keyword contribution, and the node hash is recalculated based on the updated child node hash.

[0009] In one embodiment, removing the deleted keyword contribution includes: Locate the bitmap position corresponding to the keyword in the filter structure; The parent node aggregation value is updated by performing an XOR operation on the parent node aggregation value and the original keyword bitmap of the child node.

[0010] In one embodiment, the pruning search by filtering structure comparison includes: For public keywords, directly compare the bitwise inclusion relationship between the keyword and the node aggregation value; For non-public keywords, use pre-generated encrypted tokens to decrypt the filter structure and then match; Dynamically generate pruning path records, including the root node hash and aggregation value of the skipped subtree.

[0011] In one embodiment, generating verification information for verifying the query result includes: Construct an existence proof bitmap to identify the position of each keyword in the matching subgraph in the filter structure.

[0012] In one embodiment, generating verification information for verifying the query result further includes: Call the on-chain certificate management contract to generate an aggregate signature for the authorization validity of non-public keywords; The proof-of-existence bitmap is combined with the aggregate signature into a verifiable data packet.

[0013] In one embodiment, receiving the classified keyword data includes: When receiving keyword data in ciphertext form, a threshold encryption mechanism is adopted, the private key is sharded and stored in multiple consensus nodes, and decrypted collaboratively through the consensus protocol, and a single node cannot obtain the complete private key.

[0014] The present invention also provides a knowledge graph retrieval device for private railway documents, the device comprising: A classification data receiving module is used to receive the classified keyword data, wherein the public keywords are input in plain text and the non-public keywords are input in cipher text; Build a tree index module, which is used to build a tree index structure based on the received keywords, where the leaf nodes store the keyword filtering structure, knowledge graph subgraph data and data hash values, and the non-leaf nodes store the aggregated value of the child node filtering structure and the parent node hash value generated based on the child node hash; A dynamic update index module is used to respond to a data deletion request, mark the target data as deleted, and update the filter structure and hash value of the associated nodes from bottom to top; The query request processing module is used to receive query requests containing public keyword plaintext and non-public keyword authorization credentials, traverse the index tree, perform pruning search through filter structure comparison, and return the matching knowledge graph subgraph set and verification information; A verification information module is provided to generate verification information for verifying query results, including: correctness verification data to prove that the subgraph data contains all query keywords; completeness verification data to prove that there are no missing matching subgraphs; and index integrity verification data to prove that the result comes from the current on-chain index.

[0015] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and is characterized in that when the processor executes the computer program, it implements the above-mentioned knowledge graph retrieval method for private railway documents.

[0016] The above-mentioned knowledge graph retrieval method, device, and electronic device for privacy-sensitive railway documents receive classified keyword data and construct a tree index structure to achieve hierarchical privacy protection. Based on a dynamic update mechanism, they mark the status and update node data from the bottom up in response to deletion requests, ensuring efficient incremental maintenance. When processing mixed queries, they implement pruning search through filter structure comparison, significantly improving retrieval efficiency. Ultimately, they generate three types of verification information, including proof of correctness, proof of completeness, and proof of index integrity, forming a verifiable closed loop. Without third-party intervention, this solution balances the sensitive information protection needs of railway document scenarios with the performance of retrieval of tens of thousands of data points. It also establishes a tamper-proof audit chain through blockchain hash chains and verification packages. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 This is a flow chart of a knowledge graph retrieval method for private railway documents according to one embodiment; Figure 2 This is a flow chart of a knowledge graph retrieval method for private railway documents according to another embodiment; Figure 3 This is a flow chart of a knowledge graph retrieval method for private railway documents according to another embodiment; Figure 4 A flow chart of a knowledge graph retrieval method for private railway documents according to another embodiment; Figure 5 This is a flowchart of the fifth embodiment of the knowledge graph retrieval method for private railway documents of the present invention; Figure 6 A shared flow chart of a specific embodiment of the present invention; Figure 7 This is the on-chain index data structure diagram of the present invention; Figure 8 A flowchart for constructing an on-chain storage index for the invention combining explicit and implicit storage; Figure 9 Schematic diagram of the on-chain storage index construction process of the present invention; Figure 10 This is a timing diagram of the chain index query process of the present invention; Figure 11 Schematic diagram of the on-chain index query process of the present invention; Figure 12This is a schematic diagram of a knowledge graph retrieval device for private railway documents according to one embodiment; Figure 13 FIG. 1 is a diagram showing the internal structure of a computer device according to an embodiment. DETAILED DESCRIPTION

[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0020] Railway official document knowledge graph data refers to structured data with semantic connections, constructed by digitally collecting various official documents within the railway system and using technical means such as keyword screening, entity recognition, word vector training, and relationship extraction. This document data covers multiple fields, including engineering construction, transportation production, business development, resource management, and integrated collaboration. With the advancement of smart railway construction, the railway system has an increasing demand for the processing and utilization of digitized official document data. This is particularly true for the storage, retrieval, and sharing of official document resources, placing higher demands on efficient data mining and knowledge management. Currently, the application of railway official document knowledge graphs is evolving towards efficiency and intelligence, aiming to automate the processing of large amounts of official document data, construct a semantic network with unified terminology and structure across departments, and support intelligent retrieval and decision analysis. However, the sharing and application of railway official document data requires not only efficient storage and access of massive amounts of data and relationship extraction, but also concerns the security, confidentiality, and privacy protection of document content. Traditional data sharing models, such as centralized document management platforms or data exchange marketplaces, rely on the trustworthiness of third-party platforms. If these platforms are attacked or face information leakage risks, data leaks and the credibility of document content can be compromised. As a decentralized data storage and sharing technology, blockchain technology maintains an open, transparent and tamper-proof digital ledger through distributed nodes. Blockchain can ensure the security, authenticity and credibility of official document data and provide a reliable data sharing and traceability mechanism for various official documents in the railway system. Compared with the traditional centralized management method, blockchain technology has the following advantages in the railway official document knowledge graph retrieval scenario: (1) Decentralized trust mechanism: Blockchain eliminates the dependence on centralized institutions through distributed ledger technology. Participants can directly share railway official document data based on a consensus mechanism. This not only ensures the authenticity and reliability of the data, but also solves the trust problem in cross-departmental and cross-organizational cooperation. It is particularly suitable for data intercommunication between multiple departments such as railway transportation and operation management. (2) Data rights confirmation and security protection: The immutability and timestamp function of blockchain can clearly record the drafting, release information, ownership and circulation path of railway official documents, and realize the full traceability of official document data. Combined with smart contract technology, it can automatically execute authorization rules to prevent the theft, tampering or leakage of confidential information, ensuring data privacy protection and the legitimate rights and interests of relevant departments. (3) Ensuring the credibility of data sharing: The immutability and traceability of blockchain technology ensure that the entire process of railway document data sharing is highly credible, including data sources, circulation paths, and usage records. This mechanism not only prevents the denial of retrieval behavior, but also provides a credible basis for subsequent audits and supervision, ensuring the authenticity and transparency of the cross-departmental and cross-organizational data sharing process. However, there are also some challenges in the application of blockchain in the railway document knowledge graph.For example, blockchain nodes need to maintain a complete copy of blockchain data and append data blocks in chronological order, which can result in high storage overhead and query latency. Furthermore, the decentralized nature of blockchains hinders the privacy of on-chain data. Therefore, it is crucial to design efficient on-chain indexing and storage strategies tailored to specific railway document use cases to improve data storage and query efficiency, ensuring that blockchain technology meets the efficiency and privacy requirements of railway document data sharing scenarios.

[0021] With the advancement of smart railway construction, the railway document knowledge graph, as the core data carrier for structured processing of railway documents in multiple fields (such as engineering construction and transportation production), is facing an increasingly urgent need for efficient retrieval and secure sharing. Blockchain technology, due to its decentralized trust, data immutability, and full traceability, has been applied to railway document data sharing scenarios. However, the following technical bottlenecks still exist: Traditional blockchain systems (such as traditional public chains) primarily support simple queries based on block height or transaction hashes. Semantic-based searches for multiple keywords within the railway document knowledge graph (e.g., searching for "technical standards + contract terms") require traversing the entire chain, resulting in high query latency, high resource consumption, and low on-chain search efficiency.

[0022] Railway documents contain a large amount of sensitive information (such as security technical documentation and confidentiality agreements), requiring strict access control. The transparent storage nature of blockchain leads to the exposure of private data in plain text on distributed nodes, resulting in insufficient protection of private data.

[0023] To improve retrieval efficiency, keywords must be stored in plain text on the chain, but privacy is sacrificed; and privacy protection solutions (such as data desensitization) often destroy the data structure, resulting in the inability to support efficient retrieval, and efficiency and privacy cannot be reconciled.

[0024] This paper designs a blockchain index structure and its retrieval and verification mechanism that supports mixed storage of plaintext and ciphertext for official document knowledge graph data involving confidential and sensitive information in the railway system, realizing efficient and verifiable multi-keyword retrieval, which is suitable for privacy-sensitive data sharing scenarios in the fields of railway engineering construction, transportation management, etc.

[0025] The following combination Figures 1 to 13 The present invention describes the knowledge graph retrieval method, device and electronic device for private railway documents.

[0026] like Figure 1 As shown, in one embodiment, a knowledge graph retrieval method for private railway documents includes the following steps: Step S110 receives classified keyword data, where public keywords are entered in plain text and private keywords are entered in cipher text. When receiving cipher text keyword data, a threshold encryption mechanism is used, with the private key fragmented and stored across multiple consensus nodes. Decryption is performed collaboratively via a consensus protocol, and no single node can obtain the complete private key.

[0027] Data owners extract keywords from the railway document knowledge graph, store publicly available keywords in plaintext and privacy-sensitive keywords in ciphertext, and upload them to the blockchain. The blockchain system receives pre-classified plaintext and ciphertext keyword data through a unified interface, eliminating external interference with data privacy. This provides the system with transparent processing capabilities for encrypted data (maintaining zero-knowledge of ciphertext data to avoid system overhead caused by encryption and decryption operations) and input standardization compatibility (supporting direct access to data sources with varying security levels, such as railway document libraries and sensor networks, reducing data integration complexity), thus enabling secure, indiscriminate access to heterogeneous data.

[0028] Step S120, constructing a tree index structure based on the received keywords, wherein the leaf nodes store the keyword filtering structure, the knowledge graph subgraph data and the data hash value, and the non-leaf nodes store the aggregated value of the child node filtering structure and the parent node hash value generated based on the child node hash.

[0029] The knowledge graph subgraph data includes entity attributes, entity relationships, and associated document identifiers in railway documents. The data hash value is the summary value after Merkle processing of the subgraph data. The blockchain constructs a tree-like on-chain index based on the uploaded keywords, where: Leaf node storage: keyword filtering structure (such as Bloom filter (CBF)), knowledge graph subgraph data (content), hash value (hash = H(content)); non-leaf node storage: bitwise sum of child node CBF (CBF = child1.CBF + child2.CBF), hash value (hash = H(child1.hash || child2.hash)).

[0030] The blockchain system independently constructs a tree index that integrates the filtering structure and data fingerprint, so that non-leaf nodes only store the filtering structure aggregation value (such as the bitwise sum of CBF) and hash value, reducing the on-chain space usage by more than 60% compared to the full data storage. The data hash of the leaf node and the hash chain design of the non-leaf node provide native support for the subsequent verification information (VO) generation.

[0031] In step S130, in response to the data deletion request, the target data is marked as deleted and the filter structure and hash value of the associated nodes are updated from the bottom up, implementing dynamic index updates. Dynamic index updates also include data addition operations, specifically locating the target leaf node for the newly added data; creating a new leaf node and updating the filter structure aggregation value and hash value of the parent node from the bottom up.

[0032] After responding to a deletion request, the blockchain system uses a bottom-up recursive update mechanism to ensure real-time index consistency. It completes the target data status marking and associated node filtering structure / hash updates within a single transaction, avoiding the "dirty read" risk of traditional blockchain indexes. At the same time, it reduces update latency by only modifying the path nodes from the leaf node to the root node (with an average complexity of O(log N)), thereby achieving atomic state synchronization that supports deletion operations.

[0033] Step S140: Receive a query request containing the plain text of public keywords and the authorization certificate of non-public keywords, traverse the index tree, perform pruning search through filter structure comparison, and return the matching knowledge graph subgraph set and verification information.

[0034] The data user requests authorization from the data owner for non-public keywords, obtains an authorization query credential for these non-public keywords, and generates a hybrid query request based on the public keywords. The blockchain traverses the index tree, performs a pruning search through filter structure comparison, and returns a set of matching knowledge graph subgraphs and verification information. The authorization query credential is generated by the data owner issuing an encrypted token to the authorized user through a smart contract. The encrypted token contains the filter structure parameters and validity period of the non-public keywords.

[0035] The blockchain system uses hybrid queries (containing plaintext keywords + encrypted credentials) as atomic operations to perform cross-classification joint searches and optimize search efficiency, enabling single-pass retrieval of data with varying levels of confidentiality. During hybrid query processing, pruning searches employ a depth-first search (DFS) strategy. When the filter structure aggregate value of a non-leaf node does not match the query request, all subtree traversals are skipped. Cross-classification joint searches process both public and private keywords simultaneously through pruning searches, resolving the splicing errors associated with traditional solutions that require multiple queries. Retrieval efficiency optimization utilizes a pre-screening mechanism based on the filter structure aggregate value, skipping over 90% of irrelevant subtrees.

[0036] Step S150 generates verification information for verifying the query results, including: correctness verification data, used to prove that the subgraph data contains all query keywords; completeness verification data, used to prove that there are no missing matching subgraphs; and index integrity verification data, used to prove that the result comes from the current on-chain index.

[0037] The blockchain system generates a self-contained, verifiable data structure. The output Verification Information (VO) is triple-verifiable and self-verified: Correctness: It includes a keyword existence bitmap and an authorization signature, allowing third-party verification of the result's authenticity; Completeness: It uses proof of filter structure mismatches based on pruned nodes to eliminate concerns about missing results; and Integrity: It reconstructs the root hash through a hash chain to verify the source index version of the result. Verification is lightweight, with the VO data size being only 5%-0% of the returned result, and third-party verification takes less than 100ms. Completeness verification specifically involves verifying that the filter structure of each pruned node does not match the query request based on the set of pruned nodes in the verification information; and proving that no subgraph data is missing by reconstructing the pruned node's hash chain. Index integrity verification specifically involves calculating the root hash layer by layer based on the leaf node path and sibling node hash values ​​in the verification information; and comparing the calculated root hash with the current root hash stored on the blockchain.

[0038] This embodiment of the knowledge graph retrieval method for private railway documents receives classified keyword data and constructs a tree index structure to achieve hierarchical privacy protection. Based on a dynamic update mechanism, it marks the status and updates node data from the bottom up in response to deletion requests, ensuring efficient incremental maintenance. When processing mixed queries, it implements pruning search through filter structure comparison, significantly improving retrieval efficiency. Ultimately, it generates three types of verification information, including proof of correctness, proof of completeness, and proof of index integrity, forming a verifiable closed loop. This solution, without third-party intervention, balances the sensitive information protection needs of railway documents with the performance of retrieval of tens of thousands of data points. It also establishes a tamper-proof audit chain through blockchain hash chains and verification packages.

[0039] like Figure 2 As shown, in one embodiment, building a tree index structure includes the following steps: Step S122: Generate a fingerprint value based on data hash for the leaf node. The leaf node fingerprint value is equal to Hash (subgraph data), the tree index structure is a binary tree structure, and the keyword filtering structure stored in the leaf node is a counting Bloom filter.

[0040] Step S124 recursively calculates the filter structure aggregation value of non-leaf nodes. The aggregation value is the bitwise sum of the filter structures of all child nodes. Bitwise summing achieves efficient aggregation, avoiding the need to rescan all child nodes. The aggregation value can be used to determine whether the subtree contains keywords, thereby performing lightweight verification. The bitwise sum operation satisfies reversibility. When deleting data, the CBF value of the target leaf node is reversely deducted from the parent node's aggregation value. When adding data, the CBF value of the new leaf node is accumulated to the parent node's aggregation value.

[0041] like Figure 3As shown, in one embodiment, in response to a data deletion request, marking the target data as deleted and updating the filter structure and hash value of the associated node from bottom to top include the following steps: Step S132: When data deletion is detected, locate the target leaf node and mark the deletion status.

[0042] Step S134, recursively update the filter structure aggregation value of the path node from the bottom up to remove the deleted keyword contribution, and recalculate the node hash based on the updated child node hash. Only the path node is updated to avoid rebuilding the entire tree, and the hash chain update ensures that the index is consistent with the on-chain data. Optionally, the deleted keyword contribution is removed, including: locating the bitmap position corresponding to the keyword in the filter structure, and updating the parent node aggregation value through the XOR operation of the parent node aggregation value and the child node original keyword bitmap. Update the parent node aggregation value: parent aggregation value_new = parent aggregation value_old XOR child node original keyword bitmap, quickly remove the specific keyword contribution through XOR (XOR), accurately update, and the bit operation ensures that the updated aggregation value accurately reflects the subtree status.

[0043] like Figure 4 As shown, in one embodiment, performing pruning search by filtering structure comparison includes the following steps: Step S142: directly compare the public keyword with the node aggregation value. If the aggregation value & keyword bitmap = keyword bitmap, then it may contain Step S144: Use the pre-generated encrypted token to decrypt the filter structure for the non-public keywords and then perform matching.

[0044] Step S146: Dynamically generate a pruning path record, including the root node hash and aggregation value of the skipped subtree.

[0045] By combining the speed and efficiency of direct plaintext matching with the security of matching after ciphertext decryption, hybrid query optimization is performed, pruning skips more than 95% of invalid subtrees, and the pruning path records are used to generate integrity verification data.

[0046] like Figure 5 As shown, in one embodiment, generating verification information for verifying the query result includes the following steps: Step S152: Construct an existence proof bitmap to identify the position of each keyword in the matching subgraph within the filter structure. A bitmap identifier is generated for each keyword in the matching subgraph, marking its position within the filter structure. The bitmap requires only a few KB to prove the keyword's existence, enabling lightweight verification. Combined with a hash chain, the bitmap can be verified to be tamper-proof.

[0047] In step S154, the on-chain certificate management contract is called to generate an aggregate signature for the authorization validity of the non-public keywords. The aggregate signature proves that the user has the right to access the non-public keywords and the authorization is verifiable.

[0048] Step S156: Combine the existence proof bitmap and the aggregate signature into a verifiable data packet. A single return result combined with verification data reduces on-chain interactions.

[0049] In a specific embodiment, the present invention is mainly aimed at the process of searching the railway document knowledge graph information on the chain, with the purpose of realizing efficient and verifiable multi-keyword search of the railway document knowledge graph information on the chain in both plaintext and ciphertext scenarios. The method of establishing a plaintext and ciphertext combined on-chain data index is adopted to improve the retrieval efficiency, and the verification parameters are returned after the retrieval is completed to support the data user to verify the retrieval results. Combining data structures such as Bloom filter and Merkle hash mountain, a new data index is designed that supports both plaintext and ciphertext storage and query, and the index construction, update, query and query result verification algorithm are designed, as follows: 5.1 Shared Process Focusing on the efficient acquisition of railway document data information on the chain in the scenario of combining open and secret, the acquisition process mainly involves three entities: data users, data owners and blockchain. Figure 6 The working principle of the present invention is mainly divided into the following steps: (1) Uploading keywords of the railway official document knowledge graph. The data owner extracts keywords that can describe the characteristics of the knowledge graph and other information required in the sharing process from the railway official document knowledge graph. Some of the publicly available keyword information, such as document titles, railway technical standards, and operation management regulations, are stored in plain text, while some privacy-related keywords, such as railway safety technical documents, confidentiality agreements, and contract terms, are stored in cipher text. The data owner uploads the integrated railway official document knowledge graph keywords to the blockchain.

[0050] (2) On-chain index generation. The blockchain stores the railway document knowledge graph keywords on the chain and generates a clear and secret combination on-chain data index through the keywords, so that subsequent data users can efficiently query the on-chain information.

[0051] (3) Query and acquisition of railway official document data information. Data users generate query parameters based on their query keywords. For plaintext keywords, data users can construct query parameters through public indexes; for ciphertext keywords, data users need to obtain query parameters from the data owner. Finally, the data user integrates the plaintext and ciphertext query parameters into a complete query parameter and sends it to the blockchain. The blockchain performs a query based on the query parameters in the on-chain index that combines plaintext and ciphertext, and returns the query results and verification parameters to the data user.

[0052] (4) Verification of query results. Data users can verify the correctness, integrity, and completeness of query results through the query results and verification parameters returned by the blockchain.

[0053] 5.2 Design of on-chain data index structure combining explicit and secret The proposed on-chain data index for the combination of explicit and secret elements adopts a tree structure, as shown in the diagram. Figure 7 The index contains two types of nodes: leaf nodes and non-leaf nodes. The leaf node corresponds to a knowledge graph subgraph, and the data stored is in the form of ,in Indicates the counting Bloom filter generated by the keywords contained in the data corresponding to the leaf node. The data stored in the leaf nodes is the information of the railway official document knowledge graph. is the hash value of the leaf node and ,in is a hash function. Each non-leaf node points to two leaf nodes, and the data stored in the non-leaf node is in the form of ,in For its two child nodes Bitwise addition, It is calculated by the hash values ​​of the two child nodes and their counting bloom filter values.

[0054] 5.3 On-chain storage index construction and update algorithm combining explicit and secret 5.3.1 On-chain index construction algorithm The algorithm for building an on-chain index is proposed. The process of index construction is to continuously append data items to the index. Figure 8 The steps of appending a knowledge graph subgraph to the index are to first generate a counting Bloom filter through the keyword information contained in the data, thereby generating leaf nodes for the data, and then append the leaf nodes corresponding to the knowledge graph subgraph data to the root node list, and then determine whether there are trees that can be merged in the root node list. The judgment condition is whether the heights of the last two trees in the root node list are the same. If they are the same, a new root node is generated for it, that is, the merged knowledge graph.

[0055] To existing nodes and Add to the index tree and See the process of Figure 9 , initial stage and The nodes are constructed into a tree, and then enter the append phase, directly and Append to the existing tree. Then detect and The height is the same, so we enter the merging stage, first and Merge into one tree and create As the root node. The tree with root node The height of the tree with the root node is the same, so a second merge is required, that is, The tree with root node Merge the trees with the root node into one tree and create As the root node.

[0056] 5.3.2 How to update the on-chain index A data deletion algorithm for on-chain indexes is designed. The specific process is to first set the deletion flag of the deleted data item to 1, and then modify the value and hash of its counting Bloom filter from the bottom up to ensure that the target will no longer be found through multi-keyword queries. For example, Figure 7 If you need to delete If the target is included, you only need to delete position 1 and modify it from bottom to top ,Right now , . and recalculate and without rebuilding the entire index tree.

[0057] 5.4 On-chain index query algorithm combining explicit and secret The proposed on-chain index supports a multi-keyword query algorithm that combines explicit and implicit keywords. The data transfer relationship between entities during the query process is as follows: Figure 10 As shown. The multi-keyword query algorithm means that when a number of keywords are input, the index will return all knowledge graph subgraphs that contain these keywords. The query keywords are divided into plaintext keywords and ciphertext keywords. The plaintext keywords queried by the data user can be sent directly to the blockchain for query. The ciphertext keywords need to obtain query permission from the data owner first, and then the Bloom filter with ciphertext keywords generated by the data owner is sent to the blockchain. The input of the query algorithm is all the root nodes of the on-chain index, the Bloom filter used for ciphertext query and plaintext query keywords, the algorithm combines plaintext keywords and Calculated , which is a counting Bloom filter that contains the plaintext and ciphertext keywords of the query. The algorithm not only returns the knowledge graph that meets the requirements As a result of the query, the validation parameters are also returned For the subsequent verification process. The query process starts from each root node in a depth-first manner and searches for each node encountered. and In contrast, if for any of Bit and satisfy , it means that the subtree may contain the searched keyword, so further search its subtree; if the query condition is not met, it proves that the subtree does not contain the searched keyword. Therefore, prune the subtree and change the node and Store in When the node being visited is a leaf node, the leaf node's and Append to If the leaf node meets the query conditions, the target will be added to the query and the results will be returned. When the query is completed, the query results will be returned. and validation parameters .

[0058] For example, in an index tree such as Figure 11 As shown, assuming .When the query starts, the root nodes will be searched separately and the root node is tree. It meets the query conditions, so further search its child nodes, It also meets the query conditions, so its child nodes are further searched. Does not meet the query conditions, so Store to Search again The right child node is found It meets the query conditions and is a leaf node, so Store in Lieutenant General Store to So far. The subtree of is checked and the query begins node. The query conditions are not met, so Store to middle. The tree represented by the query is completed, and the root node is started to query The tree, however Does not meet the query conditions, so directly Store to The query ends.

[0059] 5.5 Query Result Verification Algorithm Through the VO generation process described in the on-chain index query algorithm proposed by this invention, it can be seen that VO contains two kinds of content: (1) the hash and CBF of the pruned non-leaf nodes; (2) the hash and CBF of the leaf nodes accessed during the query process. and When you verify the correctness and completeness of the query results, as well as the integrity of the index on the chain, you can verify the correctness of the query results. The integrity of the query results refers to whether all the returned items contain the query keywords. The completeness of the query results refers to whether all the items on the chain containing the query keywords are returned, that is, whether the query results are missing. Since the immutability of the blockchain has already guaranteed that the on-chain index structure cannot be tampered with, the integrity of the on-chain index is mainly used to verify whether the query node responsible for the query has fabricated the query results, that is, whether the query results are derived from a legitimate on-chain index. The specific verification method is described below.

[0060] (1) Verification of query result correctness: data users verify the correctness of the query result through Verify that all the targets returned by the query contain the keywords entered in the query.

[0061] (2) Verification of query result completeness: Stores the pruned nodes Information so data users can compare it with queries For comparison, if any of Bit and satisfy , it proves that the pruned nodes do not contain the query keywords, that is, the query results are not missed.

[0062] (3) On-chain index integrity: As shown in the figure, data users pass Build the root hash value of the index structure and compare it with the root hash of the query index on the chain. The construction order is based on the query order, so just press The root hash can be obtained by sequentially calculating the hash values ​​of the nodes in .

[0063] The proposed algorithm for constructing and updating on-chain storage indexes that combines both plaintext and ciphertext storage is based on a counting Bloom filter structure. This algorithm constructs indexes without requiring the specific semantics of keywords, thus supporting the storage of both plaintext and ciphertext keywords. The index leverages the deletability of the counting Bloom filter to enable the deletion of data elements, thus meeting the need for dynamic addition and deletion of on-chain shared data in the context of railway official document knowledge graph data sharing.

[0064] A proposed on-chain index query and verification algorithm combining plaintext and ciphertext is proposed. Based on the proposed index, a query and verification algorithm is designed to enable efficient multi-keyword queries on on-chain data that support both plaintext and ciphertext keywords, improving the efficiency and accuracy of data sharing. The present invention also designs a verification algorithm that supports data users in verifying the correctness, integrity, and completeness of query results, ensuring the credibility of data queries and effectively avoiding user losses caused by obtaining incorrect query results.

[0065] The use of an on-chain indexed data structure improves the efficiency of on-chain data queries, thereby enhancing the accuracy and efficiency of railway document knowledge graph retrieval. Furthermore, the index designed by this invention supports the storage and query of both plaintext and ciphertext data, ensuring the security of some private information within railway document data. These technological breakthroughs have successfully improved the overall performance of the blockchain-based railway document knowledge graph retrieval system, providing a more reliable and efficient solution for railway document data sharing and retrieval.

[0066] The following describes the knowledge graph retrieval device for private railway documents provided by the present invention. The knowledge graph retrieval device for private railway documents described below and the knowledge graph retrieval method for private railway documents described above can be referenced to each other.

[0067] like Figure 12 As shown, in one embodiment, a knowledge graph retrieval device for private railway documents includes a classification data receiving module 1210, a tree index building module 1220, a dynamic index update module 1230, a query request processing module 1240 and a verification information providing module 1250.

[0068] The classification data receiving module 1210 is used to receive the classified keyword data, wherein the public keywords are input in plain text form and the non-public keywords are input in cipher text form.

[0069] The tree index construction module 1220 is used to construct a tree index structure based on the received keywords, wherein the leaf nodes store the keyword filtering structure, the knowledge graph subgraph data and the data hash value, and the non-leaf nodes store the aggregated value of the child node filtering structure and the parent node hash value generated based on the child node hash.

[0070] The dynamic update index module 1230 is used to respond to a data deletion request, mark the target data as deleted, and update the filter structure and hash value of the associated node from bottom to top.

[0071] The query request processing module 1240 is used to receive query requests containing public keyword plain text and non-public keyword authorization credentials, traverse the index tree, perform pruning search through filter structure comparison, and return the matching knowledge graph subgraph set and verification information.

[0072] A verification information module 1250 is provided for generating verification information for verifying the query results, including: correctness verification data for proving that the subgraph data contains all query keywords; completeness verification data for proving that there are no missing matching subgraphs; and index integrity verification data for proving that the result comes from the current on-chain index.

[0073] Figure 13 The following is a schematic diagram of the physical structure of an electronic device. The electronic device may be a smart terminal, and its internal structure diagram may be as follows: Figure 13 As shown. The electronic device includes a processor, a memory, and a network interface connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a knowledge graph retrieval method for privacy-oriented railway documents is implemented, which includes: receiving keyword data that has been classified, wherein public keywords are input in plain text and non-public keywords are input in cipher text; Build a tree index structure based on the received keywords, where the leaf nodes store the keyword filtering structure, knowledge graph subgraph data and data hash values, and the non-leaf nodes store the aggregated value of the child node filtering structure and the parent node hash value generated based on the child node hash; In response to a data deletion request, mark the target data as deleted and update the filter structure and hash value of the associated nodes from bottom to top; Receive query requests containing public keyword plaintext and non-public keyword authorization credentials, traverse the index tree, perform pruning search through filter structure comparison, and return the matching knowledge graph subgraph set and verification information; Generate verification information for query results, including: correctness verification data to prove that the subgraph data contains all query keywords; completeness verification data to prove that no subgraphs are missing; and index integrity verification data to prove that the result comes from the current on-chain index.

[0074] Those skilled in the art will understand that Figure 13The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the electronic device to which the solution of the present invention is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0075] On the other hand, the present invention also provides a computer storage medium storing a computer program, which, when executed by a processor, implements a knowledge graph retrieval method for private railway documents, the method comprising: receiving keyword data that has been classified, wherein public keywords are input in plain text and non-public keywords are input in cipher text; Build a tree index structure based on the received keywords, where the leaf nodes store the keyword filtering structure, knowledge graph subgraph data and data hash values, and the non-leaf nodes store the aggregated value of the child node filtering structure and the parent node hash value generated based on the child node hash; In response to a data deletion request, mark the target data as deleted and update the filter structure and hash value of the associated nodes from bottom to top; Receive query requests containing public keyword plaintext and non-public keyword authorization credentials, traverse the index tree, perform pruning search through filter structure comparison, and return the matching knowledge graph subgraph set and verification information; Generate verification information for query results, including: correctness verification data to prove that the subgraph data contains all query keywords; completeness verification data to prove that no subgraphs are missing; and index integrity verification data to prove that the result comes from the current on-chain index.

[0076] In another aspect, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and when the processor executes the computer instructions, implements a knowledge graph retrieval method for private railway documents, the method comprising: receiving keyword data that has been classified, wherein public keywords are input in plain text and non-public keywords are input in cipher text; Build a tree index structure based on the received keywords, where the leaf nodes store the keyword filtering structure, knowledge graph subgraph data and data hash values, and the non-leaf nodes store the aggregated value of the child node filtering structure and the parent node hash value generated based on the child node hash; In response to a data deletion request, mark the target data as deleted and update the filter structure and hash value of the associated nodes from bottom to top; Receive query requests containing public keyword plaintext and non-public keyword authorization credentials, traverse the index tree, perform pruning search through filter structure comparison, and return the matching knowledge graph subgraph set and verification information; Generate verification information for query results, including: correctness verification data to prove that the subgraph data contains all query keywords; completeness verification data to prove that no subgraphs are missing; and index integrity verification data to prove that the result comes from the current on-chain index.

[0077] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory.

[0078] By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0079] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0080] The above-described embodiments merely illustrate several embodiments of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make various modifications and improvements without departing from the spirit of the present invention, and these modifications and improvements fall within the scope of the present invention. Therefore, the scope of the present invention shall be determined by the appended claims.

Claims

1. A knowledge graph retrieval method for private railway documents, characterized by: Executed by a blockchain system, the method includes: receiving keyword data that has been classified, wherein public keywords are input in plain text and non-public keywords are input in cipher text; Build a tree index structure based on the received keywords, where the leaf nodes store the keyword filtering structure, knowledge graph subgraph data and data hash values, and the non-leaf nodes store the aggregated value of the child node filtering structure and the parent node hash value generated based on the child node hash; In response to a data deletion request, mark the target data as deleted and update the filter structure and hash value of the associated nodes from bottom to top; Receive query requests containing public keyword plaintext and non-public keyword authorization credentials, traverse the index tree, perform pruning search through filter structure comparison, and return the matching knowledge graph subgraph set and verification information; Generate verification information for query results, including: correctness verification data to prove that the subgraph data contains all query keywords; completeness verification data to prove that no subgraphs are missing; and index integrity verification data to prove that the result comes from the current on-chain index.

2. The knowledge graph retrieval method for private railway documents according to claim 1 is characterized in that: The constructing of the tree index structure includes: Generate fingerprint values ​​based on data hash for leaf nodes; The filter structure aggregate value of the non-leaf node is recursively calculated, where the aggregate value is the bitwise sum operation result of the filter structures of all child nodes.

3. The knowledge graph retrieval method for private railway documents according to claim 2 is characterized in that: The step of marking the target data as deleted in response to the data deletion request and updating the filter structure and hash value of the associated nodes from bottom to top includes: When data deletion is detected, the target leaf node is located and marked as deleted; The filter structure aggregation value of the path node is recursively updated from the bottom up to remove the deleted keyword contribution, and the node hash is recalculated based on the updated child node hash.

4. The knowledge graph retrieval method for private railway documents according to claim 3 is characterized in that: The removal of deleted keyword contributions includes: Locate the bitmap position corresponding to the keyword in the filter structure; The parent node aggregation value is updated by performing an XOR operation on the parent node aggregation value and the original keyword bitmap of the child node.

5. The knowledge graph retrieval method for private railway documents according to claim 1 is characterized in that: The pruning search by filtering structure comparison includes: For public keywords, directly compare the bitwise inclusion relationship between the keyword and the node aggregation value; For non-public keywords, use pre-generated encrypted tokens to decrypt the filter structure and then match; Dynamically generate pruning path records, including the root node hash and aggregation value of the skipped subtree.

6. The knowledge graph retrieval method for private railway documents according to claim 1 is characterized in that: Generating verification information for verifying the query result includes: Construct an existence proof bitmap to identify the position of each keyword in the matching subgraph in the filter structure.

7. The knowledge graph retrieval method for private railway documents according to claim 6 is characterized in that: The generating of verification information for verifying the query result further includes: Call the on-chain certificate management contract to generate an aggregate signature for the authorization validity of non-public keywords; The proof-of-existence bitmap is combined with the aggregate signature into a verifiable data packet.

8. The knowledge graph retrieval method for private railway documents according to any one of claims 1 to 7, characterized in that: The receiving of the classified keyword data includes: When receiving keyword data in ciphertext form, a threshold encryption mechanism is adopted, the private key is sharded and stored in multiple consensus nodes, and decrypted collaboratively through the consensus protocol, and a single node cannot obtain the complete private key.

9. A knowledge graph retrieval device for private railway documents, characterized by: The device comprises: A classification data receiving module is used to receive the classified keyword data, wherein the public keywords are input in plain text and the non-public keywords are input in cipher text; Build a tree index module, which is used to build a tree index structure based on the received keywords, where the leaf nodes store the keyword filtering structure, knowledge graph subgraph data and data hash values, and the non-leaf nodes store the aggregated value of the child node filtering structure and the parent node hash value generated based on the child node hash; A dynamic update index module is used to respond to a data deletion request, mark the target data as deleted, and update the filter structure and hash value of the associated nodes from bottom to top; The query request processing module is used to receive query requests containing public keyword plaintext and non-public keyword authorization credentials, traverse the index tree, perform pruning search through filter structure comparison, and return the matching knowledge graph subgraph set and verification information; A verification information module is provided to generate verification information for verifying query results, including: correctness verification data to prove that the subgraph data contains all query keywords; completeness verification data to prove that there are no missing matching subgraphs; and index integrity verification data to prove that the result comes from the current on-chain index.

10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, it implements the knowledge graph retrieval method for private railway documents as described in any one of claims 1 to 8.