Dynamic expression analysis and execution method and system based on visual interaction
By combining a visual interface and a converter, the problem of expression engines being unfriendly to non-technical personnel is solved, enabling business personnel to directly participate in the dynamic parsing and execution of expressions, thus ensuring the reliability and stability of the expression engine.
Patent Information
- Application Number
- CN202511517179.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-23
- Publication Date
- 2025-11-21
AI Technical Summary
Existing expression engine development applications are not user-friendly for non-technical personnel, lack visual interface operation, are highly specialized, have high learning costs, and cannot be directly participated in by business personnel.
The system receives expression metadata input from users through a visual interface, adjusts the order by dragging and dropping, and converts it into an executable syntax structure that the expression engine can recognize through a converter. It also incorporates a multi-layered security protection mechanism for verification and conversion.
It enables non-professionals to dynamically parse and execute expressions in a visual manner, ensuring the reliability and stability of the expression engine and reducing the learning cost.
Smart Images

Figure CN120994185A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of object development technology, and more specifically, to a method and system for dynamic parsing and execution of expressions based on visual interaction. Background Technology
[0002] Currently, many applications developed based on expression engines provide interface parameters based on the expression engine's syntax rules. This is too technical, unfriendly to business personnel who do not understand coding, has a high learning cost, and does not provide a user-friendly visual interface for manipulating expressions.
[0003] Patent document CN117933383A discloses a rule configuration method based on the Aviator expression engine. The method includes: determining a target object for which a rule needs to be configured; configuring a first operator on the target object based on the Aviator expression engine; the first operator being used to collect business data of the target object; obtaining the rule to be configured for the target object; configuring a second operator based on the rule to be configured using the Aviator expression engine; generating a rule expression based on the first and second operators; and using the rule expression as the target rule for the target object. However, this method of configuring and executing the expression engine in this patent document is not user-friendly for non-technical personnel.
[0004] Patent document CN110888672B discloses a method for implementing an expression engine based on a metadata architecture, including: obtaining user configuration information; the expression engine generating corresponding rule data based on the configuration information; when the user operates on the business data of an entity, obtaining the corresponding data through the expression engine; the expression engine generating the corresponding rule data based on the configuration information specifically includes: the lower-end routing layer of the expression engine performing data query; the upper-end analysis layer of the expression engine using expressions described based on metadata to output the corresponding rule data; the upper-end analysis layer of the expression engine using expressions described based on metadata to output the corresponding rule data specifically includes: the upper-end analysis layer obtaining the configuration information, performing lexical and syntactic analysis on the configuration information based on the metadata architecture, returning optimization results, and outputting the corresponding rule data to the routing layer. Summary of the Invention
[0005] In view of the shortcomings of the prior art, the purpose of this invention is to provide a method and system for dynamic parsing and execution of expressions based on visual interaction.
[0006] The present invention provides a method for dynamic parsing and execution of expressions based on visual interaction, comprising the following steps: Step S1: Receive the expression metadata input by the user through the visual interface, and adjust the order of the expression metadata by dragging and dropping; Step S2: Receive the expression metadata after the order was adjusted in step S1 through the converter receiving interface, and convert the expression metadata into an executable syntax structure that the expression engine can recognize through preset rules; Step S3: Receive the executable syntax structure transformed in step S2 through the expression engine, execute the syntax and return the result.
[0007] Preferably, step S1 specifically includes the following steps: Step S1.1: Enter or select the variable list returned by the server in the input box of the visualization interface, and select the corresponding operator to form preliminary expression metadata; the expression metadata includes the operator and the variables in the variable list; Step S1.2: Based on the complexity of the expression metadata formed in step S1.1, preprocessing operations are added to obtain expression metadata that meets the preset structure requirements; Step S1.3: Adjust the order and nesting results of the expression metadata that meet the preset structure requirements in step S1.2 by dragging and dropping; Step S1.4: After the expression metadata is adjusted in step S1.3, the adjusted expression metadata in step S1.3 is split into corresponding attribute information through a visual interface and sent to the converter; the attribute information contains all the data that make up the expression.
[0008] Preferably, in step S1.2, the preprocessing operations include sibling operations, splitting, inverting, and deleting; Step S1.3 specifically includes the following steps: Adding a new step: In the visual interface, add a new row of expression check boxes, and associate the new expression check box with other expression check boxes at the same level using the connection keyword; Adding steps: In the visual interface, add a sibling operation, add a row of expression check boxes at the same level as an existing expression check box, and associate the added expression check box with other expression check boxes at the same level using the connection keyword; Splitting steps: Perform the splitting operation in the visual interface to split the existing expression selection box into two expression selection boxes, and use the connecting keyword to associate the two sibling expression selection boxes formed after the splitting to form an expression group with a nested effect; Adjustment steps: After performing the new step and / or add step and / or split step, drag any expression selection box to move it to the same level as the target expression selection box, and use the connection keyword to associate the moved expression selection box with other expression selection boxes at the same level, thereby adjusting the order and nesting relationship of the expression metadata; In step S1.4, the attribute information includes lvalues, rvalues, operators, and negation; the lvalues in the attribute information correspond to the variable data to the left of the operator in the expression metadata, the rvalues in the attribute information correspond to the variable data to the right of the operator in the expression metadata, the operators in the attribute information correspond to the operators in the expression metadata, and the negation in the attribute information corresponds to an independent variable data transmitted to the server.
[0009] Preferably, step S2 specifically includes the following steps: Step S2.1: Receive the attribute information from step S1.4 through the converter receiving interface, and preview the result through the converter. Based on the attribute information, check whether the expression metadata meets the preset requirements. If it does not meet the preset requirements, repeat steps S1.2 to S1.4 until the preset requirements are met. Step S2.2: Perform security verification on the expression metadata received in step S2.1 through a multi-layer security protection mechanism to obtain secure expression metadata; Step S2.3: The internal algorithm of the converter performs value mapping on the variables in the attribute information of the secure expression metadata in step S2.2, and converts the operators in the attribute information into syntax that the expression engine can recognize; Step S2.4: The syntax of the variables and operators after value mapping in step S2.3 is concatenated by the converter to construct an executable syntax structure that the expression engine can recognize; Step S2.5: Send the converted executable syntax structure to the expression engine for processing via the converter.
[0010] Preferably, in step S2.2, the multi-layer security protection mechanism includes three layers: the first layer intercepts dangerous syntax structures in expression metadata through keyword blacklist matching; the second layer prevents resource exhaustion by real-time monitoring of memory resources; and the third layer controls the access boundaries of expression metadata through a variable whitelist mechanism. Step S2.3 specifically includes the following steps: Step S2.3.1: Based on the attribute information of the expression metadata, verify the type of the expression; the type of the expression includes a single expression and a group of expressions; Step S2.3.2: After completing the type validation of the expression, iterate through all variable data, match the actual values corresponding to the variables in the expression through the database and replace them to realize the value mapping of variables; Step S2.3.3: For expressions of type group of expressions, after completing the value mapping of variables, determine the boundary of each sub-expression and encapsulate the entire expression group into a syntax structure that the expression engine can recognize and run, thus realizing the conversion of operators into syntax that the expression engine can recognize; for expressions of type single expression, after completing the value mapping of variables, directly encapsulate them into a syntax structure that the expression engine can recognize and run, thus realizing the conversion of operators into syntax that the expression engine can recognize.
[0011] This invention also provides a system for dynamic parsing and execution of expressions based on visual interaction, comprising the following modules: Module M1: Receives expression metadata input by the user through a visual interface and allows users to adjust the order of the expression metadata by dragging and dropping. Module M2: Receives the rearranged expression metadata from module M1 through the converter receiving interface, and converts the expression metadata into an executable syntax structure that the expression engine can recognize through preset rules; Module M3: Receives the converted executable syntax structure from module M2 through the expression engine, executes the syntax, and returns the result.
[0012] Preferably, module M1 specifically includes the following modules: Module M1.1: Input or select the variable list returned by the server in the input box of the visual interface, and select the corresponding operator to form preliminary expression metadata; the expression metadata includes the operator and the variables in the variable list; Module M1.2: Based on the complexity of the expression metadata formed in module M1.1, preprocessing operations are added to obtain expression metadata that meets the preset structure requirements; Module M1.3: Adjusts the order and nesting results of expression metadata in module M1.2 that meet the preset structure requirements through drag-and-drop operations; Module M1.4: After the expression metadata in Module M1.3 is adjusted, the adjusted expression metadata in Module M1.3 is broken down into corresponding attribute information through a visual interface and sent to the converter; the attribute information contains all the data that makes up the expression.
[0013] Preferably, in module M1.2, the preprocessing operations include sibling operations, splitting, inversion, and deletion; Step S1.3 specifically includes the following steps: Adding a new step: In the visual interface, add a new row of expression check boxes, and associate the new expression check box with other expression check boxes at the same level using the connection keyword; Adding steps: In the visual interface, add a sibling operation, add a row of expression check boxes at the same level as an existing expression check box, and associate the added expression check box with other expression check boxes at the same level using the connection keyword; Splitting steps: Perform the splitting operation in the visual interface to split the existing expression selection box into two expression selection boxes, and use the connecting keyword to associate the two sibling expression selection boxes formed after the splitting to form an expression group with a nested effect; Adjustment steps: After performing the new step and / or add step and / or split step, drag any expression selection box to move it to the same level as the target expression selection box, and use the connection keyword to associate the moved expression selection box with other expression selection boxes at the same level, thereby adjusting the order and nesting relationship of the expression metadata; In module M1.4, the attribute information includes lvalues, rvalues, operators, and negation; the lvalues in the attribute information correspond to the variable data to the left of the operator in the expression metadata, the rvalues in the attribute information correspond to the variable data to the right of the operator in the expression metadata, the operators in the attribute information correspond to the operators in the expression metadata, and the negation in the attribute information corresponds to an independent variable data transmitted to the server.
[0014] Preferably, module M2 specifically includes the following modules: Module M2.1: Receives attribute information from module M1.4 through the converter receiving interface, previews the results through the converter, and checks whether the expression metadata meets the preset requirements based on the attribute information. If the preset requirements are not met, the process of modules M1.2 to M1.4 is repeated until the preset requirements are met. Module M2.2: Performs security verification on the expression metadata received in module M2.1 through a multi-layer security protection mechanism to obtain secure expression metadata; Module M2.3: Through the converter's internal algorithm, it performs value mapping on the variables in the attribute information of the secure expression metadata in Module M2.2, and converts the operators in the attribute information into syntax that the expression engine can recognize; Module M2.4: It uses a converter to concatenate the syntax of variables and operators after value mapping in module M2.3, and constructs an executable syntax structure that the expression engine can recognize. Module M2.5: Sends the converted executable syntax structure to the expression engine for processing via a converter.
[0015] Preferably, in module M2.2, the multi-layer security protection mechanism includes three layers: the first layer intercepts dangerous syntax structures in expression metadata through keyword blacklist matching; the second layer prevents resource exhaustion by real-time monitoring of memory resources; and the third layer controls the access boundaries of expression metadata through a variable whitelist mechanism. Step S2.3 specifically includes the following steps: Step S2.3.1: Based on the attribute information of the expression metadata, verify the type of the expression; the type of the expression includes a single expression and a group of expressions; Step S2.3.2: After completing the type validation of the expression, iterate through all variable data, match the actual values corresponding to the variables in the expression through the database and replace them to realize the value mapping of variables; Step S2.3.3: For expressions of type group of expressions, after completing the value mapping of variables, determine the boundary of each sub-expression and encapsulate the entire expression group into a syntax structure that the expression engine can recognize and run, thus realizing the conversion of operators into syntax that the expression engine can recognize; for expressions of type single expression, after completing the value mapping of variables, directly encapsulate them into a syntax structure that the expression engine can recognize and run, thus realizing the conversion of operators into syntax that the expression engine can recognize.
[0016] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention solves the problem that expression engines require professional developers to code and business personnel cannot directly participate by adopting a structure of dynamic input and drag-and-drop assembly of expressions on a visual page; at the same time, it ensures the reliability and stability of the expression engine execution process through a multi-layer security protection mechanism.
[0017] 2. This invention generates expression metadata through input and drag-and-drop via a visual interface. After receiving the metadata, the converter verifies it through a multi-layered security protection mechanism, serializes the metadata into a syntax structure executable by the expression engine, and finally executes it through the expression engine to output the result. Attached Figure Description
[0018] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a schematic diagram illustrating the visual interface. Figure 2 This is a flowchart illustrating the dynamic parsing and execution method of expressions based on visual interaction. Detailed Implementation
[0019] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make several changes and improvements without departing from the concept of the present invention. These all fall within the protection scope of the present invention.
[0020] Example 1 like Figure 1 and Figure 2 As shown, this embodiment provides a method for dynamic parsing and execution of expressions based on visual interaction, including the following steps: Step S1: Receive the expression metadata input by the user through the visual interface, and adjust the order of the expression metadata by dragging and dropping; Step S1 specifically includes the following steps: Step S1.1: Enter or select the variable list returned by the server in the input box of the visualization interface, and select the corresponding operator to form preliminary expression metadata; the expression metadata includes the operator and the variables in the variable list; Step S1.2: Based on the complexity of the expression metadata formed in step S1.1, preprocessing operations are added to obtain expression metadata that meets the preset structure requirements; Step S1.3: Adjust the order and nesting results of the expression metadata that meet the preset structure requirements in step S1.2 by dragging and dropping; Step S1.3 specifically includes the following steps: Adding a new step: In the visual interface, add a new row of expression check boxes, and associate the new expression check box with other expression check boxes at the same level using the connection keyword; Adding steps: In the visual interface, add a sibling operation, add a row of expression check boxes at the same level as an existing expression check box, and associate the added expression check box with other expression check boxes at the same level using the connection keyword; Splitting steps: Perform the splitting operation in the visual interface to split the existing expression selection box into two expression selection boxes, and use the connecting keyword to associate the two sibling expression selection boxes formed after the splitting to form an expression group with a nested effect; Adjustment steps: After performing the new step and / or add step and / or split step, drag any expression selection box to move it to the same level as the target expression selection box, and use the connection keyword to associate the moved expression selection box with other expression selection boxes at the same level, thereby adjusting the order and nesting relationship of the expression metadata; Step S1.4: After the expression metadata is adjusted in step S1.3, the adjusted expression metadata in step S1.3 is broken down into corresponding attribute information through a visual interface and sent to the converter; the attribute information contains all the data that makes up the expression; In step S1.2, the preprocessing operations include sibling operations, splitting, negation, and deletion; in step S1.4, the attribute information includes lvalues, rvalues, operators, and negation; the lvalues in the attribute information correspond to the variable data to the left of the operator in the expression metadata, the rvalues in the attribute information correspond to the variable data to the right of the operator in the expression metadata, the operators in the attribute information correspond to the operators in the expression metadata, and the negation in the attribute information corresponds to an independent variable data being transmitted to the server.
[0021] Step S2: Receive the expression metadata after the order was adjusted in step S1 through the converter receiving interface, and convert the expression metadata into an executable syntax structure that the expression engine can recognize through preset rules; Step S2 specifically includes the following steps: Step S2.1: Receive the attribute information from step S1.4 through the converter receiving interface, and preview the result through the converter. Based on the attribute information, check whether the expression metadata meets the preset requirements. If it does not meet the preset requirements, repeat steps S1.2 to S1.4 until the preset requirements are met. Step S2.2: Perform security verification on the expression metadata received in step S2.1 through a multi-layer security protection mechanism to obtain secure expression metadata; Step S2.3: The internal algorithm of the converter performs value mapping on the variables in the attribute information of the secure expression metadata in step S2.2, and converts the operators in the attribute information into syntax that the expression engine can recognize; Step S2.3 specifically includes the following steps: Step S2.3.1: Based on the attribute information of the expression metadata, verify the type of the expression; the type of the expression includes a single expression and a group of expressions; Step S2.3.2: After completing the type validation of the expression, iterate through all variable data, match the actual values corresponding to the variables in the expression through the database and replace them to realize the value mapping of variables; Step S2.3.3: For expressions of type group of expressions, after completing the value mapping of variables, determine the boundary of each sub-expression and encapsulate the entire expression group into a syntax structure that the expression engine can recognize and run, thus realizing the conversion of operators into syntax that the expression engine can recognize; for expressions of type single expression, after completing the value mapping of variables, directly encapsulate them into a syntax structure that the expression engine can recognize and run, thus realizing the conversion of operators into syntax that the expression engine can recognize. Step S2.4: The syntax of the variables and operators after value mapping in step S2.3 is concatenated by the converter to construct an executable syntax structure that the expression engine can recognize; Step S2.5: Send the converted executable syntax structure to the expression engine for processing via the converter; In step S2.2, the multi-layer security protection mechanism includes three layers: the first layer intercepts dangerous syntax structures in expression metadata through keyword blacklist matching; the second layer prevents resource exhaustion by real-time monitoring of memory resources; and the third layer controls the access boundaries of expression metadata through a variable whitelist mechanism.
[0022] Step S3: Receive the executable syntax structure transformed in step S2 through the expression engine, execute the syntax and return the result.
[0023] The present invention also provides a visually interactive expression dynamic parsing and execution system. The visually interactive expression dynamic parsing and execution system can be implemented by executing the process steps of the visually interactive expression dynamic parsing and execution method. That is, those skilled in the art can understand the visually interactive expression dynamic parsing and execution method as a preferred embodiment of the visually interactive expression dynamic parsing and execution system.
[0024] Example 2 Those skilled in the art can understand this embodiment as a more specific description of Embodiment 1.
[0025] This embodiment provides a visual interactive system for dynamic expression parsing and execution, including the following modules: Module M1: Receives expression metadata input by the user through a visual interface and allows users to adjust the order of the expression metadata by dragging and dropping. Module M1 specifically includes the following modules: Module M1.1: Input or select the variable list returned by the server in the input box of the visual interface, and select the corresponding operator to form preliminary expression metadata; the expression metadata includes the operator and the variables in the variable list; Module M1.2: Based on the complexity of the expression metadata formed in module M1.1, preprocessing operations are added to obtain expression metadata that meets the preset structure requirements; Module M1.3: Adjusts the order and nesting results of expression metadata in module M1.2 that meet the preset structure requirements through drag-and-drop operations; Step S1.3 specifically includes the following steps: Adding a new step: In the visual interface, add a new row of expression check boxes, and associate the new expression check box with other expression check boxes at the same level using the connection keyword; Adding steps: In the visual interface, add a sibling operation, add a row of expression check boxes at the same level as an existing expression check box, and associate the added expression check box with other expression check boxes at the same level using the connection keyword; Splitting steps: Perform the splitting operation in the visual interface to split the existing expression selection box into two expression selection boxes, and use the connecting keyword to associate the two sibling expression selection boxes formed after the splitting to form an expression group with a nested effect; Adjustment steps: After performing the new step and / or add step and / or split step, drag any expression selection box to move it to the same level as the target expression selection box, and use the connection keyword to associate the moved expression selection box with other expression selection boxes at the same level, thereby adjusting the order and nesting relationship of the expression metadata; Module M1.4: After the expression metadata in Module M1.3 is adjusted, the adjusted expression metadata in Module M1.3 is broken down into corresponding attribute information through a visual interface and sent to the converter; the attribute information contains all the data that makes up the expression; In module M1.2, the preprocessing operations include sibling operations, splitting, negation, and deletion; in module M1.4, the attribute information includes lvalues, rvalues, operators, and negation; the lvalues in the attribute information correspond to the variable data to the left of the operator in the expression metadata, the rvalues in the attribute information correspond to the variable data to the right of the operator in the expression metadata, the operators in the attribute information correspond to the operators in the expression metadata, and the negation in the attribute information corresponds to an independent variable data being transmitted to the server.
[0026] Module M2: Receives the rearranged expression metadata from module M1 through the converter receiving interface, and converts the expression metadata into an executable syntax structure that the expression engine can recognize through preset rules; Module M2 specifically includes the following modules: Module M2.1: Receives attribute information from module M1.4 through the converter receiving interface, previews the results through the converter, and checks whether the expression metadata meets the preset requirements based on the attribute information. If the preset requirements are not met, the process of modules M1.2 to M1.4 is repeated until the preset requirements are met. Module M2.2: Performs security verification on the expression metadata received in module M2.1 through a multi-layer security protection mechanism to obtain secure expression metadata; Module M2.3: Through the converter's internal algorithm, it performs value mapping on the variables in the attribute information of the secure expression metadata in Module M2.2, and converts the operators in the attribute information into syntax that the expression engine can recognize; Step S2.3 specifically includes the following steps: Step S2.3.1: Based on the attribute information of the expression metadata, verify the type of the expression; the type of the expression includes a single expression and a group of expressions; Step S2.3.2: After completing the type validation of the expression, iterate through all variable data, match the actual values corresponding to the variables in the expression through the database and replace them to realize the value mapping of variables; Step S2.3.3: For expressions of type group of expressions, after completing the value mapping of variables, determine the boundary of each sub-expression and encapsulate the entire expression group into a syntax structure that the expression engine can recognize and run, thus realizing the conversion of operators into syntax that the expression engine can recognize; for expressions of type single expression, after completing the value mapping of variables, directly encapsulate them into a syntax structure that the expression engine can recognize and run, thus realizing the conversion of operators into syntax that the expression engine can recognize. Module M2.4: It uses a converter to concatenate the syntax of variables and operators after value mapping in module M2.3, and constructs an executable syntax structure that the expression engine can recognize. Module M2.5: Sends the converted executable syntax structure to the expression engine for processing via a converter; In module M2.2, the multi-layer security protection mechanism comprises three layers: the first layer intercepts dangerous syntax structures in expression metadata through keyword blacklist matching; the second layer prevents resource exhaustion by real-time monitoring of memory resources; and the third layer controls the access boundaries of expression metadata through a variable whitelist mechanism.
[0027] Module M3: Receives the converted executable syntax structure from module M2 through the expression engine, executes the syntax, and returns the result.
[0028] Example 3 Those skilled in the art can understand this embodiment as a more specific description of Embodiment 1.
[0029] This embodiment provides a method for dynamic parsing and execution of expressions based on visual interaction, including the following steps: Step 1: Receive the expression metadata input by the user through a visual interface, and adjust the order of the expression metadata by dragging and dropping; Step 2: The converter receives the expression metadata input from the interface and converts the expression metadata into an executable syntax structure that the expression engine can recognize according to the specified rules; Step 3: The expression engine receives the transformed executable syntax structure, executes the syntax, and returns the result.
[0030] Further, step 1 includes the following steps: Step 1.1: The user manually enters or selects the variable list returned by the server in the input box, and selects the corresponding operator at the same time; Step 1.2: Based on the complexity of the expression, the user designs the expression metadata structure that meets the user's requirements by adding siblings, splitting, negating, deleting, etc. Step 1.3: Users can adjust the order of expressions and nested results by dragging and dropping. Step 1.4: After the expression is edited, the interface will split the expression metadata into the corresponding left-hand value, right-hand value, operator, negation and other attribute information, and send it to the converter.
[0031] Step 1.5: The user previews the results through the converter to check if the expression meets the requirements.
[0032] The main body of expression metadata consists of variables and operators in the variable list. Expression metadata includes variables in the variable list, operators (such as relational operators like ">", "<", "=", and "!="), concatenation keywords (such as "AND", "OR", etc.), and negation flags (e.g., the expression "a = b AND !(c != d)"). Here, the variable list is [a, b, c, d], the operators are "=" and "!=", the negation flag is "!", and the concatenation keyword is "AND". Two independent expressions are grouped together using concatenation keywords.
[0033] A variable list is a user-defined set of data with business meaning, defining the relationships between variables on both sides of an operator. By introducing a variable list, users can pre-define the data needed for their business logic and quickly define the relationships between variables using operators during application, forming a complete expression metadata and improving application efficiency.
[0034] The attribute information contains all the data that makes up the expression. The left-hand value in the attribute information corresponds to the variable data on the left side of the operator in the expression metadata, and the right-hand value corresponds to the variable data on the right side of the operator. The operator corresponds to the operator in the expression. The negation corresponds to an independent variable data being transmitted to the server.
[0035] A variable list is a user-defined series of data with business meaning. Operators are used to connect two variables to form a complete expression and define the relationship between the variables on both sides of the operator. By introducing a variable list, users can pre-define the data needed in their business and quickly define the required expressions using operators during application.
[0036] Step 1.3 specifically includes the following steps: Step S1.3.1: Click the [Add] button on the interface to add a new row of expression selection boxes at the outermost level, and connect expressions at the same level by connecting keywords (such as "AND" or "OR"); Step S1.3.2: Click the "Add Sibling" button on the interface to add a new row of expression selection boxes at the same level as the expression, and connect it to the sibling expression using the connecting keyword; Step S1.3.3: Click the [Split] button on the interface to split the expression at this level from one line into two lines, and connect the two expressions at the same level with the connecting keyword to form a nested effect and form an expression group; Step S1.3.4: Users can drag the expression selection box to move the expression in the same line to the same level as the expression they want to combine, and connect it with the expression at that level through the connecting keyword to achieve a new expression order and nesting effect, ultimately forming a new and complete expression logic.
[0037] Further, step 2 includes the following steps: Step 2.1: The converter receives the left-hand value, right-hand value, operator, and inversion information input from the interface; Step 2.2: Perform security verification on expression metadata through a multi-layered security protection mechanism. The first layer intercepts dangerous syntax structures in the expression by matching keywords with a blacklist. The second layer prevents resource exhaustion by monitoring memory resources in real time. The third layer controls the access boundaries of expression data through a variable whitelist mechanism. The first layer: By scanning the entire variable data, the AC automaton algorithm is used to achieve O(n) efficient matching of the dangerous word list (such as "System.exit", "Runtime.exec", "File.delete", etc.) to ensure safe execution; The second layer monitors memory and CPU time in real time. When memory usage exceeds 80%, it performs forced GC (garbage collection) and throws an OOM exception. Alternatively, when the execution time of an expression exceeds 1000ms, it triggers Thread.interrupt() to interrupt execution and release resources. The third layer: When configuring the variable list, declare the available variables through a whitelist mechanism, automatically verify and warn of the use of unauthorized variables; Step 2.3: The converter maps the values of the variables input from the interface through an internal algorithm, converting the operators into syntax that the expression engine can recognize; Step 2.4: The converter concatenates the value-mapped variables and operator expressions to construct structured data that the expression engine can recognize; Step 2.5: The converter sends the converted structured data to the expression engine for processing.
[0038] Step 2.3 specifically includes the following steps: Step S2.3.1: Verify whether the expression is a single expression or a group of expressions by checking the attribute information of the expression metadata; Step S2.3.2: Traverse all variable data, match the actual values corresponding to the variables in the expression in the database, and replace them; Step S2.3.3: Determine the boundaries of each subexpression in the expression group and encapsulate the entire expression into a syntax structure that the corresponding programming language can recognize and run (e.g., the expression "a = b AND !(c != d)" is eventually converted to "(3 = 2)&!(4 != 5)").
[0039] In this embodiment, expression metadata is generated by inputting and dragging through a visual interface. After receiving the metadata, the converter verifies it through a multi-layered security protection mechanism, serializes the metadata into a syntax structure that can be executed by the expression engine, and finally executes it through the expression engine to output the result.
[0040] This embodiment solves the problem that expression engines require professional developers to code and business personnel cannot directly participate by adopting a structure of dynamic input and drag-and-drop assembly of expressions on a visual page; at the same time, it ensures the reliability and stability of the expression engine execution process through a multi-layered security protection mechanism.
[0041] Those skilled in the art will understand that, besides implementing the system and its various devices, modules, and units provided by this invention in the form of purely computer-readable program code, the same functions can be achieved entirely through logical programming of the method steps, making the system and its various devices, modules, and units of this invention function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, the system and its various devices, modules, and units provided by this invention can be considered as a hardware component, and the devices, modules, and units included therein for implementing various functions can also be considered as structures within the hardware component; alternatively, the devices, modules, and units for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0042] Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Unless otherwise specified, the embodiments and features described in this application can be arbitrarily combined with each other.
Claims
1. A method for dynamic parsing and execution of expressions based on visual interaction, characterized in that, Includes the following steps: Step S1: Receive the expression metadata input by the user through the visual interface, and adjust the order of the expression metadata by dragging and dropping; Step S2: Receive the expression metadata after the order was adjusted in step S1 through the converter receiving interface, and convert the expression metadata into an executable syntax structure that the expression engine can recognize through preset rules; Step S3: Receive the converted executable syntax structure from step S2 through the expression engine, execute the syntax and return the result; Step S1 specifically includes the following steps: Step S1.1: Enter or select the variable list returned by the server in the input box of the visualization interface, and select the corresponding operator to form preliminary expression metadata; the expression metadata includes the operator and the variables in the variable list; Step S1.2: Based on the complexity of the expression metadata formed in step S1.1, preprocessing operations are added to obtain expression metadata that meets the preset structure requirements; Step S1.3: Adjust the order and nesting results of the expression metadata that meet the preset structure requirements in step S1.2 by dragging and dropping; Step S1.4: After the expression metadata in step S1.3 is adjusted, the adjusted expression metadata in step S1.3 is broken down into corresponding attribute information through a visual interface and sent to the converter; The attribute information contains all the data that makes up the expression.
2. The method for dynamic parsing and execution of expressions based on visual interaction according to claim 1, characterized in that, In step S1.2, the preprocessing operations include sibling operations, splitting, inversion, and deletion. Step S1.3 specifically includes the following steps: Adding a new step: In the visual interface, add a new row of expression check boxes, and associate the new expression check box with other expression check boxes at the same level using the connection keyword; Adding steps: In the visual interface, add a sibling operation, add a row of expression check boxes at the same level as an existing expression check box, and associate the added expression check box with other expression check boxes at the same level using the connection keyword; Splitting steps: Perform the splitting operation in the visual interface to split the existing expression selection box into two expression selection boxes, and use the connecting keyword to associate the two sibling expression selection boxes formed after the splitting to form an expression group with a nested effect; Adjustment steps: After performing the new step and / or add step and / or split step, drag any expression selection box to move it to the same level as the target expression selection box, and use the connection keyword to associate the moved expression selection box with other expression selection boxes at the same level, thereby adjusting the order and nesting relationship of the expression metadata; In step S1.4, the attribute information includes lvalues, rvalues, operators, and negation; The left-hand value in the attribute information corresponds to the variable data on the left side of the operator in the expression metadata, the right-hand value in the attribute information corresponds to the variable data on the right side of the operator in the expression metadata, the operator in the attribute information corresponds to the operator in the expression metadata, and the negation in the attribute information corresponds to an independent variable data being transmitted to the server.
3. The method for dynamic parsing and execution of expressions based on visual interaction according to claim 1, characterized in that, Step S2 specifically includes the following steps: Step S2.1: Receive the attribute information from step S1.4 through the converter receiving interface, and preview the result through the converter. Based on the attribute information, check whether the expression metadata meets the preset requirements. If it does not meet the preset requirements, repeat steps S1.2 to S1.4 until the preset requirements are met. Step S2.2: Perform security verification on the expression metadata received in step S2.1 through a multi-layer security protection mechanism to obtain secure expression metadata; Step S2.3: The internal algorithm of the converter performs value mapping on the variables in the attribute information of the secure expression metadata in step S2.2, and converts the operators in the attribute information into syntax that the expression engine can recognize; Step S2.4: The syntax of the variables and operators after value mapping in step S2.3 is concatenated by the converter to construct an executable syntax structure that the expression engine can recognize; Step S2.5: Send the converted executable syntax structure to the expression engine for processing via the converter.
4. The method for dynamic parsing and execution of expressions based on visual interaction according to claim 3, characterized in that, In step S2.2, the multi-layer security protection mechanism includes three layers: the first layer intercepts dangerous syntax structures in expression metadata through keyword blacklist matching; the second layer prevents resource exhaustion by real-time monitoring of memory resources; and the third layer controls the access boundaries of expression metadata through a variable whitelist mechanism. Step S2.3 specifically includes the following steps: Step S2.3.1: Based on the attribute information of the expression metadata, verify the type of the expression; the type of the expression includes a single expression and a group of expressions; Step S2.3.2: After completing the type validation of the expression, iterate through all variable data, match the actual values corresponding to the variables in the expression through the database and replace them to realize the value mapping of variables; Step S2.3.3: For an expression of type expression group, after completing the value mapping of variables, determine the boundary of each sub-expression, and encapsulate the entire expression group into a syntax structure that the expression engine can recognize and run, thereby realizing the conversion of operators into syntax that the expression engine can recognize. For expressions of type single expression, after completing the variable value mapping, they are directly encapsulated into a syntax structure that the expression engine can recognize and run, realizing the conversion of operators into syntax that the expression engine can recognize.
5. A system for dynamic parsing and execution of expressions based on visual interaction, characterized in that, Includes the following modules: Module M1: Receives expression metadata input by the user through a visual interface and allows users to adjust the order of the expression metadata by dragging and dropping. Module M2: Receives the rearranged expression metadata from module M1 through the converter receiving interface, and converts the expression metadata into an executable syntax structure that the expression engine can recognize through preset rules; Module M3: Receives the converted executable syntax structure from module M2 through the expression engine, executes the syntax and returns the result; Module M1 specifically includes the following modules: Module M1.1: Input or select the variable list returned by the server in the input box of the visual interface, and select the corresponding operator to form preliminary expression metadata; the expression metadata includes the operator and the variables in the variable list; Module M1.2: Based on the complexity of the expression metadata formed in module M1.1, preprocessing operations are added to obtain expression metadata that meets the preset structure requirements; Module M1.3: Adjusts the order and nesting results of expression metadata in module M1.2 that meet the preset structure requirements through drag-and-drop operations; Module M1.4: After the expression metadata in Module M1.3 is adjusted, the adjusted expression metadata in Module M1.3 is broken down into corresponding attribute information through a visual interface and sent to the converter; The attribute information contains all the data that makes up the expression.
6. The expression dynamic parsing and execution system based on visual interaction according to claim 5, characterized in that, In module M1.2, the preprocessing operations include sibling operations, splitting, inversion, and deletion. Step S1.3 specifically includes the following steps: Adding a new step: In the visual interface, add a new row of expression check boxes, and associate the new expression check box with other expression check boxes at the same level using the connection keyword; Adding steps: In the visual interface, add a sibling operation, add a row of expression check boxes at the same level as an existing expression check box, and associate the added expression check box with other expression check boxes at the same level using the connection keyword; Splitting steps: Perform the splitting operation in the visual interface to split the existing expression selection box into two expression selection boxes, and use the connecting keyword to associate the two sibling expression selection boxes formed after the splitting to form an expression group with a nested effect; Adjustment steps: After performing the new step and / or add step and / or split step, drag any expression selection box to move it to the same level as the target expression selection box, and use the connection keyword to associate the moved expression selection box with other expression selection boxes at the same level, thereby adjusting the order and nesting relationship of the expression metadata; In module M1.4, the attribute information includes lvalues, rvalues, operators, and negation; The left-hand value in the attribute information corresponds to the variable data on the left side of the operator in the expression metadata, the right-hand value in the attribute information corresponds to the variable data on the right side of the operator in the expression metadata, the operator in the attribute information corresponds to the operator in the expression metadata, and the negation in the attribute information corresponds to an independent variable data being transmitted to the server.
7. The expression dynamic parsing and execution system based on visual interaction according to claim 5, characterized in that, Module M2 specifically includes the following modules: Module M2.1: Receives attribute information from module M1.4 through the converter receiving interface, previews the results through the converter, and checks whether the expression metadata meets the preset requirements based on the attribute information. If the preset requirements are not met, the process of modules M1.2 to M1.4 is repeated until the preset requirements are met. Module M2.2: Performs security verification on the expression metadata received in module M2.1 through a multi-layer security protection mechanism to obtain secure expression metadata; Module M2.3: Through the converter's internal algorithm, it performs value mapping on the variables in the attribute information of the secure expression metadata in Module M2.2, and converts the operators in the attribute information into syntax that the expression engine can recognize; Module M2.4: It uses a converter to concatenate the syntax of variables and operators after value mapping in module M2.3, and constructs an executable syntax structure that the expression engine can recognize. Module M2.5: Sends the converted executable syntax structure to the expression engine for processing via a converter.
8. The expression dynamic parsing and execution system based on visual interaction according to claim 7, characterized in that, In module M2.2, the multi-layer security protection mechanism includes three layers: the first layer intercepts dangerous syntax structures in expression metadata through keyword blacklist matching; the second layer prevents resource exhaustion by monitoring memory resources in real time; and the third layer controls the access boundaries of expression metadata through a variable whitelist mechanism. Step S2.3 specifically includes the following steps: Step S2.3.1: Based on the attribute information of the expression metadata, verify the type of the expression; the type of the expression includes a single expression and a group of expressions; Step S2.3.2: After completing the type validation of the expression, iterate through all variable data, match the actual values corresponding to the variables in the expression through the database and replace them to realize the value mapping of variables; Step S2.3.3: For an expression of type expression group, after completing the value mapping of variables, determine the boundary of each sub-expression, and encapsulate the entire expression group into a syntax structure that the expression engine can recognize and run, thereby realizing the conversion of operators into syntax that the expression engine can recognize. For expressions of type single expression, after completing the variable value mapping, they are directly encapsulated into a syntax structure that the expression engine can recognize and run, realizing the conversion of operators into syntax that the expression engine can recognize.
Citation Information
Patent Citations
A method and system for implementing an expression engine based on a metadata architecture.
CN110888672B
Rule configuration method and device based on Aviator expression engine and storage medium
CN117933383A
Method and script engine for realizing service function
CN110908640A
Efficient and real-time expression grammar verification method and system
CN112765969A
Data processing method and system based on visual computing engine and computer equipment
CN112784143A