Spatial query verification method, device, equipment and storage medium
The dual verification method using sorting and hash value techniques addresses the issue of inaccurate spatial query results by ensuring accuracy on the client side, optimizing resource usage and enhancing result precision without modifying server hardware.
Patent Information
- Application Number
- CN202111075985.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-14
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-09-14
AI Technical Summary
Existing spatial query methods fail to provide accurate query results, which are prone to inaccuracies or incorrect results, especially in the context of spatial query verification, and the server may intentionally or unintentionally return inaccurate or incorrect query results to the user, leading to inefficient use of computing resources and communication bandwidth.
A dual verification method involving sorting and hash value verification is employed to ensure accuracy, where spatial query results are first arranged based on distance and then verified using a VO verification set and Merkle-Hash tree, ensuring correctness through multiple layers of verification.
This approach ensures accurate spatial query results by performing dual verification on the client side without altering the server's hardware environment, thereby optimizing resource usage and improving result precision.
Smart Images

Figure CN113918836B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of spatial query technology, and is a spatial query verification method, device, equipment and storage medium. Background Art
[0002] With the widespread popularity of smart devices and the Internet, people have an increasingly strong demand for location information. People are getting used to using mobile phones and other electronic devices to search for some location information they want, especially the location of some specific venues within the user's surrounding area. This type of query demand is growing significantly, and mobile users are increasingly using location queries. Spatial location query mainly searches for a given coordinate location. It usually takes the given location as a parameter, searches for queries in the spatial location dataset, and returns spatial objects that are closer to the given location. These spatial objects can be any points of interest in the location dataset, such as restaurants, tourist attractions, hotels, and entertainment service venues. When hackers intrude or process a lot of information, the server may intentionally or unintentionally return inaccurate or incorrect query results to the user. In order to save computing resources and communication bandwidth, it may return a general and approximate query result, which will cause the user to be unable to obtain accurate results. Summary of the invention
[0003] The present invention provides a spatial query verification method, device, equipment and storage medium, which overcomes the deficiencies of the above-mentioned prior art and can effectively solve the problem that the existing spatial query method cannot perform spatial query verification, resulting in the user being unable to obtain accurate query results.
[0004] One of the technical solutions of the present invention is achieved by the following measures: a spatial query verification method, comprising:
[0005] According to the spatial query point, the query obtains multiple spatial query results and their first arrangement sequences, and establishes the corresponding VO verification set and the hash value of the root node;
[0006] Determine the distance between each spatial query result and the spatial query point, and obtain a second arrangement sequence of the plurality of spatial query results according to the distance;
[0007] Compare the first arrangement sequence with the second arrangement sequence to verify the correctness of the query result;
[0008] According to the VO verification set and the second permutation sequence, the hash value of the root node is determined and compared with the received hash value to verify the correctness of the query result again.
[0009] The following are further optimizations and / or improvements to the above technical solutions:
[0010] The second arrangement sequence of obtaining multiple spatial query results includes:
[0011] Receive the VO verification set and the hash value of the root node;
[0012] Extract each spatial query result in the VO validation set, and use the Euclidean distance to calculate the distance from each spatial query result to the spatial query point;
[0013] The multiple spatial query results are reordered according to the distances to obtain a second arrangement sequence of the multiple spatial query results.
[0014] The above again verifies the correctness of the query results, including:
[0015] According to the VO verification set and the second permutation sequence, a Merkle-Hash tree is established;
[0016] Determine the hash value of the root node in the Merkle-Hash tree;
[0017] Compare the hash value with the received hash value to verify the correctness of the query result again.
[0018] The above query obtains multiple spatial query results and their first arrangement sequences according to the spatial query point, and establishes the corresponding VO verification set and the hash value of the root node, including:
[0019] Receive the top-k query points of spatial location sent by the client;
[0020] The query obtains k spatial query results and their first arrangement sequence;
[0021] Based on the query results, reconstruct the Merkle-Hash tree according to the VO verification set;
[0022] Determine the hash value of the root node in the Merkle-Hash tree.
[0023] The second technical solution of the present invention is achieved by the following measures: a spatial query verification device, comprising:
[0024] The server obtains multiple spatial query results and their first arrangement sequences according to the spatial query point, and establishes the corresponding VO verification set and the hash value of the root node;
[0025] The user end includes a sorting unit, a first verification unit, and a second verification unit;
[0026] A sorting unit, determining the distance between each spatial query result and the spatial query point, and obtaining a second arrangement sequence of the plurality of spatial query results according to the distance;
[0027] A first verification unit compares the first arrangement sequence with the second arrangement sequence to verify the correctness of the query result;
[0028] The second verification unit determines the hash value of the root node according to the VO verification set and the second arrangement sequence, and compares it with the received hash value to verify the correctness of the query result again.
[0029] The present invention performs dual verification of spatial query results through sorting verification and hash value verification, thereby achieving efficient verification of spatial query results, allowing users to obtain accurate spatial query results. At the same time, dual verification of spatial query results can be performed on the client side without changing the hardware environment of the server side, which is convenient for wide promotion. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Attached Figure 1 This is a flow chart of the method of Example 1 of the present invention.
[0031] Attached Figure 2 This is a flow chart of the spatial query method in Embodiment 2 of the present invention.
[0032] Attached Figure 3 Flow chart of the method for obtaining the second arrangement sequence in Example 2 of the present invention.
[0033] Attached Figure 4 This is a flow chart of a method for re-verifying the correctness of a query result in Embodiment 2 of the present invention.
[0034] Attached Figure 5 This is a block diagram of the device structure of embodiment 3 of the present invention. DETAILED DESCRIPTION
[0035] The present invention is not limited by the following embodiments, and specific implementation methods can be determined based on the technical solution of the present invention and actual conditions.
[0036] The present invention will be further described below in conjunction with embodiments and drawings:
[0037] Embodiment 1: As attached Figure 1 As shown, an embodiment of the present invention discloses a spatial query verification method, including:
[0038] Step S101, according to the spatial query point, query to obtain multiple spatial query results and their first arrangement sequence, and establish the corresponding VO verification set and the hash value of the root node; this process is completed by the server.
[0039] Here, the spatial query point may be a top-k query point of a spatial position. When querying, k spatial query results are obtained through a top-k nearest neighbor query, and a first arrangement sequence is generated.
[0040] Here, the VO verification set is used to load the data object; the hash value is to map a longer piece of data into a shorter piece of data. This piece of small data is the hash value of the big data, which is generally used for verification. For example, when downloading file A from the Internet, the original hash value of file A is compared with the hash value of the downloaded file during verification. If they are the same, it means that the two files are exactly the same and the file is not damaged during the download process. If they are inconsistent, it means that the downloaded file is different from the original file and the file is damaged during the download process.
[0041] Step S102, determining the distance between each spatial query result and the spatial query point, and obtaining a second arrangement sequence of the plurality of spatial query results according to the distances;
[0042] Step S103, comparing the first arrangement sequence with the second arrangement sequence to verify the correctness of the query result;
[0043] Step S104, determine the hash value of the root node according to the VO verification set and the second arrangement sequence, and compare it with the received hash value to verify the correctness of the query result again. After the second verification, the results of the two verifications can be combined to analyze and adjust the spatial query result.
[0044] The above steps S102 to S104 may be completed on the client side.
[0045] The present invention discloses a spatial query verification method, which performs dual verification on spatial query results through sorting verification and hash value verification, thereby realizing efficient verification of spatial query results. At the same time, dual verification of spatial query results can be performed on the client side without changing the hardware environment of the server side, thereby facilitating wide promotion.
[0046] Embodiment 2: The embodiment of the present invention discloses a spatial query verification method, comprising:
[0047] Step S201, according to the spatial query point, query to obtain multiple spatial query results and their first arrangement sequence, and establish the corresponding VO verification set and the hash value of the root node, as shown in the attached Figure 2 As shown, including:
[0048] Step S2011, receiving the spatial location top-k query points sent by the client;
[0049] Step S2012, query and obtain k spatial query results and their first arrangement sequence;
[0050] Step S2013, constructing a VO verification set and a Merkle-Hash tree according to the query results;
[0051] Step S2014, determine the hash value of the root node in the Merkle-Hash tree.
[0052] Here, the spatial query point can be the top-k query point of the spatial position, and k spatial query results are obtained through top-k nearest neighbor query during query.
[0053] Here, the VO verification set is used to load the data object; the Merkle-Hash tree is a hash tree, each leaf node of which is labeled with the hash of the data block, and the nodes other than the leaf nodes are labeled with the encrypted hash of their child node labels. The top of the hash tree is the top hash, also known as the root hash or main hash. As long as any leaf node changes, the root hash will change; the hash value is to map a longer piece of data to a shorter piece of data. This small piece of data is the hash value of the big data, which is generally used for verification. For example, when downloading file A from the Internet, the original hash value of file A is compared with the hash value of the downloaded file during verification. If they are the same, it means that the two files are exactly the same and the download process did not damage the file. If they are inconsistent, it means that the downloaded file is different from the original file and the file was damaged during the download process.
[0054] Step S202: determine the distance between each spatial query result and the spatial query point, and obtain a second arrangement sequence of multiple spatial query results according to the distance, as shown in the attached figure. Figure 3 As shown, including:
[0055] Step S2021, receiving the VO verification set and the hash value of the root node;
[0056] Step S2022, extract each spatial query result in the VO verification set, and use the Euclidean distance to calculate the distance from each spatial query result to the spatial query point; here, the Euclidean distance is the absolute distance between two points in the multidimensional space, which can be understood as: the real distance between two points in the m-dimensional space, or the natural length of the vector (that is, the distance from the point to the origin), and the Euclidean distance in the two-dimensional and three-dimensional space is the actual distance between the two points;
[0057] Step S2023: re-arrange the multiple spatial query results according to the distances to obtain a second arrangement sequence of the multiple spatial query results.
[0058] Step S203, comparing the first arrangement sequence with the second arrangement sequence to verify the correctness of the query result;
[0059] Step S204: Determine the hash value of the root node based on the VO verification set and the second permutation sequence, and compare it with the received hash value to verify the correctness of the query result again. Figure 4 As shown, including:
[0060] Step S2041, receiving the spatial location top-k query points sent by the client;
[0061] Step S2042, query and obtain k spatial query results and their first arrangement sequence;
[0062] Step S2043, based on the query result, reconstruct the Merkle-Hash tree based on the VO verification set;
[0063] Step S2044, determining the hash value of the root node in the Merkle-Hash tree;
[0064] Step S2045, compare it with the received hash value to verify the correctness of the query result again.
[0065] Embodiment 3: As attached Figure 5 As shown, an embodiment of the present invention discloses a spatial query verification device, including:
[0066] The server obtains multiple spatial query results and their first arrangement sequences according to the spatial query point, and establishes the corresponding VO verification set and the hash value of the root node;
[0067] The user end includes a sorting unit, a first verification unit, and a second verification unit;
[0068] A sorting unit, determining the distance between each spatial query result and the spatial query point, and obtaining a second arrangement sequence of the plurality of spatial query results according to the distance;
[0069] A first verification unit compares the first arrangement sequence with the second arrangement sequence to verify the correctness of the query result;
[0070] The second verification unit determines the hash value of the root node according to the VO verification set and the second arrangement sequence, and compares it with the received hash value to verify the correctness of the query result again.
[0071] Embodiment 4, the storage medium stores a computer program that can be read by a computer, and the computer program is configured to execute the spatial query verification method when running.
[0072] The above storage medium may include, but is not limited to: a USB flash drive, a read-only memory, a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0073] Embodiment 5, the electronic device includes a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the spatial query verification method.
[0074] The electronic device mentioned above further includes a transmission device and an input / output device, wherein the transmission device and the input / output device are both connected to the processor.
[0075] The above technical features constitute the best embodiment of the present invention, which has strong adaptability and best implementation effect. Non-essential technical features can be added or reduced according to actual needs to meet the requirements of different situations.
Claims
1. A spatial query verification method, characterized in that: include: Receive the top-k query points of spatial location sent by the client; The query obtains k spatial query results and their first arrangement sequence, wherein the k spatial query results are k spatial query results obtained by top-k nearest neighbor query based on the top-k query points of the spatial position; According to the spatial query results, a VO verification set and a Merkle-Hash tree are constructed, where the VO verification set is used to load each spatial query result; Determine the hash value of the root node in the Merkle-Hash tree; Receive the VO verification set and the hash value of the root node; Extract each spatial query result in the VO validation set, and use the Euclidean distance to calculate the distance from each spatial query result to the spatial query point; Re-arrange the multiple spatial query results according to the distances to obtain a second arrangement sequence of the multiple spatial query results; Compare the first arrangement sequence with the second arrangement sequence to verify the correctness of the query result; According to the VO verification set and the second permutation sequence, a Merkle-Hash tree is established; Determine the hash value of the root node in the Merkle-Hash tree; Compare the hash value with the received hash value to verify the correctness of the query result again.
2. A spatial query verification device using the method as claimed in claim 1, characterized in that: include: The server side includes: Receive the top-k query points of spatial location sent by the client; The query obtains k spatial query results and their first arrangement sequence, wherein the k spatial query results are k spatial query results obtained by top-k nearest neighbor query based on the top-k query points of the spatial position; According to the spatial query results, a VO verification set and a Merkle-Hash tree are constructed, where the VO verification set is used to load each spatial query result; Determine the hash value of the root node in the Merkle-Hash tree; The user end includes a sorting unit, a first verification unit, and a second verification unit; Sorting unit, including: Receive the VO verification set and the hash value of the root node; Extract each spatial query result in the VO validation set, and use the Euclidean distance to calculate the distance from each spatial query result to the spatial query point; Re-arrange the multiple spatial query results according to the distances to obtain a second arrangement sequence of the multiple spatial query results; A first verification unit compares the first arrangement sequence with the second arrangement sequence to verify the correctness of the query result; The second verification unit includes: According to the VO verification set and the second permutation sequence, a Merkle-Hash tree is established; Determine the hash value of the root node in the Merkle-Hash tree; Compare the hash value with the received hash value to verify the correctness of the query result again.
3. A storage medium, characterized in that: The storage medium stores a computer program that can be read by a computer, and the computer program is configured to execute the spatial query verification method as claimed in claim 1 when running.
4. An electronic device, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the spatial query verification method as claimed in claim 1.
Citation Information
Patent Citations
Method and apparatus for implementing dual-identity authentication
CN101321068A
Verification method and system for space text Top-k query in outsourced database
CN104536984A
Method for realizing and using MRS tree data structure under multi-user space query
CN107193980A
Locating method and system of improved databases
CN108304460A
Method and device for outsourced data query verification, electronic equipment and readable storage medium
CN108733710A
