A method and apparatus for automatic inference of variable types in a low-code platform
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAN GRAPE CITY SOFTWARE CO LTD
- Filing Date
- 2026-02-28
- Publication Date
- 2026-05-29
Smart Images

Figure CN121766459B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of low-code development technology, and in particular to a method and apparatus for automatically inferring variable types on a low-code platform. Background Technology
[0002] With the widespread adoption of low-code development, low-code platforms have become core tools for rapidly building applications, and variable type configuration is a crucial link in the orchestration of business logic and data flow within these platforms. However, variable type handling in low-code platforms still faces numerous pain points: when creating variables, users either need to explicitly declare the type, which is cumbersome and error-prone when dealing with complex generic types, and type changes require manual synchronization of all related variables; or they need to use a dynamic type mechanism, which results in the inability to detect type errors at compile time, leading to high performance overhead and poor maintainability; even if some platforms support simple literal type inference, they can only handle basic literal scenarios and cannot cope with complex business scenarios such as complex expressions, function calls, chained dependencies between variables, and multi-node assignments; another solution is to implement type inference through self-developed domain-specific languages, but this has problems such as extremely high development and maintenance costs, high user learning barriers, and accumulated technical debt.
[0003] Current variable type handling methods struggle to balance ease of use, type safety, and adaptability to complex scenarios: explicit declarations increase user burden and maintenance costs, dynamic types lack security guarantees, simple inference has limited applicability, and self-developed solutions suffer from high costs and steep learning curves. These issues lead to low-code platform variable configuration efficiency and high error rates, hindering improvements in development efficiency and platform usability.
[0004] Therefore, how to achieve automatic variable type inference in a low-code platform without requiring users to manually specify variable types, while supporting complex scenarios such as complex expressions, chained dependencies, and multi-source assignments, and taking into account type safety, low usage cost, and low maintenance cost, is a technical problem that urgently needs to be solved. Summary of the Invention
[0005] In view of this, the present application provides an automatic variable type inference method and apparatus for low-code platforms. Through multi-stage inference, expression type calculation, and chain dependency handling, it eliminates the need for users to manually specify types, supports inference in complex scenarios, maintains type safety, reduces usage and maintenance costs, and improves the development efficiency and ease of use of low-code platforms. The automatic variable type inference method and apparatus for low-code platforms provided in this application are implemented as follows:
[0006] This application provides an automatic inference method for variable types on a low-code platform, comprising:
[0007] The variables and automatic type identifiers in the low-code platform are filtered and matched to obtain the target variable;
[0008] The target variable is matched based on the type inference rules to obtain the default value inference result;
[0009] The structured model and declaration information corresponding to the business logic in the low-code platform are traversed and integrated to obtain the node assignment inference results;
[0010] Based on a multi-round iterative strategy, the target variables are recursively derived to obtain the dependency inference results.
[0011] The default value inference result, the node assignment inference result, and the dependency inference result are integrated to obtain the initial type of the target variable;
[0012] Based on the inferred source information, the initial type is stored and change notification is processed to obtain the target type of the target variable.
[0013] In some embodiments, the step of traversing and integrating the structured model and declaration information corresponding to the business logic in the low-code platform to obtain the node assignment inference result includes:
[0014] The structured model and declaration information corresponding to the business logic in the low-code platform are subjected to association traversal processing to obtain the initial variable writing association information, which includes the variable identifier and node feature information corresponding to each business logic node.
[0015] Based on the type inference rules, the variable identifiers written into the association information of the initial variables are matched with the node feature information of the corresponding business logic nodes to obtain the variable inference type corresponding to each business logic node.
[0016] The variable identifiers and variable inference types corresponding to each business logic node are deduplicated and validated to obtain the node assignment inference results.
[0017] In some embodiments, the matching process of the target variable based on the type inference rule to obtain the default value inference result includes:
[0018] The target variable is associated with the type inference rule to obtain the literal default value and the expression default value.
[0019] The literal type inference rules are used to match the default value of the literal to obtain the literal type result;
[0020] The expression's default value and expression type calculation logic are combined to obtain the expression type result;
[0021] The literal type result and the expression type result are integrated to obtain the default value inference result.
[0022] In some embodiments, the recursive derivation of the target variable and the dependency inference result based on a multi-round iterative strategy includes:
[0023] Based on the inference results of the default values and the inference results of the node assignments, the target variables are classified to obtain a set of variables with determined types and a set of variables with undetermined types.
[0024] Iterative processing of the set of variables of undetermined type includes:
[0025] Dependency analysis is performed on the variables in the set of undetermined type variables to obtain the chain dependencies between the variables;
[0026] Based on the type inference rule and the chain dependency relationship, the variables in the set of undetermined type variables are inferred. If there is a variable in the set of undetermined type variables that depends on a variable in the set of determined type variables, the variable in the set of undetermined type variables is added to the set of determined type variables, and the set of undetermined type variables is updated synchronously.
[0027] When the number of variables in the current set of undetermined type variables is the same as the number of variables in the set of determined type variables in the previous round, the iteration stops, and the target set of determined type variables and the target set of undetermined type variables are obtained.
[0028] Based on the set of variables with known target types, dependency links are marked on the variables in the set of variables with unknown target types to obtain dependency inference results.
[0029] In some embodiments, the process of combining the default value of the expression and the expression type calculation logic to obtain the expression type result includes:
[0030] The default values of the expression are parsed to obtain an abstract syntax tree;
[0031] Based on the type inference rules and the type characteristics of each node, the abstract syntax tree is recursively traversed to obtain the initial type result of each node;
[0032] Based on the type inference rules, the operand types corresponding to the operators in the abstract syntax tree are processed for compatibility, and the result types corresponding to the operators are obtained.
[0033] The initial type results of each node and the result types corresponding to the operators are integrated to obtain the expression type result.
[0034] In some embodiments, the filtering and matching process of variables and automatic type identifiers in the low-code platform to obtain the target variable includes:
[0035] Obtain multiple variables that conform to a preset automatic type identifier, and obtain a set of variables to be filtered based on the multiple variables that conform to the preset automatic type identifier;
[0036] Delete the variables with manually specified fixed data types from the set of variables to be filtered, and obtain the processed set of variables to be filtered;
[0037] Variables in the processed set of variables to be filtered that do not have a clearly defined data type and conform to the preset automatic type identifier are retained;
[0038] The retained variables are validated for validity, and invalid variable markers and duplicate variables are removed to obtain the target variable set.
[0039] In some embodiments, the maximum number of iterations for the iterative process is 20.
[0040] This application provides an automatic inference device for variable types on a low-code platform, comprising:
[0041] The matching module is used to filter and match variables and automatic type identifiers in the low-code platform to obtain the target variable;
[0042] The matching module is also used to perform matching processing on the target variable based on type inference rules to obtain the default value inference result;
[0043] The processing module is used to traverse and integrate the structured model and declaration information corresponding to the business logic in the low-code platform to obtain the node assignment inference results.
[0044] The processing module is also used to perform recursive derivation processing on the target variable based on a multi-round iterative strategy to obtain the dependency inference result;
[0045] The processing module is further used to integrate the default value inference result, the node assignment inference result, and the dependency inference result to obtain the initial type of the target variable;
[0046] The notification module is used to store the initial type based on the inferred source information and process change notifications to obtain the target type of the target variable.
[0047] The computer device provided in this application includes a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements the method described in this application.
[0048] The computer-readable storage medium provided in this application embodiment stores a computer program thereon, which, when executed by a processor, implements the method described in this application embodiment.
[0049] This application provides an automatic variable type inference method and apparatus for low-code platforms. The method involves: filtering and matching variables with automatic type identifiers in the low-code platform to obtain target variables; obtaining default value inference results based on type inference rules; traversing the structured model and declaration information corresponding to business logic to obtain node assignment inference results; recursively deriving dependency inference results through a multi-round iterative strategy; integrating default value inference results, node assignment inference results, and dependency inference results to determine the initial type of the target variable; storing the initial type based on inference tracing information and implementing change notifications; and finally obtaining the target type. This approach, through multi-stage inference, expression type calculation, and chained dependency handling, eliminates the need for users to manually specify types, supports inference in complex scenarios, maintains type safety, reduces usage and maintenance costs, improves the development efficiency and usability of low-code platforms, and solves the technical problems mentioned in the background art. Attached Figure Description
[0050] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 A schematic diagram illustrating the implementation flow of an automatic inference method for variable types on a low-code platform provided in this application embodiment;
[0052] Figure 2 A schematic diagram illustrating the implementation process of obtaining node assignment inference results provided in an embodiment of this application;
[0053] Figure 3 This is a schematic diagram of the structure of an automatic inference device for low-code platform variable types provided in an embodiment of this application. Detailed Implementation
[0054] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0055] The following description of some technologies involved in the embodiments of this application is provided to aid understanding and should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, some descriptions of well-known functions and structures are omitted in the following description.
[0056] Figure 1 This is a schematic diagram illustrating the implementation flow of an automatic variable type inference method for a low-code platform provided in this application embodiment, including steps 101 to 106. Wherein, Figure 1 This is merely one execution order shown in the embodiments of this application and does not represent the only execution order for an automatic inference method of variable types on a low-code platform. Where the final result can be achieved, Figure 1 The steps shown can be performed in parallel or in reverse order.
[0057] Step 101: Filter and match the variables and automatic type identifiers in the low-code platform to obtain the target variable.
[0058] In this embodiment, the low-code platform pre-defines a unified automatic type identifier as "Auto" to distinguish between variables whose types need to be automatically inferred and variables whose types are manually specified. First, a variable traversal program is started to scan all created variables in the platform (including page variables, logical variables, local variables, etc.), filtering out variables configured with the "Auto" automatic type identifier to form a set of variables to be filtered. Then, the set of variables to be filtered is initially filtered, removing those with manually specified fixed data types (such as basic types String and Integer, and composite types List). <user>Generic type Map <String,List <map>For variables of type 'Auto' (e.g., non-Auto), only variables with undefined data types and configured with the Auto flag are retained. Finally, a validity check process is executed, which checks whether the variable identifier is unique, whether the variable is associated with a valid business logic node, and whether the variable has configuration syntax errors. Invalid variable identifiers and duplicate variables are removed, and the target variable set is finally formed. The target variable set is temporarily stored in the structure of variable unique identifier - variable module - associated logic ID.
[0059] Step 102: Match the target variable based on the type inference rules to obtain the default value inference result.
[0060] In this embodiment of the application, the preset type inference rules include literal type mapping sub-rules and expression type calculation sub-rules, and scenario-based inference is performed based on the default value configuration of the target variable.
[0061] Default value classification and identification: Parse the default value configuration field of the target variable. If the default value is a single value without operators, function calls, or variable references (such as 123, "username", true, null), it is determined to be a literal default value. If the default value contains operators (such as +, -, ×, ÷), function calls, or variable references, it is determined to be an expression default value.
[0062] Literal type inference: Matching types based on literal type mapping subrules. Numeric literals without decimal points and within the range [-2³¹+1, 2³¹-1] are inferred as Integer type; values outside this range or containing decimal points are inferred as Decimal type; character sequences enclosed in single or double quotes are inferred as String type; literals containing only true or false are inferred as Boolean type; null or undefined literals are marked for recursive inference, ultimately yielding the literal type result.
[0063] Expression type inference: The expression type calculation engine is invoked to process the default value of the expression. First, the expression string is parsed into an abstract syntax tree. The nodes of the abstract syntax tree contain types such as literal nodes, variable reference nodes, function call nodes, member access nodes, and operator nodes.
[0064] The visitor pattern is used to recursively traverse the abstract syntax tree, progressing from leaf nodes to the root node. The initial type of each node is analyzed using type inference rules. Literal nodes are inferred according to literal rules; variable reference nodes query the currently determined type of the variable (marking it as undetermined if none exists); function call nodes first infer the types of the actual arguments and then match them with the function's return type; member access nodes look up the pre-defined type of the corresponding attribute based on the type of the left operand; and operator nodes do not infer their initial type at this stage.
[0065] Operator nodes are processed based on type upgrade rules. Arithmetic operators with operands containing Decimal result in Decimal; those with operands containing Integer result in Integer; those containing String result in String. Comparison and logical operators always result in Boolean.
[0066] The results of all node types are summarized from the root node of the abstract syntax tree to obtain the expression type result. If there are node types that are incompatible, they are marked as type conflicts.
[0067] The literal type results and expression type results are integrated according to the structure of variable identifier-inferred type-source marker, with the source marker explicitly indicating the default value inference, thus forming the default value inference result.
[0068] Step 103: Traverse and integrate the structured model and declaration information corresponding to the business logic in the low-code platform to obtain the node assignment inference results.
[0069] In this embodiment of the application, the business logic in the low-code platform is organized into a structured model in the form of a directed acyclic graph, and the declaration information is the variable exposed after each business logic node implements the interface and writes it into the declaration.
[0070] The business logic nodes are traversed in topological sorting order (from the start node to the end node) to avoid looping. Each node returns a variable identifier and corresponding node characteristic information through its implementation method. Assignment nodes return the assignment source type (literal / expression / variable reference) and assignment source content; data query nodes return the query table name, column name, and column database type; list operation nodes return the source list variable identifier and operation type; date operation nodes return the operation type (time difference / formatting / parsing); and logic call nodes return the called logic ID and return value definition type. This information is collected to form initial variables and write them into the associated information. A waiting mechanism is supported in asynchronous scenarios to ensure that the information of asynchronous nodes is completely obtained.
[0071] Based on type inference rules, the initial variables are written into the variable identifier in the association information and matched with the corresponding node feature information. The data query node maps the database column type to the platform type. The list operation node transform retains the element type, filter retains the list type, find returns the element type, and length returns the Integer type. The date operation node returns Integer for time difference, returns String for formatting, and returns Date for parsing. The logic call node directly reuses the return value type of the called logic. The assignment node performs corresponding inference based on the assignment source type to obtain the variable inference type for each node.
[0072] The deduplication process employs a combination of variable identifier and node ID as the primary key, retaining the inferred type of the most recently written node for the same variable. Type compatibility checks are performed, with compatible types (such as Integer and Decimal) taking the broader type range, and incompatible types marked as type conflicts and all conflicting types retained, ultimately forming the node assignment inference result.
[0073] Step 104: Based on a multi-round iterative strategy, recursively derive the target variable and obtain the dependency inference results.
[0074] In this embodiment, a multi-round iteration strategy is used to handle chain dependencies between variables.
[0075] Combining the inference results of default values and node assignments, the target variable is divided into a set of variables with known types and a set of variables with unknown types: variables with clear types (not those with type conflicts to be recursively inferred) are assigned to the set of known types and stored as variable identifier-known type key-value pairs; the remaining variables are assigned to the set of unknown types, and the variable identifier and the reason for the unknown type are recorded (such as dependence on unknown variables or the existence of type conflicts).
[0076] Start the iteration process, with a preset maximum number of iterations of 20.
[0077] parse the reference relationships between variables in an undetermined set and construct dependency chains (e.g., A→B→C means A depends on B and B depends on C).
[0078] For undetermined variables that depend on variables in a determined set, their types are inferred using type inference rules. For example, if variable A depends on variable B, and B is determined to be of type String, then A is inferred to be of type String.
[0079] The successfully derived variables are moved from the undetermined set to the determined set, and the number and content of variables in both sets are updated simultaneously.
[0080] If, after two consecutive iterations, the number of undetermined set variables remains unchanged and the number of determined set variables remains unchanged (result convergence), or the maximum number of iterations is reached, the iteration stops, and the target set of determined type variables and the target set of undetermined type variables are obtained.
[0081] For variables in the set where the target is not determined, mark the circular dependency links (such as A→B→C→A), the direct dependency list, and the indirect dependency list to form the dependency inference results.
[0082] Step 105: Integrate the default value inference results, node assignment inference results, and dependency inference results to obtain the initial type of the target variable.
[0083] In this embodiment, the node assignment inference result > dependency inference result > default value inference result, and the results are integrated according to the current priority.
[0084] If the type of a variable is clear in the node assignment inference result, use that type directly as the candidate initial type.
[0085] If the node assignment result does not contain the variable type or the tag type conflict, the type in the dependency inference result is used.
[0086] If the dependency inference result is still unclear, the type in the inference result will be used with the default value.
[0087] During the integration process, if there is a conflict between types from different sources, the node assignment inference result shall prevail, and the conflict information (conflict type, source node, inference rule) shall be recorded in the inference tracing information. After integration, variables with clear types shall be determined as the initial types, and variables with undetermined types shall be marked as undetermined types and the reason shall be recorded.
[0088] Step 106: Based on the inferred source information, the initial type is stored and change notification is processed to obtain the target type of the target variable.
[0089] In this embodiment, the storage and change notification of the initial type are implemented through a global type registry center using the singleton pattern.
[0090] The target variable's identifier, initial type, and inference tracing information are entered into the type registry. The tracing information includes the source type (default value / node assignment / recursive inference), associated node ID, inference timestamp, and conflict record. The storage format is variable unique identifier-initial type-tracing ID.
[0091] The type registry pre-sets subscription trigger rules, clearly defining type adjustment trigger scenarios as changes in dependent variable types and updates to data models. When the trigger rules cause an initial type change, the registry pushes a change notification to platform components (such as designers, compilers, and code completion modules) that subscribe to the variable through a notification interface. The notification includes the variable identifier, old type, new type, and reason for the change.
[0092] The type registry provides a global cross-module access interface, through which all modules of the platform (page designer, logic designer, data model designer) obtain unified variable types and traceability information to ensure type data consistency.
[0093] After the registry center verifies the storage integrity, confirms that the change notification has been delivered to all subscribed components, and completes the information transfer between modules, the initial type is officially determined as the target type of the target variable and is persistently stored in the registry center to support subsequent traceability and maintenance.
[0094] This application addresses the burden and cumbersome configuration issues inherent in existing technologies where users are required to explicitly declare variable types. Users only need to select "Auto" for automatic type identification to complete the entire automatic inference process, significantly reducing the understanding cost and configuration difficulty of the platform's type system, especially suitable for inference scenarios involving complex generic types. Through multi-source inference (default values, node assignments, recursive dependencies) and compile-time type verification, it avoids the defect of discovering type errors only at runtime in dynamic type systems, while providing accurate code completion and type compatibility verification, improving development efficiency and code reliability. Multi-round iterative recursive derivation resolves chained dependencies between variables, comprehensively determining variable types by considering multiple node assignment sources, overcoming the limitation of simple literal inference only handling basic scenarios, and covering diverse business scenarios such as complex expressions, function calls, and data queries. Through inference source tracking information recording and automatic change synchronization mechanisms, when the data model or dependent variables change, the relevant variable types can be automatically re-inferred and synchronized to each module, reducing maintenance costs. Simultaneously, the global type registry center enables cross-module information sharing, ensuring type data consistency.
[0095] In the above Figure 1 Based on the above, this application embodiment also provides a schematic diagram of the implementation process for obtaining node assignment inference results. For example... Figure 2 As shown, steps 201 to 203 are included:
[0096] Step 201: Perform association traversal processing on the structured model and declaration information corresponding to the business logic in the low-code platform to obtain the initial variables and write them into the association information.
[0097] In this embodiment of the application, the structured model corresponding to the business logic in the low-code platform is organized in the form of a directed acyclic graph, which is used to clarify the execution order and data flow relationship of each business logic node; the declaration information is the variable exposed by each business logic node after implementing the preset interface and writing it into the relevant declaration data.
[0098] The traversal order adopts a topological sorting rule, starting from the starting node of the business logic and proceeding sequentially to the ending node, ensuring that each node is only accessed after all its preceding dependent nodes have been traversed, thus completely avoiding the problem of circular traversal.
[0099] Each business logic node has pre-implemented the VariableWriter interface, which includes the getWrittenVariables() method. Nodes use this method to return their own variable writing specifications. The returned results support synchronous data collections or asynchronous objects to adapt to scenarios that require additional time for data queries.
[0100] Collect the variable write specifications returned by each node to form initial variable write association information. The variable identifiers in the initial variable write association information are the unique names of the variables corresponding to the node write operations, and the node feature information includes key configurations that are differentiated according to the node type.
[0101] The characteristic information of an assignment node includes the type of the assignment source (literal / expression / variable reference) and the specific content of the assignment source.
[0102] The characteristic information of a data query node includes the table name associated with the query, the selected column names, and the original database type of each column.
[0103] The characteristic information of a list operation node includes the variable identifier corresponding to the source list and the specific operation type.
[0104] The characteristic information of the date operation node includes the date operation type (time difference calculation / date formatting / string parsing to date).
[0105] The characteristic information of a logic call node includes the unique ID of the called logic and the predefined return value type definition of that logic.
[0106] Step 202: Based on the type inference rules, the variable identifiers written into the association information of the initial variables are matched with the node feature information of the corresponding business logic nodes to obtain the variable inference type corresponding to each business logic node.
[0107] In this embodiment, based on the platform's preset type inference rules, the variable identifiers written into the association information of the initial variables are matched one by one with the feature information of the corresponding nodes, and targeted inference is performed according to the node type to obtain the variable inference type corresponding to each business logic node.
[0108] For assignment nodes, if the assignment source is a literal, the type is directly inferred according to the literal type mapping rules (e.g., numeric literals with a decimal point are of type Decimal, those without are of type Integer). If it is an expression, the expression type calculation engine is called to parse the expression and obtain the type; if it is a variable reference, the currently determined type of the referenced variable is queried (if not determined, it is temporarily recorded as pending recursive inference).
[0109] For data query nodes, conversion is performed according to the preset database type and platform type mapping rules. For example, the INT type in the database is mapped to the Integer type in the platform, the VARCHAR type is mapped to the String type, and the DATE type is mapped to the Date type. Finally, the variable inference type is obtained by integrating the types of the query columns.
[0110] For list operation nodes, inference is performed based on the operation type: the transform operation retains the element type of the source list, the filter operation retains the overall type of the source list, the find operation returns the element type of the source list, and the length operation is always inferred as Integer type.
[0111] For date operation nodes, time difference calculation operations are inferred to be of type Integer, date formatting operations are inferred to be of type String, and string parsing operations to date are inferred to be of type Date.
[0112] For logic call nodes, the predefined return value type definition of the called logic is directly reused as the inference type of the target variable for the current node.
[0113] For other types of business logic nodes, the variable inference type is obtained by combining the node feature information with the exclusive inference logic preset when implementing the VariableWriter interface. If it cannot be inferred, it is marked as undetermined.
[0114] Step 203: Perform deduplication and verification on the variable identifiers and variable inference types corresponding to each business logic node to obtain the node assignment inference results.
[0115] In this embodiment of the application, deduplication and verification processing is performed on the variable identifiers and corresponding variable inference types of all business logic nodes.
[0116] A combined primary key mechanism of variable identifier and node ID is adopted to deduplicate the inference types of the same variable in different nodes, retaining only the inference type corresponding to the latest execution order node, and eliminating duplicate inference records in historical nodes.
[0117] Perform type compatibility checks. If the inferred type of the same variable is a compatible type (such as Integer and Decimal) in different nodes, then the type with a wider range (i.e., Decimal) is taken as the inferred type after verification. If the inferred type is an incompatible type (such as String and Integer), then the variable is marked as a type conflict, and the conflict type and node identifier corresponding to all nodes are retained.
[0118] The variable identifier after deduplication and verification, the final inference type, the associated node ID, and the verification status information are integrated to form the node assignment inference result. The verification status includes three categories: type determination, type conflict, and type pending recursion.
[0119] This application's embodiments utilize a standardized VariableWriter interface, allowing each business logic node to independently declare variable writing behavior and characteristic information. This enables adaptation to new node types without modifying the core inference logic, enhancing the solution's scalability. Topological sorting avoids loop traversal, and a deduplication mechanism combining variable identifiers and node IDs preserves the type information of the latest assigned node. Compatibility checks handle compatible and conflicting types, resolving the issue of existing technologies' inability to comprehensively determine types based on multiple assignment sources. Dedicated inference strategies are developed for different node types (assignment nodes, data query nodes, list operation nodes, etc.), accurately deriving types based on node characteristic information (such as table structure, operation type, and return value definition), ensuring the inference results are highly adaptable to the business scenario. The interface returns objects to obtain variable information for asynchronous nodes, ensuring that nodes requiring additional time-consuming operations such as data queries can still provide complete information for type inference, improving the solution's versatility.
[0120] In some embodiments, the target variable is matched based on type inference rules to obtain the default value inference result, including: the target variable is associated based on type inference rules to obtain the literal default value and the expression default value.
[0121] Specifically, the default value configuration field of the target variable is first parsed, and the default value of the target variable is associated with the classification criteria of the default value in the type inference rule.
[0122] If the default value is a single value with no operators, no function calls, and no variable references, it is determined to be the default value of a literal.
[0123] If the default value contains arithmetic operators (+, -, ×, ÷), comparison operators (>, <, ==, etc.), logical operators (&&, ||, !), or function calls, it is determined to be the default value of the expression.
[0124] By classifying and identifying, the literal default values and expression default values corresponding to the target variable are collected separately, forming two independent sets of default values. The sets record the correspondence between variable identifier and default value content.
[0125] Furthermore, based on the literal type inference rules, the default value of the literal is matched to obtain the literal type result.
[0126] Specifically, based on the preset literal type inference rules, type matching is performed on each of the collected default literal values.
[0127] Numeric literals: If they do not contain a decimal point and the value is within the range of [-2³¹+1, 2³¹-1], they are inferred to be of type Integer; if the value is outside this range or contains a decimal point, they are inferred to be of type Decimal.
[0128] String literals: A sequence of characters enclosed in single or double quotes is directly inferred to be of type String.
[0129] Boolean literals: Literals that are only true or false, inferred to be of type Boolean.
[0130] Null literals: those with a default value of null or undefined do not have their specific type inferred directly and are marked as pending recursive inference.
[0131] After completing the type matching of all literal default values, a literal type result is generated. The result format is variable identifier-literal type-matching status, which includes two categories: type determination and recursive inference.
[0132] Furthermore, the default value of the expression and the expression type calculation logic are combined to obtain the expression type result.
[0133] Specifically, the expression string is converted into an abstract syntax tree. The node types of the abstract syntax tree cover literal nodes, variable reference nodes, function call nodes, member access nodes, and operator nodes, clarifying the hierarchy and relationship of each node in the expression.
[0134] The visitor pattern is used to recursively traverse the abstract syntax tree, proceeding from the leaf nodes to the root node, and the initial type of each node is analyzed in conjunction with type inference rules.
[0135] Literal nodes: The type is directly determined by the literal type inference rules.
[0136] Variable reference node: Queries the currently determined type of the referenced variable (if not determined, it is marked as undetermined).
[0137] Function call node: First, infer the types of all actual arguments, then combine them with the return type template of the function definition to match the type definition of the function call to return an Integer type. If all actual arguments are Integer, the type of the function call node is inferred to be Integer.
[0138] Member access node: First, infer the type of the left operand, and then find the type corresponding to the right operand based on the preset attribute configuration of that type.
[0139] Operator nodes: Initial type is not inferred at this time; only the associated operand nodes are recorded.
[0140] Operator type compatibility handling: Based on preset type upgrade rules, type calculations are performed on operator nodes in the abstract syntax tree.
[0141] Arithmetic operators: When operands include Decimal type, the result type is Decimal; when all operands are Integer type, the result type is Integer; when operands include String type, the result type is String.
[0142] Comparison operators (such as >, ==) and logical operators (such as &&, ||): Regardless of the operand type, the result type is always Boolean.
[0143] The string operator (+) results in a string when any operand is of type String.
[0144] Starting from the root node of the abstract syntax tree, the type result of the expression is obtained by combining the type results of all lower-level nodes and the calculation results of the operator nodes; if there are incompatible node types (such as String type and Integer type performing arithmetic operations), the type result of the expression is marked as a type conflict.
[0145] Furthermore, the literal type results and expression type results are integrated to obtain the default value inference result.
[0146] Specifically, the literal type result and the expression type result are integrated.
[0147] For target variables that only have literal default values, their literal type results are directly used as the inference sub-results of the default values of the variable.
[0148] For target variables that only have default values for their expressions, the result of their expression type is directly used as the sub-result of the default value inference for that variable.
[0149] During integration, the original state of each sub-result is preserved. If the type is determined, the specific type is recorded. If the type is to be recursively deduced and there is an undetermined conflict, the corresponding state information is marked accordingly.
[0150] Finally, all sub-results are integrated using a triplet structure of variable identifier-inference type-source marker, where the source marker is uniformly set to default value inference, forming a complete default value inference result.
[0151] This application's embodiments overcome the limitations of simple literal inference by dividing default value inference into two scenarios: literals and expressions. It covers both fast type matching of basic literals and complex expressions through an expression type calculation engine, supporting type inference for complex default values such as function calls, variable references, and operator combinations. Based on preset literal type mapping rules, it avoids type judgment errors caused by single mappings, ensuring the accuracy of basic type inference. Through structured storage of variable identifier-inferred type-source markers, it clearly distinguishes the source of default value inference, facilitating priority integration with node assignment inference and recursive dependency inference results, improving the logic and traceability of the overall inference results. Null literals are marked for recursive inference, and expression type conflicts are explicitly marked, preventing invalid type information from interfering with subsequent integration processes and improving the rigor of type inference. Whether it's a single literal, a complex expression, or a variable reference-type default value, the type result can be obtained through the corresponding inference logic, meeting the flexible configuration requirements of variable default values in low-code platforms.
[0152] In some embodiments, the target variables are recursively derived based on a multi-round iterative strategy to obtain dependency inference results, including: classifying the target variables based on default value inference results and node assignment inference results to obtain a set of variables with determined types and a set of variables with undetermined types.
[0153] Specifically, the target variable is classified based on the inference results from default values and the inference results from node assignments.
[0154] Variables with a defined type are classified into the set of variables with defined types; all other variables are classified into the set of variables with undefined types.
[0155] The collection of variables with known types is stored using a key-value pair structure that uniquely identifies the variable and determines its type. The known types include platform-preset basic types (Integer, Decimal, String, etc.) and generic types (List). <user>Types such as (etc.) and composite types are used to ensure the uniqueness and accuracy of type information.
[0156] The set of undetermined type variables is stored in the correspondence between the variable unique identifier and the undetermined reason. The undetermined reason includes the existence of type conflicts between the dependent undetermined variables and the inability to infer them through existing rules.
[0157] Furthermore, iterative processing is performed on the set of variables with undetermined types, including: performing dependency analysis on the variables in the set of variables with undetermined types to obtain the chain dependencies between the variables.
[0158] Specifically, the iterative processing core adopts a fixed-point strategy, that is, it continues to infer until the result is stable, while setting a maximum limit on the number of iterations (in this application, the maximum number of iterations is 20) to avoid infinite iterations due to circular dependencies.
[0159] For each variable in the set of undetermined type variables, resolve its reference relationships in the business logic and build chained dependencies between variables.
[0160] The analysis dimensions include all scenarios involving variable associations, such as variable assignment source references, variable references in expressions, and actual parameter variable references in function calls.
[0161] If the type of variable A depends on the type of variable B, and the type of variable B depends on the type of variable C, then a chain dependency link A→B→C is constructed. All links are integrated to form a dependency graph. The dependency graph is consistent with the directed acyclic graph structure of the business logic to ensure the accuracy of the dependency relationship.
[0162] Furthermore, based on type inference rules and chain dependencies, variables in the set of undetermined type variables are inferred. If a variable in the set of undetermined type variables depends on a variable in the set of determined type variables, the variable in the set of undetermined type variables is added to the set of determined type variables, and the set of undetermined type variables is updated synchronously.
[0163] Specifically, by combining the platform's preset type inference rules with the chain dependency relationship constructed above, type inference is performed on variables with undetermined types, and the two sets are updated simultaneously.
[0164] Iterate through each variable in the set of variables with undetermined types, examining its predecessor variables in the dependency chain. If all predecessor variables have been included in the set of variables with determined types, then deduce the type of the current variable according to the type inference rules. For example, if variable A depends on variable B, variable B is determined to be of type String, and the assignment logic of variable A is a direct reference to variable B, then variable A is deduced to be of type String; if the assignment logic of variable A is an operation between variable B and a numeric literal, and variable B is of type Integer, then the type of variable A is deduced according to the type upgrade rules.
[0165] Remove successfully derived and clearly defined variables from the set of variables with undetermined types and add them to the set of variables with determined types. At the same time, update the variable list and the reason for undetermined type in the set of variables with undetermined types. If a variable cannot be derived because its dependent predecessor variable is still undetermined, retain its undetermined state and wait for the next iteration.
[0166] Furthermore, when the number of variables in the current set of undetermined type variables is the same as the number of variables in the set of determined type variables in the previous round, the iteration stops, resulting in the target set of determined type variables and the target set of undetermined type variables.
[0167] Specifically, compare the number of variables in the undetermined type variable set in the current round with the number of variables in the determined type variable set in the previous round. If the two are consistent, and in two consecutive iterations, the number of variables in the determined type variable set has not increased and the number of variables in the undetermined type variable set has not decreased, then the inference result is determined to be converged and the iteration is stopped.
[0168] If the number of iterations reaches the preset maximum number of iterations, the iteration will be forcibly stopped even if the above core conditions are not met, to avoid infinite loops.
[0169] After the iteration stops, the current set of variables with determined types becomes the target set of variables with determined types, and the current set of variables with undetermined types becomes the target set of variables with undetermined types.
[0170] Furthermore, based on the set of variables with known target types, dependency links are marked on the variables in the set of variables with unknown target types to obtain dependency inference results.
[0171] Specifically, based on the set of variables with known target types, dependency link marking is performed on variables in the set of variables with unknown target types to clarify the dependency relationships of the unknown variables.
[0172] The marked content includes a list of direct dependent variables (i.e., variables that are directly referenced), a list of indirect dependent variables (i.e., other preceding variables in the dependency chain besides the direct dependencies), and the complete path of the dependency chain (e.g., A→B→C).
[0173] For circular dependency scenarios (such as A→B→C→A), explicitly mark the circular dependency chain and the variables involved in the loop, and update the cause of the uncertainty to be circular dependency that makes it impossible to infer.
[0174] For variables whose type conflict is undetermined, the conflict records in the node assignment inference results are used to mark the node identifiers and conflict types associated with the conflict.
[0175] Finally, the unique variable identifier, dependency link information, undetermined cause, and marked state are integrated to form a complete dependency inference result, where the marked state includes circular dependencies, undetermined variable type conflicts.
[0176] This application's embodiments utilize a fixed-point iteration strategy and dependency chain analysis to progressively deduce the types of undetermined variables that depend on variables of determined types, achieving type propagation inference in multi-layered dependency scenarios and overcoming the limitations of existing technologies in handling chained dependencies. A maximum iteration limit and a convergence condition of two consecutive rounds without increments are preset to avoid infinite iterations caused by circular dependencies. Incremental inference only updates affected variables, improving inference performance. Complete dependency chains and undetermined causes are marked for scenarios such as circular dependencies, dependencies on undetermined variables, and type conflicts, providing clear evidence for problem localization and manual intervention, and improving the maintainability of type inference. Categorized storage and dynamic updates of determined / undetermined type variable sets ensure clear management of variable states during inference, avoiding type information confusion and improving the rigor of inference logic. Combining type inference rules and chained dependency relationships, linked inference is achieved after changes in dependent variable types, ensuring consistency and timeliness of type information and supporting low-code business logic orchestration with large-scale, high-dependency complexity.
[0177] In some embodiments, the expression default value and expression type calculation logic are combined to obtain the expression type result, including: parsing the expression default value to obtain an abstract syntax tree.
[0178] Specifically, the parsing module of the expression type calculation engine is invoked to perform parsing processing on the default values of the expression. The expression string is decomposed into a structured abstract syntax tree according to grammatical rules, clarifying the hierarchical structure and node relationships of the abstract syntax tree. The abstract syntax tree node types include literal nodes (storing single values such as numbers, strings, and booleans), variable reference nodes (recording the unique identifier of the referenced variable), function call nodes (containing the function name and argument list), member access nodes (recording the left operand identifier and member attribute name), and operator nodes (containing arithmetic operators, comparison operators, logical operators, etc.), ensuring that each expression element corresponds to a unique abstract syntax tree node type.
[0179] Furthermore, based on the type inference rules and the type characteristics of each node, the abstract syntax tree is recursively traversed to obtain the initial type results of each node.
[0180] Specifically, the visitor pattern is used to perform a recursive traversal of the abstract syntax tree from the leaf nodes to the root node. Combining the type inference rules with the type characteristics of each node, the initial type result of each node is determined one by one.
[0181] Literal nodes: The initial type is determined according to the preset literal type inference rules. Numeric literals without decimal points and within the range of [-2³¹+1, 2³¹-1] are of type Integer, while those with decimal points or exceeding this range are of type Decimal; string literals are of type String; Boolean literals are of type Boolean.
[0182] Variable reference node: Query the type of the referenced variable in the currently obtained inference results (such as default value inference results, node assignment inference results). If it has been determined, it will be directly used as the initial type of the node. If it has not been determined, it will be marked as undetermined.
[0183] Function call node: First, recursively infer the node type corresponding to all actual parameters, then combine the predefined return value type template of the function to match the actual parameter type with the template parameter type to determine the initial type of the function call node.
[0184] Member access node: First, infer the type of the left operand, then find the type corresponding to the member attribute based on the preset attribute configuration of that type, and use it as the initial type of the node.
[0185] Operator nodes: The initial type is not inferred at this time. Only the identifiers of all operand nodes associated with it are recorded to prepare for subsequent compatibility processing.
[0186] After traversal, a set of correspondences between node identifier, initial type, and node type is formed, which is the initial type result of each node.
[0187] Furthermore, based on type inference rules, the operand types corresponding to operators in the abstract syntax tree are processed for compatibility to obtain the result type corresponding to the operator.
[0188] Specifically, based on the type upgrade rules in the type inference rules, operand type compatibility processing is performed on all operator nodes in the abstract syntax tree to clarify the result type corresponding to the operator.
[0189] Arithmetic operators: If any operand contains a Decimal type, the result type is Decimal; if all operands are Integer type, the result type is Integer; if any operand contains a String type, the result type is String (string concatenation logic is performed).
[0190] Comparison operators: Regardless of the operand type, the result type is always Boolean.
[0191] Logical operators: The result type is always Boolean.
[0192] String operator: When any operand is of type String, the result type is String.
[0193] During processing, if the operand type is undetermined, the result type of the operator node is marked as pending recursive deduction; if the operand types are incompatible (such as performing arithmetic operations between String and Integer types), it is marked as a type conflict.
[0194] Furthermore, the initial type results of each node and the result types corresponding to the operators are integrated to obtain the expression type result.
[0195] Specifically, starting from the root node of the abstract syntax tree, the initial type results of all nodes are combined with the result types corresponding to the operators, and a top-down integration process is performed.
[0196] If the root node is a literal node, variable reference node, function call node, or member access node, the initial type result of that node is directly used as the core basis for the expression type.
[0197] If the root node is an operator node, the result type corresponding to that operator is directly used as the core basis for the expression type.
[0198] During the integration process, the type status of all lower-level nodes is verified: if there is a type conflict flag, the final expression type result is marked as type conflict; if there is a flag indicating pending recursive inference, the final expression type result is marked as pending recursive inference; if all node types are determined and there are no conflicts, the type corresponding to the core basis is used as the final expression type result.
[0199] The final result is an integrated result of expression identifier, expression type result, and state marker, where the state marker includes type determination of type conflicts to be recursively inferred.
[0200] This application embodiment decomposes expressions into a traceable node structure through abstract syntax tree parsing and visitor pattern recursive traversal, deriving the type of each node one by one, supporting complex expression forms such as literals, variable references, function calls, member access, and operator combinations. Based on preset type upgrade rules, it handles the type matching of operators and operands, avoiding inference errors caused by type incompatibility, while clearly defining the fixed return types of comparison operators and logical operators, improving the consistency of expression type inference. By recording the initial type of each node and the operator processing results, a complete expression type inference chain is formed, facilitating subsequent source tracing and analysis of type conflicts or uncertain causes, improving problem localization efficiency. The expression type calculation engine, as an independent module, can be reused in multiple scenarios, ensuring that expressions from different sources (default value expressions, node assignment expressions) all obtain unified and accurate type results, improving the modularity and reusability of the solution.
[0201] In some embodiments, filtering and matching processes are performed on variables and automatic type identifiers in the low-code platform to obtain target variables, including: obtaining multiple variables that conform to preset automatic type identifiers, and obtaining a set of variables to be filtered based on the multiple variables that conform to preset automatic type identifiers.
[0202] Specifically, the low-code platform defaults to a unified automatic type identifier of "Auto," which is the core basis for distinguishing variables that require automatic type inference from other variables. The system initiates a variable scanning program, traversing all created variables in the platform, covering various variable forms such as page variables, logical variables, and local variables; it filters out all variables that are explicitly marked with the "Auto" automatic type identifier in the configuration fields, regardless of whether the variable is currently associated with business logic or has a default value configured, and includes them in the initial collection scope; all variables that conform to the "Auto" identifier are summarized according to the structure of variable unique identifier-module-configuration status to form a set of variables to be filtered, where the configuration status includes associated logic and unassociated logic.
[0203] Furthermore, variables with manually specified fixed data types are removed from the set of variables to be filtered, resulting in the processed set of variables to be filtered.
[0204] Specifically, the filtering process for the set of variables to be filtered involves removing variables that have been manually assigned a fixed data type. Each variable in the set is iterated through, and its type configuration record is checked. If a variable is marked with both the "Auto" flag and a manually assigned fixed data type, it is considered an explicitly typed variable and is removed from the set. Only variables that have not been manually assigned any fixed data type and are only configured with the "Auto" flag are retained, forming the processed set of variables to be filtered. This ensures that subsequent inferences only consider variables that truly require automatic type determination.
[0205] Furthermore, variables in the processed set of variables to be filtered that do not have a clearly defined data type and conform to the preset automatic type identifier are retained.
[0206] Specifically, a second screening process is performed on the processed set of variables to be screened, clarifying the retention criteria. Variables must simultaneously meet two core conditions: unspecified data type and conformity to the preset automatic type identifier. Unspecified data type means that the variable's specific type has not been manually specified through the platform configuration interface, code snippets, or any other means, and the type configuration field only contains the "Auto" identifier. Conformity to the preset automatic type identifier means that the variable's type identifier strictly matches the platform's preset "Auto" identifier, without any variations or custom identifiers. This screening step eliminates variables with both "Auto" identifiers and implicit fixed types due to configuration anomalies, retaining only variables whose types are completely unspecified and explicitly request automatic inference, ensuring the accuracy of the inferred objects.
[0207] Furthermore, the retained variables are validated for validity, and invalid variable identifiers and duplicate variables are removed to obtain the target variable set.
[0208] Specifically, the validity of the retained variables is checked, and invalid and duplicate variables are removed.
[0209] Validate the validity of variable identifiers, removing variables with empty identifiers, those containing illegal characters, or those exceeding platform length limits. Validate variable association status, removing empty variables that are not associated with any valid business logic nodes and have no default value configuration. Validate variable configuration syntax, removing variables with syntax errors in type identifier configurations or abnormal association information formats.
[0210] Based on the unique identifier of the variable, if there are duplicate records with the same identifier among the variables to be verified, only the variable record with the latest creation time or the most complete association logic will be retained, and all other duplicate variables will be removed.
[0211] Variables that pass the legality check and are not duplicated are integrated according to the structure of variable unique identifier - module to which it belongs - associated logical ID - configuration status to form the final target variable set, providing clear and effective processing objects for subsequent multi-stage type inference.
[0212] This application's embodiment employs a four-step process: filtering Auto-identified variables, eliminating manually specified type variables, retaining variables with unclear types, and validating the validity of the results. This ensures that the target variables only contain those truly needed for automatic inference, preventing invalid variables from consuming inference resources and improving inference efficiency. The filtering criteria explicitly state that only Auto-identified variables are configured and no fixed types are manually specified, eliminating abnormal variables where Auto-identified variables coexist with implicit fixed types, ensuring the purity of the inference object and improving the accuracy of subsequent inference results. Validation eliminates empty variables with invalid identifiers, abnormal configurations, or no association with business logic. A deduplication mechanism retains unique valid variable records, providing standardized and consistent processing objects for subsequent multi-stage inference and reducing the triggering of anomalies during the inference process. A unified filtering logic covers various variable types, ensuring the global applicability of the automatic type inference function and improving the versatility of the solution.
[0213] While this application provides method operation steps as shown in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-inventive labor. The order of steps listed in this embodiment is merely one possible execution order among many and does not represent the only execution order. In actual device or client product execution, the method can be executed sequentially according to this embodiment or the accompanying drawings, or in parallel (e.g., in a parallel processor or multi-threaded processing environment).
[0214] like Figure 3 As shown in the illustration, this application also provides an automatic inference device 300 for variable types on a low-code platform. The device includes:
[0215] Matching module 301 is used to filter and match variables and automatic type identifiers in the low-code platform to obtain the target variable.
[0216] The matching module 301 is also used to perform matching processing on the target variable based on the type inference rules to obtain the default value inference result.
[0217] The processing module 302 is used to traverse and integrate the structured model and declaration information corresponding to the business logic in the low-code platform to obtain the node assignment inference result.
[0218] The processing module 302 is also used to perform recursive derivation processing on the target variable based on a multi-round iterative strategy to obtain the dependency inference result.
[0219] The processing module 302 is also used to integrate the default value inference results, node assignment inference results and dependency inference results to obtain the initial type of the target variable.
[0220] The notification module 303 is used to store the initial type based on the inferred source information and process the change notification to obtain the target type of the target variable.
[0221] In some embodiments, the processing module 302 is further configured to perform association traversal processing on the structured model and declaration information corresponding to the business logic in the low-code platform to obtain initial variable writing association information, which includes variable identifiers and node feature information corresponding to each business logic node.
[0222] The matching module 301 is also used to match the variable identifiers written into the association information of the initial variables with the node feature information of the corresponding business logic nodes based on the type inference rules, so as to obtain the variable inference type corresponding to each business logic node.
[0223] The processing module 302 is also used to perform deduplication and verification processing on the variable identifiers and variable inference types corresponding to each business logic node, so as to obtain the node assignment inference results.
[0224] In some embodiments, the processing module 302 is further configured to perform association processing on the target variable based on type inference rules to obtain literal default values and expression default values.
[0225] The matching module 301 is also used to perform matching processing on the default value of the literal based on the literal type inference rules to obtain the literal type result.
[0226] The processing module 302 is also used to combine the default value of the expression and the expression type calculation logic to obtain the expression type result.
[0227] The processing module 302 is also used to integrate the literal type result and the expression type result to obtain the default value inference result.
[0228] In some embodiments, the processing module 302 is further configured to classify the target variable based on the default value inference result and the node assignment inference result to obtain a set of variables with determined types and a set of variables with undetermined types.
[0229] Processing module 302 is also used for iterative processing of the set of variables of undetermined type, wherein:
[0230] Dependency analysis is performed on variables in a set of variables with undetermined types to obtain the chained dependencies between the variables.
[0231] Based on type inference rules and chain dependencies, variables in the set of undetermined type variables are inferred. If a variable in the set of undetermined type variables depends on a variable in the set of determined type variables, the variable in the set of undetermined type variables is added to the set of determined type variables, and the set of undetermined type variables is updated synchronously.
[0232] When the number of variables in the current set of undetermined type variables is the same as the number of variables in the set of determined type variables in the previous round, the iteration stops, and the target set of determined type variables and the target set of undetermined type variables are obtained.
[0233] The processing module 302 is also used to perform dependency link marking on the variables in the target undetermined type variable set based on the target known type variable set, and obtain the dependency inference result.
[0234] In some embodiments, the processing module 302 is further configured to parse the default values of the expression to obtain an abstract syntax tree.
[0235] The processing module 302 is also used to recursively traverse the abstract syntax tree based on the type inference rules and the type characteristics of each node to obtain the initial type result of each node.
[0236] The processing module 302 is also used to perform compatibility processing on the operand types corresponding to operators in the abstract syntax tree based on type inference rules, so as to obtain the result type corresponding to the operator.
[0237] The processing module 302 is also used to integrate the initial type results of each node and the result types corresponding to the operators to obtain the expression type result.
[0238] In some embodiments, the processing module 302 is further configured to obtain a plurality of variables that conform to a preset automatic type identifier, and obtain a set of variables to be filtered based on the plurality of variables that conform to the preset automatic type identifier.
[0239] The processing module 302 is also used to delete variables with manually specified fixed data types from the set of variables to be filtered, so as to obtain the processed set of variables to be filtered.
[0240] The processing module 302 is also used to retain variables in the processed set of variables to be filtered that do not have a clearly defined data type and conform to the preset automatic type identifier.
[0241] The processing module 302 is also used to perform legality checks on the retained variables, remove invalid variable identifiers and duplicate variables, and obtain the target variable set.
[0242] Some modules in the apparatus described in this application can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0243] The apparatus or module described in the above embodiments can be implemented by a computer chip or physical entity, or by a product with a certain function. For ease of description, the above apparatus is described by dividing it into various modules according to their functions. When implementing the embodiments of this application, the functions of each module can be implemented in one or more software and / or hardware. Of course, a module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.
[0244] The methods, apparatus, or modules described in this application can be implemented in a computer-readable program code manner. The controller can be implemented in any suitable manner, such as a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of a memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code manner, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included within it for implementing various functions can also be considered as structures within the hardware component. Alternatively, the device used to implement various functions can be viewed as either a software module that implements the method or a structure within a hardware component.
[0245] This application also provides an apparatus, the apparatus comprising: a processor; a memory for storing processor-executable instructions; wherein, when the processor executes the executable instructions, it implements the method described in this application.
[0246] This application also provides a non-volatile computer-readable storage medium storing a computer program or instructions thereon, which, when executed, enables the method described in this application embodiment to be implemented.
[0247] Furthermore, in the various embodiments of the present invention, each functional module can be integrated into a processing module, or each module can exist independently, or two or more modules can be integrated into a single module.
[0248] The aforementioned storage media include, but are not limited to, Random Access Memory (RAM), Read-Only Memory (ROM), Cache, Hard Disk Drive (HDD), or Memory Card. The memory can be used to store computer program instructions.
[0249] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary hardware. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, or it can be embodied in the process of data migration. The computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, mobile terminal, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0250] The various embodiments described in this specification are presented in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. All or part of this application can be used in numerous general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, mobile communication terminals, multiprocessor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices, etc.
[0251] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of this application.< / user> < / map> < / user>
Claims
1. An automatic variable type inference method for low-code platforms, characterized in that, include: The variables and automatic type identifiers in the low-code platform are filtered and matched to obtain the target variable; The target variable is matched based on the type inference rules to obtain the default value inference result; The structured model and declaration information corresponding to the business logic in the low-code platform are traversed and integrated to obtain the node assignment inference results; Based on a multi-round iterative strategy, the target variables are recursively derived to obtain the dependency inference results. The default value inference result, the node assignment inference result, and the dependency inference result are integrated to obtain the initial type of the target variable; Based on the inferred source information, the initial type is stored and change notification is processed to obtain the target type of the target variable; The process of traversing and integrating the structured model and declaration information corresponding to the business logic in the low-code platform to obtain the node assignment inference result includes: The structured model and declaration information corresponding to the business logic in the low-code platform are subjected to association traversal processing to obtain the initial variable writing association information, which includes the variable identifier and node feature information corresponding to each business logic node. Based on the type inference rules, the variable identifiers written into the association information of the initial variables are matched with the node feature information of the corresponding business logic nodes to obtain the variable inference type corresponding to each business logic node. The variable identifiers and variable inference types corresponding to each business logic node are deduplicated and validated to obtain the node assignment inference results. The matching process based on the type inference rule for the target variable to obtain the default value inference result includes: The target variable is associated with the type inference rule to obtain the literal default value and the expression default value. The literal type inference rules are used to match the default value of the literal to obtain the literal type result; The expression's default value and expression type calculation logic are combined to obtain the expression type result; The literal type result and the expression type result are integrated to obtain the default value inference result; The multi-round iterative strategy is used to recursively derive the target variables to obtain dependency inference results, including: Based on the inference results of the default values and the inference results of the node assignments, the target variables are classified to obtain a set of variables with determined types and a set of variables with undetermined types. Iterative processing of the set of variables of undetermined type includes: Dependency analysis is performed on the variables in the set of undetermined type variables to obtain the chain dependencies between the variables; Based on the type inference rule and the chain dependency relationship, the variables in the set of undetermined type variables are inferred. If there is a variable in the set of undetermined type variables that depends on a variable in the set of determined type variables, the variable in the set of undetermined type variables is added to the set of determined type variables, and the set of undetermined type variables is updated synchronously. When the number of variables in the current set of undetermined type variables is the same as the number of variables in the set of determined type variables in the previous round, the iteration stops, and the target set of determined type variables and the target set of undetermined type variables are obtained. Based on the set of variables with known target types, dependency links are marked on the variables in the set of variables with unknown target types to obtain dependency inference results.
2. The method according to claim 1, characterized in that, The process of combining the default value of the expression and the expression type calculation logic to obtain the expression type result includes: The default values of the expression are parsed to obtain an abstract syntax tree; Based on the type inference rules and the type characteristics of each node, the abstract syntax tree is recursively traversed to obtain the initial type result of each node; Based on the type inference rules, the operand types corresponding to the operators in the abstract syntax tree are processed for compatibility, and the result types corresponding to the operators are obtained. The initial type results of each node and the result types corresponding to the operators are integrated to obtain the expression type result.
3. The method according to claim 1, characterized in that, The process of filtering and matching variables and automatic type identifiers in the low-code platform to obtain target variables includes: Obtain multiple variables that conform to a preset automatic type identifier, and obtain a set of variables to be filtered based on the multiple variables that conform to the preset automatic type identifier; Delete the variables with manually specified fixed data types from the set of variables to be filtered, and obtain the processed set of variables to be filtered; Variables in the processed set of variables to be filtered that do not have a clearly defined data type and conform to the preset automatic type identifier are retained; The retained variables are validated for validity, and invalid variable markers and duplicate variables are removed to obtain the target variable set.
4. The method according to claim 1, characterized in that, The maximum number of iterations for the iterative process is 20.
5. An automatic inference device for variable types on a low-code platform, characterized in that, include: The matching module is used to filter and match variables and automatic type identifiers in the low-code platform to obtain the target variable; The matching module is also used to perform matching processing on the target variable based on type inference rules to obtain the default value inference result; The processing module is used to traverse and integrate the structured model and declaration information corresponding to the business logic in the low-code platform to obtain the node assignment inference results. The processing module is also used to perform recursive derivation processing on the target variable based on a multi-round iterative strategy to obtain the dependency inference result; The processing module is further used to integrate the default value inference result, the node assignment inference result, and the dependency inference result to obtain the initial type of the target variable; The notification module is used to store the initial type based on the inferred source information and process change notifications to obtain the target type of the target variable; The processing module is also used to traverse and integrate the structured model and declaration information corresponding to the business logic in the low-code platform to obtain the node assignment inference result, wherein: The structured model and declaration information corresponding to the business logic in the low-code platform are subjected to association traversal processing to obtain the initial variable writing association information, which includes the variable identifier and node feature information corresponding to each business logic node. Based on the type inference rules, the variable identifiers written into the association information of the initial variables are matched with the node feature information of the corresponding business logic nodes to obtain the variable inference type corresponding to each business logic node. The variable identifiers and variable inference types corresponding to each business logic node are deduplicated and validated to obtain the node assignment inference results. The matching module is further configured to perform matching processing on the target variable based on type inference rules to obtain a default value inference result, wherein: The target variable is associated with the type inference rule to obtain the literal default value and the expression default value. The literal type inference rules are used to match the default value of the literal to obtain the literal type result; The expression's default value and expression type calculation logic are combined to obtain the expression type result; The literal type result and the expression type result are integrated to obtain the default value inference result; The processing module is further configured to perform recursive derivation processing on the target variable and the target variable based on a multi-round iterative strategy to obtain the dependency inference result, wherein: Based on the inference results of the default values and the inference results of the node assignments, the target variables are classified to obtain a set of variables with determined types and a set of variables with undetermined types. Iterative processing of the set of variables of undetermined type includes: Dependency analysis is performed on the variables in the set of undetermined type variables to obtain the chain dependencies between the variables; Based on the type inference rule and the chain dependency relationship, the variables in the set of undetermined type variables are inferred. If there is a variable in the set of undetermined type variables that depends on a variable in the set of determined type variables, the variable in the set of undetermined type variables is added to the set of determined type variables, and the set of undetermined type variables is updated synchronously. When the number of variables in the current set of undetermined type variables is the same as the number of variables in the set of determined type variables in the previous round, the iteration stops, and the target set of determined type variables and the target set of undetermined type variables are obtained. Based on the set of variables with known target types, dependency links are marked on the variables in the set of variables with unknown target types to obtain dependency inference results.
6. A computer device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 4.