A spatial structure matching method for spatial text data
By constructing connected graphs and undirected graphs for subgraph matching, the problem of difficulty in accurately representing user query intentions in massive spatial text data is solved, and efficient spatial structure matching and flexibility of query results are achieved.
Patent Information
- Application Number
- CN202111190044.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-13
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2041-10-13
AI Technical Summary
When processing massive spatial text data, it is difficult to accurately represent the user's query intentions, and frequent indexing is required, resulting in inefficiency and redundant calculations.
By constructing a connected graph composed of point-edge collections to represent the spatial structure, including distance and direction constraints, filter out point pairs that meet the conditions, and construct an undirected graph for subgraph matching to achieve spatial structure matching.
This method does not require indexing in advance, avoids redundant calculations, improves query efficiency, and can return query results of different precisions according to user needs, making it more widely applicable.
Smart Images

Figure CN113934944B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of spatial text data, and in particular to a spatial structure matching method oriented to spatial text data. Background Art
[0002] With the increasing popularity of location-based services (LBS), a large amount of spatial geographic location data combined with text data generates a large number of spatial text objects, which are usually called spatial-textual data objects. The processing and analysis of massive spatial text data can further derive various smart city applications. A large number of studies have proposed various methods to query and search spatial text databases. Existing related research mainly includes research on spatial keyword query and spatial pattern matching. Among them, spatial keyword query (SKQ) is mainly divided into spatial query and keyword query, and the goal is to find several objects that contain the query keyword and are closest to the query location. Researchers have pioneered different types of SKQ, such as m-closest keywords query (mCK) [Chan, HKH, Long, C. and Wong, RCW, 2018. On generalizing collective spatial keyword queries. IEEE Transactions on Knowledge and Data Engineering, 30(9), pp. 1712-1726.] and collective spatial keyword query (CoSKQ) [Long, C., Wong, RCW, Wang, K. and Fu, AWC, 2013, June. Collective spatial keyword queries: a distance owner-driven approach. In Proceedings of the 2013 ACM SIGMOD International Conference on Management of Data (pp. 689-700).]. mCK is used to find a group of spatial objects in the database that covers all query keywords and has the smallest diameter, where the diameter represents the distance between the two spatial objects in the object group that are the farthest apart. CoSKQ finds a group of objects in the database that collectively covers a given set of keywords with the smallest cost. Although these SKQs can solve some problems, they only return a set of results with a specific object distribution and cannot accurately represent the user's query intent. The shortcomings of the SKQ method: Traditional SKQ problems generally only consider the maximum distance constraint of the spatial object group, and do not consider the distance limit between object point pairs. Therefore, they cannot support users' fine-grained query requirements in terms of spatial constraints.
[0003] On the other hand, in the study of spatial text data, distance is often a constraint that cannot be ignored, and SKQ cannot capture the distance constraint well and return results that are more in line with the user's query intention. Spatial pattern matching (SPM) can solve the problem of distance constraints. SPM allows users to formulate spatial patterns with multiple keyword objects and distance constraints between different objects as query input, and returns all matching instances in the database that meet the spatial pattern constraints [Fang, Y., Cheng, R., Cong, G., Mamoulis, N. and Li, Y., 2018, April. On spatial pattern matching. In 2018 IEEE 34th International Conference on Data Engineering (ICDE) (pp. 293-304). IEEE.]. The main idea of solving the SPM problem is based on the index structure of the Inverted R-tree, a variant of the R-tree, and multi-way join operations. Researchers proposed the spatial pattern matching algorithm MPJ (Multi-Pair-Join) and its improved algorithm MSJ (Multi-Star-Join) [Fang, Y., Li, Y., Cheng, R., Mamoulis, N. and Cong, G., 2019. Evaluating pattern matching queries for spatial databases. The VLDB Journal, 28 (5), pp. 649-673.]. Both MPJ and MSJ are based on the PJ (Pair-Join) algorithm. The main idea of the PJ algorithm is to find matching node pairs in each layer of the IR tree node from top to bottom, then search the child nodes of these matching node pairs, find the matching node pairs of the next layer in them, and repeat the downward search operation until all matches of the edges are found in the IR tree child node layer. After obtaining all the required edges, MPJ connects all isolated edges with the same endpoints according to a certain connection order to form a set, and finally forms a result point set as the return result. MSJ first improves the spatial pattern proposed by the user to a certain extent (there is a distance range for the edges in the spatial pattern, and some endpoints are connected to multiple points at the same time, which will cause some distance ranges to be redundant), then calculates the number of matching nodes of all edges to calculate the connection order, and uses star pruning (if the number of neighbors around the spatial text object is less than the number of neighbors of the matching point in the spatial pattern, it can be directly pruned) to filter out unsatisfied edges, and finally connects the matches of each edge according to the connection order to obtain a match.The shortcomings of the above research: The MPJ and MSJ algorithms for solving SPM first need to establish a static IR tree index for the spatial text database and search on the index structure. Therefore, the dynamically changing spatial text database will lead to frequent indexing operations. In large-scale spatial text object databases, SPM may return many results with only keywords and point distance constraints. Summary of the invention
[0004] The purpose of the present invention is to provide a spatial structure matching method for spatial text data, which can solve the problem of excessive redundant queries of spatial text object relationships and the need to consume a certain amount of disk space to establish indexes. Specifically, a specific spatial structure style is proposed for the user, and the spatial structure style includes a certain number of spatial objects, which have different spatial keywords, and any two spatial object points may have a certain distance and direction constraints, and all specific object point sets that meet the user's needs are queried in a massive spatial text database.
[0005] In order to achieve the above technical objectives, the present invention adopts the following scheme:
[0006] A spatial structure matching method for spatial text data, comprising:
[0007] S1 constructs a connected graph consisting of a set of points and edges to represent the spatial structure. Each object point in the point set is assigned a keyword attribute. Each edge in the edge set contains a distance constraint interval and a direction constraint interval. The maximum distance d in the spatial structure is determined based on the distance constraint interval of the spatial structure. max ;
[0008] S2: screening the spatial text database according to the keywords contained in the spatial structure, and putting the object points in the spatial text database having the keywords contained in the point set into the candidate set; the spatial text database is a database recording the information of all object points, and the information of the object points contains the keywords;
[0009] S3 selects candidates whose distance in a certain direction is less than d max The point pair;
[0010] S4 re-screens the point pairs screened out in S3 based on the keyword attributes, distance constraint intervals, and direction constraint intervals contained in the spatial structure to obtain point pairs that meet the conditions;
[0011] S5 constructs an undirected graph using the point pairs screened out in S4, and builds a query subgraph based on the spatial structure. It searches for subgraphs in the undirected graph constructed by S5 through subgraph matching to complete spatial structure matching.
[0012] As a preferred implementation, in S3, the candidate set is screened to find maxThe point pairs are:
[0013] With each object point as the center, d max Construct object point circle for diameter;
[0014] Project each object point circle onto the y-axis, and generate projections of the upper and lower bounds of the circle on the y-axis. Analyze the distribution of the upper and lower bounds of the object point circle to obtain the intersection of the circles, and determine the point pairs corresponding to the intersecting object point circles. The present invention quickly determines the circles of object points that may intersect by projecting on the y-axis, and then further checks the distance and direction of the selected intersection points.
[0015] Furthermore, the S3 also includes:
[0016] The minimum and maximum values of the horizontal coordinates of all object points in the spatial text database are used as the left and right boundaries, n·d max As the span of the partition, the spatial text database is divided into several regions, and n is a positive integer;
[0017] After determining the partition where each object point in the candidate set is located, project each object point circle onto the y-axis. The upper and lower bounds of the circle are projected on the y-axis. Analyze the upper and lower bounds of the object point circle in each partition to obtain the circle intersection situation, and obtain the point pairs corresponding to the intersecting object point circles in each partition.
[0018] As a preferred implementation, the method of analyzing the upper and lower bounds of the object point circle to obtain the circle intersection situation includes:
[0019] Traverse the lower and upper bounds of the circle within each partition by linear scanning;
[0020] Establish a key-value mapping table, in which the key value is the object point, and the mapping content is the set of other object points that intersect with the projection of the object point circle;
[0021] Scan all object point circles from top to bottom. When scanning to the top of an object point circle, add the corresponding object point to the intersection object set of each object point with existing key values in the key-value mapping table, then add the new key value of the object point in the key-value mapping table, and assign the intersection object set of the object point to an empty set. When scanning to the bottom of the object point circle, all other object points intersecting with the object point have been found, and the intersection object set of the object point is retained in the result set, and the key value of the object point is deleted from the key-value mapping table. After scanning all object point circles, the result set contains the required point pairs.
[0022] As a preferred implementation, the partition where each object point in the candidate set is located is determined by calculating according to its horizontal coordinate value x x min is the left boundary, and the result is the partition;
[0023] If an object is ≤d from any partition boundary max , then the object belongs to both partitions connected by the partition boundary.
[0024] Preferably, the size of n is determined according to the distribution of object points. The partition span will affect the computational efficiency and memory overhead, and needs to be selected with reference to the actual object distribution. Large partitions are more likely to produce misjudgments that two object point circles do not intersect but their projections intersect, which brings additional verification computation overhead; while small partitions may separate more object point circles. In order to avoid missing intersections, the segmented object point circles need to consider their intersections with other object point circles in two partitions, which will bring additional computational and storage overhead.
[0025] As a preferred implementation, the information of the object point in the spatial text database also includes the longitude and latitude of the object point.
[0026] As a preferred implementation, in S5, an undirected graph is constructed using the object points screened out in S4 as vertices and the connection relationships between point pairs as edges of corresponding vertices.
[0027] As a preferred implementation, in S5, the VF3 algorithm [Carletti V, Foggia P, Saggese A, Vento M. Challenging the time complexity of exact subgraphisomorphism for huge and dense graphs with VF3. IEEE transactions on patternanalysis and machine intelligence. 2017Apr 24; 40(4): 804-18.] is used to implement subgraph matching.
[0028] As a preferred implementation, S5 further includes performing a matching check on the results returned by the subgraph matching. If the edges of the returned subgraph all have corresponding matching edges in the query subgraph, the spatial structure matching is completed.
[0029] In a complex urban structure, a spatial pattern can not only have the constraints of keywords and distance, but also further consider the constraints provided by direction, thereby reducing many inaccurate results and making them more in line with the user's intention. The present invention defines a spatial structure matching (Spatial structure matching, SSM) query and attempts to solve this problem. It allows users to provide specified keyword objects and assign them structural constraints of distance and direction, thereby forming a pattern with a specific spatial structure. SSM queries a large spatial text database according to the specified pattern, and finally returns a set of all spatial text objects in the spatial text database that match the pattern.
[0030] The spatial structure matching method of the present invention does not need to establish an index structure in advance, avoids redundant calculation operations, and improves the efficiency of the query. In addition, the proposed method can return query results of different precisions according to different needs of users and different inputs of users, making the method of the present invention more flexible and more widely applicable. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 This is a schematic diagram of the spatial structure matching SSM process. Figure 1 (a) is the spatial structure S, which contains keyword information and the distance interval dist and direction interval dir of each edge; Figure 1 (b) is the distribution of each object in the spatial text data D; Figure 1 The dashed box in (c) shows the returned result of S’s query in D.
[0032] Figure 2 It is a schematic diagram of the partition structure. a etc. are spatial text objects, and P1, P2, P3, etc. are partitions.
[0033] Figure 3 Schematic diagram of the projection of the circle on the y-axis.
[0034] Figure 4 is an undirected graph constructed, where: (a) shows the undirected graph G constructed based on S s ; (b) shows the undirected graph G constructed based on R2, where the dotted box is G s The returned results of the query in G.
[0035] Figure 5 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0036] The purpose of the present invention is to provide a spatial structure matching method for spatial text data. A user provides a spatial structure pattern and queries all result sets that meet the constraints of the spatial structure pattern in the spatial text database. Figure 1 As shown, Figure 1 (a) Provide the user with a spatial structure pattern S, which includes keyword information and the distance interval dist and direction interval dir of each edge; Figure 1 (b) is the distribution of all objects in the spatial text database D, Figure 1 (c) is the query result of S in D. In order to solve the above technical problems, the present invention adopts the following technical solutions.
[0037] A spatial structure matching method for spatial text data comprises the following steps:
[0038] Step 1 The user sends the spatial structure S to the server. The submitted spatial structure style is a connected graph S = {P, E} consisting of a point set P and an edge set E. The points in the point set P represent objects, and the edges in the edge set E connect two points, representing the relationship between objects. Each point in the point set has a keyword attribute, and the two endpoints of each edge in the edge set each have a keyword. The edge contains a distance constraint interval and a direction constraint interval.
[0039] The server resolves the maximum distance d in the spatial structure based on the distance constraint interval of the spatial structure. max .
[0040] Figure 1 The edge set (a collection of object relationships) in the example of (a) has the same distance constraint interval and direction constraint interval. The maximum distance d in the diagram is max is 100m; for spatial structures with different distance constraint intervals and direction constraint intervals, the largest distance in the distance constraint intervals of all edges is selected as d max .
[0041] Step 2 The server screens and filters the spatial text database D according to the keywords contained in P, and puts the object points with the keywords contained in P into the candidate set CR.
[0042] Step 3 Take the minimum value x of the horizontal coordinate value of all object points in D min and the maximum value x max As the left and right boundaries of the space of D, n·d max The span as the partition divides the space of D into several regions, where n is a positive integer.
[0043] For the object point in CR, calculate according to its horizontal coordinate value x (i.e., the number of d in which the object is calculated max The position of the partition is determined by rounding up. Figure 2 For example, x min and x max The distance between them is 12 d max, n=4 in the schematic diagram, that is, 4·d max As the partition span, the space of D is divided into P1, P2, and P33 partitions. In particular, if an object is ≤ d from any partition boundary max , then the object belongs to both partitions connected by the partition boundary.
[0044] Step 4 constructs a diameter d for each object point in each partition. max If two circles intersect, it means that the distance between the objects that generate the two circles is less than or equal to d max , so we only need to pay attention to whether the two circles intersect to avoid calculating two objects at a longer distance.
[0045] The present invention first screens out the candidate set whose distance in a certain direction is less than d max Point pairs are then checked and screened to find the point pairs that meet the requirements. In this embodiment, the circle is projected onto the y-axis. Each circle will have an upper bound and a lower bound. By analyzing the distribution of the upper and lower bounds of each circle, the intersection of the circles can be obtained. The candidate set with a vertical distance less than d is screened. max Point pair. Figure 3 As shown, a , O b , O c For the example object point (origin), construct diameter d max The highest and lowest points of the circle are projected on the y-axis, and the upper and lower bounds of the circle in each partition are traversed by linear scanning. The method includes: establishing a key-value mapping table M to record the intersection object point set of each object point in the execution process, scanning all circles from top to bottom (line segments projected on the y-axis), and whenever the top of the projection line segment corresponding to an object point is scanned, the object point is added to the intersection object point set of each object point with a key value in M, and then the new key value of the object point is added to M, and its intersection object set is assigned an empty set; if the bottom of an object is scanned, then all other objects intersecting with this object have been found, and the intersection object set of this object can be retained in the result set R1, and the key value of this object is deleted from M, and R1 is returned after all circles are scanned.
[0046] by Figure 3 For example, when scanning to O a At the top, add object point O to M a The new key value of , and assign its intersection object set to an empty set, and continue scanning down to O b At the top, O b Add to O a The intersection object set of M and add the object point O to M b , and give O bThe intersection object set of is assigned to an empty set; continue scanning to O a The bottom end is a All other objects that intersect have been found, i.e. O a The set of intersecting objects is {O b}, you can a :{O b} is retained in the result set R1, and the object point O a The key value is deleted from M. At this time, all circles have not been scanned yet, and the scan continues down to O b Bottom, object point O b After scanning, the intersection object set is empty, and the object point O b The key value is deleted from M. Similarly, continue scanning down to the object point O c At the top, add object point O in M c , and give O c The intersection object set of is assigned to an empty set; continue scanning down to O c Bottom, object point O c After scanning, the intersection object set is empty, and the object point O c The key value of is deleted from M. After scanning all circles, return to R1. R1 = {O a :{O b}}, only O a , O b A point right.
[0047] Step 5 R1 has all vertical distances less than d max The point pair relationship of R1 is filtered more carefully through the specific constraints of dist and dir. First, it is necessary to check whether the keyword pair contained in the point pair belongs to S. For the point pair whose keyword pair belongs to S, the direction and distance of the point pair are calculated and it is determined whether it is in the distance interval and direction interval of the corresponding keyword pair in S. If it is satisfied, it is retained in R2.
[0048] Step 6 After filtering, all object point-to-point relationships in R2 will always satisfy the constraint conditions of one of the edges in S. However, a single point-to-point relationship does not meet the requirements of the query results. It is necessary to aggregate the scattered object point-to-point relationships into a point set and return it to the user. Use all point-to-point relationships in R2 to construct an undirected graph G. Specifically, use the object points in R2 as vertices in the undirected graph G, and the connection relationship of the point pairs in R2 as the edge of the corresponding vertex in the undirected graph G to construct the undirected graph G. Each point in G has a unique id value and keyword attribute, and the edge in G contains the id values of the two connected points. G is likely to be a non-connected graph. S has a connection relationship between keywords and points, and can construct a subgraph G for query. s(also an undirected graph), we use the subgraph matching method to find the result. Specifically, we find G s =(V s ,E s ) and G=(V,E) that is, there exists a function f: V s →V and (u,v)∈E s So that (f(u), f(v))∈E also holds. The classic VF3 algorithm is used to solve the subgraph matching problem [Carletti, V., Foggia, P., Saggese, A. and Vento, M., 2017. Challenging the time complexity of exact subgraph isomorphism for huge and dense graphs with VF3. IEEE transactions on pattern analysis and machine intelligence, 40(4), pp. 804-818.], and then the results returned by the subgraph matching are checked for matching. Since all the object point pairs in G already meet the three constraints of S: keywords, spatial distance and direction, it is only necessary to check that each edge of the subgraph obtained by subgraph matching can correctly and uniquely match the query subgraph G. s Just map the edges one by one.
[0049] Appendix: Symbol annotations involved in the method:
[0050]
Claims
1. A spatial structure matching method for spatial text data, characterized in that: include: S1 constructs a connected graph consisting of a set of points and edges to represent the spatial structure. Each object point in the point set is assigned a keyword attribute. Each edge in the edge set contains a distance constraint interval and a direction constraint interval. The maximum distance in the spatial structure is determined based on the distance constraint interval of the spatial structure. ; S2: screening the spatial text database according to the keywords contained in the spatial structure, and putting the object points in the spatial text database having the keywords contained in the point set into the candidate set; the spatial text database is a database recording the information of all object points, and the information of the object points contains the keywords; S3 selects the candidate set whose distance in a certain direction is less than The point pair; S4 re-screens the point pairs screened out in S3 based on the keyword attributes, distance constraint intervals, and direction constraint intervals contained in the spatial structure to obtain point pairs that meet the conditions; S5 constructs an undirected graph using the point pairs screened out in S4, and builds a query subgraph based on the spatial structure. It searches for subgraphs in the undirected graph constructed by S5 through subgraph matching to complete spatial structure matching.
2. The method according to claim 1, characterized in that In S3, the candidate set with a vertical distance less than The point pairs are: With each object point as the center, Construct object point circle for diameter; Project each object point circle onto Axis, the upper and lower boundaries of the circle are The axis generates a projection, analyzes the upper and lower bounds of the object point circle to obtain the circle intersection situation, and determines the point pairs corresponding to the intersecting object point circles.
3. The method according to claim 2, characterized in that Also includes: The minimum and maximum values of the horizontal coordinates of all object points in the spatial text database are used as the left and right boundaries. As the span of the partition, the spatial text database is divided into several regions. is a positive integer; After determining the partition where each object point in the candidate set is located, project each object point circle onto Axis, the upper and lower boundaries of the circle are The projection is generated on the axis, and the upper and lower bounds of the object point circles in each partition are analyzed to obtain the circle intersection situation, and the point pairs corresponding to the intersecting object point circles in each partition are obtained.
4. The method according to claim 2 or 3, characterized in that: The method of analyzing the upper and lower bounds of the object point circle to obtain the intersection of the circles includes: Traverse the lower and upper bounds of the circle within each partition by linear scanning; Establish a key-value mapping table, in which the key value is the object point, and the mapping content is the set of other object points that intersect with the projection of the object point circle; Scan all object point circles from top to bottom. When scanning to the top of an object point circle, add the corresponding object point to the intersection object set of each object point with existing key values in the key-value mapping table, then add the new key value of the object point in the key-value mapping table, and assign the intersection object set of the object point to an empty set. When scanning to the bottom of the object point circle, all other object points intersecting with the object point have been found, and the intersection object set of the object point is retained in the result set, and the key value of the object point is deleted from the key-value mapping table. After scanning all object point circles, the result set contains the required point pairs.
5. The method according to claim 3, characterized in that: The partition where each object point in the candidate set is located is determined by: Perform calculations , is the left boundary, and the result is the partition; If an object is ≤ , then the object belongs to both partitions connected by the partition boundary.
6. The method according to claim 3, characterized in that: Said The size of is determined according to the distribution of object points.
7. The method according to claim 1, characterized in that The information of the object point in the spatial text database also includes the longitude and latitude of the object point.
8. The method according to claim 1, characterized in that In S5, an undirected graph is constructed using the object points screened out in S4 as vertices and the connection relationships between the point pairs as the edges of the corresponding vertices.
9. The method according to claim 1, characterized in that: In S5, the VF3 algorithm is used to implement subgraph matching.
10. The method according to claim 1, characterized in that The S5 further includes performing a matching check on the results returned by the subgraph matching. If the edges of the returned subgraph all have corresponding matching edges in the query subgraph, the spatial structure matching is completed.
Citation Information
Patent Citations
Semantic understanding based space keyword indexing method
CN105069094A
Set keyword query method based on graph data
CN105740246A