Spatial data semantic query method and device

By optimizing spatial data storage through an improved VAE model and quadtree index, and combining it with parallel query of the Redis database, the problems of low query efficiency and load balancing in the existing technology are solved, and efficient and accurate semantic query of spatial data is achieved.

CN114491088BActive Publication Date: 2025-09-05MIGU CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111611843.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2025-09-05
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

Existing spatial data semantic query methods have problems such as low query efficiency and query requests disrupting load balancing. In addition, deep learning models find it difficult to effectively integrate spatial location information and text information, resulting in inaccurate query results.

Method used

The VAE model improved by the generative model is used to extract the heat-spatial distribution feature vector and the semantic-spatial distribution feature vector. The spatial data storage is optimized by combining the quadtree index. The load balancing of space, semantics and heat is achieved through the heat-spatial distribution feature network and the semantic-spatial distribution feature network. The Redis database is used to store parallel queries.

Benefits of technology

It achieves load balancing of spatial data in the two dimensions of space-heat and space-semantics, improves query efficiency, ensures timely acquisition of hot data, and improves query accuracy and response efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114491088B_ABST
    Figure CN114491088B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for semantic querying of spatial data. The method comprises: receiving query text information input by a user, converting the query text information to obtain a query term heat-spatial distribution feature vector and a query term spatial region list; determining first index data in a database based on the query spatial region list, and determining the storage location of first spatial data corresponding to the first index data in the database based on the distance between the query term heat-spatial distribution feature vector and the semantic feature vector of the first index data; querying the database for the corresponding node based on the storage location of the first spatial data to obtain and return a query result containing the first target spatial data. The present invention avoids the problem of index imbalance and incorporates data access heat, combining space, semantics, and access heat to provide efficient and accurate spatial semantic querying.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning technology, and in particular to a spatial data semantic query method and device. Background Art

[0002] With the development of location-based services, the demand for querying spatial data is also increasing (i.e., querying data with spatial location coordinates). Spatial data consists of two parts: spatial location coordinates and related text data (such as the name of the spatial object, keywords, etc.). Based on the user's query text information, a semantic search function is provided to the user, and results with similar semantics to the user's query text information are returned, so that the user can query results within a certain spatial range that are semantically similar to the query text conditions. For example, if a user queries for "mobile" within 5 kilometers of a certain place, the spatial semantic query can return results within 5 kilometers, such as "XX Mobile Company" and "XX Telecom Company". It can also return results that have no direct relationship with "mobile" in the literal sense but are related at the semantic level, such as "Migu".

[0003] Existing spatial data semantic queries mainly use the following methods:

[0004] (1) Spatial semantic dual indexing

[0005] A spatial data index is established based on the spatial location information of spatial data. A semantic index is then created for each spatial index. When a user queries, the spatial index first filters out data with inconsistent spatial locations, and then searches the semantic index to obtain semantically similar spatial data. Alternatively, a similar inverted index can be used to first establish a semantic index for spatial data, storing semantically similar data together. The spatial location coordinates of each data item are then recorded separately. When a user queries, they first search for semantically similar data and then filter out data that meets the query criteria based on spatial location to obtain the final result. Using a dual index structure inevitably leads to index imbalance, resulting in some spatial regions containing more data and others containing less. When query requests are consistently concentrated in spatial regions with more data, the query system's load balancing is disrupted, query time is increased, and query efficiency is reduced. When a large amount of semantically similar data is stored together, if these data are spatially distant, the spatial filtering effort increases, reducing the query efficiency of the system.

[0006] (2) Spatial semantic fusion index

[0007] Using a deep learning model, the spatial location and semantic information of the data are combined to generate a spatial semantic vector, which is then indexed. When a user queries, the spatial and textual conditions of the query are converted into a spatial semantic vector before the index is queried. The Euclidean distance between the vectors is used to determine whether the data meets the query conditions, and data with the closest Euclidean distance is ultimately returned to the user. However, this approach can produce inaccurate query results. Current deep learning models cannot effectively integrate spatial location and textual information, and the calculated spatial semantic vectors may produce errors and return irrelevant data. Furthermore, this approach requires continuous updating of the deep learning model and reconstruction of the semantic index, resulting in poor real-time performance. Summary of the Invention

[0008] In view of the above problems, the present invention is proposed to provide a spatial data semantic query method and device that overcomes the problems of low query efficiency during retrieval and query request disruption of load balancing.

[0009] According to one aspect of the present invention, a spatial data semantic query method is provided, which includes:

[0010] Receive the query text information input by the user and transform the query text information to obtain the query word heat-spatial distribution feature vector and the query word spatial area list;

[0011] Determine the first index data in the database according to the query spatial area list, and determine the storage location of the first spatial data corresponding to the first index data in the database based on the distance between the query term heat-spatial distribution feature vector and the semantic feature vector of the first index data;

[0012] The database is queried for a corresponding node according to the storage location of the first spatial data, and a query result including the first target spatial data is obtained and returned.

[0013] According to another aspect of the present invention, a spatial data semantic query device is provided, comprising:

[0014] A receiving module adapted to receive query text information input by a user and convert the query text information to obtain a query word heat-spatial distribution feature vector and a query word spatial region list;

[0015] a location determination module adapted to determine first index data in the database according to the query spatial region list, and determine a storage location of first spatial data corresponding to the first index data in the database based on a distance between a query term heat-spatial distribution feature vector and a semantic feature vector of the first index data;

[0016] The first query module is adapted to query a node corresponding to the database according to a storage location of the first spatial data, and obtain and return a query result containing the first target spatial data.

[0017] According to another aspect of the present invention, there is provided an electronic device, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;

[0018] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned spatial data semantic query method.

[0019] According to another aspect of the present invention, a computer storage medium is provided, wherein the storage medium stores at least one executable instruction, and the executable instruction enables a processor to execute operations corresponding to the above-mentioned spatial data semantic query method.

[0020] The spatial data semantic query method and device according to the present invention simultaneously achieves load balancing of spatial data in the two dimensions of space-heat and space-semantics, avoiding query hotspots in any of the spatial, semantic, and heat aspects, and greatly improving query efficiency.

[0021] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:

[0023] Figure 1 A flowchart of a spatial data semantic query method according to an embodiment of the present invention is shown;

[0024] Figure 2 shows a schematic diagram of the network model to be trained;

[0025] Figure 3a It shows a flow chart of storing the spatial data to be stored into the database;

[0026] Figure 3b shows a schematic diagram of quadtree partitioning of spatial regions;

[0027] Figure 4Shows a schematic diagram of database storage data;

[0028] Figure 5 A functional block diagram of a spatial data semantic query device according to an embodiment of the present invention is shown;

[0029] Figure 6 A schematic structural diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0030] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0031] Figure 1 A flowchart of a spatial data semantic query method according to an embodiment of the present invention is shown.

[0032] like Figure 1 As shown in FIG, the spatial data semantic query method specifically includes the following steps:

[0033] Step S101 : receiving query text information input by a user, and converting the query text information to obtain a query word heat-spatial distribution feature vector and a query word spatial region list.

[0034] When a user issues a spatial semantic query, the system receives the query text input. It then transforms the query text to facilitate subsequent queries. This transformation is based on the semantics contained in the query text and the user's current location (obtained with user authorization), achieving a three-pronged approach: spatial, semantic, and popularity (based on the popularity of each word in the query text).

[0035] The query text information can be transformed based on a neural network model. Specifically, this embodiment is based on a generative model, such as a VAE (Variational Auto-Encoder) model, and the improved preset VAE model is trained. The model here can also adopt any autoencoder model, which is not limited here. The following is an illustration using the VAE model as an example. The training process includes: collecting spatial sample data, preprocessing the spatial sample data, and constructing a spatial sample set. The spatial sample set includes spatial location information, range information, a keyword list, and access popularity information. The preprocessing of the spatial sample data is to convert the spatial location and access popularity of the spatial sample data into a One-Hot vector, and use a Bert model to convert the text in the spatial sample data into an initial semantic vector, such as the spatial sample data is <(121.456, 36.789), 5000, <"Mobile", "Nanjing">, 15679>. The first element is the spatial location information, i.e. longitude and latitude, the second element is the range information, such as within 5000 meters, the third element is the keyword list after word segmentation, and the fourth element is the access popularity information. After preprocessing, these four elements are converted into<S,R,V,H> Four vector groups are used as input and output of the preset VAE model. The preset VAE model adopts the structure of automatic codec, such as Figure 2As shown, the system includes an encoder, a heat-spatial distribution layer and a semantic-spatial distribution layer connected to the encoder, an attention layer, and a decoding layer. The encoder is composed of a stack of two-dimensional convolutional layers, with a pooling layer between each layer to extract information from the vector group and perform preliminary encoding. The heat-spatial distribution layer is used to extract the correlation between the heat and spatial position of spatial data, namely the probability distribution. It is composed of a stack of feedforward networks. The heat-spatial distribution layer can be used to extract heat-spatial distribution feature vectors, obtaining heat-spatial distribution feature vectors for different texts. By calculating the cosine distance between different feature vectors, it can be determined whether the spatial data represented by two feature vectors are spatially close and have similar access popularity. This allows spatial data with high access popularity and close spatial locations to be clustered during storage, reducing unnecessary data access and improving query efficiency. The semantic-spatial distribution layer is also composed of a stack of feedforward networks and is used to extract semantic-spatial distribution feature vectors. By calculating the Euclidean distance between semantic-spatial distribution feature vectors, spatial data with similar semantics and adjacent spatial locations are clustered and stored, improving query efficiency. The attention layer is used to combine the feature vectors generated by the heat-spatial distribution layer and the semantic-spatial distribution layer and extract key features at the same time, generating a feature vector that integrates space, semantics, and heat. This vector can be used to preliminarily calculate the similarity between spatial data. The decoder is also composed of a stack of convolution and pooling layers. Its function is to restore the vector generated by the attention layer to the four initial vectors, namely<S’,R’,V’,H’> During the training process, after the spatial sample set is input into the preset VAE model, the vector group is calculated<S’,R’,V’,H’> Compared to vector groups<S,R,V,H> For example, the mean square error function is used to calculate the loss of each vector, and the average value is taken as the total loss. The parameters of each layer are adjusted by backpropagation according to the loss, and the process is iterated continuously until the model converges and the training is completed.

[0036] Among them, the heat-spatial distribution layer and the encoder form a heat-spatial distribution feature network, which is used to extract the heat-spatial distribution feature vector; the semantic-spatial distribution layer and the encoder form a semantic-spatial distribution feature network, which is used to extract the semantic-spatial distribution feature vector; the heat-spatial distribution feature network, the semantic-spatial distribution feature network and the attention layer form a fusion feature network, which is used to fuse spatial, semantic and heat feature vectors.

[0037] Furthermore, this embodiment can also use the daemon process to regularly update the VAE model training. After the VAE model training is completed, it can continue to receive spatial sample data, such as input:

[0038] <(121.559, 36.889), 5000, <“Mobile”, “Hangzhou”>>

[0039] Unlike the training process, the daemon process does not require input of access popularity information for its spatial sample data. The VAE model has already learned the relationship between access popularity and spatial location. The features output by the heat-spatial distribution feature network and the fusion feature network already include access popularity predictions for the input spatial data. The feature vector output by the semantic-spatial distribution feature network also does not need to include heat information. Furthermore, other models besides VAE can also be used, and this is not a limitation here.

[0040] Based on the heat-space distribution feature network, semantic-space distribution feature network, and fusion feature network obtained through the above training, we can not only learn the feature representation methods of heat-space and semantic-space, but also establish the correlation between space, semantics, and heat, thereby ensuring the accuracy of feature vectors when calculating similarity, improving the accuracy of the model, and improving the accuracy of queries. The existing spatial data semantic query does not take the heat of the data into consideration, and does not make corresponding optimization processing for hot data, resulting in users being unable to obtain hot data in a timely manner, greatly reducing the response efficiency of the query, and affecting the user's experience. This embodiment integrates the feature vectors of spatial position, semantics, and heat, and provides users with high-heat data, which can better meet user needs.

[0041] For the query text information input by the user, such as the query spatial range, query keywords, and the user's current location information (spatial coordinates) obtained with the user's permission, or the specified query spatial coordinates, the query text information such as the query keywords is transformed using the trained heat-spatial distribution feature network to obtain the corresponding query word heat-spatial distribution feature vector. At the same time, the spatial coordinates and spatial range are used to construct the minimum enclosing rectangle of the query area, and combined with the quadtree calculation, a list of query word spatial areas that intersect with the query spatial position range is obtained. The quadtree can use features such as CIF-quadtree to calculate the CIF-quadtree nodes that intersect with the query spatial position range.<Q1,Q2,…,QN> Wait, the query word heat-spatial distribution feature vector and query word space area list<Q1,Q2,…,QN> Used as query conditions to query the database.

[0042] Step S102: determining the first index data in the database according to the query spatial area list, and determining the storage location of the first spatial data corresponding to the first index data in the database based on the distance between the query term heat-spatial distribution feature vector and the semantic feature vector of the first index data.

[0043] In this embodiment, the database uses a Redis database, for example, to store data in a key-value pair (KV) format. The database stores first index data and first spatial data. The storage locations of the first index data and the first spatial data are determined based on the heat-spatial distribution feature vector and semantic-spatial feature vector of the first spatial data.

[0044] Specifically, to address the inefficiency of spatial region queries during storage, this embodiment also introduces and improves the CIF-quadtree index. Each node in the CIF-quadtree stores the spatial region that intersects its dividing line. When spatial data is unevenly distributed, meaning that certain subregions have a large amount of data, the CIF-quadtree index can be highly unbalanced, leading to low query efficiency. To address this issue, a heat-spatial distribution feature network is used to improve spatial imbalance during storage.

[0045] When storing the spatial data to be stored in the database, the following steps are taken: Figure 3a As shown:

[0046] Step S301 : Divide the spatial region into at least two layers of sub-space regions using a quadtree, and determine the corresponding sub-space region according to the spatial coordinate information of each spatial data to be stored.

[0047] Specifically, multiple spatial data to be stored are obtained and processed to obtain the spatial data to be stored in the form of <spatial minimum enclosing rectangle, spatial text data>. The spatial minimum enclosing rectangle is determined based on the spatial coordinate information of the spatial data, such as Figure 3b As shown, the rectangles A, B, C, D, E, F, G, and H in the figure are the minimum spatial enclosing rectangles, which are determined according to the spatial coordinate information of each spatial data.

[0048] This embodiment uses a CIF-quadtree to first divide the spatial region into two layers of subspace regions. The two layers of subspace regions include the upper node subspace region and the lower node subspace region, which facilitates the subsequent storage of spatial data that should be stored in the lower node subspace region in the upper node subspace region. The spatial region can also be further divided according to the amount of data to be stored, and the levels can be expanded to 3 layers, 4 layers, etc., which is not limited here. Figure 3b In the example, the spatial region is first divided into four first-level subspace regions (upper-level node subspace regions), and then the subspace region in the upper right corner is further divided to obtain the lower-level node subspace region.

[0049] like Figure 3bIn the figure, based on the intersection of the minimum spatial enclosing rectangle of the spatial data and at least two layers of subspace regions, it can be seen that the upper node subspace region involves spatial data A, B, C, D, and E, and the lower node subspace region in the upper right corner involves data F, G, and H. Based on the intersection of the minimum spatial enclosing rectangle of the spatial data and the divided subspace regions, the subspace regions of each layer corresponding to the multiple spatial data to be stored are determined.

[0050] Step S302 , calculating the heat-space feature vector of the spatial data to be stored in each layer of the subspace region, and calculating the Euclidean distance between the spatial data to be stored in the upper node subspace region and the lower node subspace region based on the feature vector.

[0051] Figure 3b Although the spatial data F and G are the spatial data to be stored in the subspace area of ​​the lower node, it can be seen from the figure that they are close to the spatial data E. If they are stored in the subspace area of ​​different layers, different nodes need to be accessed during query, which affects the query efficiency.

[0052] The heat-space distribution feature network obtained by training can be used to obtain the heat-space feature vector of each spatial data, and the Euclidean distance between the heat-space feature vector of the spatial data to be stored in the upper node subspace area and the heat-space feature vector of the spatial data to be stored in the lower node subspace area is calculated respectively.

[0053] Step S303: determine whether the Euclidean distance is less than a preset distance threshold.

[0054] It is determined whether the calculated Euclidean distance is less than a preset distance threshold. The preset distance threshold can be set according to the implementation situation. When it is determined that the Euclidean distance is less than the preset distance threshold, step S304 is executed; if not, step S305 is executed.

[0055] Step S304 : updating the spatial data to be stored in the subspace region of the lower-level node to the subspace region of the upper-level node, and storing the spatial data to be stored in the subspace region of the upper-level node.

[0056] When the Euclidean distance is less than the preset distance threshold, the spatial data to be stored in the lower node subspace area can be updated to the upper node subspace area, and the spatial data to be stored is stored in the upper node subspace area, so that the data storage is more evenly distributed.

[0057] like Figure 3b In the process, by calculating the Euclidean distance between the heat-space feature vector of spatial data F and G and the heat-space feature vector of spatial data E, it is determined that it is less than the preset distance threshold, and the spatial data F and G are stored in the upper node subspace area.

[0058] Step S305: determine whether all the space data to be stored has been stored.

[0059] The data in the storage space is judged to determine whether the storage has been completed. If so, the execution ends. If not, the execution continues to step S306.

[0060] To determine whether all the spatial data to be stored has been stored, it can be determined that there is no spatial data to be stored in the lower-level child node spatial area. Alternatively, in this embodiment, in order to avoid excessive loops affecting storage efficiency, a preset number of levels for dividing the lower-level node spatial area can be set. The preset number of levels for dividing the lower-level node spatial area can be set according to the implementation situation. When the number of levels for re-dividing the lower-level node spatial area reaches the preset number of levels, the execution will no longer be repeated, and the spatial data to be stored in the lower-level node spatial area will be stored in the lower-level node spatial area, etc. Through the above judgment, it can be determined whether all the spatial data to be stored has been stored.

[0061] Step S306: Update the lower-level node space region to the upper-level node subspace region, and divide the updated upper-level node subspace region to obtain a new lower-level node space region.

[0062] If the Euclidean distance is determined to be not less than the preset distance threshold, the lower-level node subspace region is updated to the new upper-level node subspace region. The CIF-quadtree is then used to continue dividing the new upper-level node subspace region into new lower-level node subspace regions. Steps S302-S303 are then repeated for the spatial data to be stored, based on the new upper-level node subspace region and the new lower-level node subspace region, to determine its storage location.

[0063] The above steps determine the subspace encoding (Zorder encoding) for the spatial data to be stored. Based on the subspace encoding and the spatial data to be stored, the data is stored in the corresponding storage location in the database. For example, by mapping Redis slot numbers, index data is evenly stored in Redis. Simultaneously, the spatial data to be stored is also evenly stored in Redis, thus solving the storage load balancing problem.

[0064] Specifically, for the spatial data to be stored, the corresponding index data and spatial data need to be stored. The index data is a fusion index obtained by fusing spatial semantics. In this embodiment, the database is explained using redis as an example. The index data and spatial data are stored in key-value pairs, and are stored based on a determined storage location. The storage location of the index data is determined specifically as follows: first, the corresponding node in the database is determined based on the subspace area coding of the spatial data to be stored. The subspace area corresponds to the storage area of ​​the database, and the corresponding node in the database can be determined based on the subspace area coding. Then, based on the subspace area coding of the spatial data to be stored, and the heat-spatial feature vector of each spatial data corresponding to the node, the storage location of the index data for storing the spatial data to be stored is calculated. The following formula can be used for calculation:

[0065]

[0066] IB id is the storage location of the index data, Z value Represents the Zorder encoding of the subspace region, so that the spatially adjacent subspace regions can be mapped to different nodes of redis to achieve spatial anti-clustering storage. i The heat-spatial distribution feature vector of each spatial data stored in the node, H max It is the heat-space distribution feature vector corresponding to the hottest spatial data among all spatial data. Here, 8192 is half of the total number of redis slots (the other half is used to store the corresponding spatial data). Different total slot values ​​are set according to the specific implementation situation. By calculating the cosine distance between the heat-space feature vector and the maximum heat-space feature vector and obtaining the average value, this value is used as the offset value to distinguish the access heat of different nodes. Since the heat-space feature vector integrates the distribution of heat for spatial position, different spatial regions can calculate their own unique offset values ​​to prevent the situation where different spatial regions have the same access heat and the final calculated value is the same, thereby realizing cross-storage of subspace regions with different heat, that is, a redis node stores both data of hot subspace regions and data of non-hot subspace regions, realizing uniform storage of the two dimensions of heat and spatial position. According to the storage location of the calculated index data, the index data of the spatial data to be stored is stored accordingly. The index data is stored in the form of key-value pairs of <subspace region code, <list of semantic feature vectors of each spatial data in the storage location of the index data>>. As <Zorder_id,<data_loc,data_loc,...,data_loc> >. The key is the subspace region code, and the value is the list of semantic feature vectors calculated by semantic distribution storage of each spatial data in the storage location of the index data.

[0067] The storage of spatial data calculates the storage location of the to-be-stored spatial data according to the storage location of the index data and the semantic-spatial feature vector of the to-be-stored spatial data obtained by using the semantic-spatial distribution feature network. The following formula can be used for the calculation:

[0068] D id =[dis(TS i , TS all ) + IB id % 8192

[0069] D id is the storage location of the to-be-stored spatial data, TS i is the semantic-spatial distribution feature vector of each spatial data stored in the node in the CIF-quadtree, and TS all is a preset feature vector, which is set according to the implementation situation. Calculate the cosine distance between TS i and TS all . Considering that the distances between semantically similar feature vectors and the same feature vector are close, semantically similar spatial data can be mapped to the same storage slot in redis, realizing semantic aggregated storage. IB id is the storage location of the index data. As an offset, it enables spatial data in adjacent subspace regions to be stored on different redis nodes, preventing semantically similar spatial data in different subspace regions from being mapped to the same storage slot. This not only realizes local semantic aggregated storage within the subspace region but also realizes overall semantic dispersed storage between subspace regions. Store the to-be-stored spatial data according to the storage location corresponding to the to-be-stored spatial data. The to-be-stored spatial data can be stored in the form of <spatial data identifier, spatial data>, such as <id, XXX text content>.

[0070] The storage of index data and spatial data is as Figure 4 shown. The index data and spatial data are respectively stored in the corresponding nodes. Further, the semantic-spatial distribution feature vectors of all spatial data in the storage location corresponding to the spatial data can be converted into a feature vector through a function such as the Attention function, and this feature vector is stored in the value of the index data for convenient use as a condition for semantic query.

[0071] The above method completes the storage of the spatial data to be stored in the database. During index storage, spatially adjacent and highly popular spatial data are stored together, while high- and low-popularity data are evenly distributed. This facilitates user queries. Even if data in a certain spatial area becomes a hot query data, query hotspots will not be generated, thus preventing load balancing from being disrupted. When storing spatial data, semantically similar spatial data are stored together within the subspace area. The spatial and heat pruning functions of the index are used to limit the spatial data requiring semantic queries to a few subspace areas, reducing the query scale. Semantically distributed storage is then used to store spatial data on different nodes, thereby dispersing query requests and balancing the load during storage queries, greatly improving query accuracy and efficiency.

[0072] After the spatial data to be stored is stored in the database, the first index data and the first spatial data are stored in the database. When a user query request is received, the Zorder code of each query spatial region corresponding to the query spatial region list is determined, thereby querying the database to obtain the storage location of the required first index data. If the query spatial region list contains multiple query spatial regions, multiple storage locations of the first index data are obtained.

[0073] Based on the storage location of the first index data, multiple first index data in the database can be accessed in parallel. The cosine distance between the query term heat-spatial distribution feature vector and each feature vector in the list of semantic feature vectors of the value in the first index data is calculated, and the semantic feature vector with the closest distance and the most semantic relevance is found. Based on the semantic feature vector, the corresponding storage location of the first spatial data can be determined.

[0074] Step S103: query the database for a corresponding node according to the storage location of the first spatial data, obtain and return a query result containing the first target spatial data.

[0075] Based on the obtained storage location of the first spatial data, the database nodes corresponding to the storage location of the first spatial data are queried in parallel to obtain the first spatial data stored in each node, thereby obtaining and returning the first target spatial data to the user. The first spatial data in each storage location only contains semantically similar data within a subspace area, so the query volume is small, and Redis's serial execution method achieves high execution efficiency.

[0076] Furthermore, for the newly added second spatial data, such as real-time second spatial data, it can be stored in a storage queue first, and the storage queue can be a redis queue. When a user query request is received, in addition to querying the first spatial data stored in the database, the second spatial data stored in the storage queue can also be queried according to the query text information to obtain the second target spatial data that meets the query text information. When querying, you can directly use the space and query text as conditions for one-to-one matching and filtering, that is, check whether the spatial position of the second spatial data in the storage queue meets the spatial conditions of the query, whether the text of the second spatial data is semantically close to the query keyword (such as using the Bert model to judge the semantic similarity, etc.), and finally obtain the second target spatial data that meets the query text information. Merge the second target spatial data with the first target spatial data obtained from the database to obtain the merged query result.

[0077] Furthermore, a preset process can be used to periodically detect the access heat of the second spatial data in the storage queue to determine whether the access heat is greater than a preset heat threshold; if so, the second spatial data is stored in the database, and the description of the spatial data to be stored is referred to when storing, which will not be repeated here. If not, the second spatial data in the storage queue is sorted according to the access heat, the feature similarity between the second spatial data is calculated, and the sorting is adjusted based on the feature similarity. Specifically, there are<A、B、C、D、E> The priority of the storage queue for the five second spatial data is determined by the semantics and popularity of the second spatial data, with the priority decreasing from left to right. When the designated process detects that the access popularity of C becomes the highest, the second spatial data is first sorted based on the access popularity, and C is set as the head of the storage queue. Then, the fusion feature network is used to calculate the fusion feature vector of each second spatial data, and the feature similarity with C is calculated. The sorting is further adjusted based on the feature similarity. For example, if it is calculated that the feature similarity of B and E to C is higher, the sorting is adjusted.<C、B、E、A、D> , so that the second space data with high popularity and similarity to the high popularity are ranked first. When users query similar data, they do not need to spend too much time searching the entire storage queue, thereby improving the efficiency of data query.

[0078] The spatial data semantic query method provided by the present invention simultaneously achieves load balancing of spatial data in both the spatial-heat and spatial-semantic dimensions, avoiding query hotspots in any of the spatial, semantic, and heat dimensions, greatly improving query efficiency. Through the heat-spatial distribution feature network, spatially adjacent hotspot data is stored adjacently, which not only ensures spatial pruning performance but also ensures that hotspot data can be accessed as much as possible, allowing users to obtain hotspot data in a timely manner. Through the semantic-spatial distribution feature network, semantic storage and query are facilitated, and the effective combination of the spatial-semantic dimensions is achieved, while also playing the role of spatial semantic pruning. By adding and updating spatial data through the storage queue, new data does not need to be modified when the existing structure of the index data is added, resulting in higher efficiency. Furthermore, parallel query can more accurately and efficiently query spatial data that meets the user's query conditions.

[0079] Figure 5 FIG. 1 shows a functional block diagram of a spatial data semantic query device according to an embodiment of the present invention. Figure 5 As shown, the spatial data semantic query device includes the following modules:

[0080] The receiving module 510 is adapted to receive query text information input by a user and convert the query text information to obtain a query word heat-spatial distribution feature vector and a query word spatial region list;

[0081] a location determination module 520 adapted to determine first index data in the database based on the query spatial region list, and determine a storage location in the database of first spatial data corresponding to the first index data based on a distance between a query term heat-spatial distribution feature vector and a semantic feature vector of the first index data;

[0082] The first query module 530 is adapted to query a node corresponding to the database according to the storage location of the first spatial data, and obtain and return a query result including the first target spatial data.

[0083] Optionally, the receiving module 510 is further adapted to:

[0084] Receive query text information input by the user, and transform the query text information based on the user's location information to obtain a query term heat-spatial distribution feature vector; wherein the heat-spatial distribution feature vector is obtained based on a heat-spatial distribution feature network; the heat-spatial distribution feature network is composed of a heat-spatial distribution layer and an encoder in a generative model; and a list of query term spatial regions that intersect with the query spatial location range is obtained based on a quadtree calculation.

[0085] Optionally, the device further includes: a second query module 540, adapted to query the second spatial data stored in the storage queue according to the query text information to obtain second target spatial data that meets the query text information; and merge the second target spatial data with the first target spatial data in the database to obtain a merged query result.

[0086] Optionally, the device also includes: an update module 550, which is suitable for using a preset process to periodically detect the access popularity of the second spatial data in the storage queue; determine whether the access popularity is greater than a preset popularity threshold; if so, store the second spatial data in the database; if not, sort the second spatial data in the storage queue according to the access popularity, calculate the feature similarity between the second spatial data, and adjust the sorting based on the feature similarity.

[0087] Optionally, the first query module 530 is further adapted to:

[0088] According to the storage location of the first spatial data, the nodes corresponding to the storage location of the first spatial data are searched in parallel in the database to obtain the first target spatial data stored in each node.

[0089] Optionally, the device further includes: a storage module 560;

[0090] The storage module 560 includes:

[0091] The data locating unit 561 is adapted to divide the spatial region into at least two layers of subspace regions using a quadtree, and determine the corresponding subspace region according to the spatial coordinate information of each spatial data to be stored; the two layers of subspace regions include an upper node subspace region and a lower node subspace region;

[0092] The adjustment and update unit 562 is suitable for calculating the heat-space feature vector of the spatial data to be stored in the subspace area of ​​each level, and calculating the Euclidean distance between the spatial data to be stored in the upper node subspace area and the lower node subspace area based on the heat-space feature vector; judging whether the Euclidean distance is less than a preset distance threshold; if so, updating the spatial data to be stored in the lower node subspace area to the upper node subspace area, and storing the spatial data to be stored in the upper node subspace area; if not, updating the lower node spatial area to the upper node subspace area, dividing the updated upper node subspace area to obtain a new lower node spatial area; repeating this unit until all the spatial data to be stored are stored.

[0093] Optionally, the database is a redis database;

[0094] The storage module 560 is further adapted to:

[0095] Determine the corresponding node in the database according to the subspace region code of the spatial data to be stored;

[0096] Obtaining a storage location for index data of the to-be-stored spatial data based on the subspace region coding of the to-be-stored spatial data and the heat-spatial feature vector of each spatial data corresponding to the node;

[0097] Determining a semantic-spatial feature vector of the spatial data to be stored; wherein the semantic-spatial feature vector is obtained based on a semantic-spatial distribution feature network; the semantic-spatial distribution feature network is composed of a semantic-spatial distribution layer and an encoder in a generative model;

[0098] The storage location of the spatial data to be stored is calculated based on the semantic-spatial feature vector of the spatial data to be stored, the preset feature vector, and the storage location of the index data;

[0099] The index data of the spatial data to be stored is stored correspondingly according to the storage location of the index data, and the spatial data to be stored is stored correspondingly according to the storage location of the spatial data.

[0100] The description of each module above refers to the corresponding description in the method embodiment and will not be repeated here.

[0101] The present application also provides a non-volatile computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the spatial data semantic query method in any of the above method embodiments.

[0102] Figure 6 A schematic structural diagram of an electronic device according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the electronic device.

[0103] like Figure 6 As shown, the electronic device may include: a processor (processor) 602 , a communication interface (Communications Interface) 604 , a memory (memory) 606 , and a communication bus 608 .

[0104] in:

[0105] The processor 602 , the communication interface 604 , and the memory 606 communicate with each other via a communication bus 608 .

[0106] The communication interface 604 is used to communicate with other devices such as clients or other servers.

[0107] The processor 602 is configured to execute the program 610 , and specifically to execute the relevant steps in the above-mentioned spatial data semantic query method embodiment.

[0108] Specifically, the program 610 may include program codes, which include computer operation instructions.

[0109] Processor 602 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included in an electronic device may be processors of the same type, such as one or more CPUs, or processors of different types, such as one or more CPUs and one or more ASICs.

[0110] The memory 606 is used to store the program 610. The memory 606 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0111] Program 610 can be specifically configured to cause processor 602 to execute the spatial data semantic query method described in any of the aforementioned method embodiments. The specific implementation of each step in program 610 can be found in the corresponding descriptions of the corresponding steps and units in the aforementioned spatial data semantic query embodiments and will not be repeated here. Those skilled in the art will clearly understand that, for ease and brevity of description, the specific operating processes of the devices and modules described above can refer to the corresponding process descriptions in the aforementioned method embodiments and will not be repeated here.

[0112] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general-purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing this type of system. In addition, the present invention is not directed to any specific programming language. It should be understood that various programming languages ​​can be utilized to realize the content of the present invention described herein, and the above description of specific languages ​​is for the purpose of disclosing the best mode of the present invention.

[0113] In the description provided herein, numerous specific details are described. However, it is understood that embodiments of the present invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.

[0114] Similarly, it should be understood that in order to streamline the present disclosure and aid understanding of one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Accordingly, the claims that follow the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of the invention.

[0115] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed herein may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0116] Furthermore, those skilled in the art will appreciate that although some embodiments described herein include certain features included in other embodiments but not other features, combinations of features from different embodiments are intended to be within the scope of the present invention and to form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.

[0117] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the spatial data semantic query device according to an embodiment of the present invention. The present invention may also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0118] It should be noted that the above embodiments illustrate rather than limit the invention, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising several different elements and by means of appropriately programmed computers. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

Claims

1. A spatial data semantic query method, characterized in that the method include: Receive query text information input by the user and transform the query text information to obtain a query term heat-spatial distribution feature vector and a query term spatial region list; wherein, the minimum enclosing rectangle of the query region is constructed based on the spatial coordinates and spatial range, and combined with quadtree calculation, a list of query term spatial regions that intersect with the query spatial position range is obtained; Determine the first index data in the database according to the query spatial area list, and determine the storage location of the first spatial data in the database corresponding to the first index data based on the distance between the query word heat-spatial distribution feature vector and the semantic feature vector of the first index data; wherein, when the spatial data to be stored is stored in the database, for the spatial data to be stored, including index data and spatial data, determine the corresponding node in the database according to the subspace area code of the spatial data to be stored, and calculate the storage location of the index data for storing the spatial data to be stored according to the subspace area code of the spatial data to be stored and the heat-spatial feature vector of each spatial data corresponding to the node; calculate the storage location of the spatial data in the spatial data to be stored according to the storage location of the index data and the semantic-spatial feature vector of the spatial data to be stored obtained by using the semantic-spatial distribution feature network; The database corresponding to the node is queried according to the storage location of the first spatial data to obtain and return a query result containing the first target spatial data.

2. The method according to claim 1, characterized in that The receiving of the query text information input by the user and converting the query text information to obtain the query word heat-spatial distribution feature vector and the query word spatial area list further includes: Receive query text information input by the user, and transform the query text information based on the user's location information to obtain a query term heat-space distribution feature vector; wherein the heat-space distribution feature vector is obtained based on a heat-space distribution feature network; the heat-space distribution feature network is composed of a heat-space distribution layer and an encoder in the generative model; A list of query word space regions that intersect with the query space position range is obtained based on the quadtree calculation.

3. The method according to claim 1, characterized in that The method further comprises: querying the second spatial data stored in the storage queue according to the query text information to obtain the second target spatial data that meets the query text information; The second target spatial data is merged with the first target spatial data in the database to obtain a merged query result.

4. The method according to claim 3, characterized in that The method further comprises: Using a preset process to regularly detect the access popularity of the second space data in the storage queue; Determine whether the access heat is greater than a preset heat threshold; If so, storing the second spatial data in a database; If not, the second spatial data in the storage queue are sorted according to the access popularity, the feature similarity between the second spatial data is calculated, and the sorting is adjusted based on the feature similarity.

5. The method according to claim 1, wherein The querying of the database corresponding to the node according to the storage location of the first spatial data to obtain and return a query result containing the first target spatial data further includes: According to the storage location of the first spatial data, nodes corresponding to the storage location of the first spatial data are searched in parallel in a database to obtain the first target spatial data stored in each node.

6. The method according to claim 1, wherein The method further comprises: Using a quadtree to divide the spatial region into at least two layers of subspace regions, and determining corresponding subspace regions according to spatial coordinate information of each spatial data to be stored; the two layers of subspace regions include an upper-level node subspace region and a lower-level node subspace region; Calculate the heat-space feature vectors of the spatial data to be stored in the subspace regions of each level, and calculate the Euclidean distance between the spatial data to be stored in the upper-level node subspace region and the lower-level node subspace region based on the heat-space feature vectors; determine whether the Euclidean distance is less than a preset distance threshold; if so, update the spatial data to be stored in the lower-level node subspace region to the upper-level node subspace region, and store the spatial data to be stored in the upper-level node subspace region; if not, update the lower-level node spatial region to the upper-level node subspace region, and divide the updated upper-level node subspace region to obtain new lower-level node spatial regions; repeat this step until all the spatial data to be stored are stored.

7. The method according to claim 6, characterized in that The database is a redis database; Storing the space data to be stored further includes: Determining a semantic-spatial feature vector of the spatial data to be stored; wherein the semantic-spatial feature vector is obtained based on a semantic-spatial distribution feature network; the semantic-spatial distribution feature network is composed of a semantic-spatial distribution layer and an encoder in a generative model; Calculating the storage location of the spatial data in the spatial data to be stored based on the semantic-spatial feature vector of the spatial data to be stored, the preset feature vector, and the storage location of the index data; The index data of the spatial data to be stored is stored correspondingly according to the storage location of the index data, and the spatial data to be stored is stored correspondingly according to the storage location of the spatial data in the spatial data to be stored.

8. A spatial data semantic query device, characterized in that: The device includes: A receiving module adapted to receive query text information input by a user and convert the query text information to obtain a query term heat-spatial distribution feature vector and a query term spatial region list; wherein, the minimum enclosing rectangle of the query region is constructed based on the spatial coordinates and the spatial range, and a quadtree calculation is combined to obtain a list of query term spatial regions that intersect with the query spatial position range; A location determination module is adapted to determine first index data in a database based on the query spatial region list, and determine a storage location in the database of first spatial data corresponding to the first index data based on a distance between the query term heat-spatial distribution feature vector and the semantic feature vector of the first index data; wherein, when storing spatial data to be stored in a database, for the spatial data to be stored, including index data and spatial data, a corresponding node in the database is determined based on a subspace region code of the spatial data to be stored, and a storage location of the index data for storing the spatial data to be stored is calculated based on the subspace region code of the spatial data to be stored and the heat-spatial feature vector of each spatial data corresponding to the node; and a storage location of the spatial data in the spatial data to be stored is calculated based on the storage location of the index data and a semantic-spatial feature vector of the spatial data to be stored obtained using a semantic-spatial distribution feature network; The first query module is adapted to query a node corresponding to the database according to the storage location of the first spatial data, and obtain and return a query result containing the first target spatial data.

9. An electronic device comprising: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute an operation corresponding to the spatial data semantic query method according to any one of claims 1 to 7.

10. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, wherein the executable instruction enables a processor to execute operations corresponding to the spatial data semantic query method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Spatial keyword Top-K query method based on spatial-semantic-numerical relevancy

    CN110362652A

  • Spatial text data caching processing method and device, electronic equipment and storage medium

    CN111353012A

  • Data query method and device, electronic equipment and storage medium

    CN112115227A