A method and apparatus for querying spatial text
By using polynomial fitting and encryption matrix techniques, the problem that the query range cannot be arbitrarily shaped in existing technologies has been solved, thereby improving the accuracy and security of query results within the range required by users.
Patent Information
- Application Number
- CN202111210427.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-18
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2041-10-18
AI Technical Summary
Existing technologies cannot query ranges of arbitrary shapes, resulting in search results including objects that users do not need, reducing the accuracy and precision of the search, and posing security risks.
By obtaining the query range and keyword set from the query request, multinomial fitting is performed to generate query keyword vectors and query range vectors. An encrypted lower triangular matrix is constructed, and the encrypted matrix is used to determine the query results, ensuring that the query results are within the range actually needed by the user, and guaranteeing query security through the encryption matrix.
It enables querying ranges of arbitrary shapes, improving the accuracy and precision of queries while enhancing query security.
Smart Images

Figure CN113987144B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of Fintech, and in particular to a method and device for querying spatial text. BACKGROUND
[0002] With the development of computer technology, more and more technologies (for example: blockchain, cloud computing or big data) are applied in the financial field, and the traditional financial industry is gradually changing to Fintech, and big data technology is no exception. However, due to the security and real-time requirements of the financial and payment industries, higher requirements are also put forward for the spatial keyword query in big data technology.
[0003] In the prior art, when a user queries an object within a certain range, the selected query range is generally a preset range and shape. Specifically, a spatial geographic coordinate is generated into a Gray code using a preset encoding algorithm. Figure One A Gray code of a spatial geographic coordinate is shown in the present application as an example, as shown in Figure 1 Each cell (such as "0011") represents a region, Figure 1 As shown in the Gray code, each object (such as object P located in the "0011" region) in the spatial text data set is recorded.
[0004] Based on the above Gray code, when the user determines the query range, the query range is determined in units of cells, such as the region represented by "0011, 0010, 0111, 0110". Then, according to the text keyword of the query request, the query result is determined in the "0011, 0010, 0111, 0110" query range.
[0005] However, the prior art cannot realize the query of a query range of any shape, cannot meet the actual needs of the user for the query range, and leads to the query result including objects that the user does not need, thereby reducing the accuracy of the query. SUMMARY
[0006] The present application provides a method and device for querying spatial text, which can realize the query of a query range of any shape, meet the actual needs of the user for the query range, improve the accuracy of the query, and improve the accuracy of the determined query result.
[0007] In a first aspect, the present application provides a method for querying spatial text, comprising:
[0008] obtaining a query request; the query request includes a query range and a query keyword set; the query range is a closed region formed by a query curve;
[0009] encoding the query keyword set to obtain a query keyword vector;
[0010] For any query curve, the query curve is polynomial fitted, and the coefficients of the powers of the fitted polynomial are determined as a query range vector; based on the query range vector and the query keyword vector, a first lower triangular matrix is obtained; the first lower triangular matrix is encrypted by a first encryption matrix to obtain a query sub-trapdoor;
[0011] Based on each query sub-trapdoor and the index of each object in the spatial text data set, the object satisfying the preset condition is determined as the query result; wherein the index of any object is obtained by encrypting the second lower triangular matrix obtained according to the spatial position and the keyword set of the object by a second encryption matrix.
[0012] In the above technical solution, the query range is a closed area formed by the query curve, that is, the query range in the application can be of any shape; the multi-dimensional keyword query is realized by determining the query keyword vector, which improves the accuracy of keyword query; then the fitting curve corresponding to the query curve is determined to determine the object satisfying the preset condition, which is equivalent to determining the object corresponding to the query keyword set and within the query range, so as to meet the actual needs of the user query range, that is, the query result is within the actual needs of the user query range, so as to improve the accuracy of the query; and the information of the query request and the object is encrypted by the encryption matrix, so as to ensure the security of the query.
[0013] Optionally, the query keyword set is encoded to obtain a query keyword vector, comprising:
[0014] Based on the number m of keywords in the keyword dictionary, a first vector is established; the keyword dictionary is obtained by taking the union of the keyword sets of each object in the spatial text data set;
[0015] If it is determined that the jth keyword record in the keyword dictionary is in the query keyword set, the jth dimensional element of the first vector is assigned a value of 1;
[0016] If it is determined that the jth keyword in the keyword dictionary is not recorded in the query keyword set, the jth dimensional element of the first vector is assigned a value of 0;
[0017] The first vector with the assigned dimensional elements is determined as the query keyword vector.
[0018] In the above technical solution, the query keyword is represented in the form of a vector to realize multi-dimensional keyword query, improve query efficiency and query accuracy.
[0019] Optionally, based on the query range vector and the query keyword vector, a first lower triangular matrix is obtained, comprising:
[0020] determining a first random lower triangular matrix based on the highest order n of the polynomial and the number m of keywords in the keyword dictionary;
[0021] assigning diagonal lines of the first random lower triangular matrix according to each dimension element in the query range vector and the query keyword vector to obtain a first lower triangular matrix;
[0022] The second lower triangular matrix is obtained by the following method, comprising:
[0023] determining a second random lower triangular matrix based on the highest order n of the polynomial and the number m of keywords in the keyword dictionary;
[0024] For any object, determining an index space vector by n+1 order n+1 latitude values of the object after n+1 times of processing and the longitude value of the object; encoding the keyword set of the object to obtain an index keyword vector;
[0025] assigning diagonal lines of the second random lower triangular matrix according to each dimension element in the index space vector and the index keyword vector to obtain a second lower triangular matrix.
[0026] In the above technical solution, the query range and the query keyword set of the query request are represented by the first lower triangular matrix, and the spatial position and the keyword set of the object are represented by the second lower triangular matrix, so that the object corresponding to the query keyword set and within the query range is determined according to the first lower triangular matrix and the second lower triangular matrix, and the query result is determined within the actual query range of the user, thereby improving the accuracy of the query.
[0027] Optionally, assigning diagonal lines of the first random lower triangular matrix according to each dimension element in the query range vector and the query keyword vector comprises:
[0028] assigning a coefficient of an rth order term in the query range vector to an element in an r+1th row and an r+1th column of the first random lower triangular matrix; 0≤r≤n;
[0029] assigning -1 to an element in an n+2th row and an n+2th column of the first random lower triangular matrix;
[0030] assigning a jth dimension element in the query keyword vector to an element in an n+2+jth row and an n+2+jth column of the first random lower triangular matrix;
[0031] assigning the number of keywords in the query keyword set to an element in the last row and the last column of the first random lower triangular matrix.
[0032] In the technical solution, the query range and the query keyword set of the query request are expressed by a matrix, so that the calculation amount is reduced and the query efficiency is improved when determining the query result.
[0033] Optionally, the diagonal line of the second random lower triangular matrix is assigned values according to each dimension element in the index space vector and the index keyword vector, including:
[0034] The latitude value of the object after r times of processing is assigned to the element in the r+1th row and the r+1th column of the second random lower triangular matrix; 0≤r≤n;
[0035] The longitude value of the object is assigned to the element in the n+2th row and the n+2th column of the second random lower triangular matrix;
[0036] The jth dimension element in the index keyword vector is assigned to the element in the n+3+jth row and the n+3+jth column of the second random lower triangular matrix;
[0037] -1 is assigned to the element in the last row and the last column of the second random lower triangular matrix.
[0038] By expressing the spatial position and the keyword set of the object by a matrix, repeated calculation of each object is not needed when determining the query result, the calculation amount is reduced, and the query efficiency is improved.
[0039] Optionally, the first lower triangular matrix is encrypted by a first encryption matrix to obtain a query sub-trapdoor, including:
[0040] The first lower triangular matrix is encrypted by an inverse matrix of at least one random reversible square matrix, a third lower triangular matrix with diagonal values being set values, and a fourth lower triangular matrix with diagonal values being 1 to obtain a query sub-trapdoor; wherein the set values are preset positive real numbers from the 1st row and the 1st column to the n+2th row and the n+2th column, and 1 from the n+3th row and the n+3th column to the n+m+3th row and the n+m+3th column;
[0041] The index of any object is obtained by encrypting the second lower triangular matrix obtained according to the spatial position and the keyword set of the object by a second encryption matrix, including:
[0042] The second lower triangular matrix obtained according to the spatial position and the keyword set of the object;
[0043] The index of the object is obtained by encrypting the second lower triangular square matrix according to the at least one random reversible square matrix, the third random lower triangular matrix, and the fourth random lower triangular matrix.
[0044] In the technical solution, the information of the query request and the object is encrypted by the random matrix, so that the query security is ensured.
[0045] Optionally, the query curve includes a first query curve and a second query curve; the query sub-trap includes a first query sub-trap and a second query sub-trap; based on the index of each object in the spatial text data set and the query sub-trap, the object meeting the preset condition is determined as a query result, including:
[0046] For any object, a first result matrix is determined based on the index of the object and the first query sub-trap; a second result matrix is determined based on the index of the object and the second query sub-trap.
[0047] The trace of the first result matrix and the trace of the second result matrix are determined, and whether the object meets the preset condition is determined according to the trace of the first result matrix and the trace of the second result matrix.
[0048] Optionally, the preset condition includes:
[0049] The absolute value of the trace of the first result matrix and the absolute value of the trace of the second result matrix are less than a first threshold value; and the trace of the first result matrix is greater than a second threshold value; the trace of the second result matrix is less than the second threshold value.
[0050] The first threshold value is used to determine the object meeting the query keyword set.
[0051] The second threshold value is used to determine the object meeting the query range.
[0052] In the technical solution, the first threshold value is used to ensure that the object corresponding to the query keyword set, that is, the keyword set contained in the object includes the query keyword set or is consistent with the query keyword set; the first threshold value is used to ensure that the object is within the query range, so as to determine the query result based on the threshold value, improve the accuracy of the query, and improve the accuracy of determining the query result.
[0053] In a second aspect, an embodiment of the present application provides a spatial text query device, including:
[0054] An acquisition module is configured to acquire a query request; the query request includes a query range and a query keyword set; the query range is a closed area formed by a query curve.
[0055] A processing module is configured to encode the query keyword set to obtain a query keyword vector.
[0056] For any query curve, the query curve is polynomial fitted, and coefficients of each power term of the fitted polynomial are determined as a query range vector; based on the query range vector and the query keyword vector, a first lower triangular matrix is obtained; the first lower triangular matrix is encrypted by a first encryption matrix to obtain a query sub-trapdoor;
[0057] Based on each query sub-trapdoor and the index of each object in the spatial text data set, the object satisfying the preset condition is determined as a query result; wherein the index of any object is obtained by encrypting a second lower triangular matrix obtained according to the spatial position and the keyword set of the object by a second encryption matrix.
[0058] Optionally, the processing module is specifically configured to:
[0059] Based on the number m of keywords in the keyword dictionary, a first vector is established; the keyword dictionary is obtained by taking the union set of the keyword set of each object in the spatial text data set;
[0060] If it is determined that the jth keyword record in the keyword dictionary is recorded in the query keyword set, the jth dimensional element of the first vector is assigned a value of 1;
[0061] If it is determined that the jth keyword in the keyword dictionary is not recorded in the query keyword set, the jth dimensional element of the first vector is assigned a value of 0;
[0062] The first vector with the assigned dimensional elements is determined as the query keyword vector.
[0063] Optionally, the processing module is specifically configured to:
[0064] Based on the number n of the highest power term in the polynomial and the number m of keywords in the keyword dictionary, a first random lower triangular matrix is determined;
[0065] According to each dimensional element in the query range vector and the query keyword vector, the diagonal line of the first random lower triangular matrix is assigned a value, and a first lower triangular matrix is obtained;
[0066] Based on the number n of the highest power term in the polynomial and the number m of keywords in the keyword dictionary, a second random lower triangular matrix is determined;
[0067] For any object, the latitude value of the object is processed for n+1 times to obtain n+1 latitude values, and the longitude value of the object is determined as an index space vector; the keyword set of the object is encoded to obtain an index keyword vector;
[0068] According to each dimensional element in the index space vector and the index keyword vector, the diagonal line of the second random lower triangular matrix is assigned a value, and a second lower triangular matrix is obtained.
[0069] Optionally, the processing module is specifically configured to:
[0070] assign a coefficient of an rth power term in the query range vector to an element in an (r+1)th row and an (r+1)th column of the first random lower triangular matrix; 0≤r≤n;
[0071] assign -1 to an element in an (n+2)th row and an (n+2)th column of the first random lower triangular matrix;
[0072] assign an element in a jth dimension of the query keyword vector to an element in an (n+2+j)th row and an (n+2+j)th column of the first random lower triangular matrix;
[0073] assign a number of keywords in the query keyword set to an element in a last row and a last column of the first random lower triangular matrix.
[0074] Optionally, the processing module is specifically configured to:
[0075] assign a latitude value of the object after r times of processing to an element in an (r+1)th row and an (r+1)th column of the second random lower triangular matrix; 0≤r≤n;
[0076] assign a longitude value of the object to an element in an (r+2)th row and an (r+2)th column of the second random lower triangular matrix;
[0077] assign an element in a jth dimension of the index keyword vector to an element in an (n+3+j)th row and an (n+3+j)th column of the second random lower triangular matrix;
[0078] assign -1 to an element in a last row and a last column of the second random lower triangular matrix.
[0079] Optionally, the processing module is specifically configured to:
[0080] encrypt the first lower triangular matrix according to an inverse matrix of at least one random reversible square matrix, a third lower triangular matrix with diagonal values being set values, and a fourth lower triangular matrix with diagonal values being 1 to obtain a query sub-trapdoor; wherein the set values are preset positive real numbers from a 1st row and a 1st column to an (n+2)th row and an (n+2)th column, and 1 from an (n+3)th row and an (n+3)th column to an (n+m+3)th row and an (n+m+3)th column;
[0081] the second lower triangular matrix obtained according to the spatial position of the object and the keyword set;
[0082] encrypt the second lower triangular square matrix according to the at least one random reversible square matrix, the third random lower triangular matrix, and the fourth random lower triangular matrix to obtain the index of the object.
[0083] Optionally, the query curve comprises a first query curve and a second query curve; the query sub-trap comprises a first query sub-trap and a second query sub-trap; and the processing module is specifically configured to:
[0084] For any object, a first result matrix is determined based on the index of the object and the first query sub-trap, and a second result matrix is determined based on the index of the object and the second query sub-trap;
[0085] The trace of the first result matrix and the trace of the second result matrix are determined, and it is determined whether the object satisfies a preset condition according to the trace of the first result matrix and the trace of the second result matrix.
[0086] In a third aspect, an embodiment of the present application further provides a computer device, comprising:
[0087] a memory configured to store program instructions;
[0088] a processor configured to invoke the program instructions stored in the memory, and execute the query method of the spatial text according to the obtained program.
[0089] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions are used to make a computer execute the query method of the spatial text. BRIEF DESCRIPTION OF DRAWINGS
[0090] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0091] Figure 1 A Gray code diagram of a spatial geographic coordinate provided by the embodiment of the present application;
[0092] Figure 2 A system architecture diagram provided by the embodiment of the present application;
[0093] Figure 3 A flow diagram of the query method of the spatial text provided by the embodiment of the present application;
[0094] Figure 4 A query range diagram provided by the embodiment of the present application;
[0095] Figure 5 A structure diagram of an application scenario provided by the embodiment of the present application;
[0096] Figure 6 A structural schematic diagram of a spatial text query device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0097] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0098] In the prior art, the method for determining a query result based on a query range includes the following four stages:
[0099] S1, system initialization;
[0100] A data owner generates a master key msk.
[0101] S2, data encryption;
[0102] The data owner encodes an object in a spatial text data set according to a preset encoding mode to obtain an object information vector; for example, a spatial text data set DB = {D1, D2, …, Dz}, an i-th object Di = {Dp, Dq}, wherein Dp is a spatial coordinate of the object Di, and Dq is a keyword set of the object Di; a preset encoding algorithm is used to generate a Gray code as shown in FIG. 1 from a spatial geographic coordinate, and then a spatial coordinate of the object Di is encoded into a Gray code as shown in FIG. 2 by using a preset encoding mode, and the object P is encoded into "0011"; then a bitmap encoding mode is used to encode the keyword set of the object Di into a bitmap; and finally an object information vector is generated based on the Gray code and the bitmap of the object; Figure 1 Figure 1
[0103] The object information vector is encrypted according to the master key msk.
[0104] S3, trapdoor generation;
[0105] After obtaining a query request, a query range of the query request is encoded according to a preset encoding algorithm to obtain a query code; a query keyword set of the query request is encoded according to a bitmap encoding algorithm to obtain a query bitmap; and a query vector is determined based on the query code and the query bitmap.
[0106] The query vector is encrypted according to the master key msk.
[0107] S4, query;
[0108] The object corresponding to the query keyword set within the query range is determined according to the query vector and the object information vector.
[0109] But in the above query method, because the preset encoding algorithm can only determine the query range as a rectangle, as shown in Figure 1 each cell (such as "0011") as the basis unit, the query range of the rectangle cannot be determined, and the actual needs of the user cannot be met. For example, a user wants to query how many banks there are in a city. Because the area of most cities is irregular, according to the existing technical solution, the rectangular query range needs to include the city, but on the basis of including the city, the rectangular query range will also include other areas, such as other cities, resulting in that the banks in the rectangular query range are not limited to the city, but also include the banks of other cities, so that the query result (bank) determined is not for the city, thereby causing the query result determined to include objects that the user does not need, reducing the accuracy of the query, and reducing the accuracy of the query result determined.
[0110] In another query method, the query request includes a query location and a query keyword. For example, a user A initiates a query request at a specific location, and the location is the query location of the query request, which is generally a latitude and longitude coordinate value, i.e., a query point.
[0111] For the query point query, the minimum spatial distance between the query point and each minimum bounding rectangle in the index tree constructed in advance according to the plaintext spatial text data needs to be determined, and then the similarity between each spatial text and the keyword of the query request is determined according to the keyword corresponding to the spatial text existing in each minimum bounding rectangle and the keyword of the query request. Finally, the query value is determined according to the preset weight, the spatial distance, and the keyword similarity, the query result is determined according to the size of the query value, for example, the spatial text (equivalent to the leaf node in the index tree) corresponding to the maximum query value is taken as the query result. The index tree is constructed by the data owner according to the plaintext spatial text, and the minimum bounding rectangle is the spatial range of the non-leaf node.
[0112] However, the above method has the problem that the query value is related to the preset weight. For example, when the weight of the spatial distance is small and the weight of the keyword similarity is large, the query result is prone to have nodes similar to the keyword in the query request, thereby causing the sorting of the relevance values of the spatial text data to be leaked, and the attacker is prone to speculate the information of each object according to the sorting of the relevance values, and may analyze the daily habits and preferences of the query user, thereby causing a security risk.
[0113] Therefore, there is an urgent need for a spatial text query method to meet the actual needs of the user's query range, i.e., the query result is within the user's actual needs of the query range, to improve the accuracy of the query, to improve the accuracy of the query result determined, and to increase the security of the query.
[0114] Figure 2 An exemplary system architecture to which embodiments of the application can be applied is shown, which includes a server 200 that can include a processor 210, a communication interface 220, and a memory 230.
[0115] The communication interface 220 is configured to receive a query request and send a query result.
[0116] The processor 210 is the control center of the server 200, and connects various parts of the server 200 through various interfaces and routes, and performs various functions of the server 200 and processes data by running or executing software programs / modules stored in the memory 230 and calling data stored in the memory 230. Optionally, the processor 210 can include one or more processing units.
[0117] The memory 230 can be used to store software programs and modules, and the processor 210 performs various functions and data processing by running the software programs and modules stored in the memory 230. The memory 230 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required by at least one function, etc.; and the data storage area can store data created according to business processing, etc. In addition, the memory 230 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.
[0118] It should be noted that the structure shown above is only an example, and the embodiments of the application are not limited thereto. Figure 3 The structure shown above is only an example, and the embodiments of the application are not limited thereto.
[0119] Based on the above description, Figure 3 An exemplary flowchart of a spatial text query method provided by an embodiment of the application is shown, which can be executed by a spatial text query device.
[0120] As shown in the flowchart, Figure 3 The flowchart specifically includes:
[0121] Step 310: Obtain a query request.
[0122] In an embodiment of the application, the query request includes a query range and a query keyword set; the query range is a closed region formed by a query curve; for example, the query range is an elliptical region formed by two curves, and the query keyword set includes query keywords "Sichuan" and "hot pot".
[0123] Step 320: Encode the query keyword set to obtain a query keyword vector.
[0124] In the embodiment of the present application, the query keyword vector is obtained by determining whether the keywords recorded in the keyword dictionary exist in the query keyword set.
[0125] In step 330, for any query curve, the query curve is polynomial fitted, and the coefficients of the power terms of the fitted polynomial are determined as the query range vector.
[0126] In the embodiment of the present application, the query curve is fitted into a polynomial, so that the query curve can be represented in a matrix to participate in the calculation.
[0127] In step 340, based on the indexes of each query sub-trap and each object in the spatial text data set, the objects meeting the preset condition are determined as the query result.
[0128] In the embodiment of the present application, the preset condition includes a first threshold and a second threshold, the first threshold is used to determine the object meeting the query keyword set, and the second threshold is used to determine the object meeting the query range.
[0129] In step 310, the query range can be an area of any shape, and the query range can be a closed area formed by a plurality of query curves, and the number of query curves is not limited; Figure 4 A query range schematic diagram is exemplarily provided in the embodiment of the present application, as shown in Figure 4 The query range is a closed area formed according to two query curves, which are a first query curve θ1( Figure 4 indicated by the dashed line in the figure) and a second query curve θ2( Figure 4 indicated by the solid line in the figure); wherein the query curve can be a curve of any shape, which is not specifically limited.
[0130] In step 320, the first vector is established, and each dimension element in the first vector is valued according to the keyword dictionary and the query keyword set, so as to obtain the query keyword vector.
[0131] Specifically, based on the number m of keywords in the keyword dictionary, the first vector is established; if it is determined that the jth keyword record in the keyword dictionary is in the query keyword set, the jth dimension element of the first vector is valued as 1; if it is determined that the jth keyword record in the keyword dictionary is not in the query keyword set, the jth dimension element of the first vector is valued as 0; the first vector after the valuation of each dimension element is determined as the query keyword vector.
[0132] The keyword dictionary is a union set of the keyword sets of each object in the spatial text data set. For example, given a spatial text data set D, the spatial text data set D includes information (spatial position and keyword set) of multiple objects, for example, the spatial text data set D includes multiple objects, and the first object is taken as an example. The spatial position coordinates of the first object are (x1, y1), and the keyword set includes "Sichuan", "spicy", and "hot pot". Wherein, x1 represents the latitude value of the first object, and y1 represents the longitude value of the first object.
[0133] Then, the keyword dictionary W is determined according to the keyword sets of all objects in the spatial text data set D. For example, the spatial text data set D includes two objects, the keyword set of the first object includes the keywords "Sichuan", "spicy", and "hot pot", and the keyword set of the second object includes the keywords "spicy" and "roast meat". Therefore, the keyword dictionary W is the union set of the keyword set of the first object and the keyword set of the second object, and specifically includes the keywords "Sichuan", "spicy", "roast meat", and "hot pot"; that is, m = 4.
[0134] Based on the above example, a first vector is established based on m = 4, that is, {m1, m2, m3, m4}. It is assumed that the query keyword set includes the keywords "Sichuan" and "hot pot". When j = 1, the first keyword in the keyword dictionary W is "Sichuan", and it is determined that the first keyword exists in the query keyword set. Therefore, the first dimension element (m1) in the first vector is assigned a value of 1. Similarly, the second dimension element (m2) is assigned a value of 0, the third dimension element (m3) is assigned a value of 0, and the fourth dimension element (m4) is assigned a value of 1. Therefore, the query keyword vector is {1, 0, 0, 1}.
[0135] In step 330, when the query curve is polynomial fitted, the larger the degree of polynomial fitting is, the higher the fitting accuracy is, and the relatively larger the calculation amount is. For example, n represents the degree of polynomial fitting, the larger n is, the higher the fitting accuracy is, and when n = 10, the fitting accuracy is more than 99%. In the embodiment of the present application, n = 10 is taken as an example, but n = 10 is not limited.
[0136] Based on the above step 310, after the first query curve θ1 and the second query curve θ2 are polynomial fitted, the corresponding first fitting curve and the second fitting curve are obtained.
[0137] After the fitting curve is obtained, the query range vector is determined according to the polynomial of the fitting curve. For example, the query range vector of the fitting curve is {a0, a1, …, a 10}; the query range vector of the fitting curve the query range vector is {b0, b1, …, b 10}.
[0138] For any fitting curve, the random lower triangular matrix constructed based on the query range vector and the query keyword vector is valued, so as to obtain the first lower triangular matrix representing the query range information and the query keyword set of the fitting curve. It should be noted that in the embodiments of the present application, the matrix is a square matrix.
[0139] Specifically, the first random lower triangular matrix is determined based on the number n of the highest order term in the polynomial and the number m of the keywords in the keyword dictionary; the diagonal line of the first random lower triangular matrix is valued according to the elements of each dimension in the query range vector and the query keyword vector, so as to obtain the first lower triangular matrix. The lower triangular matrix is a matrix in which the elements above the diagonal line are all 0.
[0140] For example, a (n+m+3) × (n+m+3) -dimensional lower triangular matrix E1 (the first random lower triangular matrix) is randomly generated, Then the diagonal line of the first random lower triangular matrix is valued according to the elements of each dimension in the query range vector and the query keyword vector.
[0141] Further, the coefficient of the rth order term in the query range vector is valued to the element in the r+1th row and the r+1th column of the first random lower triangular matrix; 0≤r≤n; -1 is valued to the element in the n+2th row and the n+2th column of the first random lower triangular matrix; the jth element in the query keyword vector is valued to the element in the n+2+jth row and the n+2+jth column of the first random lower triangular matrix; the number of keywords in the query keyword set is valued to the element in the last row and the last column of the first random lower triangular matrix.
[0142] For the first fitting curve For example, when r=0, the coefficient of the 0th order term in the query range vector is a0, which is valued to the element in the r+1th row and the r+1th column of the first random lower triangular matrix E1 Similarly, the elements of each dimension in the query range vector are valued to the first random lower triangular matrix E1;
[0143] -1 is valued to the element in the r+1th row and the r+1th column of the first random lower triangular matrix E1
[0144] assign the element in the jth dimension of the query keyword vector to the element in the n+2+jth row and the n+2+jth column of the first random lower triangular matrix; if the value of the element in the jth dimension of the query keyword vector is 1, assign "1" to the element in the n+2+jth row and the n+2+jth column of the first random lower triangular matrix E1;
[0145] assign the number of keywords in the query keyword set (for example, the number of keywords in the query keyword set is 2) to the element in the last row and the last column of the first random lower triangular matrix E1
[0146] Accordingly, the first fitting curve is obtained Similarly, the first lower triangular matrix of the second fitting curve is
[0147] Based on the above description, for any object in the spatial text data set, a second lower triangular matrix representing the spatial position and keyword set of the object is stored; specifically, the second lower triangular matrix is obtained by the following method, including: determining a second random lower triangular matrix based on the degree n of the highest order term in the polynomial and the number m of keywords in the keyword dictionary; for any object, determining an index space vector based on the n+1 items of latitude values obtained by processing the latitude value of the object n+1 times and the longitude value of the object; encoding the keyword set of the object to obtain an index keyword vector; and assigning the diagonal line of the second random lower triangular matrix according to the elements in each dimension of the index space vector and the index keyword vector to obtain the second lower triangular matrix.
[0148] For example, the keyword set of the ith object o i includes the keywords "spicy" and "roast meat", so according to the above method for determining the query keyword vector, the index keyword vector of the object is {0, 0, 0, 0}.
[0149] Suppose the spatial position of the object o i is (x i , y i ); wherein x i is the latitude value of the object o i , and y i is the longitude value of the object o i ; then the index space vector is determined as After obtaining the object o iAfter obtaining the index space vector and index key vector, the diagonal E2 of the second random lower triangular matrix is assigned a value; specifically, the latitude value of the object, after being processed r times, is assigned to the element in the (r+1)th row and (r+1)th column of the second random lower triangular matrix; 0≤r≤n; the longitude value of the object is assigned to the element in the (r+2)th row and (r+2)th column of the second random lower triangular matrix; the j-th dimension element of the index key vector is assigned to the element in the (n+3+j)th row and (n+3+j)th column of the second random lower triangular matrix; and -1 is assigned to the element in the last row and last column of the second random lower triangular matrix.
[0150] Based on the example of determining the first lower triangular matrix described above, a (n+m+3)×(n+m+3) dimensional lower triangular matrix F1 (the second random lower triangular matrix) is randomly generated. Then, values are assigned to the diagonal of the second random lower triangular matrix based on the elements of each dimension in the index space vector and index key vector of the first object o1.
[0151] When r = 0, the 0th dimension value in the index space vector is Will The value is assigned to the element in the first row and first column of the second random lower triangular matrix F1. Similarly, assign the values corresponding to each dimension element in the index space vector to the second random lower triangular matrix F1;
[0152] y i The value is assigned to the element in the (r+1)th row and (r+1)th column of the second random lower triangular matrix E2.
[0153] Assign the j-th element of the index key vector to the element in the (n+2+j)-th row and (n+2+j)-th column of the second random lower triangular matrix; if j=1, and the value of the j-th element in the index key vector is 0, then assign "0" to the element in the (n+2+j)-th row and (n+2+j)-th column of the second random lower triangular matrix F1.
[0154] Assign -1 to the element in the last row and last column of the second random lower triangular matrix E2.
[0155] In summary, we obtain the second lower triangular matrix.
[0156] After obtaining the first and second lower triangular matrices, it is necessary to encrypt them to ensure query security.
[0157] Specifically, the first lower triangular matrix is encrypted according to an inverse matrix of at least one random reversible square matrix, a third random lower triangular matrix with diagonal values being set values, and a fourth lower triangular matrix with diagonal values being 1 to obtain a query sub-trapdoor; wherein the set values are preset positive real numbers from the first row and the first column to the n+2th row and the n+2th column, and 1 from the n+3th row and the n+3th column to the n+m+3th row and the n+m+3th column.
[0158] In the embodiment of the application, the random reversible square matrix, the third random lower triangular matrix, the third lower triangular matrix, the fourth random lower triangular matrix and the fourth lower triangular matrix are generated in advance as key components for encrypting information.
[0159] For example, two (n+m+3)×(n+m+3) reversible square matrices M1 and M2 are randomly generated;
[0160] A (n+m+3)×(n+m+3) random lower triangular matrix D1 is randomly generated, and D1 is taken as the third random lower triangular matrix; based on the third random lower triangular matrix D1, the values from the first row and the first column to the n+2th row and the n+2th column in the third random lower triangular matrix D1 are set to 0.001 (a preset positive real number), and the values from the n+3th row and the n+3th column to the n+m+3th row and the n+m+3th column are 1, so as to obtain the third lower triangular matrix D2;
[0161] A (n+m+3)×(n+m+3) random lower triangular matrix S1 is randomly generated, and S1 is taken as the fourth random lower triangular matrix; based on the fourth random lower triangular matrix S1, the diagonal values of the fourth random lower triangular matrix S1 are set to 1 to obtain the fourth lower triangular matrix S2;
[0162] The inverse matrices of the reversible square matrices M1 and M2, the third lower triangular matrix D2 and the fourth lower triangular matrix S2 are multiplied with the first lower triangular matrix to obtain a query sub-trapdoor; for example, the first query sub-trapdoor of the query curve θ1 is The second query sub-trapdoor of the query curve θ2 is
[0163] For any object, the second lower triangular matrix is encrypted according to the at least one random reversible square matrix, the third random lower triangular matrix and the fourth lower triangular matrix to obtain an index of the object; for example, the index of the object o i
[0164] In step 340, for any object, it is determined whether the object satisfies the preset condition by multiplying the index of the object with the first query sub-trapdoor R1 and the second query sub-trapdoor R2 respectively.
[0165] Specifically, for any object, a first result matrix is determined based on the index of the object and the first query sub-trapdoor; a second result matrix is determined based on the index of the object and the second query sub-trapdoor; a trace of the first result matrix and a trace of the second result matrix are determined, and it is determined whether the object satisfies the preset condition according to the trace of the first result matrix and the trace of the second result matrix. Wherein, the trace of the matrix is the sum of each element on the diagonal line in the matrix.
[0166] For example, the first result matrix is tr(C i R1);
[0167]
[0168] The second result matrix is tr(C i R2);
[0169]
[0170] Wherein, K can be the number of query keywords included in the keyword set of the i-th object; for example, the keyword set of the i-th object includes "hot pot", "Sichuan" and "spicy", the query keyword set includes the keywords "hot pot" and "Sichuan", then K=2; K can also be the number of keywords in the keyword set of the i-th object; δ is the number of query keywords in the query keyword set.
[0171] Further, the preset condition includes:
[0172] The absolute value of the trace of the first result matrix and the absolute value of the trace of the second result matrix are less than a first threshold value; and the trace of the first result matrix is greater than a second threshold value; the trace of the second result matrix is less than the second threshold value; wherein the first threshold value is used to determine the object that meets the query keyword set; the second threshold value is used to determine the object that meets the query range.
[0173] For example, the first threshold value is 0.1; because in the third lower triangular matrix D2, the values of the (n+3)th row and the (n+3)th column to the (n+m+3)th row and the (n+m+3)th column are 1, and the elements of the first lower triangular matrix and the second lower triangular matrix from the (n+3)th row and the (n+3)th column to the (n+m+3)th row and the (n+m+3)th column are used to represent the keywords;
[0174] In the third lower triangular matrix D2, the values of the 1st column to the n+2th column of the 1st row to the n+2th row are set as 0.001 (a preset positive real number), and the elements of the 1st column to the n+2th column of the 1st row to the n+2th row of the first lower triangular matrix and the second lower triangular matrix are used to represent the query range.
[0175] If K = δ, the trace of the result matrix is smaller due to the preset positive real number (0.001), and thus, if the absolute value of the trace of the first result matrix and the absolute value of the trace of the second result matrix are not smaller than the first threshold value, it is proved that K is not equal to δ, the keyword of the object does not correspond to the query keyword, and the object cannot be used as the query result; otherwise, the object has the prerequisite requirement of being used as the query result.
[0176] In the embodiment of the present application, the first result matrix is used to represent the first query sub-trapdoor, the first query sub-trapdoor corresponds to the first query curve θ1 (as shown by the dashed line in the figure), and in the spatial position, the first query curve θ1 is located in the upper half, and thus, if the trace of the first result matrix is greater than 0 (the second threshold value), it is indicated that the object is located below the first query curve θ1; if the trace of the second result matrix is smaller than 0 (the second threshold value), it is indicated that the object is located above the second query curve θ1. Figure 4
[0177] Thus, for the first result matrix and the second result matrix of any object, if the absolute value of the trace of the first result matrix and the absolute value of the trace of the second result matrix are smaller than the first threshold value, the trace of the first result matrix is greater than the second threshold value, and the trace of the second result matrix is smaller than the second threshold value, it is determined that the keyword set of the object corresponds to the query keyword set, and the object is in the query range, and thus the object is determined as the query result.
[0178] Figure 5 An exemplary structure schematic diagram of an application scenario is shown as shown in the figure, which includes a data owner 510, a cloud server 520 and a user terminal 530. Figure 5
[0179] The data owner 510 determines at least one random reversible square matrix, a third lower triangular matrix, a fourth lower triangular matrix, a third random lower triangular matrix and a fourth random lower triangular matrix, and uses the at least one random reversible square matrix, the third lower triangular matrix, the fourth lower triangular matrix, the third random lower triangular matrix and the fourth random lower triangular matrix as key components; the data owner 510 sends the inverse matrix of the at least one random reversible square matrix, the third lower triangular matrix and the fourth lower triangular matrix to the user terminal 530.
[0180] The data owner 510 determines a second lower triangular matrix for each object in the spatial text data set, and encrypts the second lower triangular matrix of each object based on at least one random reversible square matrix, a third random lower triangular matrix, and a fourth random lower triangular matrix, to obtain an index of each object; and sends the index to the cloud server 520.
[0181] The user end 530 determines a first lower triangular matrix of the first query curve and the second query curve based on a query range and a query keyword set of the query request, and encrypts the first lower triangular matrix according to an inverse matrix of at least one random reversible square matrix, a third lower triangular matrix, and a fourth lower triangular matrix sent by the data owner 510, to determine a query sub-trap of the first query curve and the second query curve, and sends the query sub-trap of the first query curve and the second query curve to the cloud server 520.
[0182] The cloud server 520 determines an object meeting a preset condition as a query result based on each query sub-trap and an index of each object in the spatial text data set, and returns the query result to the user end 530.
[0183] Based on the same technical concept, Figure 6 An exemplary structural schematic diagram of a spatial text query device provided by an embodiment of the present application is shown, which can execute the flow of the spatial text query method.
[0184] As Figure 6 shown, the device specifically includes:
[0185] The acquisition module 610 is configured to acquire a query request; the query request includes a query range and a query keyword set; the query range is a closed region formed by a query curve;
[0186] The processing module 620 is configured to encode the query keyword set to obtain a query keyword vector;
[0187] For any query curve, the processing module 620 is configured to perform polynomial fitting on the query curve, determine coefficients of each power term of the fitted polynomial as a query range vector, obtain a first lower triangular matrix based on the query range vector and the query keyword vector, and encrypt the first lower triangular matrix by a first encryption matrix to obtain a query sub-trap.
[0188] The cloud server 520 is configured to determine an object meeting a preset condition as a query result based on each query sub-trap and an index of each object in the spatial text data set, and return the query result to the user end 530.
[0189] Optionally, the processing module 620 is specifically configured to:
[0190] establish a first vector based on the number m of keywords in a keyword dictionary; the keyword dictionary is a union of keyword sets of each object in the spatial text data set;
[0191] if it is determined that the jth keyword record in the keyword dictionary is recorded in the query keyword set, assign the jth dimensional element of the first vector to 1;
[0192] if it is determined that the jth keyword in the keyword dictionary is not recorded in the query keyword set, assign the jth dimensional element of the first vector to 0;
[0193] the first vector after assigning each dimensional element is determined as the query keyword vector.
[0194] Optionally, the processing module 620 is specifically configured to:
[0195] determine a first random lower triangular matrix based on the number n of the highest order term in the polynomial and the number m of keywords in the keyword dictionary;
[0196] value the diagonal line of the first random lower triangular matrix according to each dimensional element in the query range vector and the query keyword vector, to obtain a first lower triangular matrix;
[0197] determine a second random lower triangular matrix based on the number n of the highest order term in the polynomial and the number m of keywords in the keyword dictionary;
[0198] for any object, determine an index space vector based on n+1 latitude values after n+1 times of processing of the latitude value of the object and the longitude value of the object, and determine an index keyword vector by encoding the keyword set of the object;
[0199] value the diagonal line of the second random lower triangular matrix according to each dimensional element in the index space vector and the index keyword vector, to obtain a second lower triangular matrix.
[0200] Optionally, the processing module 620 is specifically configured to:
[0201] assign the coefficient of the rth order term in the query range vector to the element in the r+1th row and the r+1th column of the first random lower triangular matrix; 0≤r≤n;
[0202] assign -1 to the element in the n+2th row and the n+2th column of the first random lower triangular matrix;
[0203] assign the jth dimensional element in the query keyword vector to the element in the n+2+jth row and the n+2+jth column of the first random lower triangular matrix;
[0204] assigning a number of keywords in the query keyword set to an element in a last row and a last column of the first random lower triangular matrix.
[0205] Optionally, the processing module 620 is specifically configured to:
[0206] assigning the latitude value of the object to an element in an r+1th row and an r+1th column of the second random lower triangular matrix; 0≤r≤n;
[0207] assigning the longitude value of the object to an element in an r+2th row and an r+2th column of the second random lower triangular matrix;
[0208] assigning a jth dimensional element in the index keyword vector to an element in an n+3+jth row and an n+3+jth column of the second random lower triangular matrix;
[0209] assigning -1 to an element in a last row and a last column of the second random lower triangular matrix.
[0210] Optionally, the processing module 620 is specifically configured to:
[0211] encrypting the first lower triangular matrix according to an inverse matrix of the at least one random reversible square matrix, a third lower triangular matrix with diagonal values being set values, and a fourth lower triangular matrix with diagonal values being 1, to obtain a query sub-trapdoor; wherein the set values are preset positive real numbers for a 1st row and a 1st column to an n+2th row and an n+2th column, and 1 for an n+3th row and an n+3th column to an n+m+3th row and an n+m+3th column;
[0212] a second lower triangular matrix obtained according to the spatial position of the object and the keyword set;
[0213] encrypting the second lower triangular square matrix according to the at least one random reversible square matrix, the third random lower triangular matrix, and the fourth random lower triangular matrix, to obtain an index of the object.
[0214] Optionally, the query curve includes a first query curve and a second query curve; the query sub-trapdoors include a first query sub-trapdoor and a second query sub-trapdoor; and the processing module 620 is specifically configured to:
[0215] for any object, determining a first result matrix based on the index of the object and the first query sub-trapdoor, and determining a second result matrix based on the index of the object and the second query sub-trapdoor;
[0216] determining a trace of the first result matrix and a trace of the second result matrix, and determining whether the object satisfies a preset condition according to the trace of the first result matrix and the trace of the second result matrix.
[0217] Based on the same technical concept, the embodiment of the present application further provides a computer device, comprising:
[0218] a memory for storing program instructions;
[0219] a processor for invoking the program instructions stored in the memory to execute the above-mentioned spatial text query method according to the obtained program.
[0220] Based on the same technical concept, the embodiment of the present application further provides a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions are used for making a computer execute the above-mentioned spatial text query method.
[0221] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can adopt a computer program product in the form of one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0222] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system) and computer program product according to the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be realized by computer program instructions. These computer program instructions can be provided to a general purpose computer, a special purpose computer, an embedded processor or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device for realizing the functions specified in the flowcharts and / or block diagrams. Figure One one or more flows and / or blocks Figure One an apparatus for realizing the functions specified in one or more flows and / or blocks.
[0223] These computer program instructions can also be stored in a computer readable memory to guide the computer or other programmable data processing devices to work in a specific way, so that the instructions stored in the computer readable memory produce a product including instruction apparatus, which realizes the functions specified in the flowcharts and / or block diagrams. Figure One one or more flows and / or blocks Figure One an apparatus for realizing the functions specified in one or more flows and / or blocks.
[0224] These computer program instructions can also be loaded into a computer or other programmable data processing devices, so that a series of operational steps are performed on the computer or other programmable data processing devices to generate computer-implemented processes, thus the instructions executed on the computer or other programmable data processing devices provide processes for implementing the functions specified in the flowchart Figure One flowchart or multiple flows and / or blocks Figure One flowchart or multiple flows and / or blocks
[0225] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application belong to the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these modifications and variations.
Claims
1. A method for querying spatial text, characterized in that, The method comprises the following steps: obtaining a query request; the query request comprises a query range and a query keyword set; the query range is a closed region formed by a query curve; encoding the query keyword set to obtain a query keyword vector; For any query curve, a polynomial is fitted to the query curve, and coefficients of each power term of the fitted polynomial are determined as a query range vector; based on the degree of the highest power term in the polynomial n and the number of keywords in the keyword dictionary m determining a first random lower triangular matrix; assigning a coefficient of a r second power term in the query range vector to an element in the first random lower triangular matrix in the r +1 row and the r +1 column; 0≤ r ≤ n ; assigning -1 to an element in the first random lower triangular matrix at n +2 row and n +2 column; the element in the first random lower triangular matrix at the j +2+ n +2+ j row and column of the element in the query keyword vector n +2+ j row and column of the element in the query keyword vector assigning the number of keywords in the query keyword set to the element in the last row and the last column of the first random lower triangular matrix to obtain a first lower triangular matrix; and encrypting the first lower triangular matrix by a first encryption matrix to obtain a query sub-trapdoor. Based on the index of each query sub-trapdoor and each object in the spatial text data set, the object satisfying the preset condition is determined as the query result; wherein the index of any object is obtained by encrypting the second lower triangular matrix according to at least one random reversible square matrix, a third random lower triangular matrix and a fourth random lower triangular matrix; the second lower triangular matrix is obtained according to the spatial position and the keyword set of the object; the diagonal value of the third lower triangular matrix is a set value; the diagonal value of the fourth lower triangular matrix is 1; wherein the set value is the value of the first row and the first column to the third row and the third column of the first row, the fourth row and the fourth column of the second row, the fifth row and the fifth column of the third row, and the sixth row and the sixth column of the fourth row, which is a preset positive real number, the value of the fourth row and the seventh column of the fifth row, the fifth row and the eighth column of the sixth row, the sixth row and the ninth column of the seventh row, and the seventh row and the tenth column of the eighth row is 1. n +2 row n +2 column n +3 row n +3 column n + m +3 row n + m +3 column The method further comprises the following steps: based on a number of keywords in a keyword dictionary m , a first vector is established; the keyword dictionary is a union of keyword sets of each object in the spatial text data set If it is determined that the first element of the first vector is not in the keyword dictionary, the first element of the first vector is assigned a value of 0. j If it is determined that the first element of the first vector is in the keyword dictionary, the first element of the first vector is assigned a value of 1. j If it is determined that the first element of the first vector is in the keyword dictionary, the first element of the If it is determined that the first element of the first vector is not recorded in the query keyword set, the first element of the first vector is assigned a value of 0. j If it is determined that the first element of the first vector is not recorded in the query keyword set, the first element of the first vector is assigned a value of 0. j If it is determined that the first element of the first vector is not recorded in the query keyword set determining the first vector after assigning each dimension element as the query keyword vector.
2. The method of claim 1, wherein: the second lower triangular matrix is obtained by the following steps: based on the degree of the highest degree term in the polynomial n and the number of keywords in the keyword dictionary m determining a second random lower triangular matrix; For any object, the latitude value of the object is passed through n +1 processing n +1 latitude value and the longitude value of the object, determine the index space vector; encode the keyword set of the object to obtain the index keyword vector; assigning the diagonal line of the second random lower triangular matrix according to each dimension element in the index space vector and the index keyword vector to obtain the second lower triangular matrix.
3. The method of claim 2, wherein, The method further comprises the following steps: The latitude value of the object is... r The latitude value processed in the second step is assigned to the second random lower triangular matrix. r +1 line r +1 column elements; 0≤ r ≤ n ; assigning to an element in the second random lower triangular matrix a latitude value of the object r +2 row, and r +2 column the element in the second random lower triangular matrix at the j +3+ n +3+ j row n +3+ j column assigning -1 to the element in the last row and the last column of the second random lower triangular matrix.
4. The method according to any one of claims 1 to 3, characterized in that, The query curve comprises a first query curve and a second query curve; and the query sub-trapdoors comprise a first query sub-trapdoor and a second query sub-trapdoor. Based on the query sub-trapdoors and the index of each object in the spatial text data set, the objects satisfying the preset condition are determined as query results, which comprises the following steps: for any object, determining a first result matrix based on the index of the object and the first query sub-trapdoor; and determining a second result matrix based on the index of the object and the second query sub-trapdoor; determining the trace of the first result matrix and the trace of the second result matrix, and determining whether the object satisfies the preset condition according to the trace of the first result matrix and the trace of the second result matrix.
5. The method of claim 4, wherein, The preset condition comprises: the absolute value of the trace of the first result matrix and the absolute value of the trace of the second result matrix are less than a first threshold value; and the trace of the first result matrix is greater than a second threshold value; and the trace of the second result matrix is less than the second threshold value; the first threshold value is used to determine the object that meets the query keyword set; the second threshold value is used to determine the object that meets the query range.
6. An apparatus for querying spatial text, characterized by The method comprises the following steps: an obtaining module, configured to obtain a query request; the query request comprises a query range and a query keyword set; the query range is a closed region formed by a query curve; a processing module, configured to encode the query keyword set to obtain a query keyword vector; For any query curve, performing a polynomial fitting on the query curve, determining coefficients of each power term of the fitted polynomial as a query range vector based on a degree of a highest power term in the polynomial n and a number of keywords in the keyword dictionary m determining a first random lower triangular matrix; assigning to an element in a first random lower triangular matrix a coefficient of a r second power term in the query range vector r +1 column of the first random lower triangular matrix a coefficient of a r second power term in the query range vector 0≤ r ≤ n ; assigning -1 to an element in the first random lower triangular matrix at n +2 row and n +2 column; the element in the first random lower triangular matrix at the j +2+ n +2+ j row and column n +2+ j of the query keyword vector is assigned to the element in the first random lower triangular matrix at the assigning the number of keywords in the query keyword set to the element in the last row and the last column of the first random lower triangular matrix to obtain a first lower triangular matrix; and encrypting the first lower triangular matrix by a first encryption matrix to obtain a query sub-trapdoor. Based on indexes of each query sub-trapdoor and each object in the spatial text data set, objects satisfying preset conditions are determined as query results; wherein the index of any object is obtained by encrypting a second lower triangular matrix according to at least one random reversible square matrix, a third random lower triangular matrix and a fourth random lower triangular matrix; the second lower triangular matrix is obtained according to the spatial position and the keyword set of the object; the diagonal value of the third lower triangular matrix is a set value; the diagonal value of the fourth lower triangular matrix is 1; wherein the set value is the value of the first row and the first column to the third row and the third column of the first lower triangular matrix, and the value of the fourth row and the fourth column to the sixth row and the sixth column of the first lower triangular matrix is a preset positive real number, and the value of the first row and the fourth column to the third row and the sixth column of the first lower triangular matrix is 1. n +2 n +2 n +3 n +3 n + m +3 n + m +3 The processing module is specifically configured to establish a first vector based on the number of keywords in a keyword dictionary m , wherein the keyword dictionary is a union set of keyword sets of objects in the spatial text data set; if it is determined that a keyword in the keyword dictionary is recorded in the query keyword set, the element of the first vector at the position corresponding to the keyword is assigned a value of 1; if it is determined that a keyword in the keyword dictionary is not recorded in the query keyword set, the element of the first vector at the position corresponding to the keyword is assigned a value of 0; and the first vector after the assignment of the elements is determined as the query keyword vector. j j j j 7. A computer device, characterized by The method comprises the following steps: a memory, configured to store program instructions; a processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 5 according to the obtained program execution right. The method comprises the following steps: an obtaining module, configured to obtain a query request; the query request comprises a query range and a query keyword set; the query range is a closed region formed by a query curve; a processing module, configured to encode the query keyword set to obtain a query keyword vector; assigning the number of keywords in the query keyword set to the element in the last row and the last column of the first random lower triangular matrix to obtain a first lower triangular matrix; and encrypting the first lower triangular matrix by a first encryption matrix to obtain a query sub-trapdoor. The method comprises the following steps: a memory, configured to store program instructions; a processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 5 according to the obtained program execution right.
Citation Information
Patent Citations
Privacy-protected encrypted image retrieval method and system
CN112528064A
Space keyword search method based on cloud computing privacy protection
CN113177167A