An artificial intelligence-based distributed attribute graph query processing method and system
By employing an AI-based distributed attribute graph query processing method, which utilizes the Transformer model and graph neural network to optimize the query plan, the local optimum problem in query processing under dynamic environments is solved, improving query efficiency and accuracy, and adapting to distributed clusters of different sizes.
Patent Information
- Application Number
- CN202611129495.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2026-05-29
- Filing Date
- 2026-07-28
- Publication Date
- 2026-11-27
AI Technical Summary
Existing distributed attribute graph query processing technologies have weak adaptability in dynamic environments, low efficiency in complex queries, and insufficient collaborative optimization of attributes and structures, leading to query plans getting stuck in local optima, repeated data transmission, and redundant calculations.
An artificial intelligence-based approach is adopted, which uses a pre-trained Transformer model to identify query intent, and combines a dynamic scheduling model and a graph neural network to optimize the query plan, thereby achieving dynamic adaptive optimization and path planning, and collaboratively processing attribute and structure queries.
It improves query latency stability, reduces query time, enhances the efficiency of complex queries and the accuracy of attribute-structure collaborative processing, adapts to distributed clusters of different sizes, and reduces the amount of invalid data processing.
Smart Images

Figure CN123178682A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed data processing and artificial intelligence, specifically to a distributed attribute graph query processing method and system based on artificial intelligence. It is suitable for efficient query needs in large-scale distributed attribute graph scenarios and can be applied to fields such as financial risk control knowledge graphs, social network analysis, and industrial internet device correlation analysis. Background Technology
[0002] Currently, with the development of big data technology, attribute graphs, as a data model capable of expressing complex relationships and rich attribute information of entities, are widely used in various complex scenarios. To address the data storage and access requirements of large-scale attribute graphs, distributed deployment has become the mainstream architecture, which involves partitioning and storing attribute graph data in a cluster composed of multiple nodes.
[0003] Existing distributed attribute graph query processing technologies mainly employ query optimization strategies based on predefined rules. The core process includes query parsing, partition location, subquery distribution, and result aggregation. For example, some technologies locate the nodes involved in the query through a static partition mapping table and use a fixed subquery execution order scheduling strategy; other technologies optimize query plan generation through pre-computed statistical information (such as node degree distribution and attribute value frequency).
[0004] However, existing technologies have the following significant drawbacks: First, query optimization accuracy is insufficient. Static rules are difficult to adapt to dynamic changes in distributed environments (such as node load fluctuations and data distribution updates), easily leading to query plans getting stuck in local optima. For example, when the load on a node suddenly increases, a large number of subquery tasks are still allocated, causing an increase in overall query latency. Second, multi-hop join queries are inefficient. For complex queries involving multiple node joins, there is a lack of effective path planning capabilities, often resulting in duplicate data transmission or redundant computation. Especially in cross-partition join scenarios, data transmission overhead can account for more than 60% of the total query time. Third, support for attribute and structure fusion queries is insufficient. Existing technologies mainly focus on graph structure query optimization, with weak collaborative optimization capabilities for attribute condition filtering and structure queries. When queries contain complex attribute constraints (such as range queries and fuzzy matching), a large amount of invalid data is easily transmitted and processed.
[0005] Although existing technologies have introduced improvements such as graph index optimization and attribute storage optimization, none of them have deeply integrated artificial intelligence technology into the entire query processing process, and therefore cannot fundamentally solve the problems of adaptive optimization and intelligent planning for complex queries in dynamic environments. Summary of the Invention
[0006] To overcome the technical problems of existing distributed attribute graph query processing technologies, such as weak dynamic adaptation capability, low efficiency of complex queries, and insufficient collaborative optimization of attributes and structures, this invention provides a distributed attribute graph query processing method and system based on artificial intelligence.
[0007] The technical solution adopted by this invention to solve its technical problem is: A distributed attribute graph query processing method based on artificial intelligence includes the following steps: The user's graph query request is parsed and validated to obtain an intermediate representation of the query. Based on the intermediate representation of the query, the pre-trained model is used to identify and classify the query intent, and the initial query plan set is generated by combining the partition distribution information of the distributed attribute graph. The initial query plan set is optimized using a dynamic scheduling model to obtain an optimized query plan set. Each execution node collaboratively executes the query plan from the optimized query plan set to obtain intermediate results; The intermediate results from each execution node are aggregated and calculated to obtain the query result.
[0008] Furthermore, the query intermediate represents a structure query part and an attribute query part.
[0009] Furthermore, the query intent is identified and classified based on the pre-trained Transformer model, and the query node is encoded using node label features and node degree features. The initial query plan set is generated by combining the partition distribution information of the distributed attribute graph. Each query plan in the initial query plan set includes a subquery splitting scheme, partition access order, and result aggregation rules.
[0010] Furthermore, the dynamic scheduling model collects real-time status data of each execution node, uses reinforcement learning algorithms to evaluate and optimize the initial query plan set, and uses a reward function to adjust the node allocation scheme and execution priority of subqueries. The optimization objective of the dynamic scheduling model is to minimize the total query time and achieve cluster load balancing. It learns online through real-time feedback of the performance data of the execution nodes to achieve adaptive adjustment in a dynamic environment.
[0011] Furthermore, the execution nodes collaboratively execute the query plans in the optimized query plan set, including: for complex queries containing multi-hop associations, learning the topology of the distributed attribute graph based on graph neural networks, and outputting the optimal partition access path in combination with the path constraints of the current query during query execution.
[0012] Furthermore, the execution nodes collaboratively execute the query plans in the optimized query plan set, including performing attribute-structure collaborative queries using the following steps: The attribute-structure co-optimizer is used to jointly optimize the attribute constraints and structural constraints of the query to generate a collaborative filtering strategy: first, filter the candidate node set that meets the conditions through attribute constraints, and then perform adjacent node query based on structural constraints. By fusing attribute features and structural features, and calculating the similarity between the fused vector and the target vector corresponding to the query conditions, a set of nodes and edges that meet the joint constraints of attributes and structure are selected.
[0013] Furthermore, the execution nodes collaboratively execute the query plans in the optimized query plan set, including optimizing cross-partition join operations and join order using a two-layer rewrite-to-sort framework; the two-layer rewrite-to-sort framework includes: A partition-aware query rewriting strategy is adopted to reorganize and merge subqueries at partition boundaries, reducing intermediate results during cross-partition join operations; The partition-aware query rewriting strategy utilizes graph neural networks and reinforcement learning to construct a local rewriting model and a global ranking model. The local rewriting model performs local logical reorganization on subqueries in a single partition or adjacent partitions, optimizing the execution order and data access path of the subqueries. The global ranking model globally optimizes the execution order and node allocation scheme of all subqueries in the distributed cluster, outputting the optimal global execution order.
[0014] A distributed attribute graph query and processing system based on artificial intelligence, characterized in that it includes: The query access module is used to perform syntax parsing and validity verification on the user's graph query request to obtain the intermediate query representation; The AI intelligent optimization module is used to identify and classify query intent based on the intermediate representation of the query using a pre-trained model, generate an initial query plan set by combining the partition distribution information of the distributed attribute graph, and optimize the initial query plan set using a dynamic scheduling model to obtain an optimized query plan set. The distributed execution module is used by each execution node to collaboratively execute the query plans in the optimized query plan set and obtain intermediate results. The aggregation module is used to aggregate and calculate the intermediate results of each execution node to obtain the query results.
[0015] The present invention also provides a computer device including a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing the methods described above.
[0016] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a computer, implements the above-described method.
[0017] Compared with the prior art, the present invention has the following significant advantages: 1) Significantly improved dynamic adaptation capability: Through a reinforcement learning-driven dynamic scheduling model, it can respond to changes in cluster state in real time. Experiments show that under cluster load fluctuation scenarios (node CPU utilization fluctuates by ±30%), the query latency stability of this invention is improved by 65%, and the average query time is reduced by 32% compared with the traditional static scheduling strategy, effectively avoiding the local optimum problem.
[0018] 2) Significantly optimized efficiency for complex queries: The GNN-driven path planning model reduces the amount of cross-partition data transfer in multi-hop join queries by 40%-60%, and for complex queries with 3 or more hops, the total time is reduced by an average of 52%.
[0019] 3) Improved accuracy of attribute-structure collaborative processing: The joint optimization strategy improves the collaborative efficiency of attribute filtering and structure query, reducing the amount of invalid data processing by 70%; for queries containing complex attribute constraints (such as multi-condition range queries), the accuracy reaches over 95%, and the error rate is reduced by 60% compared with the traditional separate processing method.
[0020] 4) Enhanced scalability and versatility: Supports multiple graph query languages and partitioning strategies, adapting to distributed clusters of different sizes (from 10 nodes to 1000 nodes); the model achieves performance iteration through online learning, and can quickly adapt to new business scenarios (such as migrating from social networks to financial risk control) without refactoring the system, shortening the adaptation cycle from 15 days in traditional technology to 3 days. Attached Figure Description
[0021] Figure 1 This is a flowchart of the steps of a distributed attribute graph query processing method based on artificial intelligence according to the present invention.
[0022] Figure 2 This is an example diagram of the distributed attribute graph of the present invention. The diagram illustrates the node types (e.g., "Person", "Comment"), edge relationships (e.g., "hasCreator", "likes"), attribute information (e.g., "gender", "creationDate"), and partitioning (F1, F2) of the distributed attribute graph, and labels the cross-partition edges (e8, e9, e...). 10 e 11 This paper clarifies the core components of the distributed attribute graph, providing an intuitive reference for understanding the application scenarios and partitioned storage strategies of this invention.
[0023] Figure 3 This is an overall framework diagram of the R2O model of this invention. The diagram illustrates the core architecture process of this invention, including key steps such as query decomposition, feature initialization, graph neural network encoding, global ranking model, local rewriting model, and distributed execution. It marks the input and output (such as node features, edge features, and subquery selection results) and data flow of each module, clearly presenting the core working logic of the AI intelligent optimization layer.
[0024] Figure 4 This is a schematic diagram of the query rewriting process of the present invention. The diagram uses two sub-graphs (a) and (b) to illustrate the process of rewriting adjacent subqueries and then rewriting merged subqueries step by step, labeling boundary subqueries (q'1, q'2) and locally joined subqueries (q'...). 1,2 The changes in the generation logic and execution plan of the "partition-aware query rewriting" strategy of this invention intuitively demonstrate how it reduces cross-partition communication and intermediate results.
[0025] Figure 5 This is a performance comparison chart of the R2O algorithm of this invention with the baseline algorithm. The chart shows the execution time comparison between the present invention and the baseline algorithm under different datasets (LDBC-SNBSF-3 / SF-10 / SF-30, DBpedia) and different partitioning strategies (METIS / MPC), which clearly demonstrates the significant advantage of the present invention in query efficiency and provides direct data support for the technical effect.
[0026] Figure 6 This is a schematic diagram of the module composition of a distributed attribute graph query processing system based on artificial intelligence according to the present invention. Detailed Implementation
[0027] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings.
[0028] The specific objectives of this invention include: 1) achieving dynamic adaptive optimization of query plans, which can adjust the execution strategy according to the real-time status of the distributed cluster and avoid local optima; 2) improving the path planning efficiency of multi-hop association queries and reducing cross-partition data transmission and redundant calculations; 3) strengthening the collaborative processing capability of attribute constraints and graph structure queries to improve query filtering accuracy; and 4) building an end-to-end AI-driven query processing framework that covers the entire process optimization from query parsing to result aggregation.
[0029] In one embodiment, the distributed attribute graph query processing method based on artificial intelligence of the present invention, such as... Figure 1 As shown, it includes the following steps: 1) Perform syntax parsing and validity checks on the user's graph query request to obtain an intermediate query representation. The intermediate query representation includes a structure query part and an attribute query part.
[0030] 2) Based on the intermediate representation of the query, the pre-trained model is used to identify and classify the query intent, and the initial query plan set is generated by combining the partition distribution information of the distributed attribute graph.
[0031] 3) Optimize the initial query plan set using a dynamic scheduling model to obtain an optimized query plan set.
[0032] 4) Each execution node collaboratively executes the query plan in the optimized query plan set to obtain intermediate results.
[0033] 5) Aggregate the intermediate results of each execution node to obtain the query results.
[0034] In one embodiment, step 2) identifies and classifies the query intent based on a pre-trained Transformer model, encodes the query node using node label features and node degree features, and generates the initial query plan set by combining the partition distribution information of the distributed attribute graph. Each query plan in the initial query plan set includes a subquery splitting scheme, a partition access order, and result aggregation rules.
[0035] In one embodiment, the dynamic scheduling model in step 3) collects real-time status data of each execution node, uses reinforcement learning algorithm to evaluate and optimize the initial query plan set, and uses reward function to adjust the node allocation scheme and execution priority of subqueries. The optimization objective of the dynamic scheduling model is to minimize the total query time and balance the cluster load. It learns online through real-time feedback of the performance data of the execution nodes to achieve adaptive adjustment in a dynamic environment.
[0036] In one embodiment, step 4) includes: for complex queries involving multi-hop associations, learning the topology of the distributed attribute graph based on a graph neural network, and outputting the optimal partition access path in combination with the path constraints of the current query during query execution.
[0037] In one embodiment, in step 4), each execution node collaboratively executes the query plan in the optimized query plan set, including the following steps for attribute-structure collaborative query: a) using an attribute-structure collaborative optimizer to jointly optimize the attribute constraints and structural constraints of the query, generating a collaborative filtering strategy: first filtering the candidate node set that meets the conditions through attribute constraints, and then querying adjacent nodes based on structural constraints; b) fusing attribute features and structural features, and filtering out the set of nodes and edges that meet the joint constraints of attributes and structure by calculating the similarity between the fused vector and the target vector corresponding to the query conditions.
[0038] In one embodiment, in step 4), each execution node collaboratively executes the query plans in the optimized query plan set, including optimizing cross-partition join operations and join order using a two-layer framework of rewrite-to-sort. The two-layer framework of rewrite-to-sort includes: employing a partition-aware query rewrite strategy to reorganize and merge subqueries at partition boundaries, reducing intermediate results during cross-partition join operations; and based on the partition-aware query rewrite strategy, utilizing graph neural networks and reinforcement learning to construct a local rewrite model and a global sorting model. The local rewrite model performs local logical reorganization of subqueries in a single partition or adjacent partitions, optimizing the execution order and data access path of the subqueries. The global sorting model globally optimizes the execution order of all subqueries and node allocation schemes in the distributed cluster, outputting the optimal global execution order.
[0039] In one embodiment, the present invention provides an AI-based distributed attribute graph query processing method and a system for implementing the method, as detailed below: (I) System Architecture Design The system comprises four layers: a query access layer, an AI intelligent optimization layer, a distributed execution layer, and a data storage layer. These layers work collaboratively to achieve efficient query processing. The module composition and interaction relationships of each layer can be communicated through... Figure 3 Intuitively, this diagram clearly illustrates the entire process from query decomposition to distributed execution, and clarifies the relationship between the AI intelligent optimization layer and the data flow and control flow of other layers.
[0040] Query access layer: Responsible for receiving user query requests (supporting mainstream graph query languages such as Cypher and Gremlin), performing syntax parsing and semantic verification, and outputting a standardized abstract syntax tree (AST).
[0041] AI Intelligent Optimization Layer: This is the core innovation layer of the system, comprising four core modules: a query plan generator, a dynamic scheduling model, a path planning model, and an attribute-structure co-optimizer. It achieves intelligent optimization of the entire query process based on deep learning and reinforcement learning technologies. Figure 3 The core components include the "global ranking model", "local rewriting model", and feature processing.
[0042] Distributed execution layer: Composed of multiple execution nodes, each node deploys a subquery execution engine and a local caching module. It is responsible for receiving optimized subquery tasks, executing local data queries and caching intermediate results, and collaborating with other nodes to complete cross-partition join calculations. Figure 3 The node cluster in the "distributed execution" stage.
[0043] Data storage layer: A partitioned storage architecture is adopted, storing the distributed attribute graph according to a preset strategy (such as vertex hash partitioning and edge cut partitioning) on each data node; each data node maintains a local graph data index (including structure index and attribute index) and a node status monitoring module (real-time collection of status data such as load, storage capacity, and network bandwidth). Figure 2 The partitioned storage structure shown in the image (such as F1, F2 partitions and cross-partition edges) is displayed.
[0044] (II) Core Processing Flow The method includes the following steps, and the module interactions and data flow of each step can be combined. Figure 2 and Figure 3 Understood, the process details are as follows: Step S1: Query Parsing and Preprocessing. The query access layer receives the graph query request submitted by the user and converts it into an Abstract Syntax Tree (AST) through a syntax parser; the semantic verification module combines the metadata of the data storage layer (such as...) Figure 2 The node types "Person" and "Comment", attribute definitions "gender" and "creationDate", and the F1 / F2 partitions defined by the partitioning rules shown in the image are used to perform validity checks on the AST, eliminating invalid queries or supplementing missing attribute constraint information; finally, a standardized intermediate query representation (IR) is output, including the structure query part (such as... Figure 2 The relationship between "Person" and "Comment" in the "hasCreator" section and the attribute query section (such as the attribute condition filter "gender=female").
[0045] Step S2: AI-driven query plan generation. The query plan generator in the AI intelligent optimization layer receives the intermediate query representation and identifies and classifies the query intent based on a pre-trained Transformer model (e.g., point query, edge query, multi-hop path query, attribute aggregation query, etc.); it also combines the partition distribution information fed back from the data storage layer (e.g., ... Figure 2 (For the case where nodes n1-n4 are of type "Person" and are distributed in partitions F1 / F2), an initial query plan set is generated. Each query plan includes a subquery splitting scheme, partition access order, and result aggregation rules.
[0046] The encoding formula for node label features is: In the formula: For node n i The encoded value of the label, To query node n in Q i The corresponding tag type, |L N| represents the total number of unique node labels in the data graph. This formula normalizes the node label features and improves the model's accuracy in recognizing rare labels.
[0047] The encoding formula for node degree features is: Where: degree in (n i degree out (n i ) are nodes n respectively i in-degree, out-degree, degree scale The scaling factor for degree features (set to 100 in the experiment) is used to quantify the impact of node connectivity on query selectivity.
[0048] The Transformer model is trained using massive amounts of historical query data and execution logs. During the training and inference phases, the aforementioned node label and degree features are used as core input features. First, the label and degree information of nodes in the query are converted into standardized numerical vectors using the aforementioned encoding formula. These vectors are then input into the model for intent recognition and classification, thereby accurately identifying the query type and key constraints. The model achieves an accuracy rate of over 92%. Its core logic is... Figure 3 The feature initialization and feature encoding of the graph neural network are consistent with the intent recognition process.
[0049] Step S3: Dynamic Scheduling Strategy Optimization. The dynamic scheduling model collects real-time status data (including CPU utilization, memory usage, network latency, and current task queue length) from each node in the distributed execution layer. It then uses a reinforcement learning algorithm (DQN) to evaluate and optimize the initial query plan set, adjusting the node allocation scheme and execution priority of subqueries. The optimization objective of the dynamic scheduling model is to minimize the total query time and achieve cluster load balancing. Constraints include the maximum number of concurrent tasks per node and the network bandwidth limit. The model learns online through real-time feedback of execution node performance data, achieving adaptive adjustment in a dynamic environment. This process corresponds to... Figure 3 Subquery selection and state update logic in the global sorting model.
[0050] The reward function formula for the dynamic scheduling model is: In the formula, T(Q) represents the total execution time for generating the query plan, and the negative sign indicates that the reward increases as the execution time decreases. To address the issue of differences in execution time for different queries, the reward is standardized using Z-score: In the formula, μ R σ is the historical average reward.R This represents the standard deviation of historical rewards.
[0051] The formula for the cumulative reward function is: In the formula, |Q| represents the total number of subqueries, and γ∈(0,1] is the discount factor (0.95 in the experiment). This formula strengthens the weight of the impact of early decisions on the query plan.
[0052] Among them, R Q It is the core feedback metric in the reinforcement learning algorithm (DQN) of the dynamic scheduling model, used to evaluate the merits of the subquery allocation scheme during the dynamic scheduling optimization process in step S3; R Q Maximizing this is equivalent to minimizing the total query time. Subsequently, by combining the final reward function of the load balancing item, we can support the optimization goal of "minimizing the total query time and balancing the cluster load".
[0053] Step S4: Intelligent multi-hop path planning. For complex queries involving multi-hop associations, the path planning model is based on graph neural networks (GNNs) to analyze the topology of distributed attribute graphs (such as...). Figure 2 The system learns the multi-hop paths formed by the "hasCreator" association of "Person-Comment" and the "knows" association of "Person-Person", and pre-calculates the optimal access order of high-frequency association paths.
[0054] The coding formula for boundary degree features is: Where: n s n t For edge e i The source node, the target node, and degree(n) s ) represents the degree of the source node, degree(n) s Let be the degree of the target node. This formula quantifies the impact of edge connectivity on query selectivity.
[0055] In the training and inference phases, Graph Neural Networks (GNNs) use the aforementioned edge degree features as core input features. First, the connectivity information of the edges is converted into standardized numerical vectors through the above encoding formula. Then, these vectors are input into the model to learn the topology structure, thereby pre-calculating the optimal access order of high-frequency associated paths.
[0056] During query execution, the optimal partition access path is output based on the current query's path constraints (such as hop count and node type), avoiding repeated access to the same partition or invalid data transmission. For example, for a four-hop query of "user-order-product-merchant," the model can plan the optimal path of "user partition → order partition → product partition → merchant partition," reducing data transmission volume by more than 40% compared to the traditional random order. Its path planning logic can be achieved through... Figure 3 The process of neighborhood subquery fusion and optimization in the "local rewrite model" helps in understanding.
[0057] Step S5: Attribute-Structure Collaborative Query Execution. The attribute-structure collaborative optimizer jointly optimizes the attribute constraints and structural constraints of the query to generate a collaborative filtering strategy: first, it filters the candidate node set that meets the conditions (e.g., ...) through attribute constraints (local attribute index). Figure 2 (For example, Person nodes n2 and n4 with "gender=female"), then perform adjacent node queries based on structural constraints (such as Comment nodes n8, n9, n4 associated with "hasCreator"). 10 This reduces the size of the candidate set for structured queries.
[0058] The encoding formula for attribute vector features is: In the formula: encode(π(p) j )) is node n i The encoded value of the j-th attribute, α j This is the attribute feature normalization factor. For numerical attributes, it takes the global value range, and for categorical attributes, it takes the number of unique values.
[0059] Meanwhile, vector embedding technology is used to fuse attribute features (such as “creationDate<2019-01-01”) and structural features (such as “hasCreator” edge association) into a unified vector representation. By calculating the similarity between this fused vector and the target vector corresponding to the query conditions, the set of nodes / edges that meet the joint constraints of attribute + structure can be quickly filtered out.
[0060] Each node in the distributed execution layer receives the optimized subquery task, executes the local query and caches intermediate results, and cross-partition queries achieve data interaction through inter-node coordination protocols (such as...). Figure 2 The F1 and F2 partitions are connected via the cross-partition edge e8-e 11 (Data transmission), intermediate results are transmitted incrementally to reduce bandwidth consumption. The subquery rewriting and execution logic for this process can be found in [reference needed]. Figure 4 Middle boundary subquery (q'1 / q'2) and local join subquery (q' 1,2The generation and execution process of subqueries is described below. Subquery rewriting refers to using a partition-aware query rewriting strategy to reorganize and merge subqueries at partition boundaries. Boundary subqueries are subqueries executed only on data within a single partition and involving only the interaction of data between this partition and other partition boundaries (i.e., not involving full data transfer across partitions, only interacting with related data at the partition edges). Local join subqueries are subqueries that perform join calculations on the boundary subquery results of adjacent partitions locally on a single node (avoiding large amounts of data transfer across partitions).
[0061] This invention proposes a two-layer framework, R2O (Rewrite to Sort), to jointly optimize cross-partition join operations and join order for distributed schema queries. The R2O (Rewrite to Sort) two-layer framework includes: First, a partition-aware query rewriting strategy is adopted to reorganize and merge subqueries at partition boundaries to reduce intermediate results during cross-partition join operations. Then, based on a partition-aware query rewriting strategy, graph neural networks and reinforcement learning are used to construct local rewriting models and global ranking models. The "local rewriting model" refers to a subquery optimization model built on graph neural networks (GNNs), used to perform local logical reorganization of subqueries within a single partition or adjacent partitions, optimizing the execution order and data access paths of subqueries, and reducing redundant computation and invalid data reads within partitions. The "global ranking model" refers to a query plan ranking model built on reinforcement learning (DQN), used to globally optimize the execution order and node allocation scheme of all subqueries in the distributed cluster, taking into account factors such as cluster node load and network bandwidth, and outputting the optimal global execution order.
[0062] Step S6: Result Aggregation and Feedback. The designated aggregation node receives intermediate results from each execution node and performs the final aggregation calculation according to the aggregation rules in the query plan (such as counting, summing, and sorting). The query access layer formats the aggregation results and returns them to the user. Simultaneously, the execution log (including query time, performance of each node, and plan execution effect) is fed back to the AI intelligent optimization layer for model parameter updates and performance iteration. The final query performance improvement can be achieved through… Figure 5 The graph visually demonstrates the execution time advantage of this solution compared to the traditional baseline in different query scenarios.
[0063] (III) Details of Key Innovation Modules 1) Dynamic scheduling model: The architecture adopted is DQN (Deep Q Network). The state space includes the CPU utilization (0-100%), memory usage (0-100%), network latency (ms), and task queue length of each node; the action space includes the subquery-node allocation scheme and execution priority (high / medium / low).
[0064] Optimization formula for the reward function of the dynamic scheduling model (balancing efficiency and load balancing): In the formula: T(Q) is the total execution time for generating the query plan, and the negative sign indicates that the reward increases as the execution time decreases; LoadBalance(N) is the load balancing degree of the cluster nodes, calculated as follows: Where: CPU i Let i be the CPU utilization of node i. The formula represents the average CPU utilization of the cluster, where |N| is the total number of nodes. This formula ensures a balance between efficiency and system load balancing, and its core logic corresponds to... Figure 3 The strategy output and reward feedback mechanism of the global ranking model.
[0065] Among them, R final This refers to the cumulative reward function R mentioned earlier. Q Extended optimizations. R Q It is a basic reward based solely on "total query time", R final In R Q The logic adds a "load balancing item", which retains the goal of "minimizing total query time" and adds the constraint of "cluster load balancing", achieving dual optimization of efficiency and cluster stability.
[0066] 2) Path planning model: Built upon GAT (Graph Attention Network), the input is the local topology of a distributed attribute graph (e.g., Figure 2 The path score is output as a path score, which includes the association relationship between nodes n1-n4 within partition F1 and partition information (such as the partition division of F1 / F2). The formula for the total loss function of the path planning model is: In the formula: L critic For the network loss (mean squared error loss), L actor For the policy network loss (policy gradient loss), L entropy This represents the strategy entropy (balancing exploration and exploitation). The calculation formulas are as follows: L critic (Network loss) is calculated using the mean squared error loss formula: Where B is the batch size, y i V(s) is the target value for the i-th sample (calculated from the reinforcement learning reward). i ) is a value network for state s i Value estimate.
[0067] L actor (Policy network loss) is calculated using policy gradient loss, and the formula is: Where π(a) i |s i ) is the policy network in state s i Choose action a i The probability, A(s) i ,a i ) represents state s i Next action a i The advantage of this letter.
[0068] L entropy (Strategy entropy) is used to balance exploration and exploitation, and is calculated as follows: β1=0.5 and β2=0.01 are balancing coefficients used to adjust the weight of each loss item in the total loss.
[0069] The above loss function calculation is a derivative application of existing technology combining reinforcement learning and graph neural networks, which optimizes the decision accuracy of the path planning model through the collaborative optimization of multiple loss terms.
[0070] Focus on frequently associated partition pairs (e.g., using attention mechanisms) Figure 2 The Person node of F1 and the Comment node of F2 are connected via e8-e 11 (High-frequency associations across partition edges), model training employs a combination of supervised learning and reinforcement learning. Supervised data consists of historical best path examples, and reinforcement learning rewards are the transmission efficiency improvement rate corresponding to the path. Its learning process is similar to... Figure 3 The feature transfer and attention calculation process in the "graph neural network" is consistent.
[0071] Compared with the prior art, the present invention has the following significant advantages, all of which have been verified by comparative experiments, and some of these advantages can be intuitively illustrated by the accompanying drawings: 1) Significantly Enhanced Dynamic Adaptability: Through a reinforcement learning-driven dynamic scheduling model, the system can respond to cluster state changes in real time. Experiments show that under fluctuating cluster load scenarios (node CPU utilization fluctuates by ±30%), the present invention improves query latency stability by 65%, and compared to traditional static scheduling strategies, reduces average query time by 32%, effectively avoiding local optima. This advantage can be further demonstrated through… Figure 5 The execution time stability of the R2O algorithm and the baseline algorithm is compared and verified under different query scenarios.
[0072] 2) Significantly improved efficiency for complex queries: The GNN-driven path planning model reduces cross-partition data transfer volume in multi-hop join queries by 40%-60%, and for complex queries with 3 or more hops, the total time is reduced by an average of 52%. For example... Figure 2 The multi-hop query "Person-Comment-Person" is optimized using a path planning model, reducing the number of hops across partition edges e8-e. 11 The amount of data transmitted is reduced by more than 50%, corresponding to Figure 4 The significant reduction in intermediate results after query rewriting.
[0073] 3) Improved accuracy of attribute-structure collaborative processing: The joint optimization strategy improves the collaborative efficiency of attribute filtering and structure querying, reducing invalid data processing by 70%; for queries containing complex attribute constraints (such as multi-condition range queries), the accuracy reaches over 95%, and the error rate is reduced by 60% compared to the traditional separate processing method. For example... Figure 2 The joint constraint query of “gender=female” and “creationDate<2019-01-01” can be optimized through collaboration so that invalid candidate nodes (such as male Person nodes such as n1 and n3) can be filtered locally without cross-partition transmission.
[0074] 4) Enhanced scalability and versatility: Supports multiple graph query languages and partitioning strategies, adapting to distributed clusters of different sizes (from 10 nodes to 1000 nodes); the model achieves performance iteration through online learning, enabling rapid adaptation to new business scenarios (such as migrating from social networks to financial risk control) without system reconstruction, reducing the adaptation cycle from 15 days in traditional technologies to 3 days. Figure 2 The social network attribute graph is replaced with the "user-account-transaction-merchant" attribute graph of financial risk control, and the system can directly complete the adaptation by fine-tuning the model parameters.
[0075] Experimental environment description: A 100-node distributed cluster is used to store an attribute graph dataset containing 1 billion vertices and 5 billion edges (simulating social network data, with a structure similar to...). Figure 2 (Consistent), the comparison objects are the traditional static scheduling scheme and the Huawei CN120872947A scheme. Each experimental case was executed 100 times and the average value was taken. The experimental results are as follows: Figure 5 As shown, the present invention demonstrates significant efficiency advantages across various dataset sizes.
[0076] To further illustrate the feasibility of this invention, the specific implementation process is described in detail using "fraudulent transaction detection and query" in a financial risk control scenario as an example: (a) Implementation scenarios and query requirements.
[0077] Scenario: A distributed attribute graph stores financial transaction data, containing four types of nodes: "User," "Account," "Transaction," and "Merchant," and three types of edges: "Association," "Transfer," and "Consumption." Node attributes include user age, account balance, transaction amount, and merchant type. Data is partitioned and stored in a cluster of 10 nodes, partitioned by "user ID hash," and its storage structure is similar to... Figure 2 The partitioning logic is consistent, with each node corresponding to an independent storage unit similar to F1 / F2, and cross-node data transfer is handled through a process similar to e8-e. 11 Cross-partition edge protocol implementation.
[0078] Query requirement: Query "within 30 days, users aged 25-35 who made single transfer transactions exceeding 50,000 RMB through their associated accounts to merchants with high risk levels". The query language is Cypher: MATCH(u:User)-[r1:Associated]-(a:Account)-[r2:Transfer]-(m:Merchant) WHERE u.age BETWEEN 25 AND 35 AND r2.amount > 50000 AND r2.time > date()-30 AND m.risk_level = 'High' RETURN u.id, a.account_no, r2.transaction_id.
[0079] (II) Implementation steps.
[0080] Step 1: Query Parsing and Preprocessing. The query access layer receives the Cypher query, the syntax parser generates an AST, and the semantic verification module verifies it in conjunction with metadata (confirming that the User node has an age attribute, the transfer edge has an amount attribute, and so on). Figure 2 The "gender" attribute of the "Person" node and the association definition of the "hasCreator" edge are defined. The output query intermediate representation is explicitly defined as "User-association-Account-transfer-Merchant" and the attribute constraints are "u.age∈[25,35], r2.amount>50000, r2.time∈last30 days, m.risk_level='high'".
[0081] Step 2: AI-driven query plan generation. The Transformer model of the query plan generator identifies the query as a "multi-hop attribute-structure joint query," and combines this with partitioning information (Users are distributed across 10 nodes by ID hash, similar to...). Figure 2The logic of "Person" nodes being distributed across F1 / F2 generates an initial plan: The query is split into 10 subqueries (each node processes the User corresponding to the ID segment). The subquery execution order is "User filtering → associated Account query → transfer edge filtering → Merchant risk level verification". The aggregation node is designated as node 1. The feature encoding and plan generation logic of this process are the same as... Figure 3 The processing flow for "feature initialization" and "graph neural network" is the same.
[0082] Step 3: Dynamic Scheduling Strategy Optimization. The dynamic scheduling model collects real-time status data from 10 nodes and finds that nodes 3 (CPU utilization 85%) and 7 (CPU utilization 90%) have high loads, while nodes 2 (CPU utilization 30%) and 8 (CPU utilization 25%) have low loads. After optimization using the DQN model, the subquery allocation is adjusted: half of the subqueries from node 3 are moved to node 2, and half of the subqueries from node 7 are moved to node 8. The execution priority is set to "medium" to avoid overloading high-load nodes. This scheduling logic corresponds to... Figure 3 The process of subquery selection and action space update in the global ranking model.
[0083] Step 4: Intelligent Multi-Hop Path Planning. The path planning model, based on GAT network topology analysis, identifies the optimal path as "User node partition → Account partition (same partition as User) → Merchant partition (concentrated on nodes 5 and 6)," and so on. Figure 2 The partition distribution and association path optimization logic for the "Person" and "Comment" nodes are as follows: Each node executes a "User→Account" query locally, and then uniformly initiates a "Account→Merchant" cross-partition query to nodes 5 and 6, avoiding broadcasting the query to all nodes. This path planning process can be referenced. Figure 4 Optimization ideas for query rewriting paths.
[0084] Figure 4 The process of rewriting adjacent subqueries and rewriting merged subqueries is illustrated step by step using two subgraphs (a) and (b), with boundary subqueries (q'1, q'2) and partial join subqueries (q') marked. 1,2 The changes in the generation logic and execution plan of the "partition-aware query rewriting" strategy of this invention intuitively demonstrate how it reduces cross-partition communication and intermediate results.
[0085] The meanings and explanations of the symbols in the diagram are as follows: Circular nodes (such as p1, c1): indicate the entity types involved in the query (corresponding to the node types in the attribute graph); Edges (e.g., h1, l1): represent the relationships between entities (corresponding to the edge types in the attribute graph); Subquery identifiers (e.g., q1, q2): indicate the original subquery to be rewritten; Rewritten subquery identifiers (e.g., q'1, q'2): indicate the boundary subquery after partition-aware rewriting; Merge subquery identifiers (e.g., q') 1,2 ): represents a partial join subquery resulting from merging multiple boundary subqueries; A node labeled "I" indicates that the entity / relationship is the input for the query (data needs to be obtained from other partitions); A node labeled "E" indicates that the entity / relationship is the output of a query (data needs to be transferred to other partitions).
[0086] like Figure 4 As shown in (a), the rewriting process of q1 and q2 is illustrated. The processing steps include: Original subqueries q1 (containing p1→h1→c1) and q2 (containing p1→h1→c1→l1→p2); After partition-aware rewriting, boundary subqueries q'1 (p1→h1→c1, c1 marked with "E" indicates output) and q'2 (p1→h1→c1→l1→p2, p1 marked with "I" and c1 marked with "I" indicate input) are generated. Merging q'1 and q'2 yields a locally joined subquery q' 1,2 (p1→h1→c1→l1→p2, p1 is labeled "I", c1 is labeled "I"), to achieve local connection of cross-partition data.
[0087] like Figure 4 As shown in (b), q is displayed. (1,2) The rewriting process of q3 includes the following steps: Based on q' in Figure 4(a) 1,2 Combined with the new subquery q3 (c1→l1→p2); After rewriting, q' is generated 1,2 (p1→h1→c1→l1→p2, c1 is labeled “I”, p2 is labeled “E”), q'3 (c1→l1→p2, c1 is labeled “E”, p2 is labeled “I”); The result of merging is q' 1,2,3 (p1→h1→c1→l1→p2, p1 is marked with "I", c1 is marked with "I", p2 is marked with "I"), further reducing cross-partition communication.
[0088] Step 5: Attribute-Structure Collaborative Query Execution. Attribute-Structure Collaborative Optimizer Generation Strategy: This step achieves optimization through the collaboration of a "local rewrite model" and a "global sorting model": First, the local rewrite model is called to logically reorganize the local subqueries of each node (such as "User filtering → associated Account query"), optimizing the execution order of subqueries (prioritizing attribute filtering before structure query) and data access path (prioritizing reading local attribute indexes), reducing redundant calculations within partitions; simultaneously, combined with the subquery execution priority output by the global sorting model, subtasks such as "attribute filtering" and "structural constraint filtering" are scheduled to nodes with lower loads according to priority; each node first filters out Users with age∈[25,35] through the local attribute index (filtering out approximately 60% of invalid Users, similar to...). Figure 2 The process involves filtering for the "gender=female" attribute, then querying its associated Account; filtering for Accounts with a "transfer" edge using structural constraints, and then filtering for transfer records with amount > 50000 and meeting the time requirements using attribute indexes; finally, transmitting candidate AccountIDs to nodes 5 and 6, which filter for Merchants with high risk levels using attribute indexes and returning matching results. During execution, each node caches intermediate results (such as matching User-Account pairs), which can be reused for subsequent similar queries. The cache validity period is set to 1 hour. The subquery execution and intermediate result processing logic of this process is similar to... Figure 4 The execution flow of middle boundary subqueries and partial join subqueries is the same.
[0089] Step 6: Result Aggregation and Feedback. Node 1 receives the matching results from each execution node, deduplicates them by "u.id", and outputs the user ID, account number, and transaction ID in a formatted manner; simultaneously, it feeds back the execution log: total time 1.2 seconds, compared to 3.1 seconds for the traditional solution, resulting in a 61% efficiency improvement. This performance advantage is comparable to... Figure 5 The present invention shown in the paper achieves the same acceleration effect as the baseline algorithm; the log is used to update the parameters of the dynamic scheduling model and the path planning model, so as to realize online iterative optimization of the model.
[0090] (III) Implementation equipment and parameters.
[0091] Hardware: Execution nodes use Intel Xeon E5-2678v3 processors (12 cores), 32GB of RAM, and a 10Gbps network card; data nodes use SSD storage (2TB capacity); aggregation nodes have the same configuration as execution nodes, with an additional GPU (NVIDIA Tesla V100) deployed for AI model inference (corresponding to...). Figure 3 Parallel computing requirements of "Graph Neural Networks" and "MLP" in China.
[0092] Software parameters: AI model inference accuracy is FP16, dynamic scheduling model update cycle is 5 minutes, path planning model pre-training cycle is 24 hours, local cache capacity is limited to 20% of node memory, and... Figure 3 The training and inference processes of the model are configured with the same parameters.
[0093] The core innovation of this invention lies in deeply integrating AI technology into the entire process of distributed attribute graph query processing. Through technologies such as Transformer, reinforcement learning, and graph neural networks, it achieves dynamic optimization and intelligent planning. This differs from the static rule optimization approach of existing technologies; its core logic is achieved through… Figure 3 Framework diagram Figure 4 The rewrite process is clearly illustrated in the diagram. This invention allows for adjustment of model parameters (such as reward function weights and cache expiration) based on actual application scenarios, and can also be extended to support more query languages or partitioning strategies, demonstrating excellent scalability. Based on the technical solution of this invention, federated learning technology can be further introduced to adapt to distributed query requirements in privacy-preserving scenarios.
[0094] In addition to financial transaction querying in the above embodiments, the present invention can also be used in scenarios such as social network relationship analysis and industrial Internet equipment fault location.
[0095] For example, in a social network relationship analysis scenario, the data in the distributed attribute graph consists of user nodes (including attributes such as age, gender, and region), content nodes (including attributes such as publication time, type, and popularity), and interaction edges (including relationships such as likes, comments, and reposts). Using the method of this invention, we can query the "content types and core propagation paths of users aged 18-25 in a specific region who have interacted frequently in the past 7 days" in this scenario. This can reduce the amount of cross-regional data transmission by more than 55%, improve query efficiency by 48%, and achieve a propagation path identification accuracy of 93%.
[0096] For example, in the scenario of fault location of industrial Internet equipment, the data in the distributed attribute graph of this scenario includes equipment nodes (including attributes such as model, runtime, firmware version, etc.), sensor nodes (including attributes such as monitoring indicators, installation location, accuracy, etc.), and associated edges (including relationships such as data transmission, control commands, physical connections, etc.). Using the method of this invention, we can query "the associated sensor data and fault propagation path of abnormal equipment in a certain production line in the past 24 hours" in this scenario, which can reduce the fault location delay by 62%, reduce the amount of invalid data processing by 75%, and achieve a fault propagation path identification accuracy of 94%.
[0097] In one embodiment, the present invention provides a distributed attribute graph query processing system based on artificial intelligence, such as... Figure 6 As shown, it includes: The query access module is used to perform syntax parsing and validity verification on the user's graph query request to obtain the intermediate query representation; The AI intelligent optimization module is used to identify and classify query intent based on the intermediate representation of the query using a pre-trained model, generate an initial query plan set by combining the partition distribution information of the distributed attribute graph, and optimize the initial query plan set using a dynamic scheduling model to obtain an optimized query plan set. The distributed execution module is used by each execution node to collaboratively execute the query plans in the optimized query plan set and obtain intermediate results. The aggregation module is used to aggregate and calculate the intermediate results of each execution node to obtain the query results.
[0098] The above division of modules is merely illustrative. In practical applications, the functions described above can be assigned to different functional modules as needed to complete all or part of the functions described in the aforementioned method. The specific working process of each module can be referred to the corresponding process in the aforementioned method embodiments. Each module can be implemented entirely or partially through software, hardware, or a combination thereof. For example, one embodiment of the present invention provides a computer device (computer, server, etc.) including a memory and a processor. The memory stores a computer program, which is configured to be executed by the processor. The computer program includes instructions for performing the steps of the method of the present invention. Another embodiment of the present invention provides a computer-readable storage medium (such as ROM / RAM, disk, optical disk, etc.) storing a computer program. When the computer program is executed by a computer, it implements the steps of the method of the present invention. Yet another embodiment of the present invention provides a computer program product including a computer program, which, when executed by a computer, implements the steps of the method of the present invention.
[0099] The specific embodiments of the present invention disclosed above are intended to help understand the content of the present invention and to implement it accordingly. Those skilled in the art will understand that various substitutions, changes, and modifications are possible without departing from the spirit and scope of the present invention. The present invention should not be limited to the content disclosed in the embodiments of this specification; the scope of protection of the present invention is defined by the claims.
Claims
1. A distributed attribute graph query processing method based on artificial intelligence, characterized in that, Includes the following steps: The user's graph query request is parsed and validated to obtain an intermediate representation of the query. Based on the intermediate representation of the query, the pre-trained model is used to identify and classify the query intent, and the initial query plan set is generated by combining the partition distribution information of the distributed attribute graph. The initial query plan set is optimized using a dynamic scheduling model to obtain an optimized query plan set. Each execution node collaboratively executes the query plan from the optimized query plan set to obtain intermediate results; The intermediate results from each execution node are aggregated and calculated to obtain the query result.
2. The method according to claim 1, characterized in that, The query intermediate represents the inclusion of a structure query part and an attribute query part.
3. The method according to claim 1, characterized in that, The query intent is identified and classified based on the pre-trained Transformer model. The query node is encoded using node label features and node degree features. The initial query plan set is generated by combining the partition distribution information of the distributed attribute graph. Each query plan in the initial query plan set includes a subquery splitting scheme, partition access order and result aggregation rules.
4. The method according to claim 1, characterized in that, The dynamic scheduling model collects real-time status data of each execution node, uses reinforcement learning algorithm to evaluate and optimize the initial query plan set, and uses reward function to adjust the node allocation scheme and execution priority of subqueries. The optimization objective of the dynamic scheduling model is to minimize the total query time and balance the cluster load. It learns online by using real-time feedback performance data of the execution nodes to achieve adaptive adjustment in a dynamic environment.
5. The method according to claim 1, characterized in that, The execution nodes collaboratively execute the query plans in the optimized query plan set, including: for complex queries containing multi-hop associations, learning the topology of the distributed attribute graph based on graph neural networks, and outputting the optimal partition access path in combination with the path constraints of the current query during query execution.
6. The method according to claim 1, characterized in that, The collaborative execution of query plans from the optimized query plan set by each execution node includes the following steps for attribute-structure collaborative querying: The attribute-structure co-optimizer is used to jointly optimize the attribute constraints and structural constraints of the query to generate a collaborative filtering strategy: first, filter the candidate node set that meets the conditions through attribute constraints, and then perform adjacent node query based on structural constraints. By fusing attribute features and structural features, and calculating the similarity between the fused vector and the target vector corresponding to the query conditions, a set of nodes and edges that meet the joint constraints of attributes and structure are selected.
7. The method according to claim 1, characterized in that, The execution nodes collaboratively execute the query plans in the optimized query plan set, including optimizing cross-partition join operations and join order using a two-layer framework of rewriting to sorting; The two-layer framework for rewriting to sorting includes: A partition-aware query rewriting strategy is adopted to reorganize and merge subqueries at partition boundaries, reducing intermediate results during cross-partition join operations; The partition-aware query rewriting strategy utilizes graph neural networks and reinforcement learning to construct a local rewriting model and a global ranking model. The local rewriting model performs local logical reorganization on subqueries in a single partition or adjacent partitions, optimizing the execution order and data access path of the subqueries. The global ranking model globally optimizes the execution order and node allocation scheme of all subqueries in the distributed cluster, outputting the optimal global execution order.
8. A distributed attribute graph query processing system based on artificial intelligence, characterized in that, include: The query access module is used to perform syntax parsing and validity verification on the user's graph query request to obtain the intermediate query representation; The AI intelligent optimization module is used to identify and classify query intent based on the intermediate representation of the query using a pre-trained model, generate an initial query plan set by combining the partition distribution information of the distributed attribute graph, and optimize the initial query plan set using a dynamic scheduling model to obtain an optimized query plan set. The distributed execution module is used by each execution node to collaboratively execute the query plans in the optimized query plan set and obtain intermediate results. The aggregation module is used to aggregate and calculate the intermediate results of each execution node to obtain the query results.
9. A computer device, characterized in that, It includes a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing the method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a computer, implements the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data processing method, electronic equipment, readable storage medium and program product
CN120872947A
