A method for generating a workflow service based on AST for service orchestration

By using an AST-based workflow service generation method, the problems of cumbersome traditional service deployment processes and high resource consumption are solved, enabling fast and flexible service orchestration and cloud-native access.

CN115202668BActive Publication Date: 2026-05-29HANGZHOU DIANZI UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU DIANZI UNIV
Filing Date
2022-08-04
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Traditional service deployment processes are cumbersome and time-consuming, with poor code reusability. Existing service orchestration solutions have high resource consumption and limited applicability to various scenarios.

Method used

By dragging and dropping atomic services in the system's middleware, state language nodes for business processes are formed. The backend analyzes the data and logic to form an AST tree and generates executable code to provide services in the form of HTTP services.

Benefits of technology

It enables stateless executable programs with low resource consumption, fast cold start speed, wide applicability, and supports seamless cloud-native integration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115202668B_ABST
    Figure CN115202668B_ABST
Patent Text Reader

Abstract

The application discloses a service-oriented arrangement method for generating a workflow service based on an AST. The application specifically realizes the following steps: a management personnel combines atomic services in a system platform in a dragging manner to form state language nodes of a business process; a back end analyzes data and logic in the state language nodes, combines and forms an AST tree of a required language; fixed input and output logic is added; the AST tree is converted into readable code of a corresponding language, and the readable code is generated or executed into a process service through a general editor / interpreter of the language; and the application provides services in the form of an HTTP service. The executable program of the application does not depend on other independently running components, is convenient to extend, has clear responsibilities, occupies fewer resources, has a fast cold start speed and is cloud-native compared with a traditional method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer backend development technology, and in particular provides a service-oriented orchestration method based on Abstract Syntax Tree (AST) with clearly defined responsibilities for generating workflows. Background Technology

[0002] With the continuous development of computer technology, its application in various fields is becoming increasingly widespread. Therefore, technical personnel need to write different business codes according to different business requirements.

[0003] In traditional models, service deployment processes are cumbersome, time-consuming, and have poor code reusability. In service orchestration, related services are decomposed into atomic services with single functions. Each service can be deployed and used independently, and the required functions can be completed through different organizational orchestration methods to achieve the goal of rapid business deployment.

[0004] Most service orchestration solutions currently on the market can only convert processes into sets of state machine nodes and interpret and execute them, which requires high server configuration and is time-consuming. How to achieve low resource consumption and wide applicability is a key issue of concern for those skilled in the art. Summary of the Invention

[0005] The purpose of this invention is to provide a method for generating workflow services based on AST for service-oriented orchestration.

[0006] The technical solution of this invention is as follows:

[0007] Administrators can combine atomic services by dragging and dropping through the system platform to form state language nodes for business processes.

[0008] The backend analyzes the data and logic in the state language nodes and merges them to form the AST tree of the required language;

[0009] Add fixed input and output logic to the AST tree;

[0010] The AST tree is converted into readable code in the corresponding language, and the readable code is then used to generate an executable flow service through a general-purpose editor and interpreter for that language.

[0011] It provides services to the outside world in the form of HTTP services.

[0012] Furthermore, the system platform allows for the combination of atomic services via drag-and-drop. Atomic services can be combined as needed, and this combination process is visualized. The status language nodes of the business process are displayed in real time after dragging and dropping, which can be directly viewed by administrators.

[0013] Furthermore, the atomic service is the smallest service unit in the entire business process, which cannot be further divided, and the atomic service can independently complete a specific function.

[0014] Furthermore, the state language node includes sequence nodes and branch nodes, and the sequence node can call the corresponding atomic service; the sequence node is a task node that marks the task order.

[0015] Furthermore, the implementation of the analytical data and logic includes: resource management, dependency analysis, variable analysis, and code completion.

[0016] The resource management refers to each resource ID corresponding to an atomic service, which can interface with existing identified and managed atomic service resources.

[0017] The dependency analysis includes: import analysis and initialization work.

[0018] The variable analysis includes: path analysis, type analysis, and branch analysis.

[0019] The code population is achieved by traversing the tree generated in the import analysis and initialization work and adding it to the relevant fields to complete the function definition and data definition, and by traversing the branches in the branch analysis to construct the body of the handler function.

[0020] Furthermore, the import analysis traverses all task nodes based on the resource and its internal type information, and generates corresponding nodes based on field and type names, ultimately constructing an Import tree; the Import tree is the result of the import analysis, and its purpose is to clearly identify the imported language modules or packages.

[0021] The initialization process obtains the corresponding atomic service call type and address information through the resource ID, and generates the initialization statement node of the corresponding access end object instance based on the call information. The set of all used initialization statement nodes forms an Init tree; the object instance includes connection and encoding / decoding capabilities.

[0022] Furthermore, the path analysis operates on a set of nodes, performing a depth-first traversal of the input node set to preserve the original tree structure, and extracting variable path information and type information with the support of a type service. The type service stores type information of atomic service inputs and outputs corresponding to resource IDs, and allows retrieval of relevant type information stored in the type service via resource IDs.

[0023] The type analysis determines strongly typed task nodes, obtains the fields and type information contained in the type through the type service, and confirms the input and output types.

[0024] The branch analysis recursively analyzes the relationships between state language nodes to derive the sequential relationships within branches and the order and nesting relationships between branches, thus constructing the control flow.

[0025] Furthermore, the AST (Abstract Syntax Tree) is a tree-like representation of the abstract syntactic structure of a programming language's source code, where each node in the tree represents a structure within the source code. The process involves adding fixed input and output logic to parse the HTTPBody and write a JSON response.

[0026] The beneficial effects of this invention are as follows:

[0027] 1. The executable program obtained by this method is stateless. It only needs to access logs and other services that need to be called. It does not depend on other independently running components, which makes it easy to extend.

[0028] 2. Compared to traditional methods, the unified scheduler has a clearer responsibility, consumes fewer resources, has a faster cold start speed, is more cloud-native, and can be seamlessly integrated into serverless systems;

[0029] 3. The executable program is an atomic service and does not need to consider database issues. It combines logic rather than data. Attached Figure Description

[0030] Figure 1 This refers to the overall system architecture.

[0031] Figure 2 Generate flowcharts for the workflow.

[0032] Figure 3 This is a flowchart for data analysis. Detailed Implementation

[0033] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below with reference to the accompanying drawings.

[0034] The architecture of this invention is as follows: Figure 1 As shown, the overall architecture of this invention includes a system platform, a system backend, and a client. Administrators can operate the system platform, and users can operate the client. The specific functions of each part are as follows:

[0035] (1) System Platform: The system platform provides service components that can be visualized and operated by administrators. Administrators can orchestrate services, view and manage existing workflows in the platform.

[0036] Workflow generation flowchart as follows Figure 2 As shown, the specific steps include:

[0037] Step 1: Managers combine relevant service components by dragging and dropping components according to the current business process.

[0038] Step 2: Based on the programmed content, the system provides corresponding flowcharts and status language nodes, which can be adjusted as needed.

[0039] Step 3: After the administrator confirms that the business process is correct, the status language node is passed to the system backend. The system backend processes the status language node and then returns the result.

[0040] Step 4: Administrators view and manage existing workflows in the system platform.

[0041] (2) System backend: The system backend analyzes the data and logic in the state language node, merges them to form the AST tree of the required language, obtains executable code, compiles it to form a workflow to provide services.

[0042] The invention will be further described below with reference to specific implementation examples and accompanying drawings. Taking the system backend receiving a status language node from the frontend as an example, the backend creates a workflow with the following steps:

[0043] Data analysis process such as Figure 3 As shown, the specific steps include:

[0044] Step 1: Based on the mapping relationship between the set of information names contained in the state language nodes and the set of nodes. (Hereinafter referred to as I) Iterate through all Resource objects under all task nodes to perform dependency analysis. and in accordance with Fields and required type names Generate corresponding nodes (Formula 1) Complete the dependency analysis and finally obtain the Import tree. , which includes and (Formula 2).

[0045] (1)

[0046] (2)

[0047] Step 2: Based on the mapping relationship For each state node, a path-by-path traversal is performed to extract the path strings indicating input and output states. These strings are then split by the "." character to form hierarchical structures, which are then merged according to the hierarchy to complete the path analysis. Obtain path information Complete the path analysis (Formula 3).

[0048] (3)

[0049] Step 3: Based on the mapping relationship The task nodes are type-determined. The type service retrieves the fields and type information contained in the type based on the resource ID, thus completing the type analysis operation for the path indicated by each path string. Confirm input / output types Complete the type analysis (Formula 4).

[0050] (4)

[0051] Step 4: Based on the path information obtained in Step 1 and Step 2 With type information Perform tree merging operation To obtain the required data Complete the data analysis (Formula 5).

[0052] (5)

[0053] Step 5: Based on the mapping relationship Traverse the state node tree using a depth-first search method, determine the order and nesting relationship between state nodes and the branches they form, and record the branch name and create a checkpoint array whenever a branch is encountered. The state nodes within each branch are continuously added to the state node array, recursively forming the control flow and completing the branch analysis. Finally, the branch information is obtained. To form branch names and node array The correspondence is shown in Formula 6.

[0054]

[0055] Step Six: Based on the branch information obtained in Step Five Perform branch filling operation on it. To obtain the node set of the AST (Formula 7) Using the Parse method provided by the language standard library on the Node, we obtain the AST node set (Formula 8). It contains fixed parsing input logic. and parsing output logic .

[0056] (7)

[0057] (8)

[0058] (9)

[0059] Step 7: Dependency analysis based on the results of Step 1 The result of step six and fixed-bind ports for providing service code This yields the abstract syntax tree ASTFile (Formula 10).

[0060] (10)

[0061] Step 8: Based on the Abstract Syntax Tree (ASTFile) obtained in Step 7, perform a compilation operation to obtain readable code. (Formula 11); (Formula 12)

[0062] (11)

[0063] (12)

[0064] Step 9: Transform the readable code and dependency files Place the data into the Virtual File System (VFS) to obtain the workflow items required for this service. (Formula 13).

[0065] (13)

[0066] Step 10: Generate or execute the process service through a general-purpose compiler (Builder) or interpreter (Interpreter), and ultimately provide the service externally in the form of an HTTP service. Formula 14), executed via blockchain engine Write the project into the contract (Formula 15).

[0067] (14)

[0068] (15)

[0069] (3) Client: The client calls the HTTP service provided by the system backend to display the product information of this business. Users can directly operate the services provided by the system on the client.

[0070] Matters not covered in this invention are common knowledge.

[0071] The above embodiments are only for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. All equivalent changes or modifications made in accordance with the spirit and essence of the present invention should be covered within the scope of protection of the present invention.

Claims

1. A method for generating workflow services based on AST for service-oriented orchestration, characterized in that, include: Administrators can combine atomic services by dragging and dropping through the system platform to form state language nodes for business processes. The backend analyzes the data and logic in the state language nodes and merges them to form the AST tree of the required language; Add fixed input and output logic to the AST tree; The AST tree is converted into readable code in the corresponding language, and the readable code is then used to generate an executable flow service through a general-purpose editor and interpreter for that language. The service is provided externally via HTTP. The system platform allows for the combination of atomic services via drag and drop. Atomic services can be combined as needed, and the combination process is visualized. The status language nodes of the business process are displayed in real time after dragging and dropping, which can be directly viewed by administrators. An atomic service is the smallest service unit in the entire business process. It cannot be further divided, and the atomic service can independently complete a specific function. State language nodes include sequence nodes and branch nodes. Sequence nodes can call corresponding atomic services; the sequence node is a task node that marks the task order. The implementation of data and logic analysis includes: resource management, dependency analysis, variable analysis, and code completion; The resource management refers to each resource ID corresponding to an atomic service, which can interface with existing identified and managed atomic service resources; The dependency analysis includes: import analysis and initialization work; The variable analysis includes: path analysis, type analysis, and branch analysis; The code population is achieved by traversing the tree generated in the import analysis and initialization process and adding it to the relevant fields to complete the function definition and data definition, and by traversing the branches in the branch analysis to construct the main body of the handler function; The dependency analysis: Based on the mapping relationship between the set of information names contained in the state language nodes and the node set. That is, mapping relationship I, which involves traversing all Resource objects under all task nodes to perform dependency analysis. and in accordance with Fields and required type names Generate corresponding nodes Following formula (1), dependency analysis is completed, and the Import tree is finally obtained. , which includes and , corresponding to formula (2); (1) (2)。 2. The method for generating workflow services based on AST for service-oriented orchestration according to claim 1, characterized in that... The path analysis described above: According to the mapping relationship For each state node, a path-by-path traversal is performed to extract the path strings indicating input and output states. These strings are then split by the "." character to form hierarchical structures, which are then merged according to the hierarchy to complete the path analysis. Obtain path information Complete the path analysis, corresponding to formula (3); (3) According to the mapping relationship The task nodes are type-determined. The type service retrieves the fields and type information contained in the type based on the resource ID, thus completing the type analysis operation for the path indicated by each path string. Confirm input / output types Complete type analysis: (4) Based on the obtained path information With type information Perform tree merging operation To obtain the required data Complete the data analysis, corresponding to formula (5); (5)。 3. The method for generating workflow services based on AST for service-oriented orchestration according to claim 1, characterized in that... The branch analysis is implemented as follows: The branch analysis, through the relationships between state language nodes, recursively derives the internal sequence relationships of branches and the sequential and nested relationships between branches, constructing the control flow; specifically based on mapping relationships... Traverse the state node tree using a depth-first search method, determine the order and nesting relationship between state nodes and their branches, and record the branch name and create a state node array whenever a branch is encountered. The state nodes within each branch are continuously added to the state node array, recursively forming the control flow and completing the branch analysis. Finally, the branch information is obtained. To form branch names and state node array The corresponding relationship is given by formula (6). (6)。 4. The method for generating workflow services based on AST for service-oriented orchestration according to claim 3, characterized in that... Based on the obtained branch information Perform branch filling operation on it. To obtain the node set of the AST The `Parse` method, a built-in feature of the language's standard library, is used to obtain the AST (Abstract Syntax Tree) set of nodes. It contains fixed parsing input logic. and parsing output logic ; (7) (8) (9)。 5. A method for generating workflow services based on AST for service-oriented orchestration according to claim 4, characterized in that... According to dependency analysis , and fixed-bind ports for providing service code , thus obtaining the abstract syntax tree ASTFile, corresponding to formula (10); (10) The resulting abstract syntax tree (ASTFile) is compiled to produce readable code. (11) (12) Readable code and dependency files Place the data into the Virtual File System (VFS) to obtain the workflow items required for this service. , corresponding to formula (13); (13) Finally, the process service is generated or executed through a general-purpose compiler (Builder) or interpreter (Interpreter), and ultimately provided externally as an HTTP service. The corresponding formula (14) is executed through the blockchain execution engine. Write the project into the contract, corresponding to formula (15). (14) (15)。