Spatio-Temporal Semantic Query Optimization Method Integrating Property Graph Database and Relational Database

Through the hybrid storage method of GDBMS and RDBMS, combined with MTT indexing and Geohash encoding, the performance problems of GDBMS in spatiotemporal data management are solved, and efficient spatiotemporal semantic query and the expression of complex topological relationships are realized.

CN119003832BActive Publication Date: 2025-07-29BEIJING SCI & TECH PATENT OFFICE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410866535.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2025-07-29
Estimated Expiration
2044-07-01

AI Technical Summary

Technical Problem

Existing GDBMS systems are difficult to efficiently store and manage large-scale spatiotemporal data, resulting in a degradation in spatiotemporal semantic query performance and cannot meet the needs of geospatial applications.

Method used

The hybrid storage method of GDBMS and RDBMS is adopted, combined with MTT indexing and Geohash encoding, and cross-store mapping and query conversion mechanism are designed to optimize the storage and query process of spatiotemporal data.

Benefits of technology

It significantly improves the efficiency of spatiotemporal semantic queries, supports semantic expression of complex spatial topological relationships, and keeps the performance of non-spatiotemporal semantic queries unaffected.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003832B_ABST
    Figure CN119003832B_ABST
Patent Text Reader

Abstract

The present invention proposes a spatio-temporal semantic query optimization method that integrates an attribute graph database and a relational database. It belongs to database querying, and uses a hybrid storage method of GDBMS and RDBMS to manage spatio-temporal data, and optimizes the indexing of spatio-temporal entities through specific indexing strategies. In the time dimension, MTT indexing and time table partitioning are used; in the space dimension, Geohash encoding is adopted for partitioning. A spatio-temporal entity semantic link between databases is established through an entity association mechanism based on object mapping. The hybrid query is converted into executable sub-queries for GDBMS and RDBMS, and data synchronization is performed between the two databases. The method of the present invention can bridge the attribute graph and the spatial engine to achieve efficient spatio-temporal semantic querying. The cross-database spatio-temporal encoding index accelerates graph traversal and pattern matching. It supports customizable geo-spatio-temporal analysis and enhances semantic representation capabilities. The lightweight and low-code architecture is conducive to integration with existing GIS platforms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of database query, and more specifically, relates to a spatio-temporal semantic query optimization method that integrates property graph databases and relational databases. Background Art

[0002] With the rapid development of technologies such as mobile Internet, geographic information systems, and remote sensing, a vast amount of spatio-temporal data has been generated in fields such as location-based services, smart cities, and environmental monitoring. The rich spatio-temporal data records the operating states of human society and the natural environment from different granularities, levels, and perspectives. However, the data itself has no meaning on its own, and only data with assigned meanings can be used. The meaning of data is semantics, which can be regarded as the concepts and meanings represented by the real things corresponding to the data and the relationships between these meanings, and is the interpretation and logical representation of data in a certain field. Understanding the semantics expressed by spatio-temporal data is of great significance for urban management, public service optimization, resource and environmental monitoring, and improving disaster response. As a structured semantic representation method, a graph can effectively model entities, concepts, and their relationships. The combination of graphs and spatio-temporal data enables users to issue graph queries with spatio-temporal semantics.

[0003] However, when there are a large number of complex semantic associations between data, the RDBMS needs to use multi-table JOIN operations to process complex queries, resulting in a significant decline in query performance. In recent years, knowledge graph and Graph Database Management System (GDBMS) technologies have provided new ideas for solving this problem. GDBMS directly represents entities and their relationships with nodes and edges, and through efficient graph traversal and pattern matching algorithms, it can process complex association queries. In particular, if the relationships are explicitly defined for each node, traversing the relationships in GDBMS has a constant time complexity of O(1). This enables GDBMS to maintain good query response performance when facing large-scale associated data. Among them, the general GDBMS represented by Labeled Property Graph (LPG) shows unique advantages in semantic modeling with its schema-free data model and powerful graph query language. However, when knowledge graph technology is adopted in geospatial applications, existing GDBMS systems are difficult to store large-scale spatio-temporal data and efficiently support spatio-temporal semantic queries. GDBMS lacking appropriate query optimization mechanisms will also have a negative impact on the performance of geospatial applications that rely on knowledge graph technology.

[0004] Existing studies have shown that there are limitations in directly applying GDBMS to spatio-temporal data management. This is mainly because GDBMS was not designed to natively support spatio-temporal data types and operations from the beginning. For example, spatio-temporal information is attached as an attribute to the nodes or edges of a graph, resulting in its inability to fully utilize the locality principle of spatio-temporal data during storage and retrieval. In addition, the index structures and query algorithms adopted by existing GDBMS are difficult to efficiently support the pruning and aggregation calculations of spatio-temporal data. When the data scale increases, a large number of random I / Os are easily generated, leading to a decline in query performance and making it difficult to meet the requirements of GIS applications for spatio-temporal query efficiency and expression ability.

[0005] In summary, although GDBMS has advantages in expressing complex semantics, it is difficult to be directly applied to the management and query of massive spatio-temporal data. In this sense, a hybrid data management system that integrates two database paradigms (relational and graph) can overcome their respective limitations. Summary of the Invention

[0006] The present invention proposes a spatio-temporal semantic query optimization method GraST that integrates an attribute graph database and a relational database, aiming to design an efficient spatio-temporal query optimization mechanism for LPG. This method establishes associations between semantic networks and spatio-temporal objects between graphs and spatial databases by designing mechanisms such as hybrid indexing, cross-database mapping, and query transformation, and designs an efficient spatio-temporal data storage mode and association mechanism, significantly improving the efficiency of spatio-temporal semantic queries in the LPG database, supporting the semantic expression of complex spatial topological relationships, and not incurring overhead on the performance of non-spatio-temporal semantic queries. Using real large-scale datasets for experimental evaluation and comparing the spatio-temporal query efficiency with existing semantic repositories, GraST has achieved better results in terms of query efficiency, semantic expression ability, etc.

[0007] To achieve the above objectives, the present invention is implemented by adopting the following technical solutions:

[0008] Optimization of spatio-temporal data storage, adopting a hybrid storage method of GDBMS and RDBMS to manage spatio-temporal data;

[0009] Optimization of spatio-temporal entity indexing, designing specific indexing strategies for spatio-temporal semantics to optimize the organization and retrieval efficiency of spatio-temporal data; in the time dimension, adopting MTT indexing and time table partitioning; in the space dimension, adopting Geohash encoding for grid division;

[0010] Association mapping of spatio-temporal entities, introducing an entity association mechanism based on object mapping, and establishing spatio-temporal entity semantic links between heterogeneous databases by defining a unified object identification specification and cross-database mapping metadata;

[0011] Parsing and transformation of spatio-temporal queries, converting hybrid queries that integrate graph semantics and spatio-temporal semantics into executable sub-queries for GDBMS and RDBMS; the query coordinator automatically identifies spatio-temporal calculation operations during the execution of the graph query language, pushes them down to the RDBMS for execution, and realizes collaborative computing between the two databases;

[0012] Cross-database data synchronization. To ensure data consistency between heterogeneous databases, a unified object view is established for heterogeneous spatio-temporal data in different databases, and message queue middleware is used to achieve real-time synchronization between RDBMS and GDBMS;

[0013] Through comparative experiments on real datasets, evaluate the performance of the spatio-temporal semantic query optimization method in spatio-temporal semantic queries.

[0014] In one solution, the storage optimization of the spatio-temporal data includes:

[0015] GDBMS storage and optimization. In GDBMS, only the key attributes of spatio-temporal objects are stored, including:

[0016] (1) Entity ID: As a globally unique identifier, it is used to associate with the corresponding entity in the RDBMS;

[0017] (2) Entity type: Represents the semantic category to which the entity belongs, such as POI, road, and is used for semantic queries and type filtering;

[0018] (3) Attribute set: In the form of key-value pairs, store other non-spatio-temporal attributes of spatio-temporal objects;

[0019] RDBMS storage and optimization. In the RDBMS, the "wide table" mode is adopted, and full-attribute columns are defined for each type of spatio-temporal object, including:

[0020] (1) Entity ID: As the primary key of the table, it corresponds to the vertex ID in the GDBMS and is used for cross-database association;

[0021] (2) Spatial attributes: Include the geometric type, coordinate sequence, pixel sequence, spatial partition, and spatial reference system of the entity;

[0022] (3) Temporal attributes: Include the timestamp, time interval, and time granularity of the entity, supporting two data types: moment and period;

[0023] (4) Other attributes: Other semantic attributes of the entity, including name, category, and status.

[0024] In one solution, the index optimization of the spatio-temporal entity includes:

[0025] Multi-granularity time tree

[0026] Adopt MTT indexing in the time dimension, divide the time axis into intervals of multiple granularities, and organize them into a hierarchical tree structure; each layer of the tree corresponds to a time granularity, the upper-level nodes represent coarse-grained intervals, the lower-level nodes represent fine-grained intervals, and there is an inclusion relationship between parent and child nodes;

[0027] Geohash spatial partitioning

[0028] In the spatial dimension, use Geohash encoding to perform grid partitioning and indexing on the two-dimensional geographical space; Geohash uses the Z-order space-filling curve to map longitude and latitude into string encodings; the encoding length determines the spatial partitioning granularity, short encodings correspond to coarse-grained grids, and long encodings correspond to fine-grained grids;

[0029] Geohash encoding process: First, divide the spatial range according to longitude and latitude and encode it as: 00 lower left, 01 upper left, 11 upper right, 10 lower right; then, recursively divide each area until the preset encoding length is reached; finally, map the binary encoding to alphanumeric characters to obtain the Geohash encoding.

[0030] In one solution, for the associated mapping of the spatio-temporal entity, design a special mapping table in the RDBMS to store the correspondence between the GDBMS vertex type and the RDBMS table name; during query, according to the vertex entity type attribute, GraST automatically routes to the corresponding entity table in the RDBMS, and then retrieves the corresponding spatio-temporal object record according to the vertex entity ID;

[0031] In the cross-database associated query, utilize the multi-dimensional attributes of spatio-temporal vertices to achieve efficient spatio-temporal pruning;

[0032] First, use the vertex set timestamp and Geohash encoding to filter the relationship table in the spatio-temporal dimension to quickly narrow down the range of potential matching records; then, use the vertex entity ID for exact matching to find the corresponding spatio-temporal object record of this vertex in the RDBMS.

[0033] In one solution, the parsing and transformation of the spatio-temporal query includes four key modules;

[0034] (1) Clause parser: Perform syntactic and semantic analysis on the graph query statement, and extract the query graph pattern, filtering conditions, and projection columns;

[0035] (2) Spatio-temporal predicate recognizer: Identify the spatio-temporal calculation operations that need to be pushed down to the RDBMS from the filtering conditions, including spatial topological relationships, distance metrics, and time relationships;

[0036] (3) SQL converter: Convert the identified spatio-temporal predicates into equivalent SQL fragments, and apply the RDBMS spatio-temporal index to optimize the query;

[0037] (4) Query Execution Engine: Adopting the "graph - end - dominant, relational - end - collaborative" execution mode, it decomposes the hybrid query into a graph - end sub - query and a relational - end sub - query;

[0038] When the graph - end sub - query encounters a spatio - temporal predicate, it suspends and pushes down the SQL sub - query to the relational end for execution. After obtaining the entity IDs that meet the conditions, it restarts the spatio - temporal predicate operator and continues to execute until the final result is generated.

[0039] In one solution, for the cross - database data synchronization, the predefined ETL adaptor is used to convert data from multiple sources such as relational tables, raster images, and vectors into a unified spatio - temporal object model, automatically extracts spatio - temporal partition information, generates multi - granularity spatio - temporal indexes, and imports them into the GDBMS and RDBMS in parallel;

[0040] In cross - database synchronization, an object - based incremental synchronization mode is adopted; when the spatio - temporal objects at the relational end change, the ORM component publishes the changes to the message queue in the form of messages; the OGM component subscribes to the messages and performs corresponding synchronization operations in the GDBMS to ensure data consistency between the two databases;

[0041] In distributed transaction processing, a two - phase commit protocol is adopted, which is uniformly scheduled by the global transaction coordinator to ensure the atomicity and consistency of cross - database transactions.

[0042] In one solution, for the comparative experiment, multiple GDBMSs are selected as the benchmark systems, and on the query set covering typical application scenarios, the key performance indicators of the spatio - temporal semantic query optimization method and the benchmark systems are compared and analyzed.

[0043] Advantages of the present invention:

[0044] The present invention establishes an association between the semantic network and spatio - temporal objects between the graph and the spatial database, designs an efficient spatio - temporal data storage mode and association mechanism, significantly improves the efficiency of spatio - temporal semantic queries in the LPG database, supports the semantic expression of complex spatial topological relationships, and does not cause overhead to the performance of non - spatio - temporal semantic queries. Experimental evaluation is carried out using real large - scale data sets, and the spatio - temporal query efficiency is compared with existing semantic repositories. GraST has achieved better results in terms of query efficiency, semantic expression ability, etc. Brief Description of the Drawings

[0045] Figure 1 It is the query processing flow of the method GraST of the present invention;

[0046] Figure 2 It is the hybrid storage architecture of the method GraST of the present invention;

[0047] Figure 3For the GDBMS in the GraST method of the present invention, two types of special index graphs are additionally maintained: a time index graph and a space index graph;

[0048] Figure 4 For the multi-temporal storage mode of the data of the method of the present invention;

[0049] Figure 5 For the schematic diagram of the hierarchical structure of MTT;

[0050] Figure 6 For the generation process of Geohash encoding;

[0051] Figure 7 For the overall process of cross-database mapping of spatio-temporal entities in the GraST method of the present invention;

[0052] Figure 8 For the overall process of query parsing and transformation of the present invention;

[0053] Figure 9 For the data synchronization process of the cross-database coordinator of the present invention;

[0054] Figure 10 For the overall architecture of the GraST prototype system of the method of the present invention. Detailed implementation mode

[0055] To facilitate the understanding of the present invention, the present invention will be described more comprehensively below with reference to the relevant drawings. Typical embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described in the present invention. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0056] Unless otherwise defined, all technical and scientific terms used in the present invention have the same meaning as understood by those skilled in the technical field to which the present invention belongs. The terms used in the description of the present invention in the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0057] The present invention proposes a spatio-temporal semantic query optimization method GraST that integrates an attribute graph database and a relational database. This method stores complete spatio-temporal objects in a relational database (through a built-in or extended spatial data engine of the relational database) and performs spatio-temporal partitioning through Hypertable. In the graph database, spatio-temporal vertices adopt a lightweight storage strategy and are associated with a cross-database multi-granularity time tree index and Geohash spatial encoding to optimize the matching efficiency with relational tables. During querying, the user's query is decomposed into graph semantic search and spatio-temporal semantic analysis, which are respectively pushed down to the graph database and the relational database for execution, and a hybrid index is used to narrow the search space. In addition, GraST also provides an incremental synchronization mechanism based on a message queue to support dynamic spatio-temporal data management. In this embodiment, a GraST prototype system is implemented by integrating PostGIS and Neo4j, and query performance tests are carried out on a large-scale real dataset. Experiments show that GraST shortens the query response time by 1-2 orders of magnitude and at the same time supports the expression of more complex spatio-temporal topological relationships. Figure 1 Schematically shows the query processing flow of this method.

[0058] In view of the characteristics of spatio-temporal data, the method GraST of the present invention adopts a hybrid storage framework, organizes a semantic network in the GDBMS, and stores complete spatio-temporal attributes in the RDBMS. On this basis, GraST introduces a cross-database Multi-granularity time tree (MTT) index and a Geohash spatial index to accelerate spatio-temporal pruning in hybrid queries. In addition, GraST also designs entity mapping, query rewriting, and incremental update mechanisms to support the efficient execution of hybrid queries and the maintenance of data consistency. Figure 2 Shows the hybrid storage architecture of GraST.

[0059] Regarding the storage optimization of spatio-temporal data, GraST uses a hybrid storage method of GDBMS and RDBMS to manage spatio-temporal data. In the GDBMS, GraST adopts a lightweight storage strategy for spatio-temporal vertices. While in the RDBMS, GraST stores the complete information of spatio-temporal objects. The spatio-temporal data storage optimization schemes of GraST in the GDBMS and RDBMS are introduced separately.

[0060] Regarding GDBMS storage and optimization, traditional LPG usually stores all attributes of spatio-temporal objects in vertices or edges, resulting in vertex data expansion and affecting the query and traversal efficiency of the graph. To address this problem, GraST only stores the key attributes of spatio-temporal objects in the GDBMS, including:

[0061] (1) Entity ID: As a globally unique identifier, it is used to associate with the corresponding entity in the RDBMS.

[0062] (2) Entity type: Represents the semantic category to which an entity belongs, such as POI, road, etc., and is used for semantic queries and type filtering.

[0063] (3) Attribute set: Stores other non-spatiotemporal attributes of spatiotemporal objects in the form of key-value pairs.

[0064] It should be noted that spatiotemporal vertices do not directly store complete spatiotemporal information, but are connected to a dedicated index graph through LinkEdge, as Figure 3 shown. In GraST, the GDBMS additionally maintains two types of special index graphs: the time index graph and the space index graph. The time index graph uses MTT to organize and retrieve temporal data. The space index graph uses Geohash encoding to grid and encode the two-dimensional geographical space. This "index graph + link edge" design pattern delegates the spatiotemporal attributes of spatiotemporal vertices to an efficient index structure, while keeping the vertices themselves lightweight. GraST can achieve efficient spatiotemporal pruning at the subgraph level, quickly locate vertices that meet spatiotemporal conditions, and then combine with the original graph traversal and pattern matching capabilities of the GDBMS to achieve querying and analysis of large-scale spatiotemporal semantic networks. The specific construction methods of MTT and Geohash will be introduced in detail later.

[0065] For RDBMS storage and optimization, in the RDBMS, GraST adopts the "wide table" mode, defining full-attribute columns for each type of spatiotemporal object, including:

[0066] (1) Entity ID: Serves as the primary key of the table, corresponding to the vertex ID in the GDBMS, and is used for cross-database association.

[0067] (2) Spatial attributes: Include the geometric type of the entity, coordinate sequence (vector), pixel sequence (raster), spatial partition, spatial reference system, etc.

[0068] (3) Time attributes: Include the timestamp, time interval, time granularity, etc. of the entity, and support two data types: moment and period.

[0069] (4) Other attributes: Other semantic attributes of the entity, such as name, category, status, etc.

[0070] For spatiotemporal objects of vector type, the relationship table directly stores their geometric information in the form of Well-Known Text (WKT). For spatiotemporal objects of raster type with a large volume, the "image slice" method is used for storage optimization. The original raster is cut into grid-like image blocks according to Geohash partitions and converted into binary data for storage, while extracting raster metadata and storing it in an independent metadata table.

[0071] To support the management of temporal data, GraST adopts a multi-version storage mode in the RDBMS. It organizes homogeneous spatio-temporal objects into Hypertables according to the time span, and further divides the Hypertable into multiple time-partitioned tables according to the predefined time-partitioning granularity. During query, the relevant partitioned tables are determined according to the time conditions, and then time predicate filtering is performed. In addition, GraST specifically designs an entity mapping table to record the correspondence between the relational table and the graph vertex type. Figure 4 It shows the multi-temporal storage mode of data. It includes multiple time-partitioned tables such as "T1", "T2", etc. Each time-partitioned table records the dynamic attributes of the spatial object during that time period.

[0072] In terms of temporal semantic expression, GraST extends the temporal table model and query semantics of the RDBMS, introduces temporal relation constraints and aggregation functions, and supports temporal reasoning between spatio-temporal objects, such as judging temporal topological relations and calculating the overlap degree, etc. In addition, GraST also introduces a time window mode to define a sliding window on the time axis to achieve temporal aggregation analysis within the window.

[0073] Regarding the index optimization of spatio-temporal entities, GraST designs a specific index strategy for spatio-temporal semantics to optimize the organization and retrieval efficiency of spatio-temporal data. In the time dimension, GraST adopts MTT index and time table partitioning; in the space dimension, GraST adopts Geohash coding for grid division. These indexes accelerate the retrieval of spatio-temporal data and support efficient cross-database spatio-temporal queries.

[0074] Regarding the multi-granularity time tree, GraST adopts the MTT index in the time dimension, divides the time axis into intervals of multiple granularities, and organizes them into a hierarchical tree structure. Each layer of the tree corresponds to a time granularity. The upper-layer nodes represent coarse-grained intervals, the lower-layer nodes represent fine-grained intervals, and the relationship between the parent and child nodes is an inclusion relationship. Figure 5 It shows the schematic diagram of the hierarchical structure of MTT. The construction process of MTT is as follows: First, determine the maximum depth of the tree and the granularity of each layer according to the data time span and query mode; then, recursively divide the time axis from top to bottom until the minimum granularity. Each time interval generates an index node, which records metadata such as the start and end timestamps and granularity of the interval, and associates relevant spatio-temporal objects.

[0075] During query execution, MTT can quickly locate the leaf nodes covered by any time interval, obtain relevant spatio-temporal objects through node pointers, and improve the query efficiency in the time dimension. By pre-computing and storing aggregation information on tree nodes, MTT can also accelerate cross-granularity time aggregation analysis. The advantage of MTT is that it can support time queries with different granularities simultaneously, achieving a balance between query efficiency and index storage overhead. In addition, MTT can achieve pruning optimization in the time dimension through top-down time interval inclusion judgment, filter irrelevant time branches, and avoid scanning a large number of irrelevant intervals.

[0076] For Geohash spatial partitioning, in the spatial dimension, GraST uses Geohash encoding to grid and index the two-dimensional geographical space. Geohash uses the Z-order space-filling curve to map longitude and latitude into string encodings. The encoding length determines the spatial partitioning granularity, with short encodings corresponding to coarse-grained grids and long encodings corresponding to fine-grained grids. The Geohash encoding process: First, divide the spatial range according to longitude and latitude and encode it as: 00 (lower left), 01 (upper left), 11 (upper right), 10 (lower right). Then, recursively divide each area until the preset encoding length is reached; finally, map the binary encoding to alphanumeric characters to obtain the Geohash encoding.

[0077] Figure 6 Illustrates the generation process of Geohash encoding. Taking Geohash with an encoding length of 6 as an example, assuming a given geographical location point (116.23°E, 39.54°N): First, divide the longitude and latitude ranges [-180°, 180°] and [-90°, 90°] into two equal parts respectively, determine that the target point is in the upper right half area, and obtain the prefix "11"; continue to recursively divide until the binary encoding "11100 1110100100 01000 11010 11110" is obtained; next, divide every 5 bits, convert to decimal numbers, and map to Base32 characters to finally obtain the Geohash encoding "wx48uy" with a length of 6. This encoding length divides the earth into 2 15 ×2 15 grids, and each grid is approximately 1200×609.4m.

[0078] In GraST, Geohash encoding is used to construct spatial partition indexes for GDBMS and RDBMS. In GDBMS, Geohash encoding is attached to the spatial index graph for quickly filtering out irrelevant objects; in RDBMS, Geohash encoding is stored on a dedicated index column, and a B+ tree index is built on this column. For different types of spatial objects, GraST adopts corresponding encoding strategies: for point objects, directly calculate the Geohash encoding of the coordinates; for line and polygon objects, first calculate the minimum bounding rectangle (MBR), and then identify the Geohash grids intersecting with the MBR; for raster objects, first divide them into regular blocks using Geohash grids, and then convert each block into a binary string and insert it into the relational table while marking the corresponding Geohash encoding.

[0079] For the association mapping of spatio-temporal entities, to achieve seamless association between GDBMS and RDBMS in the GraST hybrid storage architecture, an entity association mechanism based on object mapping is introduced. By defining a unified object identifier specification and cross-database mapping metadata (Table 1), GraST efficiently establishes semantic links of spatio-temporal entities between heterogeneous databases.

[0080] Table 1

[0081]

[0082] Specifically, GraST defines a globally unique object identifier for each type of spatio-temporal entity, including the entity type and the entity ID. In RDBMS, different types of spatio-temporal entities are organized in corresponding wide tables, the table name reflects the entity type, and the entity ID serves as the primary key; in GDBMS, each spatio-temporal entity is abstracted as a vertex, the vertex label represents the entity type, and the entity ID serves as an inherent attribute. In this way, spatio-temporal entities in GDBMS and RDBMS can establish a one-to-one mapping relationship through the object identifier. Figure 7 Show the overall process of cross-database mapping of spatio-temporal entities.

[0083] To maintain cross-database entity mapping metadata, GraST designs a dedicated mapping table in RDBMS to store the correspondence between GDBMS vertex types and RDBMS table names. During querying, according to the vertex entity type attribute, GraST automatically routes to the corresponding entity table in RDBMS, and then retrieves the corresponding spatio-temporal object record according to the vertex entity ID. In cross-database association queries, GraST makes full use of the multi-dimensional attributes of spatio-temporal vertices to achieve efficient spatio-temporal pruning. First, using the vertex set timestamp and Geohash encoding, filter the relational table in the spatio-temporal dimension to quickly narrow down the range of potential matching records; then, use the vertex entity ID for exact matching to find the corresponding spatio-temporal object record of this vertex in RDBMS.

[0084] Based on the above cross-database entity mapping mechanism, GraST realizes transparent navigation and linking between GDBMS and RDBMS. For example, given a spatio-temporal vertex in GDBMS, using its object identifier and index information, GraST can quickly retrieve the corresponding spatio-temporal object record in RDBMS, and then obtain the complete spatio-temporal information of the entity.

[0085] Regarding the parsing and transformation of spatio-temporal queries, GraST adopts query rewriting technology to convert the hybrid query that combines graph semantics and spatio-temporal semantics into executable sub-queries for GDBMS and RDBMS. The query coordinator automatically identifies spatio-temporal calculation operations during the execution of the graph query language and pushes them down to RDBMS for execution to achieve collaborative computing of the two databases. Figure 8 Schematically shows the overall process of query parsing and transformation, including four key modules.

[0086] (1) Clause Parser: Conducts syntactic and semantic analysis on the graph query statement, extracts the query graph pattern, filtering conditions, and projection columns.

[0087] (2) Spatio-Temporal Predicate Recognizer: Identifies spatio-temporal calculation operations that need to be pushed down to RDBMS from the filtering conditions, including spatial topological relationships, distance metrics, time relationships, etc.

[0088] (3) SQL Converter: Converts the identified spatio-temporal predicates into equivalent SQL fragments and applies the spatio-temporal index of RDBMS to optimize the query.

[0089] (4) Query Execution Engine: Adopts an execution mode of "graph-side leading and relational-side collaboration", decomposes the hybrid query into graph-side sub-queries and relational-side sub-queries. When the graph-side sub-query encounters a spatio-temporal predicate, it suspends and pushes down the SQL sub-query to the relational side for execution. After obtaining the entity IDs that meet the conditions, it restarts the spatio-temporal predicate operator and continues to execute until the final result is generated.

[0090] For cross-database data synchronization, in the mixed management of massive spatio-temporal data, achieving efficient and consistent data synchronization between heterogeneous databases is a key issue. GraST proposes a cross-database coordination mechanism based on incremental updates and mapping associations, uses Object-Relational Mapping (ORM) and Object-Graph Mapping (OGM) technologies to establish a unified object view for heterogeneous spatio-temporal data in different databases, and realizes real-time synchronization between RDBMS and GDBMS. Figure 9 Schematically shows the data synchronization process of the cross-database coordinator.

[0091] When accessing multi-source heterogeneous data, GraST converts data from various sources such as relational tables, raster images, and vectors into a unified spatio-temporal object model through predefined ETL adaptors, automatically extracts spatio-temporal partition information, generates multi-granularity spatio-temporal indexes, and imports them into GDBMS and RDBMS in parallel. In cross-database synchronization, GraST adopts an object-based incremental synchronization mode. When spatio-temporal objects at the relational end change, the ORM component publishes the changes as messages to the message queue; the OGM component subscribes to the messages and performs corresponding synchronization operations in the GDBMS to ensure data consistency between the two databases. In distributed transaction processing, GraST adopts a two-phase commit protocol, which is uniformly scheduled by the global transaction coordinator to ensure the atomicity and consistency of cross-database transactions.

[0092] The comparative experiments of the present invention verify that:

[0093] Through comparative experiments on real datasets, the performance of GraST in spatio-temporal semantic queries is evaluated. We first implement the GraST prototype system, select multiple GDBMSs as benchmarks, and compare and analyze the key performance indicators of GraST and the benchmark systems on a query set covering typical application scenarios.

[0094] The implementation of the GraST prototype system takes the graph database Neo4j and the relational database PostgreSQL (with PostGIS extension) that supports spatial operations as examples. In Neo4j, we use its User-Defined Procedures (UDPs) mechanism to implement a set of custom spatio-temporal functions, and map these functions to the corresponding functions in PostGIS through a query parsing and conversion mechanism. Table 2 lists the mapping relationships between some custom spatio-temporal functions and PostGIS functions. It should be noted that only some common spatio-temporal functions are listed in Table 2. In theory, through the UDPs mechanism and the rich spatio-temporal operators of PostGIS, GraST can support the equivalent conversion of any PostGIS function.

[0095] Table 2

[0096]

[0097]

[0098] In addition, we also implemented a multi-granularity time tree index using the GraphAware TimeTree library of Neo4j. This library can conveniently represent and manage temporal data in Neo4j, support multi-granularity time aggregation queries from years to milliseconds, and has built-in utility features such as time zone definitions

[45] . On the PostgreSQL side, we adopted the TimescaleDB extension to optimize the storage and query performance of time series data. TimescaleDB provides aggregation functions, window functions, and data retention policies for time series data analysis. The overall architecture of the GraST prototype system is as Figure 10 shown. The system backend uses py2neo and psycopg2 to interact with Neo4j and PostgreSQL respectively, mainly including the following core components:

[0099] 1. Data Importer: Reads multi-source heterogeneous spatio-temporal data using the GDAL library, converts it into a unified spatio-temporal object model, and then parallel imports it into Neo4j and PostgreSQL. It is also responsible for preprocessing and generating spatio-temporal indexes. The time series data imported into PostgreSQL will be automatically organized into the HyperTable of TimescaleDB.

[0100] 2. Entity Mapper: Based on the unified object identification specification, uses the OGM and ORM mechanisms to automatically construct and dynamically maintain the entity mapping relationship between Neo4j and PostgreSQL.

[0101] 3. Query Transformer: Uses the ANTLR tool to build a Cypher grammar parser, identifies and translates the spatio-temporal predicates in Cypher queries into SQL clauses. Combines with the UDPs mechanism to achieve equivalent conversion of custom spatio-temporal functions to PostGIS and TimescaleDB functions.

[0102] 4. Data Synchronizer: Utilizes the Kafka message queue and KafkaStreams processing framework to achieve incremental data synchronization between Neo4j and PostgreSQL, ensuring the eventual consistency of data in the two databases.

[0103] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disc, a read-only memory (ROM), or a random access memory (RAM), etc.

[0104] It should be understood that the detailed description of the technical solutions of the present invention by means of the preferred embodiments above is illustrative rather than restrictive. Based on reading the specification of the present invention, those of ordinary skill in the art can modify the technical solutions recorded in each embodiment, or perform equivalent replacements for some of the technical features, and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of each embodiment of the present invention.

Claims

1. A spatio-temporal semantic query optimization method that integrates an attribute graph database and a relational database, characterized in that: The described method includes: Optimizing the storage of spatio-temporal data by using a hybrid storage method of GDBMS and RDBMS to manage spatio-temporal data. The relational database stores the full information of spatio-temporal data completely, and the graph database stores the unique identifiers of spatio-temporal data in a lightweight manner; Optimizing the index of spatio-temporal entities. Designing specific index strategies for spatio-temporal semantics to optimize the organization and retrieval efficiency of spatio-temporal data. In the time dimension, using MTT index and time table partitioning, and in the space dimension, using Geohash coding for grid division; Associative mapping of spatio-temporal entities. Introducing an entity association mechanism based on object mapping. By defining a unified object identification specification, namely entity ID and entity type, and cross-database mapping metadata, establishing a semantic link of spatio-temporal entities between heterogeneous databases; For the associative mapping of the described spatio-temporal entities, design a special mapping table in the RDBMS to store the correspondence between the vertex types of the GDBMS and the RDBMS table names. When querying, according to the vertex entity type attribute, the spatio-temporal semantic query optimization method GraST automatically routes to the corresponding entity table in the RDBMS, and then retrieves the corresponding spatio-temporal object record according to the vertex entity ID; in the cross-database associative query, utilize the multi-dimensional attributes of spatio-temporal vertices to achieve efficient spatio-temporal pruning. First, use the vertex set timestamp and Geohash coding to filter the relationship table in the spatio-temporal dimension to quickly narrow the range of potential matching records, and then use the vertex entity ID for precise matching to find the corresponding spatio-temporal object record of this vertex in the RDBMS; Parsing and transformation of spatio-temporal queries. Adopting an execution mode of "graph-side leading and relational-side cooperation", converting a hybrid query that combines graph semantics and spatio-temporal calculations into executable sub-queries for GDBMS and RDBMS. The query coordinator automatically identifies spatio-temporal calculation operations during the execution of the graph query language and pushes them down to the RDBMS for execution to achieve collaborative computing between the two databases.

2. The spatio-temporal semantic query optimization method for integrating an attribute graph database and a relational database according to claim 1, wherein: The storage optimization of the described spatio-temporal data includes: GDBMS storage and optimization. Only store the key attributes of spatio-temporal objects in the GDBMS, including: (1) Entity ID: As a globally unique identifier, used to associate with the corresponding entity in the RDBMS; (2) Entity type: Represents the semantic category to which the entity belongs, such as POI, road, used for semantic queries and type filtering; (3) Attribute set: In the form of key-value pairs, store other non-spatio-temporal attributes of spatio-temporal objects; RDBMS storage and optimization. In the RDBMS, adopt a "wide table" mode, and define full-attribute columns for each type of spatio-temporal object, including: (1) Entity ID: As the primary key of the table, corresponding to the vertex ID in the GDBMS, used for cross-database association; (2) Spatial attributes: Include the geometric type, coordinate sequence, pixel sequence, spatial partition, and spatial reference system of the entity; (3) Time attributes: Include the timestamp, time interval, and time granularity of the entity, supporting two data types of moment and time period; (4) Other attributes: Other semantic attributes of the entity, including name, category, and status.

3. The spatio-temporal semantic query optimization method for integrating an attribute graph database and a relational database according to claim 1, characterized in that: The index optimization of the described spatio-temporal entities includes: (1) Multi-granularity time tree, which adopts MTT index in the time dimension, divides the time axis into intervals of multiple granularities, and organizes them into a hierarchical tree structure. Each layer of the tree corresponds to a time granularity. The upper-layer nodes represent coarse-grained intervals, and the lower-layer nodes represent fine-grained intervals. There is an inclusion relationship between parent and child nodes; (2) Geohash spatial partitioning. In the spatial dimension, Geohash coding is used to perform grid-based partitioning and indexing on the two-dimensional geographical space. Geohash uses the Z-order space filling curve to map longitude and latitude into a string code. The coding length determines the spatial partitioning granularity. Short codes correspond to coarse-grained grids, and long codes correspond to fine-grained grids. Geohash first divides the spatial range according to longitude and latitude and encodes it as: 00 bottom left, 01 top left, 11 top right, 10 bottom right. Then, each area is recursively divided until the preset coding length is reached. Finally, the binary code is mapped to alphanumeric characters to obtain the Geohash code.

4. The spatio-temporal semantic query optimization method for integrating an attribute graph database and a relational database according to claim 1, characterized in that: The parsing and transformation of the spatio-temporal query includes four key modules: (1) Clause parser: Perform syntactic and semantic analysis on the graph query statement to extract the query graph pattern, filtering conditions, and projection columns; (2) Spatio-temporal predicate recognizer: Identify the spatio-temporal calculation operations that need to be pushed down to the RDBMS from the filtering conditions, including spatial topological relationships, distance metrics, and time relationships; (3) SQL converter: Convert the identified spatio-temporal predicates into equivalent SQL fragments and apply the RDBMS spatio-temporal index to optimize the query; (4) Query execution engine: Adopt the "graph-side dominant, relational-side collaborative" execution mode to decompose the hybrid query into graph-side subqueries and relational-side subqueries. When the graph-side subquery encounters a spatio-temporal predicate, it suspends and pushes down the SQL subquery to the relational side for execution. After obtaining the entity IDs that meet the conditions, the spatio-temporal predicate operator is restarted and continues to execute until the final result is generated.

5. The spatio-temporal semantic query optimization method for integrating an attribute graph database and a relational database according to claim 1, characterized in that: Cross-database data synchronization and distributed transaction processing; Convert data from multiple sources such as relational tables, raster images, and vectors into a unified spatio-temporal object model through predefined ETL adaptors, automatically extract spatio-temporal partitioning information, generate multi-granularity spatio-temporal indexes, and import them into GDBMS and RDBMS in parallel; In cross-database synchronization, adopt the object-based incremental synchronization mode. When the spatio-temporal object on the relational side changes, the ORM component publishes the change as a message to the message queue, and the OGM component subscribes to the message and performs the corresponding synchronization operation in the GDBMS to ensure data consistency between the two databases; In distributed transaction processing, adopt the two-phase commit protocol, which is uniformly scheduled by the global transaction coordinator to ensure the atomicity and consistency of cross-database transactions; Cross-database data synchronization, using ORM and OGM technologies, to establish a unified object view for heterogeneous spatio-temporal data in different databases, and realize real-time synchronization between RDBMS and GDBMS.

6. The spatio-temporal semantic query optimization method for integrating an attribute graph database and a relational database according to claim 1, characterized in that: The comparative experiment selects multiple GDBMSs as the benchmark systems, and on the query set covering typical application scenarios, comparatively analyzes the key performance indicators of the spatio-temporal semantic query optimization method and the benchmark systems; Through the comparative experiment with real datasets, evaluate the performance of the spatio-temporal semantic query optimization method in spatio-temporal semantic queries.

Citation Information

Patent Citations

  • A knowledge map organization query method based on hybrid database

    CN109241078A

  • Space-time grid index query method and system based on degraded quadtree

    CN116775971A