Distributed database retrieval optimization method and system for geographic knowledge graph
By constructing a spatiotemporal semantic potential field model and optimizing query routing using decision trees for distributed geographic knowledge graphs, the problem of blindness in distributed queries is solved, and query efficiency and data transmission efficiency are improved.
Patent Information
- Application Number
- CN202511405878.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-29
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2045-09-29
AI Technical Summary
In distributed geographic knowledge graph queries, the lack of a global pre-assessment of the spatiotemporal and semantic distribution of data nodes leads to blind query planning, resulting in suboptimal execution paths and high data transmission overhead.
A spatiotemporal semantic potential field model is constructed, and a spatial, temporal, and semantic distribution model is built for each data node. Query routing is optimized through query dependency graphs and decision trees to achieve adaptive execution.
It improves the accuracy of query routing decisions, reduces the size of intermediate result sets and cross-node data transfer overhead, and enhances the system's adaptability and robustness.
Smart Images

Figure CN120873046B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer data processing technology, specifically to a distributed database retrieval optimization method and system for geographic knowledge graphs. Background Technology
[0002] With the integration of Geographic Information Systems (GIS) and Artificial Intelligence (AI) technologies, Geographic Knowledge Graphs (GKGraphs), as structured knowledge bases for organizing and managing large-scale geospatial and semantic information, are finding increasingly widespread applications. Because GKGraphs typically involve massive amounts of data, their practical deployment often requires the use of distributed databases or distributed graph database systems for storage. This involves dividing the complete knowledge graph data and storing it across multiple interconnected data nodes to achieve scalable storage and computing capabilities.
[0003] However, the distributed storage nature of data presents significant challenges to efficient query processing. In current distributed query processing frameworks, the query coordinator often lacks a comprehensive and accurate understanding of the specific data distribution across the entire distributed system when formulating query execution plans. The coordinator typically only knows that each node stores a "part" of the data, but for a specific query sub-objective (e.g., finding a specific type of event occurring within a specific region at a specific time), the coordinator cannot accurately predict which data node is most likely to contain dense data that satisfies these spatiotemporal and semantic constraints. This lack of information leads to considerable arbitrariness in query planning; the system may send subqueries to multiple data nodes that do not contain or contain only a very small amount of relevant data, resulting in unnecessary network communication overhead and wasted computing resources.
[0004] Furthermore, existing query optimizers often make decisions based on local or short-sighted criteria when determining the execution order of query sub-objectives. The optimizer may prioritize executing the subquery that currently appears simplest or has the smallest expected result set, failing to proactively assess the constraints and positive impacts of this execution step on subsequent join queries. The execution path determined by this greedy strategy is often suboptimal globally, potentially leading to the generation of large intermediate result sets during query execution. These intermediate result sets require large-scale transfers between different data nodes to complete join operations, which has become one of the core bottlenecks restricting the performance of distributed graph queries.
[0005] Furthermore, traditional query execution models are typically static. Once a query plan is determined, the execution engine strictly follows that plan. However, the statistics used to generate the plan may be outdated or inaccurate, leading to biases in the initial planning itself. Static execution models lack the ability to dynamically adjust subsequent execution paths based on actual intermediate results during execution, making them unable to adapt to the actual data distribution, resulting in decreased query performance and a lack of robustness.
[0006] Therefore, existing technologies need to design a query optimization method that can achieve globally optimal path planning and adaptive execution. Summary of the Invention
[0007] The purpose of this invention is to provide a distributed database retrieval optimization method and system for geographic knowledge graphs, in order to solve the technical problem that in a distributed environment, the lack of global pre-assessment of the spatiotemporal and semantic distribution of data at each data node leads to blind query planning, resulting in suboptimal execution paths and high data transmission overhead.
[0008] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0009] The first aspect of this invention provides a distributed database retrieval optimization method for geographic knowledge graphs, the method comprising:
[0010] Construct a spatiotemporal semantic potential field model for each data node in a distributed database;
[0011] Receive user queries, decompose the user queries into multiple query sub-targets, and construct a query dependency graph based on the data dependencies between the query sub-targets;
[0012] Based on the spatiotemporal semantic potential field model of each data node and the query dependency graph, the execution decision tree is planned and generated by predicting the potential gain of executing different query sub-targets on subsequent query sub-targets.
[0013] Each query sub-target is transformed into an executable subquery, and the subquery is sent to the corresponding target data node according to the execution decision tree for adaptive execution.
[0014] In one specific embodiment, constructing the spatiotemporal semantic potential field model includes:
[0015] A spatial potential field component is constructed to characterize the spatial location distribution density of geographic data within the data node in the form of a continuous mathematical function; a temporal potential field component is constructed to characterize the temporal attribute distribution density of data within the data node in the form of a continuous mathematical function or a piecewise function; and a semantic potential field component is constructed to provide a membership query mechanism for the set of semantic concepts contained within the data node.
[0016] In one specific embodiment, the spatial potential field components are constructed using a Gaussian mixture model or kernel density estimation; the temporal potential field components are constructed using kernel density estimation or statistical histograms; and the semantic potential field components are constructed using a probabilistic data structure, such as a cuckoo filter or a Bloom filter.
[0017] In one specific embodiment, the step of decomposing the user query into multiple query sub-targets and constructing a query dependency graph includes:
[0018] The basic graph pattern in the user query is parsed into one or more triple patterns, where each triple pattern corresponds to a query sub-target;
[0019] Analyze whether there are shared query variables among the multiple query sub-targets. If so, establish a directed edge between the corresponding query sub-targets in the query dependency graph. The directed edge represents the data dependency relationship.
[0020] In one specific embodiment, prior to the step of planning and generating the execution decision tree, the method further includes:
[0021] For a query sub-target and a data node, the conditional potential energy is calculated under given preconditions, based on the spatial, temporal, and semantic constraints contained in the query sub-target and the spatiotemporal semantic potential field model of the data node.
[0022] The conditional potential energy P(i,g) k |C) is a scalar value used to quantify the query subtarget g given that the precondition C is met. k Hand over to data node D with index i i The degree of matching of the expected execution.
[0023] In one specific embodiment, the potential energy gain G(i,g) k |C) Calculated in the following manner:
[0024] ;
[0025] Among them, Succ(g k In the query dependency graph, the query subtarget g is... kThe set of all direct successor query sub-targets; Indicates query subtarget g j The maximum conditional potential energy achievable in data node m. This potential energy gain is used to quantize the execution of the query sub-objective g. k For all its subsequent query subtargets g j The expected increase in the total system potential energy.
[0026] In one specific embodiment, the step of planning and generating the execution decision tree includes:
[0027] Based on a query subtarget g k In a data node D with index i i Conditional potential energy P(i,g) k |C) and potential energy gain G(i,g) k |C), calculate its overall utility U(i,g) k |C)=αP(i,g k |C)+βG(i,g k |C), where α and β are preset weight coefficients; iteratively select the combination of query sub-objectives and data nodes with the greatest comprehensive utility as the next execution step for planning and generating the execution decision tree, until all query sub-objectives have been planned.
[0028] In one specific embodiment, the adaptive execution step includes:
[0029] Receive the intermediate result set of the subquery from the target data node;
[0030] Compare whether the deviation between the actual result size of the intermediate result set and the expected result size predicted based on the conditional potential energy before execution exceeds a preset threshold;
[0031] If the deviation exceeds a preset threshold, dynamic rerouting is triggered.
[0032] In one specific embodiment, the dynamic rerouting step includes:
[0033] The intermediate result set is used as a new, defined prerequisite. For the query sub-targets in the query dependency graph that have not yet been executed, the steps of planning and generating an execution decision tree are re-executed to generate an updated execution decision tree based on the actual execution results. Execution continues based on the updated execution decision tree.
[0034] A second aspect of the present invention provides a distributed database retrieval optimization system for implementing the aforementioned distributed database retrieval optimization method for geographic knowledge graphs, comprising:
[0035] The potential field model building module is used to build a spatiotemporal semantic potential field model for each data node of the distributed database.
[0036] The query parsing module is used to receive user queries, decompose the user queries into multiple query sub-targets, and construct a query dependency graph based on the data dependencies between the query sub-targets.
[0037] The routing planning module is used to generate an execution decision tree by predicting the potential gain of different query sub-targets for subsequent query sub-targets based on the spatiotemporal semantic potential field model of each data node and the query dependency graph.
[0038] The adaptive execution module is used to send sub-queries to the target data node step by step according to the execution decision tree and perform adaptive execution.
[0039] This invention provides a distributed database retrieval optimization method and system for geographic knowledge graphs, which has the following beneficial effects:
[0040] 1. This invention achieves the quantification and pre-perception of the spatial, temporal, and semantic distribution characteristics of data within distributed data nodes by constructing a spatiotemporal semantic potential field model offline for each data node. During the query planning phase, this model enables the system to accurately predict the execution potential (conditional potential) of query sub-targets on different nodes based on their constraints, thereby avoiding blind data source selection and significantly improving the accuracy of query routing decisions.
[0041] 2. This invention introduces a potential gain prediction mechanism. When planning the execution order, it not only considers the execution cost of the current step but also proactively quantifies the constraint optimization effect of the step on subsequent related query sub-objectives. By maximizing the comprehensive utility function to generate the execution decision tree, it ensures that the generated query plan is close to the optimal overall, effectively reducing the size of the intermediate result set and the total overhead of cross-node data transmission.
[0042] 3. This invention designs a closed-loop mechanism for adaptive execution and dynamic rerouting. By monitoring the deviation between the actual size of the returned intermediate results and the model's predicted values in real time during execution, the system can promptly detect and correct suboptimal planning caused by sudden changes in data distribution or inaccurate model predictions. Once a significant deviation is detected, the system uses the actual intermediate results to trigger rerouting, dynamically adjusting subsequent execution paths, thereby ensuring the query process's high adaptability and robustness to the actual data situation. Attached Figure Description
[0043] Figure 1 This is a functional block diagram of a distributed database retrieval optimization system according to an embodiment of the present invention;
[0044] Figure 2This is a flowchart illustrating a distributed database retrieval optimization method for geographic knowledge graphs according to an embodiment of the present invention.
[0045] Among them, 10 is the potential field model construction module; 20 is the query parsing module; 30 is the route planning module; and 40 is the adaptive execution module. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of the present invention clearer, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the scope of protection of the invention.
[0047] See attached document Figure 1 This invention provides a distributed database retrieval optimization system for implementing a distributed database retrieval optimization method for geographic knowledge graphs. This system is deployed in a distributed environment containing multiple interconnected data nodes, each storing a portion of the geographic knowledge graph data. The distributed database retrieval optimization system may include: a potential field model construction module 10, a query parsing module 20, a route planning module 30, and an adaptive execution module 40.
[0048] The potential field model construction module 10 is used to build a spatiotemporal semantic potential field model offline for each data node of the distributed database. The construction process of this spatiotemporal semantic potential field model is executed after system initialization or after a specified scale update of the data within the data node. The potential field model construction module 10 accesses each data node to read the data stored internally, and performs mathematical modeling for the spatial, temporal, and semantic dimensions of the data, ultimately generating a spatiotemporal semantic potential field model that characterizes the distribution characteristics of the data node. The model file of the spatiotemporal semantic potential field model is stored and provided to the routing planning module 30 for use.
[0049] The query parsing module 20 receives user queries submitted by external users, decomposes the user queries into multiple query sub-targets, and constructs a query dependency graph based on the data dependencies between the query sub-targets. Specifically, when a structured query statement (user query) is received, the query parsing module 20 parses the structured query statement into a set of atomic triple patterns, each triple pattern being a query sub-target. By analyzing the shared variables among these query sub-targets, the data dependencies between them are determined, and a directed acyclic graph, i.e., the query dependency graph, is generated based on these data dependencies.
[0050] Furthermore, the query parsing module 20 encodes each query sub-target as a query intent vector. This query intent vector is a standardized data structure containing spatial constraint vectors, temporal constraint vectors, and semantic constraint vectors describing the constraints of the query sub-target. The query parsing module 20 outputs the generated query dependency graph and the query intent vectors of each query sub-target to the routing planning module 30.
[0051] The routing planning module 30 is connected to the potential field model construction module 10 and the query parsing module 20. The routing planning module 30 is configured to plan and generate an execution decision tree based on the spatiotemporal semantic potential field model of each data node and the query dependency graph, by predicting the potential gain of executing different query sub-goals on subsequent query sub-goals. During the planning process, the routing planning module 30 first obtains the spatiotemporal semantic potential field model of each data node from the potential field model construction module 10, and then obtains the query dependency graph from the query parsing module 20.
[0052] Subsequently, the routing planning module 30 calculates the conditional potential energy of each query sub-target in the query dependency graph under different preconditions using a spatiotemporal semantic potential field model, and predicts the potential energy gain that executing any query sub-target can bring based on the changes in conditional potential energy. Finally, the routing planning module 30 determines an optimal sequence of execution steps by solving an optimization problem aimed at maximizing overall utility, and solidifies this sequence of execution steps into an execution decision tree. This execution decision tree is then sent to the adaptive execution module 40.
[0053] The adaptive execution module 40 is connected to the routing planning module 30 and all data nodes in the distributed environment. The adaptive execution module 40 is configured to transform each query sub-target into an executable subquery, and then send the subquery step-by-step to the target data nodes for execution according to the execution path determined by the execution decision tree. The adaptive execution module 40 parses the root node of the execution decision tree and sends the corresponding subquery to the target data node specified therein.
[0054] During execution, the adaptive execution module 40 also receives intermediate result sets returned by the target data nodes. The adaptive execution module 40 uses these intermediate result sets as new, definitive preconditions and can request the routing planning module 30 to re-evaluate the unexecuted portions of the execution decision tree based on these preconditions. If the evaluation determines that a better execution path exists, dynamic rerouting is triggered, and the adaptive execution module 40 continues to execute subsequent subqueries according to the updated execution path. After the query execution is complete, the adaptive execution module 40 is responsible for aggregating the intermediate result sets returned from different target data nodes to form the final query result.
[0055] See attached document Figure 2This embodiment provides a distributed database retrieval optimization method for geographic knowledge graphs. This method can be divided into an offline stage and an online stage. The offline stage mainly completes the data distribution modeling of each data node, while the online stage performs query planning and execution in real time after receiving a user query. The method specifically includes the following steps:
[0056] Step S100: Construct a spatiotemporal semantic potential field model offline for each data node of the distributed database.
[0057] Step S200: Receive user queries online, decompose the user query into multiple query sub-targets and construct a query dependency graph.
[0058] Step S300: Based on the spatiotemporal semantic potential field model and query dependency graph of each data node, an execution decision tree is planned and generated by predicting the potential gain of executing different query sub-targets on subsequent query sub-targets.
[0059] Step S400: Transform each query sub-target into an executable subquery, send the subquery step by step to the target data node according to the execution path determined by the execution decision tree, and perform adaptive execution until the final query result is obtained.
[0060] The following will elaborate on each step in the above process.
[0061] In step S100, the first step in constructing a spatiotemporal semantic potential field model for each data node is to construct the spatial potential field components of the data node. The purpose of the spatial potential field components is to establish a continuous mathematical model that can characterize the spatial location distribution density of all geographic entities stored within the data node. This continuous mathematical model can output a scalar value for any given geographic coordinate point, which reflects the probability density of the existence of geographic entities near that geographic coordinate point.
[0062] In one specific embodiment, the spatial potential field components are constructed using a Gaussian Mixture Model. Geographic entities are often distributed in space as multiple clusters of different shapes and sizes, such as commercial areas or residential areas in a city. The Gaussian Mixture Model can fit such complex distributions of arbitrary shapes by weighted sums of multiple Gaussian distributions.
[0063] The construction process of spatial potential components specifically includes the following steps:
[0064] First, from data node D i Extract all geographic entities with geospatial coordinate attributes from the database and generate a coordinate data set {P1, P2, ..., P}. n ,…,PN}, where p n ∈R 2 ,p n This represents the two-dimensional geospatial coordinates of the nth geographic entity, where N is the data node D. i The total number of geographic entities in the region, where R is the set of real numbers.
[0065] Next, a Gaussian mixture model is trained using the aforementioned coordinate dataset. The goal of the training is to determine the various model parameters of the Gaussian mixture model. A key parameter among these parameters is the number of Gaussian components, K. To determine the optimal value of K, model selection methods such as the Bayesian information criterion or the Akaike information criterion can be employed. Specifically, Gaussian mixture models can be trained within a preset range of K values (e.g., from 1 to 20), and the Bayesian information criterion score for each Gaussian mixture model can be calculated. Finally, the K value that minimizes the Bayesian information criterion score is selected as the optimal K value.
[0066] After determining the optimal value of K, the other model parameters of the Gaussian mixture model are iteratively solved using the expectation-maximization algorithm. These other model parameters include the mixing weight w for each Gaussian component. k Mean vector μ k (Representing the center of the data cluster) and the covariance matrix (Represents the shape, size, and orientation of the data cluster). After training, the resulting data node D... i Spatial potential components This is a definite probability density function. For any input geospatial coordinate point p, the spatial potential field value output by this probability density function is defined by the following mathematical expression: ;
[0067] in:
[0068] i is the index of the data node.
[0069] p is the input geospatial coordinate point.
[0070] K is the number of Gaussian components in the Gaussian mixture model.
[0071] w k It is the mixing weight of the k-th Gaussian component, satisfying And w k ≧0.
[0072] It is the probability density function of a multivariate Gaussian distribution, and the mean of the multivariate Gaussian distribution is μ. k The covariance matrix of the multivariate Gaussian distribution is .
[0073] Finally, the model parameters of the Gaussian mixture model corresponding to each data node. It is serialized and stored as part of the spatiotemporal semantic potential field model. In other implementations, other density estimation techniques such as kernel density estimation can also be used to construct spatial potential field components, which can also achieve continuous function modeling of spatial data distribution.
[0074] Furthermore, the second step in constructing the spatiotemporal semantic potential field model is to construct its temporal potential field components. The purpose of constructing the temporal potential field components is to establish a continuous probability density model for the temporal attributes associated with the data within the data node (such as the occurrence time of an event or the validity time of a record). This probability density model can output a scalar value for any given time point, which represents the density of data instances existing near that time point.
[0075] In one specific embodiment, the temporal potential components are constructed using kernel density estimation. Kernel density estimation generates a smooth and continuous kernel density estimation function, avoiding the breakpoints introduced by binning operations and the sensitivity to bin width in traditional histogram methods.
[0076] The construction process of this time potential component specifically includes the following steps:
[0077] First, from data node D i Extract all relevant time attribute instances to form a timestamp dataset {t1, t2, ..., t}. M The timestamp data points in the timestamp dataset are converted into a uniform numerical format, such as UNIX timestamps, before processing to facilitate numerical calculations.
[0078] Next, the kernel density estimation function is constructed using the timestamp dataset. This kernel density estimation function estimates the kernel density at each timestamp data point t. j Place a kernel function at [location]. The kernel density estimation function is obtained by weighted summation of all kernel functions for data node D. i Time potential field components The mathematical definition is as follows: ;
[0079] in:
[0080] i is the index of the data node.
[0081] t is the input time point.
[0082] M is data node D iThe total number of instances of the internal time attribute (timestamp data points).
[0083] h is the bandwidth of the kernel function, and the value of bandwidth h determines the smoothness of the density estimation curve. The value of bandwidth h can be determined by standard methods, such as using Scott's rule or Silverman's empirical rule, to achieve a balance between bias and variance.
[0084] t j It is the j-th timestamp data point in the timestamp dataset.
[0085] It is a kernel function, usually chosen as the standard Gaussian function.
[0086] In another implementation, the time potential field components can also be constructed using statistical histograms. The entire time axis is divided into several continuous and non-overlapping time intervals. The number of time attribute instances falling within each time interval is then counted, and this number is used as the potential energy value for that time interval. While this method of constructing time potential field components using statistical histograms is simple to implement, the output potential energy value is a piecewise constant, and the result depends on the way the time intervals are divided.
[0087] Finally, for each data node, the generated kernel density estimation function or statistical histogram is solidified and stored as the temporal potential field component of the spatiotemporal semantic potential field model.
[0088] Furthermore, the final step in constructing the spatiotemporal semantic potential model is to construct the semantic potential components. Unlike the spatial and temporal potential components, the purpose of constructing the semantic potential components is not to establish a continuous density function, but to provide an efficient, low-storage-overhead mechanism for quickly determining whether a specific semantic concept (such as an entity type or relational predicate) exists in a data node.
[0089] In one specific implementation, the semantic potential components are constructed using a probabilistic data structure. This probabilistic data structure allows a large set to be represented with a storage space far smaller than the original dataset, while allowing for an extremely low error rate (false positives only, no false negatives). This is crucial for routing decisions in distributed environments because the probabilistic data structure allows for node selection without transmitting large amounts of metadata.
[0090] The probabilistic data structure used in this embodiment is the Cuckoo Filter. The construction process of this semantic potential component specifically includes the following steps:
[0091] First, from data node D iExtract all discrete semantic elements that need to be indexed. These discrete semantic elements include the type of all entities within the data node (e.g., dbo:Restaurant, dbo:City) and the relational predicates in all triples (e.g., dbo:locatedIn, dbo:servesCuisine).
[0092] Next, all extracted discrete semantic elements are inserted one by one into a pre-initialized cuckoo filter. The cuckoo filter is implemented using a hash table. When inserting a discrete semantic element, the positions of its two candidate hash buckets are calculated. If one candidate hash bucket is empty, the fingerprint of the discrete semantic element is stored there; if both candidate hash buckets are occupied, a "kick-out" operation is performed, moving the occupied old discrete semantic element to a spare position to make room for the new discrete semantic element. This process may trigger a series of chain kick-out operations.
[0093] Once constructed, the resulting cuckoo filter is the semantic potential component of the data node. This semantic potential component is essentially a compact data structure that provides a query interface. When the routing planning module 30 needs to determine whether a semantic concept (e.g., the entity type dbo:Restaurant required in a query sub-target) exists in data node D... i When the Cuckoo Filter returns "not found" (false), it can be determined with 100% certainty that the data node does not contain this semantic concept. If it returns "possibly exists" (true), it means that the data node has a very high probability of containing this semantic concept, and the routing planning module 30 will consider the data node as a candidate node.
[0094] In other implementations, the semantic potential components can also be constructed using other probabilistic data structures such as hierarchical Bloom filters. For example, different Bloom filters can be constructed for entity types and relational predicates, or a hierarchical structure can be built to support more complex semantic queries. Finally, the trained probabilistic data structure corresponding to each data node is serialized and stored as the final part of the spatiotemporal semantic potential model.
[0095] In step S200, when the system receives a structured user query (e.g., a SPARQL query), the query parsing module 20 first performs query sub-target decomposition. It parses and breaks down the basic graph pattern in the WHERE clause of the user query into a set of atomic query sub-targets. In one specific implementation, each query sub-target corresponds to a triplet pattern (Subject-Predicate-Object). For example, a user query containing two triplet patterns will be decomposed into two independent query sub-targets.
[0096] After decomposition, the query parsing module 20 constructs a corresponding query intent vector for each generated query sub-target. The purpose of constructing the query intent vector is to convert the query constraints of each query sub-target into a standardized data structure that can be used for mathematical calculations by subsequent modules. The query intent vector contains spatial constraint vectors, temporal constraint vectors, and semantic constraint vectors, which together describe all the constraint information of a query sub-target.
[0097] Spatial constraint vectors are used to encapsulate spatial extent constraints extracted from the FILTER clause of a user query or other specific geospatial functions. In this embodiment of the invention, the user query may conform to the SPARQL specification, under which strings prefixed with "?" are used to represent query variables. For example, when a user query contains a condition FILTER(geof:sfWithin(?location,"POLYGON((...))")), ?location is a query variable, and the geometric information defined by POLYGON is encoded as a spatial constraint vector. If a query subtarget does not have explicit spatial constraints, its spatial constraint vector is a preset value representing the global extent.
[0098] The time constraint vector is used to encapsulate the time range constraints extracted from the user query. For example, when a user query contains the condition FILTER(?eventTime>= "2025-01-01T00:00:00Z"^^xsd:dateTime&&?eventTime<"2025-02-01T00:00:00Z"^^xsd:dateTime), the closed-open interval [t_start,t_end] consisting of the start and end times is encoded as the time constraint vector. If the query sub-target has no time constraint, its time constraint vector is a preset value representing an infinite time range.
[0099] The semantic constraint vector is derived directly from the triple pattern of the query subtarget itself. This semantic constraint vector encapsulates the Uniform Resource Identifier (URI) or literal values of the (i.e., non-variable) subject, predicate, or object already bound within the triple pattern. For example, for the query subtarget (?restaurant,rdf:type, dbo:Restaurant), its semantic constraint vector contains the semantic concepts rdf:type and dbo:Restaurant. These semantic concepts will serve as input to the query semantic potential components in subsequent steps.
[0100] After the query sub-targets are decomposed and vectorized, the query parsing module 20 continues to construct the query dependency graph. The purpose of constructing the query dependency graph is to explicitly represent the data dependencies between the various query sub-targets, thereby providing structured input for subsequent execution order planning.
[0101] The query dependency graph constructed in this embodiment is a directed acyclic graph (DAG). In this DAG, each vertex uniquely corresponds to a query sub-target decomposed in the previous step. The directed edges in the DAG represent the data dependencies between the query sub-targets.
[0102] Specifically, the process of constructing the query dependency graph is as follows:
[0103] First, iterate through all query sub-target pairs (g i ,g j Then, check if there are shared query variables in the triple schemas corresponding to the two query sub-targets. If query sub-target g i and query subtarget g j If they share one or more of the same query variables, then a data dependency relationship exists between them.
[0104] Once a data dependency is established, a directed edge is created between the vertices representing the two query sub-targets. The direction of this directed edge determines the direction of data flow, which implicitly defines the legal execution order. A directed edge from query sub-target g... i The corresponding vertex points to the query subtarget g. j The directed edge corresponding to the vertex represents the query sub-target g. i The execution result (i.e., the value of its bound variable) is the execution of the query subtarget g. j The required input. Therefore, in any effective execution plan, g i The execution of g must precede the execution of g. j .
[0105] For example, consider a user query that contains two sub-targets:
[0106] g1: (?restaurant,rdf:type,dbo:Restaurant);
[0107] g2: (?restaurant,dbo:locatedIn,dbr:Beijing);
[0108] Since the two query sub-objectives share the query variable `restaurant`, a data dependency exists between them. Therefore, in the query dependency graph, there will be a vertex representing `g1` and a vertex representing `g2`, connected by a directed edge. The structure of this directed acyclic graph indicates that a join operation must be performed between the two query sub-objectives to obtain the final result.
[0109] After traversing all query sub-target pairs, a complete query dependency graph is generated. This graph represents the inherent logical structure of the original user query and all execution constraints. Finally, the query parsing module 20 passes this query dependency graph, along with the query intent vectors of each query sub-target, to the route planning module 30 for subsequent route planning steps.
[0110] In step S300, after receiving the query dependency graph and query intent vector, the core process of the routing planning module 30 is to calculate the execution potential of each query sub-target on each data node for each query sub-target in the query dependency graph. In this invention, this quantified execution potential is defined as conditional potential energy. Conditional potential energy P(i,g) k The physical meaning of |C) is: given the set of preconditions C, the query subtarget g will be... k Hand over to data node D with index i i The expected degree of matching or the size of the result set.
[0111] The calculation process of this conditional potential energy begins with the most basic case, that is, calculating the fundamental potential energy P(i,g) without any preconditions (i.e., the precondition set C is an empty set Ф). k |Ф). For a given query subtarget g k and data node D i The routing planning module 30 first obtains g k The corresponding query intent vector and D i The spatiotemporal semantic potential field model.
[0112] During calculation, the semantic constraint vector in the query intent vector is first used to query data node D. iThe semantic potential field components. In this embodiment, the semantic concepts such as entity types and relational predicates contained in the query sub-target are obtained based on the cuckoo filter (semantic potential field components). If the cuckoo filter returns "not found", it indicates that the data node does not contain data that satisfies this semantic constraint. At this time, the total potential value of the data node is directly set to 0, and subsequent calculations terminate.
[0113] If the semantic potential component returns "possibly existent," then the potential energy in the spatial and temporal dimensions is calculated. Based on the spatial constraint vector (e.g., a polygonal region) in the query intent vector, the potential energy for data node D is calculated. i Integrating the spatial potential field components (i.e., the Gaussian mixture model) over the polygonal region yields the spatial potential energy component P. S Similarly, based on the time constraint vector (e.g., a time interval), for data node D... i Integrating the time potential field component (i.e., the kernel density estimation function) over this time interval yields the time potential energy component P. T Finally, the spatial and temporal potential components are combined into a total potential energy value using a pre-defined combination function, for example, by weighted summation: P(i,g k |Ф)=w S P S +w T P T , where w S and w T These are configurable weighting coefficients.
[0114] Furthermore, this invention calculates conditional potential energy. After one or more preceding query sub-targets (represented by the preceding condition set C) have been executed, the resulting intermediate result set will be used to update the query intent vector of subsequent query sub-targets. For example, if the preceding query sub-targets have narrowed the query scope to three specific geographic coordinate points, the spatial constraints in the query intent vector of subsequent query sub-targets will be refined from a broad polygonal region to these three geographic coordinate points.
[0115] The routing planning module 30 uses this new query intent vector, refined by the intermediate result set, to re-execute the aforementioned conditional potential calculation process (including the calculation and merging of semantic, spatial, and temporal potential components). The potential value calculated in this way is the conditional potential P(i,g) k |C). This potential energy value more accurately reflects the data node D after obtaining a partial intermediate result set. i For query subtarget g k Its true processing potential.
[0116] In step S300, after calculating the conditional potential energy of each query sub-target under different data nodes and different preconditions, the route planning module 30 will perform a prediction of the potential energy gain. The prediction of the potential energy gain is the core mechanism for achieving forward-looking route planning in this invention. Its purpose is to quantitatively evaluate the positive impact of executing a particular query sub-target on subsequent query sub-targets that have data dependencies, i.e., to what extent it can constrain and optimize subsequent query sub-targets.
[0117] Potential gain is defined as the expected increase in the total potential value of all directly subsequent sub-targets of a query after the execution of a given sub-target. A high potential gain indicates that the current execution step can produce a highly accurate intermediate result set, thereby greatly narrowing the query scope of subsequent steps and significantly enhancing the execution potential of subsequent steps on the optimal data node.
[0118] In a specific embodiment, for a given set of preconditions C, the data node D at index i is selected. i Execute query on subtarget g k The potential energy gain G(i,g) that can be obtained k |C), is calculated using the following mathematical expression: ;
[0119] in:
[0120] G(i,g k |C) is given the precondition C, at data node D i Execute sub-goal g k Potential energy gain.
[0121] Succ(g k In the query dependency graph, the query subtarget g is... k The set of all direct successor query sub-targets.
[0122] Nodes is a collection of all data nodes.
[0123] P(m,g j |C) is the query subtarget g executed on data node m when the precondition is C. j The conditional potential energy, the calculation method of which has been described in the foregoing section.
[0124] This indicates that when executing g k Previously, querying subtarget g j The maximum conditional potential energy that can be achieved across all data nodes.
[0125] C∪{g k} indicates that gk The fact that it has been executed is added to the set of preconditions.
[0126] Indicates in g k After execution, query subtarget g. j The maximum conditional potential energy that can be achieved across all data nodes.
[0127] The first term on the right-hand side of the mathematical expression for this potential energy gain is calculated in g. k After execution, the sum A of the optimal execution potential of all its subsequent query sub-objectives in the entire distributed database retrieval optimization system. The second term on the right calculates the optimal execution potential of g... k Before execution, the sum of the optimal execution potentials B of these subsequent query sub-goals is used. The difference between the sum A and the sum B is the execution potential g. k This step contributes value to the future, overall query plan. By calculating the potential gain, the routing planning module 30 is able to identify from multiple currently executable query sub-goals which step is most beneficial to the subsequent parts of the entire query process, rather than simply selecting the step with the lowest current execution cost.
[0128] In step S300, the ultimate goal of route planning is to generate a structured, executable execution decision tree based on the aforementioned conditional potential and potential gain. This execution decision tree provides a detailed, distributed execution blueprint for the entire user query from start to finish.
[0129] To simultaneously evaluate the potential of the current execution step and its positive impact on the future at each selection step, this invention introduces a comprehensive utility function. For a given set of preconditions C, at data node D with index i... i Execute query on subtarget g k The overall utility U(i,g) k |C)=αP(i,g k |C)+βG(i,g k |C), the comprehensive utility function is defined by the following mathematical expression:
[0130] U(i,g k |C)=αP(i,g k |C)+βG(i,g k |C);
[0131] in:
[0132] P(i,g k |C) is when the precondition is C, at data node D i Execute sub-target g k The conditional potential energy, P(i,g)k |C) reflects the efficiency of the current step or the expected size of the result;
[0133] G(i,g k |C) is when the precondition is C, at data node D i Execute sub-target g k The potential energy gain, G(i,g) k |C) reflects the degree of optimization of the current step for subsequent queries;
[0134] α and β are preset non-negative weighting coefficients used to adjust current and long-term interests. In one embodiment, α+β=1 can be set.
[0135] The process of generating a decision tree is an iterative process of optimal selection. Starting with a root node representing the initial state of the query, the process gradually builds the tree path by repeatedly selecting the execution steps that yield the greatest overall utility, ultimately forming the decision tree.
[0136] Specifically, the generation process initializes the following three core sets:
[0137] The set to be planned, U, initially contains all query sub-targets in the query dependency graph.
[0138] Candidate execution set P: Initially contains all query sub-targets with an in-degree of zero in the query dependency graph.
[0139] Precondition set C: Initially an empty set.
[0140] The generation process begins with a root node representing the initial state of the query and iteratively adds new nodes to the decision tree through the following iterative steps:
[0141] 1. Computational utility: For each query sub-goal g in the candidate execution set P k and each data node D i Based on the current set of preconditions C, the comprehensive utility U(i,g) is calculated using the aforementioned comprehensive utility function. k |C).
[0142] 2. Select the optimal combination: Choose the combination of sub-objective nodes with the highest overall utility from all calculated utility values. This serves as the optimal execution decision for the current step.
[0143] 3. Construct a decision tree: Then, construct the optimal execution decision. It is solidified as a new node in the decision tree and becomes a child node of the previously selected decision node (for the first decision, it becomes a child node of the root node).
[0144] 4. Update status:
[0145] Remove the selected query sub-targets from the set to be planned U and the candidate execution set P. .
[0146] query subtargets Add it to the precondition set C.
[0147] Based on the query dependency graph, check if there are any query sub-goals in the set U to be planned that have all their predecessor dependencies (e.g., If all conditions have been met (i.e., all conditions already exist in the precondition set C), then these newly executable query sub-objectives will be moved from the unplanned set U to the candidate execution set P.
[0148] The routing planning module 30 repeats the loop from step 1 to step 4 above until the set to be planned U is empty, that is, all query sub-goals have been planned into the execution decision tree.
[0149] The final result is a complete execution decision tree. In this tree, the unique path from the root node to any leaf node defines the complete subquery execution sequence, where each non-root node specifies the query sub-target to be executed and the data node that carries that execution. This execution decision tree is then sent to the adaptive execution module 40.
[0150] In step S400, the adaptive execution module 40 receives the execution decision tree generated by the routing planning module 30 and is responsible for scheduling and managing the entire distributed query execution process according to the guidance of the execution decision tree. This execution process is not only a simple step-by-step process, but also has the adaptive capability to dynamically adjust according to the actual situation during execution.
[0151] First, the adaptive execution module 40 begins step-by-step execution. Starting from the root node of the execution decision tree, it traverses the path of the execution decision tree layer by layer downwards. Each node on the path encapsulates a specific execution step, namely, "which query sub-target to execute on which data node." Based on this, the adaptive execution module 40 constructs a specific subquery and sends the subquery to the target data node specified in that step. After sending the subquery, the adaptive execution module 40 suspends and waits for the target data node to return the intermediate result set of the subquery.
[0152] Upon receiving the intermediate result set, the adaptive execution module 40 evaluates the deviation between the actual and expected results of the execution. In one specific embodiment, this evaluation is achieved by comparing the actual result size (i.e., the number of results) of the returned intermediate result set with the expected result size predicted based on conditional potential during route planning. If the difference between the actual and expected result size exceeds a preset threshold (e.g., the actual result size is one or more orders of magnitude higher than the expected result size), or if an extreme case occurs where the expected result size is not empty but the actual result size is empty, a significant planning deviation is determined to have occurred.
[0153] When such a significant deviation is detected, a dynamic rerouting mechanism will be triggered, instead of blindly continuing to execute the remaining subsequent steps in the original execution decision tree, which are based on erroneous predictions. At this time, the adaptive execution module 40 will pause the current execution flow and feed back the actual intermediate result set that has been obtained to the routing planning module 30.
[0154] After receiving these real intermediate result sets, the routing planning module 30 restarts the routing planning process for all unexecuted query sub-goals in the query dependency graph. This routing planning process is exactly the same as step S300, but the key difference is that the input to this routing planning process (i.e., the set of preconditions C) is based on 100% accurate real data obtained up to this point, rather than predictions based on a spatiotemporal semantic potential field model. This makes the calculation of the conditional potential energy, the prediction of the potential energy gain, and the evaluation of the overall utility more accurate, thereby generating a new and more optimized execution decision tree to guide the remaining query tasks.
[0155] Finally, the adaptive execution module 40 discards the old, inaccurate execution decision tree and adopts the newly generated one, then resumes execution from where it was interrupted. This closed loop of "execution-monitoring-feedback-replanning-continue execution" constitutes the complete adaptive execution process. This process repeats until all query sub-targets in the original query dependency graph have been successfully executed. Finally, the adaptive execution module 40 performs a final merging and joining operation on the intermediate result sets generated in all steps to form the complete query result, which is then returned to the user.
[0156] To further illustrate the present invention, the complete workflow of the method will be described below through an application example.
[0157] Example:
[0158] The application scenario of this embodiment is a provincial land and resources management department that needs to select a site for a new major high-tech industrial park project within a cross-city "Yangtze River Economic Development Zone". This site selection decision requires comprehensive consideration of multi-source heterogeneous data, including current land use, national land spatial planning constraints, and mineral resource distribution.
[0159] The geographic information data of this provincial land and resources management department is managed in a distributed database cluster, mainly including the following heterogeneous data nodes:
[0160] Data node D1 (Land Use Status Database): Stores the annual land use change survey data for the entire province. The core data of D1 is land use patches with precise spatial location (vector polygon) and timestamp (survey year). Each land use patch has semantic types such as "cultivated land", "construction land", and "unused land".
[0161] Data node D2 (Land and Space Planning Database): Stores control boundary data for land and space planning, including the "Three Zones and Three Lines" (ecological protection red line, permanent basic farmland, and urban development boundary). This control boundary data mainly consists of large-scale vector polygons with semantic tags such as "prohibited construction area" and "restricted construction area".
[0162] Data node D3 (Mineral Resource Reserves Database): Stores information on the distribution, reserves, and types of proven mineral resources within the province. The data in D3 is mostly in the form of point or area-like mining areas, and is associated with semantic information such as "iron ore" and "coal mine".
[0163] The method execution flow is as follows:
[0164] Step S100, Offline Stage: Construction of the Spatiotemporal Semantic Potential Field Model:
[0165] During the offline phase of system deployment, the method of this invention has constructed spatiotemporal semantic potential field models for the three data nodes mentioned above.
[0166] For D1 (Land Use Status Database): a Gaussian mixture model was used to construct spatial potential components for the geographic center points of all land use patches, accurately reflecting the land development density of different regions; a kernel density estimation was used to construct temporal potential components for the "survey year" attribute of land use patches; and a cuckoo filter was used to construct semantic potential components for all land use type codes.
[0167] For D2 (National Spatial Planning Database): Gaussian mixture model was also used to construct spatial potential field components to reflect the spatial distribution characteristics of "three zones and three lines"; since the time attribute of this data is weak, its time potential field components can be set to a globally uniform distribution; the Cuckoo Filter was used to construct semantic potential field components for its planning type (such as dbo:PermanentFarmland).
[0168] For D3 (mineral resource reserves database): a Gaussian mixture model was used to construct spatial potential field components for its mineral locations, forming a heat map of mineral resource distribution; a cuckoo filter was used to construct semantic potential field components for mineral types such as "iron ore" and "copper ore".
[0169] Step S200, Online Stage: Query Reception and Parsing:
[0170] A planner initiated the following complex user query: "Within the Yangtze River Economic Development Zone, find all land parcels that were designated for construction after 2023, are not within the permanent basic farmland red line, and require that there be iron ore deposits within a five-kilometer radius of the land parcels."
[0171] After receiving this user query, the system decomposes it into the following four query sub-objectives and constructs a query dependency graph between the sub-objectives (in this example, they all depend on the ? parcel variable):
[0172] g1:?plot rdf:type dbo:ConstructionLand (plot is construction land);
[0173] g2:? Plot ex:surveyYear>2023 (Plots surveyed after 2023);
[0174] g3:?Plot geoof:sfWithin"Yangtze River Economic Development Zone" (spatial scope constraint);
[0175] g4:?plotgeof:sfDisjoint?farmland.?farmlandrdf:type dbo:PermanentFarmland (does not intersect with permanent basic farmland);
[0176] g5:?plot ex:nearBy?mineral.?mineral rdf:type dbo:IronOre (nearby iron ore);
[0177] Step S300, Online Phase, Route Planning:
[0178] The routing planning module begins generating an execution decision tree for the user's query. It first evaluates all query sub-goals (g1, g2, g3, g4, g5) that can serve as starting points.
[0179] Calculating conditional potential energy and potential energy gain: The routing planning module calculates the overall utility of executing each query sub-objective on different data nodes. The process reveals that although g3 (spatial range constraint) can be applied to all data nodes, due to the vast area of the Yangtze River Economic Development Zone, directly executing this spatial range constraint does not effectively narrow the query range of subsequent steps, resulting in a low potential energy gain.
[0180] In contrast, combining steps g1 (construction land) and g2 (after 2023), while initially potentially involving the entire province, has very strong semantic and temporal constraints. By querying the spatiotemporal semantic potential field model of each data node, the system predicts that data node D1 (land use status database) has the highest conditional potential energy under these two constraints. Furthermore, the precise list of land parcels generated after executing this step will significantly constrain the calculation range of subsequent steps g3, g4, and g5, thus resulting in the highest potential energy gain.
[0181] Generating the execution decision tree: Based on the comprehensive utility function, the system decides to take (g1AND g2) as the first execution step and executes it on data node D1. Subsequently, using the land parcel results obtained from D1, g4 (farmland investigation) will be executed on D2, and g5 (iron ore exploration) will be executed on D3. Finally, a clear execution decision tree is formed.
[0182] Step S400, Online Phase, Adaptive Execution:
[0183] The adaptive execution module begins executing the decision tree:
[0184] Step-by-step execution: The adaptive execution module sends a subquery to data node D1, requesting to retrieve all construction land parcels after 2023.
[0185] Dynamic Rerouting: D1 returned results. However, the adaptive execution module discovered that the number of plots returned far exceeded the scale predicted by the spatiotemporal semantic potential field model (possibly because a large-scale development zone was designated for construction that year, and the offline model had not yet fully updated this mutation). This is a significant planning bias. The system immediately paused the original plan. It fed back this real, larger-scale list of plots to the routing planning module and triggered dynamic rerouting.
[0186] Based on this real and massive list of plots, the routing planning module replans for the remaining sub-goals (g4 and g5). The routing planning module now finds that using this massive list of plots to query for nearby iron ore (g5) in D3 is less efficient than first filtering using the "permanent basic farmland" red line (g4) in D2, as the latter is expected to eliminate more than 90% of the candidate plots at once, making it more efficient.
[0187] Thus, a new and better execution decision tree is generated. The adaptive execution module adopts the new plan, first sending the list of plots to D2 for filtering, and then sending the filtered small number of results to D3 for final matching.
[0188] Ultimately, the system efficiently completed this complex cross-database query and returned to the planners a list of candidate plots that accurately met all the conditions, providing strong technical support for scientific decision-making in land resources and urban and rural planning.
[0189] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A distributed database retrieval optimization method for a geographic knowledge graph, characterized in that, The method comprises the following steps: constructing a spatiotemporal semantic potential field model for each data node of a distributed database; receiving a user query, decomposing the user query into multiple query sub-targets, and constructing a query dependency graph according to data dependency relationships among the query sub-targets; based on the spatiotemporal semantic potential field model of each data node and the query dependency graph, predicting the potential energy gain of executing different query sub-targets on subsequent query sub-targets, planning and generating an execution decision tree; converting each query sub-target into an executable sub-query, sending the sub-query to a corresponding target data node according to the execution decision tree, and performing adaptive execution, wherein, before the step of planning and generating an execution decision tree, the method further comprises: for a query sub-target and a data node, calculating a conditional potential energy under a given precondition based on the constraint conditions contained in the query sub-target and the spatiotemporal semantic potential field model of the data node, the conditional potential energy being used to quantify the expected matching degree of executing the query sub-target on the data node, the potential energy gain is defined as the difference between the total system potential corresponding to all subsequent query sub-targets after executing a query sub-target and the total system potential before executing the query sub-target, the total system potential being the sum of the maximum conditional potential energy that one or more query sub-targets can achieve in all data nodes, the step of planning and generating an execution decision tree comprises: calculating the comprehensive utility of the combination of a query sub-target and a data node according to the conditional potential energy and the potential energy gain of the query sub-target on the data node, iteratively selecting the combination of the query sub-target and the data node with the maximum comprehensive utility as the next execution step of the execution decision tree, until all query sub-targets are planned. 2.The distributed database retrieval optimization method for geographic knowledge graph according to claim 1, wherein, The step of constructing a spatiotemporal semantic potential field model comprises: constructing a spatial potential field component for representing the spatial position distribution density of data in the data node; constructing a temporal potential field component for representing the temporal attribute distribution density of data in the data node; constructing a semantic potential field component for representing the set of semantic concepts contained in the data node. 3.The distributed database retrieval optimization method for geographic knowledge graph according to claim 2, characterized in that, The construction of the spatial potential field component adopts a Gaussian mixture model; the construction of the temporal potential field component adopts kernel density estimation; and the construction of the semantic potential field component adopts a probabilistic data structure. 4.The distributed database retrieval optimization method for geographic knowledge graph according to claim 1, wherein, The step of decomposing the user query into multiple query sub-targets and constructing a query dependency graph according to data dependency relationships among the query sub-targets comprises: parsing a basic graph pattern in the user query into one or more triple patterns, each triple pattern corresponding to a query sub-target; analyzing whether there are shared query variables among the multiple query sub-targets, and if so, establishing a data dependency relationship for the corresponding query sub-targets in the query dependency graph. 5.The distributed database retrieval optimization method for geographic knowledge graph according to claim 1, wherein, The step of adaptive execution comprises: receiving an intermediate result set of a sub-query returned by a target data node; judging whether the deviation between the actual result size of the intermediate result set and the expected result size predicted based on the conditional potential energy exceeds a preset threshold; if the deviation exceeds the preset threshold, triggering dynamic rerouting.
6. The distributed database retrieval optimization method for geographic knowledge graph according to claim 5, characterized in that, The step of dynamic re-routing comprises: a step of taking the intermediate result set as a new precondition, re-executing the plan and generating an updated execution decision tree for query sub-targets in the query dependency graph that have not been executed.
7. A distributed database search optimization system for a geographic knowledge graph, for implementing the method of any one of claims 1-6, characterized in that, comprise: a potential field model construction module, configured to construct a spatiotemporal semantic potential field model for each data node of the distributed database; a query analysis module, configured to receive a user query, decompose the user query into multiple query sub-targets, and construct a query dependency graph according to data dependency relationships among the query sub-targets; a routing plan module, configured to predict potential energy gain of executing different query sub-targets on subsequent query sub-targets based on the spatiotemporal semantic potential field model of each data node and the query dependency graph, plan and generate an execution decision tree; an adaptive execution module, configured to send sub-queries to target data nodes step by step according to the execution decision tree and perform adaptive execution.
Citation Information
Patent Citations
Detection system for natural land resources
CN120525192A
Natural language space-time retrieval method and system based on large model
CN120653659A