CN117850754A - Method and system for processing and executing expression of low-code support multi-platform - Google Patents

Method and system for processing and executing expression of low-code support multi-platform Download PDF

Info

Publication number
CN117850754A
CN117850754A CN202410068028.2A CN202410068028A CN117850754A CN 117850754 A CN117850754 A CN 117850754A CN 202410068028 A CN202410068028 A CN 202410068028A CN 117850754 A CN117850754 A CN 117850754A
Authority
CN
China
Prior art keywords
expression
scene
abstract syntax
syntax tree
database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410068028.2A
Other languages
Chinese (zh)
Inventor
孔伟
邹强鲁
李伦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Yunwei Technology Co ltd
Original Assignee
Hangzhou Yunwei Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Yunwei Technology Co ltd filed Critical Hangzhou Yunwei Technology Co ltd
Priority to CN202410068028.2A priority Critical patent/CN117850754A/en
Publication of CN117850754A publication Critical patent/CN117850754A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

The invention relates to the technical field of low codes, and provides a method and a system for processing and executing expressions of a low-code support multi-platform, wherein the method comprises the following steps: writing business logic through the expression, and analyzing the expression into an abstract syntax tree through an expression analyzer; when a general design scene is adopted, directly calling java class corresponding to elements in an abstract syntax tree in an execution environment, directly interpreting and executing the java class based on the context of a logic flow, and obtaining a result value; when the database queries the scene, the abstract syntax tree number is converted into SQL sentence fragments corresponding to the database type, and the SQL sentences are applied to the generated codes. The invention provides a complete expression editor suitable for a low-code design platform, which allows a user to quickly write logic, process or read data in a way of writing expressions, and the expressions have high consistency in processing general demands in logic flows or in database query, and the same function performs proper operation under an identification environment.

Description

Method and system for processing and executing expression of low-code support multi-platform
Technical Field
The invention relates to the technical field of low codes, in particular to a method and a system for processing and executing expressions of a low-code support multi-platform.
Background
A low code platform is a development platform that can quickly generate applications without coding or with a small amount of code. It allows developers to build business processes, logic, and data models using easily understood visualization tools, and add their own code if necessary. In the low code platform, a logic flow is used for enabling a user to design own business logic, the logic flow realizes the control flow capability required by conventional code writing, but lacks the capability of operating on object data, such as inquiring a piece of data of a user table through the logic flow, and the name attribute of the piece of data is required to be modified or the value of the age attribute of the piece of data is read out, so that no simple mode of sequential operation can be realized for processing by common people temporarily.
Therefore, a person skilled in the art needs to design a service logic design interface capable of realizing fine manipulation of various data, reading and modifying service data, and matching with logic flows to realize most of user service operation scenes.
Disclosure of Invention
In order to achieve the above object, the present invention provides the following technical solutions:
the invention provides a method for processing and executing an expression of a low-code support multi-platform, wherein the processing and the execution of the expression depend on the low-code platform, and the method comprises the following steps:
writing business logic through the expression, and analyzing the expression into an abstract syntax tree through an expression analyzer;
when a general design scene is adopted, directly calling java class corresponding to elements in an abstract syntax tree in an execution environment, directly interpreting and executing the java class based on the context of a logic flow, and obtaining a result value; the element type (object) in each type of abstract syntax tree has a corresponding java class, and each java class has an execution method for acquiring the executed value, so that the calculation result of the expression can be directly acquired in the logic flow; the abstract syntax tree object comprises a function call object, a constant object, a variable object, or an operator object.
When the database queries the scene, the abstract syntax tree object number is converted into SQL sentence fragments corresponding to the database type, and the SQL sentences are applied to the generated codes.
Further, the expression editor adds a list based on an open source item monaco-editor, the list contains functions which can be used by the expression, various parameter variable values which can be used, and supports validity check of the expression written by a user, and if the design has a position where an error can be prompted.
Further, the expression parser cuts the expressions in the form of character strings, acquires all elements in the expressions, classifies the elements, switches the segmented elements from the prefix expressions to the suffix expressions, and reassembles the java objects with hierarchical layers, namely abstract syntax trees;
the elements include at least two of operators, operands, function calls, left and right brackets, commas, where the operands are in turn constants and variables.
Further, the general design scenario includes when a node is assigned, when an initial value of a parameter is printed, or when a node is looped.
Further, the database query scene comprises a function of deriving a data query with pages in a management page created by a user based on an entity table by using a query node or an SQL node in a logic flow.
Further, the concrete process of converting the abstract syntax tree into the SQL sentence fragments of the corresponding database type is as follows:
based on the conversion of the type of each element in the abstract syntax tree into the corresponding predefined java object type, the expression is converted into the corresponding SQL sentence fragment by calling the method of converting the corresponding database version SQL syntax defined by each java object type.
Further, the types of databases that support the transformation of functions within an expression include mysql, oracle, dm, and SQL Server.
Further, the expression includes a user-designed expression string of the function call.
The present invention also provides a system for supporting expression processing and execution of multiple platforms, the system comprising:
the design unit is used for writing business logic by using the expression;
an acquisition unit configured to acquire an expression in the design unit;
the parsing unit is used for parsing the expression into an abstract syntax tree;
the scene judging unit is used for judging the scene of the expression in the logic flow, wherein the scene comprises a general design scene and a database query scene;
the first execution unit is used for calling java class corresponding to the element in the abstract syntax tree, directly interpreting and executing the java class based on the context of the logic flow and obtaining a result value;
the conversion unit is used for converting the functions in the expression into SQL statement fragments of corresponding database types;
the second execution unit is used for applying the converted SQL statement to the generated code;
when the scene judging unit judges that the scene is a general design scene, the first executing unit is directly executed;
and when the scene judging unit judges that the database inquires the scene, the executing conversion unit and the second executing unit.
Further, the general design scene comprises an assignment node, an initial value of a parameter, a printing node or a circulation node;
the database query scenario includes a logic flow using a query node or SQL node, paged data query in a management page created by a user based on an entity table, and a export function.
The expression parser cuts the expressions in the form of character strings, acquires all elements in the expressions, classifies the elements, switches the segmented elements from the prefix expressions to the suffix expressions, and reassembles the java objects with the layers; the elements include at least two of operators, operands, function calls, left and right brackets, commas, where the operands are in turn constants and variables.
The invention has the following beneficial effects:
(1) The invention provides a complete expression editor suitable for a low-code design platform, which allows a user to quickly write logic, process or read data in a way of writing expressions, and the expressions have high consistency in processing general scenes in logic flows or in database query, and the same function performs proper operation under an identification environment.
(2) The invention realizes the capability of operating and processing data in a low-cost mode by writing the expression with relatively simple structure, improves the design efficiency of users and reduces the use threshold of the low-code platform. And the unified adaptation is not performed on the expression in the code execution environment and the database execution environment, so that the consistency and the universality of the behavior of the expression in different environments are improved.
(3) The invention realizes the quick realization of the business logic of the user in a low-cost mode on a low-code platform, and particularly realizes the operation capability on data.
(4) The invention can realize how to finely manipulate various data in the graphical business logic design interface, realize the reading and modification of business data, and realize most of user business operation scenes in cooperation with logic flows.
Drawings
FIG. 1 is a schematic overall flow chart of the present invention.
FIG. 2 is a schematic diagram of the logic of the present invention in a scenario in which a database query is processed.
Fig. 3 is a schematic diagram of a general scenario of the present method for processing logic flows.
Fig. 4 is a schematic diagram of the unit of the system of the present invention.
Detailed Description
The following detailed description of the embodiments of the invention, taken in conjunction with the accompanying drawings, should be taken as illustrative of the invention only and not as limiting, the examples being intended to provide those skilled in the art with a better understanding and reproduction of the technical solutions of the invention, the scope of the invention still being defined by the claims.
As shown in FIG. 1, the present invention provides a method for low-code support of multi-platform expression processing and execution, the expression processing and execution being dependent on a low-code platform, the method comprising:
writing business logic through an expression, and analyzing the expression into an abstract syntax tree through an expression analyzer, wherein the concrete process is as follows: the expression parser cuts the expressions in the form of character strings, acquires all elements in the expressions, classifies the elements, switches the segmented elements from the prefix expressions to the suffix expressions, and reassembles the java objects with the hierarchical layers, namely abstract syntax trees;
the elements include at least two of operators, operands, function calls, left and right brackets, commas, where the operands are in turn constants and variables.
The expression in the form of a character string is analyzed into a java object with a layer-test structure by the expression editor, and then the content of the expression is analyzed and converted into SQL sentences or a direct calculation function. The elements after the expression analysis have specific types, such as constants, variables and certain function calls, and the types have corresponding java classes which contain the capability of directly executing or converting the general environment into SQL.
As shown in fig. 2, when assigning a node, an initial value of a parameter, printing a node or looping a node and other general design scenes, directly calling java class corresponding to an element in an abstract syntax tree in an execution environment, directly interpreting and executing the java class based on the context of a logic flow, and obtaining a result value; each abstract syntax tree element type (object) of each type has a corresponding java class, each java class has an execution method, and the execution method is used for acquiring the value after execution, so that the calculation result of the expression can be directly acquired in the logic flow; the abstract syntax tree object comprises a function call object, a constant object, a variable object, or an operator object. Each element type in the expression has a java class corresponding to the element type, the class can store the object of the element related to the element, such as a Constant value in the expression, and the Constant in the corresponding expression parser can become a Constant class instance after being parsed into an abstract syntax tree; for another example, the expression "1+1" is shown, where the plus sign is resolved into Add functions, corresponding to Add classes. The Add function represents addition calculation, two parameters are needed, so that two required constant objects (number 1) are stored inside, at this time, the Add can directly calculate the result value 2 in a general scene, and output "1+1" is generally performed in a database scene, because the database can directly perform addition calculation.
As shown in fig. 3, when a query node or an SQL node is used in a logic flow, and a user uses paged data query in a management page created based on an entity table to derive a database query scene such as a function, an abstract syntax tree object is converted into an SQL statement fragment of a corresponding database type, and the SQL statement fragment is applied to a generated code, and the specific process is as follows:
based on the conversion of the type of each element in the abstract syntax tree into the corresponding predefined java object type, the expression is converted into the corresponding SQL sentence fragment by calling the method of converting the corresponding database version SQL syntax defined by each java object type.
In some preferred embodiments, the types of databases that support the conversion of functions within an expression include mysql, oracle, dm, and SQL Server.
In some preferred embodiments, the expression comprises a user-designed expression string of a function call.
As shown in fig. 4, the present invention further provides a system for supporting expression processing and execution of multiple platforms, the system comprising:
the design unit is used for writing business logic by using the expression;
an acquisition unit configured to acquire an expression in the design unit;
the parsing unit is used for parsing the expression into an abstract syntax tree;
the scene judging unit is used for judging the scene of the expression in the logic flow, wherein the scene comprises a general design scene and a database query scene;
the first execution unit is used for calling java class corresponding to the element in the abstract syntax tree, directly interpreting and executing the java class based on the context of the logic flow and obtaining a result value;
the conversion unit is used for converting the functions in the expression into SQL statement fragments of corresponding database types;
the second execution unit is used for applying the converted SQL statement to the generated code;
when the scene judging unit judges that the scene is a general design scene, the first executing unit is directly executed;
and when the scene judging unit judges that the database inquires the scene, the executing conversion unit and the second executing unit.
In some preferred embodiments, the general design scenario includes an assignment node, an initial value of a parameter, a print node, or a loop node;
the database query scenario includes a logic flow using a query node or SQL node, paged data query in a management page created by a user based on an entity table, and a export function.
The expression parser cuts the expressions in the form of character strings, acquires all elements in the expressions, classifies the elements, switches the segmented elements from the prefix expressions to the suffix expressions, and reassembles the java objects with the layers; the elements include at least two of operators, operands, function calls, left and right brackets, commas, where the operands are in turn constants and variables.
The expression editor adds a list based on an open source item monaco-editor, wherein the list contains functions which can be used by the expression, various parameter variable values which can be used, and supports validity check of the expression written by a user, and if the design has a position where an error can be prompted.
The interface of the expression editor comprises a text editing area, a shortcut button area, an embedded function area, a resource description area and the like, allows a user to quickly write logic, process or read data in a manner of writing expressions, and the expressions process general scenes in logic flows or have high consistency in use in database queries, and the same function performs proper operation in an identification environment.
For example, the expression is written with 1+1, output 2 is performed in a general scenario, and 2 should be output in a database scenario, as should a more complex scenario. For example, a CurrentDate () function is used in an expression, and this function is the current date of acquisition, so that in a general scenario, the corresponding function acquisition date in java needs to be called, and in a database scenario, the function acquisition date such as now () needs to be called, so as to ensure that the meaning of the same function is consistent in both scenarios.
The invention also provides a database processing system,
comprising the following steps:
a memory storing a program;
and the processor is used for realizing the method for supporting the processing and execution of the expression of the multiple platforms when the processor executes the program.
The present invention provides a storage medium having a program stored thereon,
the program, when executed by a processor, implements the method for supporting multi-platform expression processing and execution described above.
It should be noted that technical features not described in detail in the present invention may be implemented by any prior art.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.

Claims (10)

1. A method of low code support multi-platform expression processing and execution, wherein the expression processing and execution is dependent on a low code platform, the method comprising:
writing business logic through the expression, and analyzing the expression into an abstract syntax tree through an expression analyzer;
when a general design scene is adopted, directly calling java class corresponding to elements in an abstract syntax tree in an execution environment, directly interpreting and executing the java class based on the context of a logic flow, and obtaining a result value;
when the database queries the scene, the abstract syntax tree is converted into SQL sentence fragments corresponding to the database types, and the SQL sentences are applied to the generated codes.
2. The method according to claim 1, wherein the expression editor adds a list based on an open source item monaco-editor, and the list includes functions and various parameter values that can be used by the expression.
3. The method for processing and executing the expression of the low-code support multi-platform according to claim 1, wherein the expression parser cuts the expression in the form of a character string, acquires all elements in the expression, classifies the elements, switches the segmented elements from the prefix expression to the suffix expression, and finally reassembles the java object with the hierarchical level, namely an abstract syntax tree;
the elements include at least two of operators, operands, function calls, left and right brackets, commas, where the operands are in turn constants and variables.
4. The method of claim 1, wherein the generic design scenario comprises an assignment node, an initial value of a parameter, a print node, or a loop node.
5. The method of claim 1, wherein the database query scenario comprises a logical flow using query nodes or SQL nodes, a paged data query in a management page created by a user based on an entity table, and a export function.
6. A method for low-code multi-platform expression processing and execution according to claim 3, wherein the specific process of converting the abstract syntax tree into the SQL statement fragment corresponding to the database type is:
based on the conversion of the type of each element in the abstract syntax tree into the corresponding predefined java object type, the expression is converted into the corresponding SQL sentence fragment by calling the method of converting the corresponding database version SQL syntax defined by each java object type.
7. The method of claim 1, wherein the expression comprises a user-designed expression string of a function call.
8. A system for low code support multi-platform expression processing and execution, the system being adapted for use in the method of any one of claims 1 to 7, the system comprising:
the design unit is used for writing business logic by using the expression;
an acquisition unit configured to acquire an expression in the design unit;
the parsing unit is used for parsing the expression into an abstract syntax tree;
the scene judging unit is used for judging the scene of the expression in the logic flow, wherein the scene comprises a general design scene and a database query scene;
the first execution unit is used for calling java class corresponding to the element in the abstract syntax tree, directly interpreting and executing the java class based on the context of the logic flow and obtaining a result value;
the conversion unit is used for converting the functions in the expression into SQL statement fragments of corresponding database types;
the second execution unit is used for applying the converted SQL statement to the generated code;
when the scene judging unit judges that the scene is a general design scene, the first executing unit is directly executed;
and when the scene judging unit judges that the database inquires the scene, the executing conversion unit and the second executing unit.
9. The multi-platform supporting expression processing and execution system of claim 8, wherein the generic design scenario comprises an assignment node, an initial value of a parameter, a print node, or a loop node;
the database query scenario includes a logic flow using a query node or SQL node, paged data query in a management page created by a user based on an entity table, and a export function.
10. The system for processing and executing expressions supporting multiple platforms according to claim 8, wherein the expression parser cuts the expressions in the form of character strings, obtains all elements in the expressions, classifies the elements, switches the segmented elements from the prefix expressions to the suffix expressions, and reassembles the java object with hierarchical layers; the elements include at least two of operators, operands, function calls, left and right brackets, commas, where the operands are in turn constants and variables.
CN202410068028.2A 2024-01-17 2024-01-17 Method and system for processing and executing expression of low-code support multi-platform Pending CN117850754A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410068028.2A CN117850754A (en) 2024-01-17 2024-01-17 Method and system for processing and executing expression of low-code support multi-platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410068028.2A CN117850754A (en) 2024-01-17 2024-01-17 Method and system for processing and executing expression of low-code support multi-platform

Publications (1)

Publication Number Publication Date
CN117850754A true CN117850754A (en) 2024-04-09

Family

ID=90530228

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410068028.2A Pending CN117850754A (en) 2024-01-17 2024-01-17 Method and system for processing and executing expression of low-code support multi-platform

Country Status (1)

Country Link
CN (1) CN117850754A (en)

Similar Documents

Publication Publication Date Title
US6449620B1 (en) Method and apparatus for generating information pages using semi-structured data stored in a structured manner
US6581062B1 (en) Method and apparatus for storing semi-structured data in a structured manner
CN110705237B (en) Automatic document generation method, data processing device and storage medium
CN113032362A (en) Data blood margin analysis method and device, electronic equipment and storage medium
CN109710220B (en) Relational database query method, relational database query device, relational database query equipment and storage medium
CN111367524B (en) Enumeration type design method and device
CN111626028A (en) Report generation method, device and equipment based on function analysis and computer medium
CN112416787A (en) JAVA-based project source code scanning analysis method, system and storage medium
CN115202626A (en) Low-code front-end development method supporting multi-technology stack components
CN113901083A (en) Heterogeneous data source operation resource analysis positioning method and equipment based on multiple analyzers
CN111124380A (en) Front-end code generation method
US7657869B2 (en) Integration of external tools into an existing design environment
CN111126008A (en) XSD-based code generation method and device, computer equipment and storage medium
CN117850754A (en) Method and system for processing and executing expression of low-code support multi-platform
CN115033249A (en) File compiling method and device
CN112685435A (en) Table query method and system based on Vue and Mybatis
CN112199335A (en) Generation method and generation system of operation log
CN114756554B (en) Data query processing method based on MyBatis framework
CN117193781B (en) SIMSCRIPT language-oriented abstract syntax tree construction method and device
CN110968634B (en) Method for realizing ETL conversion processing by utilizing programmable function based on XML description in big data scene
CN116756184B (en) Database instance processing method, device, equipment, storage medium and program product
CN114385664A (en) Splitting method, system, device and storage medium for single project micro-service
CN117473957A (en) Device and method capable of supporting multi-language text analysis
CN117873443A (en) Code generation method and system based on sql query statement
CN112799638A (en) Non-invasive rapid development method, platform, terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination