Patent ID: 11874831
Assignee: VESOFT COMPANY LIMITED
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 0:
1. A method for managing an execution plan in a graph database, comprising:
acquiring a graph query language, analyzing the graph query language by using a scanner to generate a predefined Token, parsing the predefined Token into a data structure by using a parser, and obtaining an abstract syntax tree;
processing the abstract syntax tree by using a planner to generate an execution plan, and optimizing the execution plan by using an optimizer, wherein the execution plan comprises customized execution operators and customized topologies; and
traversing and scheduling the execution plan by using a scheduler, to output an execution result;
wherein the traversing the execution plan by using a scheduler comprises:
traversing the execution plan in a breadth-first search manner by using the scheduler, and establishing a complete message notification flow for all execution nodes running execution operators in the execution plan, wherein the execution nodes and the execution operators correspond to each other in a one-to-one manner in the execution plan; and
during generation of the execution plan, registering a mapping table to store variables in the execution plan and corresponding variable values, and traversing the execution plan in a pre-order traversal manner by using the scheduler, to find out end users of all the variables in the mapping table;
wherein the execution plan is executed in the following sequence: executing a dependent operator of a current execution operator by an execution node first, and then executing the current execution operator;
wherein in the process of executing the execution plan on the execution node, if a current execution operator is an end user of an input variable in a mapping table, releasing a variable value corresponding to the input variable after execution of the current execution operator is completed, wherein an operator using the input variable is called the current execution operator;
wherein the traversing the execution plan in a pre-order traversal manner by using the scheduler, to find out end users of all the variables in the mapping table comprises:
traversing the execution plan by using the scheduler in a sequence reverse to an execution sequence of the execution plan, wherein an execution operator that first cites a variable in the mapping table is the end user of the variable; and
wherein determining an end user of a variable comprises:
(Step S401) traversing operators in the execution plan in a pre-order traversal manner, and determine whether an input variable of a current execution operator has been used before being inputted;
(Step S402) if it is determined that the input variable of the current execution operator has not been used, set the current execution operator as an end user of the input variable;
(Step S403) if it is determined that the current execution operator has been used, further determine whether the current execution operator has a branch operator;
(Step S404) if the current execution operator has a branch operator, enter the branch operator and determine whether the branch operator has a dependent operator;
(Step S405) if the current execution operator has no branch operator, determine whether the current execution operator has a dependent operator;
(Step S406) if it is determined in (step S404) or (step S405) that there is no dependent operator, it indicates that all the execution operators in the execution task have been traversed, and an end user of each variable in a mapping table is obtained; and
(Step S407) if it is determined in (step S404) or (step S405) that there is a dependent operator, set the dependent operator as the current execution operator, and continue to perform (step S401) to (step S406) cyclically.