A spatial data management method capable of realizing efficient updating and querying
By combining Merkle trees and R-trees into a multi-layered grid structure, efficient spatial data management is achieved, solving the index update and query problems of traditional blockchain in autonomous collaboration among smart products, and improving the efficiency and verifiability of data sharing.
Patent Information
- Application Number
- CN202310463095.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-26
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2043-04-26
AI Technical Summary
Traditional blockchains struggle to achieve efficient indexing, updating, and querying in spatial data management, failing to meet the needs of autonomous collaboration among smart products.
Combining Merkle trees and R-trees, a multi-layered grid structure is adopted, utilizing grid partitioning of different granularities. Spatial data is managed through Merkle R-trees, enabling efficient updates and queries.
It improves the efficiency of updating and querying spatial data, and provides a verifiable and efficient solution for data sharing among smart products in autonomous and collaborative scenarios using blockchain.
Smart Images

Figure CN116561222B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of blockchain, in particular to a spatial data management method capable of efficient updating and querying. BACKGROUND
[0002] With the popularity of intelligent devices, more and more products themselves can perform complex intelligent tasks, such as the widespread appearance of intelligent cars. On the other hand, with the breakthrough and large-scale deployment of the fifth generation communication technology, the Internet of Things has become a reality. In such an era, autonomous collaboration between intelligent products has begun to enter the field of view of researchers. In the research scene of autonomous collaboration between these intelligent products, one of the important needs that can be foreseen is the efficient processing and application of spatial data. Taking the autonomous collaboration of intelligent cars as an example, vehicles share their spatial positions and report the locations of various events. When the intelligent car collaboration cluster receives a task, it needs to go to a specific location to pick up passengers, and the cluster needs to quickly schedule the nearest unit to complete the task. In such a situation, the cluster needs to: 1) be able to share data between vehicles in the cluster in a trusted manner; 2) be able to efficiently index spatial data and provide efficient spatial query capabilities; 3) be able to efficiently update location information.
[0003] Blockchain, as a secure, trusted, and tamper-resistant decentralized technology, has received attention from all walks of life in recent years. Blockchain can ensure secure and transparent information exchange between nodes in an untrusted network environment without the need for a trusted third party. At the same time, the block chain structure of the blockchain uses a linked block list, each block containing the hash value of the previous block. The block chain structure of the blockchain ensures that the data on the blockchain is difficult to tamper with. At the same time, the structure of the Merkle tree on the blockchain provides a trusted proof for the data on the blockchain. In some research, researchers have applied blockchain to ensure trusted data sharing between vehicles.
[0004] Traditional blockchain can solve the problem of trusted data sharing, but it cannot well support the efficient indexing of spatial data and the updating of spatial data. Therefore, it is necessary to create an efficient, low-cost verifiable spatial data structure for the blockchain scenario to manage spatial data. SUMMARY
[0005] The present application combines the advantages of Merkle trees and R-trees to provide a verifiable spatial data management method in view of the deficiencies of traditional blockchain verifiable data structures in spatial data management capabilities; the division of different granularity hierarchical grids improves the updating efficiency of spatial data; through spatial range query range task subdivision and integration, the efficient spatial range query efficiency is guaranteed.
[0006] The object of the present application is achieved by the following technical solutions:
[0007] A spatial data management method capable of realizing efficient update and query,
[0008] The spatial data is a multi-layer data structure, each layer of the data structure is a grid formed by dividing the entire spatial range into different granularities; the granularity of the grid at a lower level is smaller than the granularity of the grid at a higher level; in each grid, the data structure maintains a Merkle R-tree for managing spatial data, and all data updates are preferentially performed in the Merkle R-tree maintained by the grid with the smallest granularity;
[0009] The spatial data management includes new spatial data insertion, original spatial data deletion, spatial data update and spatial range query;
[0010] The new spatial data insertion specifically includes determining the lowest level grid to which the new spatial data to be inserted should be inserted, and then inserting the spatial data into the Merkle R-tree maintained by the lowest level grid;
[0011] The original spatial data deletion specifically includes determining the grid in which the original spatial data to be deleted is located, searching for the spatial data to be deleted in the Merkle R-tree maintained by the grid, and setting a deletion flag for the spatial data to be deleted to realize deletion;
[0012] The spatial data update specifically includes performing a deletion operation on the original spatial data, and then performing an insertion operation on the new spatial data;
[0013] The spatial range query specifically includes subdividing the spatial range query task into different layers, performing spatial range query on each layer, integrating the query results of each layer, and composing a verifiable query result of the spatial range query task.
[0014] Further, when the new spatial data is inserted, the lower level grid in which the new spatial data is located is calculated through the relative position relationship of the new spatial data in the upper level grid, and the lower level grid in which the new spatial data is located is calculated according to the relative position of the new spatial data in the lower level grid, until the lowest level grid in which the new spatial data is located is found, and the new spatial data is inserted into the Merkle R-tree.
[0015] Further, when the new spatial data is inserted into the Merkle R-tree, if there is deleted spatial data, it is replaced; after insertion, if the size of the Merkle R-tree exceeds the set upper limit, the Merkle R-tree needs to be merged into the upper level.
[0016] Further, when the size of the Merkel R-tree in the grid exceeds the specified upper limit, it needs to be merged to the upper layer; when merging, the same height subtree of the Merkel R-tree to be merged is found in the Merkel R-tree of the upper layer, the Merkel R-tree to be merged and the found subtree of the Merkel R-tree are unfolded, and the space data marked for deletion is discarded, and then all the space data is reorganized into a Merkel R-tree and inserted into the Merkel R-tree of the upper layer.
[0017] Further, in the grids of two adjacent levels, the size upper limit of the Merkel R-tree in the higher level grid is set as an integer multiple of the size upper limit of the Merkel R-tree in the lower level grid.
[0018] Further, when determining the grid where the original space data to be deleted is located, the next layer grid where the original space data is located can be calculated through the relative position relationship of the original space data in the upper layer grid, and the next layer grid where the original space data is located can be calculated according to the relative position of the space data in the next layer grid, until the grid where the space data exists is found, and the original space data is searched in the Merkel R-tree of the grid and found, and the original space data is deleted by setting the leaf node where the original space data is located as deleted.
[0019] Further, when performing a spatial range query, the range of the spatial query is intersected with each layer of the grid, the Merkel R-tree in each layer of the grid is queried for the spatial range and a verifiable sub-query result is generated, the sub-query result is collected and formed into a complete verifiable query result for the spatial range query.
[0020] The beneficial effects of the present application are as follows:
[0021] The spatial data management method capable of realizing efficient updating and querying of the present application fully combines the comprehensive advantages of Merkel tree and R-tree, provides verifiable query capability through the properties of Merkel tree, and provides an efficient spatial data management method through the properties of R-tree. The present application improves the updating efficiency of spatial data by using the division of different granularity hierarchical grids, and guarantees the efficient spatial range query efficiency through the range task subdivision and integration of spatial range query, which lays a solid foundation for the application of block chain in the future autonomous collaborative scene of autonomous device. BRIEF DESCRIPTION OF DRAWINGS
[0022] Figure 1 The flowchart of the spatial data management method capable of realizing efficient updating and querying of the embodiments of the present application. DETAILED DESCRIPTION
[0023] The present invention will be described in detail below with reference to the accompanying drawings and preferred embodiments. The purpose and effects of the present invention will become clearer. It should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.
[0024] like Figure 1 As shown in the embodiment of the present invention, a spatial data management method capable of efficient updating and querying is provided. The spatial data is a multi-layered data structure, where each layer is a grid formed by dividing the entire spatial range into different fine-grained subdivisions. These grids are connected in a multi-layered structure. The fine-grainedness of lower-level grids is less than that of higher-level grids, and a lower-level grid can be considered a further subdivision of the spatial range represented by the higher-level grids. Within each grid, the data structure maintains a Merkle R-tree for managing the spatial data. All data insertions preferentially occur in the Merkle R-tree maintained by the smallest-grained grid. For any given spatial data, one and only one copy exists in the Merkle R-tree managed by a particular level of grid.
[0025] As the size of the Merkle R-tree managed in the grid gradually increases, the Merkle R-trees in the lower-level grid will be efficiently merged into the Merkle R-trees of the upper-level grid.
[0026] Merkle R-trees combine Merkle trees and R-trees, managing spatial data using R-tree methods and providing verifiable spatial queries using Merkle trees. A Merkle R-tree has intermediate nodes and leaf nodes. The fields of an intermediate node include a first hash value, a first range, and a first array. The first hash value is obtained from all child nodes of the intermediate node; the first range is the range of the smallest bounding rectangle represented by the intermediate node; and the first array contains all child nodes of the intermediate node. The fields of a leaf node include a second hash value, a second range, a first search key, a first pointer, and a first flag. The second hash value is obtained from all child nodes of the leaf node; the second range is the range of the smallest bounding rectangle represented by the leaf node; the first search key is the search key value for the resource represented by the leaf node; the first pointer contains the resource node of the leaf node; and the first flag indicates the state of the leaf node.
[0027] Spatial data management includes inserting new spatial data, deleting existing spatial data, updating spatial data, and querying spatial extent.
[0028] Specifically, the insertion of new spatial data involves determining the lowest-level grid into which the new spatial data should be inserted, and then inserting the spatial data into the Merkle R-tree maintained by that lowest-level grid.
[0029] Exemplarily, when determining the lowest level grid into which the new spatial data should be inserted, starting from the highest level grid, the grid in which the new spatial data should be located in the highest level grid can be calculated according to the division rule of the highest level grid, the lower level grid in which the new spatial data is located can be calculated by further calculating the relative position relationship of the new spatial data in the upper level grid, the lower level grid in which the new spatial data is located can be calculated according to the relative position of the new spatial data in the lower level grid, and the lowest level grid in which the new spatial data is located can be calculated until the lowest level grid in which the new spatial data is located is found, and the new spatial data is inserted into the calculated grid in the Merkle R-tree. When inserting, if there is deleted spatial data in the target leaf node, it is replaced, and if not, it is directly inserted. After insertion, if the size of the Merkle R-tree exceeds the set upper limit, the Merkle R-tree needs to be merged into the upper layer.
[0030] When the size of the Merkle R-tree in the grid exceeds the specified upper limit, it needs to be merged into the upper layer; before merging, the grid in which the Merkle R-tree is located in the entire space region is calculated to calculate the grid in which the Merkle R-tree needs to be merged in the upper level; when merging, the current Merkle R-tree is regarded as a spatial data with a certain height, and is inserted into the Merkle R-tree in the grid of the upper level; in the insertion process, the subtree with the same height as the Merkle R-tree to be merged is found, and the overlapping area of the two Merkle R-trees representing the minimum bounding rectangle is maximum, the Merkle R-tree to be merged and the found subtree of the Merkle R-tree are unfolded, all spatial data of the two Merkle R-trees are collected, and the spatial data marked as deleted is discarded, then all the collected spatial data is sorted, and all the spatial data is reorganized into a Merkle R-tree according to the organization mode of the nodes of the Merkle R-tree, and is inserted into the Merkle R-tree of the upper layer according to the height of the reorganized Merkle R-tree.
[0031] Therefore, in the grids of two adjacent levels, the size upper limit of the Merkle R-tree in the higher level grid is set as an integer multiple of the size upper limit of the Merkle R-tree in the lower level grid.
[0032] The original spatial data deletion specifically includes: determining the grid in which the original spatial data to be deleted is located, searching for the spatial data to be deleted in the Merkle R-tree maintained in the grid, and setting a deletion flag to achieve deletion.
[0033] Exemplarily, the way of determining the grid where the original spatial data to be deleted is located is the same as the way of determining the lowest level grid where the new spatial data to be inserted should be inserted, that is, starting from the highest level grid, the grid where the new spatial data should be located in all the grids of this level can be calculated according to the division rule of the grid of this level, and by further calculating the relative position relationship of the original spatial data in the upper grid, the next lower grid where the original spatial data is located can be calculated, and the next lower grid where the original spatial data is located can be calculated according to the relative position of the original spatial data in the next lower grid, until the grid where the spatial data exists is found, the leaf node where the original spatial data is located is searched in the Merkle R-tree in the grid, and the original spatial data in the leaf node is set to be deleted to delete.
[0034] The spatial data updating specifically includes: first determining the grid where the original spatial data is located, then searching the spatial data to be deleted in the Merkle R-tree maintained in the grid, and setting a deletion flag to delete the spatial data; then, for the new spatial data to be inserted, determining the lowest level grid where the new spatial data should be inserted, and then inserting the spatial data into the Merkle R-tree maintained in the lowest level grid. That is, the updating operation is to first perform a deletion operation on the original spatial data, and then perform an insertion operation on the new spatial data.
[0035] When the size of the Merkle R-tree in the grid reaches the set upper limit, the Merkle R-tree whose size exceeds the upper limit is merged into the grid of the upper level, and if the Merkle R-tree of the upper level grid also reaches the upper limit of the size after merging, it will continue to be merged into the grid of the upper level.
[0036] The spatial range query specifically includes: subdividing the spatial range query task into different levels, performing spatial range query on each level, and integrating the query results of each level to form the verifiable query result of the spatial range query task.
[0037] When performing the spatial range query, the range of the spatial query is intersected with the grid of each level, the Merkle R-tree in all the intersected grids of each level is subjected to the spatial range query and generates a verifiable sub-query result; the sub-query results are collected and formed into the complete verifiable query result for the spatial range query.
[0038] Those skilled in the art can understand that the above description is only a preferred example of the application and is not used to limit the application, although the application has been described in detail with reference to the foregoing examples, those skilled in the art can still modify the technical solutions recorded in the foregoing examples or make equivalent replacement for part of the technical features. Any modification, equivalent replacement, etc. made within the spirit and principles of the application shall be included in the protection scope of the application.
Claims
1. A spatial data management method capable of efficient update and query, characterized in that, the spatial data is a multi-layer data structure, each layer of the data structure is a grid formed by dividing the entire spatial range into different granularities; the granularity of the grid at a lower level is smaller than that of the grid at a higher level; in each grid, the data structure maintains a Merkle R-tree for managing spatial data, and all data updates are preferentially performed in the Merkle R-tree maintained by the grid at the smallest granularity; the spatial data management includes new spatial data insertion, original spatial data deletion, spatial data update, and spatial range query; the new spatial data insertion specifically includes determining the lowest level grid to which the new spatial data to be inserted should be inserted, and then inserting the spatial data into the Merkle R-tree maintained by the lowest level grid; the original spatial data deletion specifically includes determining the grid in which the original spatial data to be deleted is located, searching for the spatial data to be deleted in the Merkle R-tree maintained by the grid, and setting a deletion flag for the spatial data to achieve deletion; the spatial data update specifically includes performing a deletion operation on the original spatial data, and then performing an insertion operation on the new spatial data; the spatial range query specifically includes subdividing the spatial range query task into different layers, performing spatial range query on each layer, integrating the query results of each layer, and composing a verifiable query result of the spatial range query task; the Merkle R-tree combines a Merkle tree with an R-tree, manages spatial data in the manner of the R-tree, and provides verifiable spatial query in the manner of the Merkle tree; the Merkle R-tree has intermediate nodes and leaf nodes, the fields of the intermediate nodes include a first hash value, first range data, and a first array; the first hash value is obtained by all child nodes of the intermediate node; the first range is the range of the minimum bounding rectangle represented by the intermediate node; the first array includes all child nodes of the intermediate node; the fields of the leaf nodes include a second hash value, second range data, a first search key, a first pointer, and a first flag; the second hash value is obtained by all child nodes of the leaf node, the second range is the range of the minimum bounding rectangle represented by the leaf node, the first search key is the search key value of the resource represented by the leaf node, the first pointer includes the resource node of the leaf node, and the first flag indicates the state of the leaf node.
2. The spatial data management method capable of efficient update and query according to claim 1, wherein, When inserting new spatial data, the lower level grid in which the new spatial data is located is calculated based on the relative position relationship of the new spatial data in the upper level grid, and the lower level grid in which the new spatial data is located is calculated based on the relative position of the new spatial data in the lower level grid, until the lowest level grid in which the new spatial data is located is found, and the new spatial data is inserted into the Merkle R-tree.
3. The spatial data management method capable of efficient update and query according to claim 2, characterized in that, When inserting the new spatial data into the Merkle R-tree, if there is deleted spatial data, it is replaced; after insertion, if the size of the Merkle R-tree exceeds the set upper limit, the Merkle R-tree needs to be merged into the upper layer.
4. The spatial data management method capable of efficient update and query according to claim 3, characterized in that, When the size of the Merkel R-tree in the grid exceeds the specified upper limit, it needs to be merged to the upper layer; when merging, the same height sub-tree of the Merkel R-tree to be merged is found in the Merkel R-tree of the upper layer, the Merkel R-tree to be merged and the found Merkel R-tree sub-tree are unfolded, the space data marked for deletion is discarded, and then all the space data is reorganized into a Merkel R-tree and inserted into the Merkel R-tree of the upper layer.
5. The spatial data management method capable of efficient update and query according to claim 1, characterized in that, In the adjacent two levels of grids, the size upper limit of the Merkel R-tree in the higher level grid is set to be an integer multiple of the size upper limit of the Merkel R-tree in the adjacent lower level grid.
6. The spatial data management method capable of efficient update and query according to claim 1, wherein, When determining the grid where the original space data to be deleted is located, the next layer grid where the original space data is located can be calculated through the relative position relationship of the original space data in the upper layer grid, and the next layer grid where the original space data is located can be calculated according to the relative position of the space data in the next layer grid, until the grid where the space data exists is found, the original space data is searched in the Merkel R-tree of the grid, and the original space data is deleted by setting the leaf node where the original space data is located to be deleted.
7. The spatial data management method capable of efficient update and query according to claim 1, characterized in that, When performing a spatial range query, the range of the spatial query is intersected with each layer of the grid, the Merkel R-tree in each layer of the grid is queried for the spatial range, and a verifiable sub-query result is generated; The sub-query result is collected and formed into a complete verifiable query result for the spatial range query.
Citation Information
Patent Citations
Verifiable encrypted image retrieval privacy protection method
CN112883403A
Massive ship position point cloud multi-stage aggregation and real-time updating method
CN115438081A