Method and apparatus for executing actions in application, and device and medium
By using a tree structure to manage constraints in the application, the conflict problem caused by inflexible constraint definitions is solved, achieving more efficient and flexible constraint management, supporting more complex logic and lower storage overhead.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2024-12-07
- Publication Date
- 2026-06-11
AI Technical Summary
In existing technologies, the definition of constraints in application development lacks flexibility, which leads to conflicts between constraints and poor scalability and maintainability.
A tree structure is used to manage constraints. Multiple constraints are represented by a tree structure, and the inherent logical relationship of the tree structure is used to improve the efficiency of constraint management. A set of instructions is generated to execute actions.
By managing constraints through a tree structure, storage overhead is reduced, conflicts between constraints are avoided, and the efficiency and flexibility of constraint management are improved, supporting more complex logic and constraint settings that are more in line with human thinking.
Smart Images

Figure CN2024137661_11062026_PF_FP_ABST
Abstract
Description
Methods, apparatus, devices, and media for performing actions in an application. Technical Field
[0001] The implementation of this disclosure generally relates to action management, and in particular to methods, apparatus, devices, and computer-readable storage media for performing actions in an application. Background Technology
[0002] Applications can involve multiple data objects, and different actions can be performed based on whether the attributes of these data objects meet predetermined constraints to achieve the desired functionality. During application execution, multiple constraints may be involved. For example, it's possible to define actions to be performed on data objects when a certain constraint is met. However, in current application development, constraint definitions lack flexibility, and conflicts may exist between multiple constraints. This leads to unsatisfactory scalability and maintainability in application development. Therefore, a more efficient way to manage actions is desired. Summary of the Invention
[0003] In a first aspect of this disclosure, a method for performing actions in an application is provided. In this method, a set of constraints associated with a set of data objects in the application is obtained, the constraints representing a set of conditions for performing actions on the data objects in the set of data objects. Based on the set of constraints, a tree structure is generated, the tree structure including a set of paths, the paths representing constraints in the set of constraints. Based on the tree structure, a set of instructions for performing a set of actions on each set of data objects in the application is determined.
[0004] In a second aspect of this disclosure, an apparatus for performing actions in an application is provided. The apparatus includes: an acquisition module configured to acquire a set of constraints associated with a set of data objects in the application, wherein the constraints represent a set of conditions for performing actions on the data objects in the set of data objects; a generation module configured to generate a tree structure based on the set of constraints, the tree structure including a set of paths, wherein the paths represent constraints in the set of constraints; and a determination module configured to determine, based on the tree structure, a set of instructions for performing a set of actions on each set of data objects in the application.
[0005] In a third aspect of this disclosure, an electronic device is provided. The electronic device includes: at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method according to a first aspect of this disclosure when executed by the at least one processing unit.
[0006] In a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, causes the processor to implement the method according to a first aspect of this disclosure.
[0007] In a fifth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method according to a first aspect of this disclosure.
[0008] It should be understood that the content described in this content section is not intended to limit the key or essential features of the implementation of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0009] In the following detailed description, the above and other features, advantages, and aspects of the various implementations of this disclosure will become more apparent, taken in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0010] Figure 1 shows a block diagram of an application environment according to one implementation of the present disclosure;
[0011] Figure 2 shows a block diagram of some implementations of this disclosure for performing actions in an application;
[0012] Figure 3 shows a block diagram of a management page for determining a tree structure according to some implementations of this disclosure;
[0013] Figure 4 shows a block diagram of a tree structure according to some implementations of this disclosure;
[0014] Figure 5 shows a block diagram illustrating the execution of actions in an application according to some implementations of this disclosure;
[0015] Figure 6 shows a block diagram of the process of traversing a tree structure according to some implementations of this disclosure;
[0016] Figure 7 shows a block diagram illustrating the conversion process between tree structures and configurations according to some implementations of this disclosure;
[0017] Figure 8 shows a flowchart of a method for performing actions in an application according to some implementations of this disclosure;
[0018] Figure 9 shows a block diagram of a device for performing actions in an application according to some implementations of this disclosure; and
[0019] Figure 10 shows a block diagram of a device capable of implementing various implementations of the present disclosure. Detailed Implementation
[0020] Implementations of this disclosure will now be described in more detail with reference to the accompanying drawings. While some implementations of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the implementations set forth herein. Rather, these implementations are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and implementations of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0021] In the description of the implementation methods disclosed herein, the term "comprising" and similar terms should be understood as open inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one implementation" or "the implementation" should be understood as "at least one implementation". The term "some implementations" should be understood as "at least some implementations". Other explicit and implicit definitions may also be included below. As used herein, the term "model" can represent the relationships between various data. For example, the aforementioned relationships can be obtained based on various currently known and / or future-developed technical solutions.
[0022] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0023] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure through appropriate means in accordance with relevant laws and regulations, and user authorization should be obtained.
[0024] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0025] As an optional but non-restrictive implementation, in response to a user's active request, a prompt message can be sent to the user, for example, via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose whether to "agree" or "disagree" to provide personal information to the electronic device.
[0026] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0027] The term "in response to" as used herein refers to a state in which a corresponding event occurs or a condition is satisfied. It will be understood that the timing of subsequent actions performed in response to such event or condition is not necessarily strongly correlated with the time when the event occurs or the condition is met. For example, in some cases, subsequent actions may be performed immediately upon the occurrence of the event or the fulfillment of the condition; while in others, they may be performed some time after the occurrence of the event or the fulfillment of the condition.
[0028] Example Environment
[0029] Applications can involve multiple data objects and can perform different actions based on whether the attributes of these data objects satisfy predetermined constraints to achieve the desired functionality. During application execution, multiple constraints may be involved. For example, it is possible to define the corresponding action to be performed on a data object when a certain constraint is satisfied. Referring to Figure 1, which describes an overview of an application environment according to some implementations of this disclosure, Figure 1 shows a block diagram 100 of an application environment according to an exemplary implementation of this disclosure. A dedicated constraint management tool can be developed. As shown in Figure 1, in the management page 110, the name of the constraint can be set, and the conditions of the constraint can be set. For example, it is possible to specify that when a certain attribute of a data object in the application (e.g., obj1.att1) satisfies a predetermined condition (e.g., greater than a predetermined threshold th1), action ACT1 is executed. It should be understood that a constraint can include one or more conditions. For example, another condition can be further specified: the attribute of a data object in the application satisfies another predetermined condition (e.g., obj2.att2 = th2). In this case, the action is executed when both of the above conditions are satisfied.
[0030] For ease of description, the details of action management will be described below using a media application as an example. During the operation of a media application, different actions need to be performed according to the attributes of various data objects within the application. A media application can provide one or more media items, including but not limited to video, audio, text, images, or combinations thereof. The presented media items can be adjusted based on different parameters during application operation. For example, various constraints can be set using the management tool shown in Figure 1 or directly in the application's code to execute corresponding actions when a certain constraint is met. However, the constraints used in different scenarios are different and numerous, making them difficult to write and maintain.
[0031] For example, administrators often need to manually write a large number of constraints. Constraint management is typically done using a list approach, with each constraint supporting multiple conditions. After selecting a media item, conditions and actions can be chosen. A constraint can support multiple conditions simultaneously (i.e., multiple conditions involve "AND" logic) and can support multiple actions concurrently. Each time a new constraint is added, a new row of data needs to be added. Multiple constraints cannot share previously written conditions; they must be rewritten.
[0032] Furthermore, list mode fails to capture the logical relationships between constraints. For example, an administrator may not know which constraints B, C, and D are related to constraint A, requiring a significant amount of time to read each constraint individually. Additionally, lists make it difficult to see the full picture of constraints and to complete missing constraints. Moreover, setting constraints requires checking their correctness, leading to substantial manpower and time costs. Human error is also possible, and it's difficult to detect conflicts between multiple constraints.
[0033] Summary of the actions performed
[0034] To at least partially address the shortcomings of the prior art, a method for performing actions in an application is proposed according to one implementation of this disclosure. In summary, various constraints involved in the application are managed based on a policy tree. Specifically, referring to Figure 2, which illustrates a summary of one implementation according to this disclosure, a block diagram 200 for performing actions in an application according to some implementations of this disclosure is provided. As shown in Figure 2, a set of constraints associated with a set of data objects in the application can be obtained. Constraints within this set of constraints (e.g., constraint 210) can represent a set of conditions 214 for performing action 216 on data object 212 within the set of data objects. Further, a tree structure 220 can be generated based on this set of constraints. Here, the tree structure 220 includes a set of paths, which can represent a set of nodes from the root node to a leaf node of the tree structure. Paths within a set of paths can represent constraints within a set of constraints.
[0035] Specifically, a path can be represented as "node 1-node 2-node 3", where each node represents constraint 210. For example, node 1 can represent the root node, node 2 can represent condition 214, node 3 can represent action 216, and so on. Furthermore, based on the tree structure 220, a set of instructions can be determined for a set of actions to be performed on a set of data objects in the application. Specifically, a set of instructions can include multiple instructions, and one instruction can correspond to a constraint. For example, instruction 230 can correspond to constraint 210, in which case the instruction can be invoked to control the specified action 216 in the application. Here, instructions can be implemented in various ways; for example, an instruction can include one or more lines of code, code segments, or files. Using some implementations of this disclosure, a large number of constraints can be managed based on a tree structure, thereby improving the efficiency of constraint management by utilizing the inherent logical relationships of the tree structure (e.g., parent-child relationships between nodes).
[0036] Detailed process of performing the action
[0037] Having described an overview of some implementations of this disclosure, further details regarding methods for performing actions in an application will be described below. According to some implementations of this disclosure, management tools for determining tree structures can be provided. Further details are described in Figure 3, which shows a block diagram 300 of a management page for determining a tree structure according to some implementations of this disclosure. As shown in Figure 3, the tree structure may include a root node 310, downstream of which condition nodes 320 (one or more), action nodes 330, and information nodes 340 may be added. Condition nodes 320 may indicate the conditions for performing actions; one or more conditions may exist, and one condition node may correspond to one condition. Action nodes 330 may indicate the action to be performed, such as presenting a data item, deleting a data item, etc. One or more actions may be performed when conditions are met, thus one or more action nodes may exist. Information nodes 340 may indicate metadata associated with constraints, such as the constraint's name, identifier, setter, etc.
[0038] According to some implementations of this disclosure, the management page may include one or more controls. For example, controls 360-1, 360-2, 360-3, 360-4, and 360-5 (collectively referred to as controls 360) can be used to add nodes to the tree structure. Specifically, control 360-5 is used to add a path downstream of the root node 310, for example, the path may include condition node 320. Control 360-2 is used to add another condition node downstream of the root node 310, parallel to condition node 320 (this other condition node is displayed below condition node 320). Control 360-4 is used to add another condition node downstream of the root node 310, parallel to condition node 320 (this other condition node is displayed above condition node 320). Control 360-3 is used to add another condition node downstream of condition node 320 (this other condition node is displayed downstream of condition node 320). Alternatively and / or additionally, control 360-1 is used to add a condition node between the root node 310 and condition node 320.
[0039] Control 350 is used to set condition nodes. For example, the first control (edit control) can edit a condition node, the second control (copy control) can copy a condition node, and the third control (delete control) can delete a condition node. According to some implementations of this disclosure, the hierarchy of each node gradually decreases from left to right. In other words, condition node 320 is a child node of root node 310, action node 330 is a child node of condition node 320, and information node 340 is a child node of action node 330. It should be understood that the controls in Figure 3 are merely illustrative, and more, fewer, or different controls can be provided to edit the tree structure.
[0040] According to some implementations of this disclosure, a tree structure can be generated using the management page shown in Figure 3. Specifically, in the process of generating a tree structure based on a set of constraints: in response to receiving a request to add a path to the tree structure, a set of condition nodes is added to the root node of the tree structure, where each set of condition nodes corresponds to a set of conditions. For example, in response to receiving a request for control 360-5, a path can be added downstream of the root node, and a set of condition nodes can be added to that path. Here, a set of condition nodes may include one or more condition nodes. If multiple condition nodes need to be added, each condition node can be added one by one. Using some implementations of this disclosure, users can be graphically supported in adding multiple paths to the tree structure, with each path corresponding to one constraint. Each constraint can be processed in a similar manner to add multiple paths to the tree structure, each corresponding to multiple constraints.
[0041] According to some implementations of this disclosure, in the process of adding a set of condition nodes to the root node of a tree structure, a first condition node can be added to the root node based on the first condition in the set of conditions. Specifically, the user can click the edit control in control 350 to add a first condition node to the root node based on the first condition in the set of conditions. For example, a specific condition can be set, assuming the first condition is: obj1.att1>th1, then the specific content of condition node 320 can be set to "obj1.att1>th1".
[0042] According to some implementations of this disclosure, in response to receiving a request to add a downstream condition node to a first condition node, a second condition node can be added to the first condition node based on a second condition in a set of conditions. Specifically, the user can press control 360-3 to add another condition node. Assuming the second condition is: obj2.att2>th2, the specific content of the other condition node can be set to "obj2.att2>th2". When more conditions exist, the user can press the condition addition control (e.g., as shown by "+") located to the right of the downstream condition node to add a new condition node. Alternatively and / or additionally, for example, the user can right-click the downstream condition node and select "Add Condition Node" from the pop-up menu. Using some implementations of this disclosure, multiple condition nodes in the tree structure can correspond to multiple conditions in the constraints, thus clearly showing the logical relationship between multiple conditions.
[0043] According to some implementations of this disclosure, after all conditions in the constraints have been added to the path, an action node can be added downstream of the last condition node. Specifically, in response to receiving a request to add a downstream action node to a set of condition nodes, an action node is added to the set of condition nodes based on the action. For example, a user can right-click the last condition node and select "Add Action Node" from the pop-up menu. In this way, users can add action nodes to the path to indicate the action to be performed when the conditions in all upstream condition nodes of that action node are met.
[0044] It should be understood that one or more action nodes can exist. With multiple action nodes, multiple actions can be executed if all conditions in the constraints are met. Compared to storing constraints using a constraint list, this approach eliminates the need to store two constraints separately; instead, a tree structure can be used to store both constraints within a single path. This method allows for the appropriate merging of multiple constraints with the same conditions, thereby reducing storage overhead.
[0045] Alternatively and / or additionally, information nodes can be added downstream of the action node. Specifically, in response to a request to add a downstream information node to the action node, an information node is added to the action node; the information node is a leaf node in a tree structure. For example, a user can right-click on the action node and select "Add Information Node" from the pop-up menu. The specific content of the information node can be set based on the constraint's metadata, such as the constraint's name, identifier, setter, etc.
[0046] It should be understood that, although the above illustration shows an example of adding paths and nodes within paths based on a user's manual request, alternatively and / or additionally, the database used to store constraints can be traversed automatically, thereby automatically adding multiple paths corresponding to multiple constraints to the tree structure. For example, the database may include fields such as conditions, actions, and metadata. Each row of data in the database can be read one by one, and a path can be generated based on each row. Specifically, one or more conditions in a data row can be used to add one or more condition nodes to the path; actions in a data row can be used to add action nodes to the path; and metadata in a data row can be used to add information nodes to the path.
[0047] According to some implementations of this disclosure, multiple child nodes in a tree structure can share the path from the parent node to the root node, as described in more detail in Figure 4. Figure 4 shows a block diagram 400 of a tree structure according to some implementations of this disclosure. As shown in Figure 4, the tree structure has multiple paths. Path 1 may include: <condition node 420, condition node 422, condition node 424, condition node 430, action node 434, information node 440>, and path 2 may include: <condition node 420, condition node 422, condition node 424, condition node 432, action node 436, action node 442, information node 444>. In this case, path 1 and path 2 can share three nodes: condition node 420, condition node 422, and condition node 424. In this way, the inherent hierarchical relationship of the tree structure can be used to represent the shared parts between multiple paths, thereby showing the association between multiple constraints in a more explicit way and reducing the storage resource overhead of storing condition nodes.
[0048] According to some implementations of this disclosure, each constraint can be processed one by one using the methods described above, thereby generating the corresponding tree structure. A specific storage format for the tree structure can be defined, and multiple constraints can be stored according to the defined format. For example, the tree structure can be stored using the data structure in Table 1 below. It should be understood that Table 1 merely illustrates an example of a tree structure; alternatively and / or additionally, the tree structure can be stored based on other data structures. For example, the keyword "NodeType1" can be used to represent the root node, the keyword "NodeType2" can be used to represent the condition node, the keyword "NodeType3" can be used to represent the action node, and the keyword "NodeType4" can be used to represent the information node, and so on.
[0049] Table 1 Examples of tree structures
[0050] According to some implementation methods disclosed herein, front-end developers can pass the tree structure to the server in JSON format via an API interface. The server can store the condition nodes, action nodes, and information nodes in the tree structure and convert them into configurations to generate corresponding instructions. Specifically, in determining a set of instructions based on the tree structure, a set of configurations for executing a set of actions in the application can be generated based on a set of paths, with each set of configurations corresponding to a set of paths; and a set of configurations can be invoked in the application to determine a set of instructions.
[0051] See Figure 5 for further details. Figure 5 shows a block diagram 500 illustrating the execution of actions in an application according to some implementations of this disclosure. As shown in Figure 5, at the front end, condition nodes 520, action nodes 521, and information nodes 522 in a tree structure can be generated based on constraint data 510. Furthermore, during the generation of a set of configurations, actions to be performed on data objects can be determined based on action nodes in the path; and a set of conditions for performing actions can be determined based on a set of condition nodes in the path.
[0052] Specifically, conditions can be extracted from condition node 520 and converted into conditional statements 530 matching the application's programming language; actions can be extracted from action node 521 and converted into action statements 531 matching the application's programming language; metadata can be extracted from information node 520 and converted into information statements 530 matching the application's programming language. Configuration 533 can be generated using conditional statements 530, action statements 531, and information statements 532, and then, at box 534, the attributes of various data objects during application execution can be used to determine whether constraints are satisfied. If constraints are satisfied, instruction 541 can be invoked at box 535 to execute the corresponding action. If constraints are not satisfied, the next configuration in a set of configurations can be loaded at box 540. Using some implementation methods of this disclosure, each path in the tree structure can be traversed sequentially, and then, if it is determined that the constraints are satisfied, the corresponding action can be executed.
[0053] Based on some implementations of this disclosure, various methods can be used to traverse the paths in the tree structure. For example, a stack can be used to implement depth-first search. First, the root node can be pushed onto the stack. Specifically, a preorder traversal can be used, where the nodes enter the stack in the order of root node, left child node (and other nodes in the left subtree), and right child node (and other nodes in the right subtree). This process can be executed iteratively until all nodes have been processed. The time complexity of this scheme is O(n) (where n is the total number of nodes), and the space complexity is O(n).
[0054] Specifically, the root node can be defined as the starting node of the current traversal, and a stack can be defined to store node visit records. Further, it can be checked whether the current root node is the target node. If the current root node is the target node, the result is returned directly; if the current root node is not the target node, the root node and its next child node to be visited are pushed onto the stack, and the child node is marked as visited. If the stack is not empty, the node at the top of the stack, along with its next child node to be visited, is popped. These steps are repeated until the stack is empty or the target node is found.
[0055] Figure 6 shows a block diagram 600 of a process for traversing a tree structure according to some implementations of this disclosure. As shown in Figure 6, for ease of description, only a tree structure comprising three levels is shown. Node 1 is the root node and has a left child (i.e., node 2) and a right child (i.e., node 5). Node 2 has a left child (i.e., node 3) and a right child (i.e., node 4). Node 5 has a left child (i.e., node 6). Assuming the target node is node 6, the operation can be performed in the order described above, with the access paths shown in steps 1, 2, 3, 4, and 5 (circled in dashed lines).
[0056] According to some implementations of this disclosure, identifiers can be set for each node in the tree structure. For example, a recursive method can be used to set the identifier for each node, in which case the tree structure can be traversed recursively. The identifier of the root node can be set first, and then the setting function can be recursively called for each child node of that node to set the corresponding identifier. Specifically, the root node can be determined, and then the setting function can be recursively called for each subtree of the root node until the leaf node of the tree structure is reached. It should be understood that the above process of setting identifiers is merely exemplary; alternatively and / or additionally, the identifier for each node can be set one by one based on depth-first and / or breadth-first algorithms. Using some implementations of this disclosure, each node can be uniquely distinguished, thus facilitating subsequent editing operations on each node.
[0057] According to some implementations of this disclosure, a conversion between a tree structure and a set of configurations can be performed, as described in more detail in Figure 7. Figure 7 shows a block diagram 700 of the conversion process between a tree structure and configurations according to some implementations of this disclosure. The tree structure is shown on the left side of Figure 7, and a set of configurations corresponding to the tree structure is shown on the right side. For simplicity, information nodes in the tree structure are not shown. A path in the tree structure can correspond to a configuration. For example, the path <root node 710, condition node 711, action node 712> can correspond to configuration 720, ..., and the path <root node 710, condition node 713, action node 714> can correspond to configuration 722.
[0058] According to some implementations of this disclosure, for a first configuration in a set of configurations, a first set of condition nodes in the target path of the target tree structure is generated based on a first set of conditions associated with the first configuration; action nodes in the path are generated based on actions associated with the first configuration; and information nodes in the target path are generated based on metadata associated with the first configuration. Specifically, for configuration 720, a set of conditions defined in configuration 720 can be used to generate a set of condition nodes respectively. It should be understood that although Figure 7 only shows the case where there is only one condition node 711, alternatively and / or additionally, multiple condition nodes may exist. Furthermore, action nodes 712 can be generated using actions defined in configuration 720; and information nodes can be generated using metadata defined in configuration 720. Using some implementations of this disclosure, the proposed technical solution can be compatible with existing technical solutions. For example, multiple constraints stored in a list can be regarded as a set of configurations, thereby generating a corresponding tree structure.
[0059] According to some implementations of this disclosure, in the process of generating the first set of condition nodes, a second set of conditions associated with a second configuration in a set of configurations can be determined; in response to determining that there is an intersection between the first set of conditions and the second set of conditions, at least one shared condition node is determined based on the intersection; at least one non-shared condition is determined based on the difference between the first set of conditions and the intersection; and the first set of condition nodes is determined based on at least one shared condition node and at least one non-shared condition node.
[0060] According to some implementations of this disclosure, it is necessary to ensure that the following remain consistent before and after the conversion: the number of constraints, the names of constraints, actions, constraint on / off states, and constraint conditions. That is, regardless of whether a tree structure or a set of configurations is used to represent multiple constraints, the above-mentioned aspects of each constraint remain unchanged. When multiple conditions exist, a combination method for the conditions can be set. For example, multiple conditions can be combined hierarchically; see Figure 4 for more details. In the structure shown in Figure 4, multiple condition nodes shown horizontally (e.g., condition nodes 420, 422, 424) represent shared conditions, and multiple condition nodes shown vertically (e.g., condition nodes 430, 432) represent non-shared conditions.
[0061] According to some implementations of the present disclosure, the conditions in the first set of conditions are sorted according to at least any one of the following: the level associated with the condition, the frequency of occurrence of the condition in a set of configurations, and the attributes of the condition. Specifically, multiple shared conditions can be arranged in descending order of the level of the data object. For example, assuming there are the following data objects: account (account), campaign (activity), set (collection) with levels from high to low, multiple condition nodes can be generated sorted by condition nodes 420, 422, 424. According to some implementations of the present disclosure, if the levels of the data objects are the same, they can be sorted according to the frequency of occurrence. In other words, conditions with a higher sharing frequency can be arranged in the front position, and conditions with a lower sharing frequency can be arranged in the rear position.
[0062] Alternatively and / or additionally, conditions related to the inherent attributes (also called dimension indicators) of the data object can be arranged in the front position, and conditions related to additional attributes (also called effect indicators) determined based on the inherent attributes can be arranged in the rear position. Alternatively and / or additionally, the conditions related to the dimension indicators and the conditions related to the effect indicators can be sorted alphabetically respectively. Alternatively and / or additionally, if the number of settings used by the condition is less than 2, a separate branch can be generated. According to some implementations of the present disclosure, an operation combination method can be provided. Specifically, the sorting can be first performed according to the level of the data object. If the levels are the same, the sorting is performed according to the alphabetical order of the data objects.
[0063] In FIG. 4, assume that the first set of conditions includes: condition 1 (account att1>th1), condition 2 (campaign att2=th2), condition 3 (set att3=th3), condition 4 (obj att4<th4); assume that the second set of conditions includes: condition 1, condition 2, condition 3, condition 5 (obj att5=th5). At this time, the intersection of the first set of conditions and the second set of conditions is: condition 1, condition 2, condition 3. Thus, conditions 1-3 are shared conditions and are arranged in the front position. Based on conditions 1-3, condition nodes 420, 422, and 424 can be generated respectively. Further, conditions 4 and condition 5 are non-shared conditions. Based on conditions 4 and condition 5, condition nodes 430 and 432 can be generated respectively. Subsequently, a path 1 corresponding to the first set of conditions can be generated: <condition node 420, condition node 422, condition node 424, condition node 430, action node 434, information node 440>. A path 2 corresponding to the second set of conditions can be generated: Path 2 can include: <condition node 420, condition node 422, condition node 424, condition node 432, action node 436, action node 442, information node 444>.
[0064] According to some implementations of this disclosure, in response to determining that there is no intersection between the first set of conditions and the second set of conditions, the first set of condition nodes is determined based on the first set of conditions. Assuming the first set of conditions includes condition 6 (account att6 = th6), since there is no intersection between the first set of conditions and the second set of conditions, the first set of condition nodes can be directly determined based on the first set of conditions. In this case, condition node 450 can be generated, and correspondingly, the path <condition node 450, action node 452, information node 454> can be generated.
[0065] Based on some implementations of this disclosure, constraint management tools can be provided to implement the methods described above. Specifically, a "conversion" control can be provided to convert multiple constraints represented in a list to a tree structure. The completeness of information for each constraint on the current page can be verified, and a switching operation can be performed if the information is complete. Otherwise, prompts can be provided to remind the user to fill in incomplete information. For example, the unfilled sections can be highlighted.
[0066] According to some implementations of this disclosure, tree structure editing functionality can be provided. For example, an edit box can be provided to set the constraint type, on / off switch (indicating whether the constraint is valid by default), name, etc. Furthermore, the edited data can be stored. For example, after editing, clicking a blank area can automatically trigger a save operation, and prompts can be provided for unfilled portions, etc. According to some implementations of this disclosure, nodes can be added to the tree structure by clicking the "+" control on the page, nodes can be edited by clicking the edit control on the page, nodes can be deleted by clicking the delete control on the page, nodes can be copied by clicking the copy control on the page, etc.
[0067] Based on some implementations of this disclosure, a tree-structured approach based on decision trees is proposed, which can support the management of multiple constraints in an application in a way that is more in line with human thinking. This reduces the workload for users setting various constraints. The tree structure can effectively avoid conflicts between multiple constraints and prevent multiple paths from including the same conditions. In this way, the tree structure can more flexibly support the configuration of multiple constraints and implement more complex logic. Multiple paths can share the same one or more condition nodes, thus avoiding the problem of repeatedly creating condition nodes.
[0068] Example process
[0069] Figure 8 illustrates a flowchart of a method 800 for performing actions in an application according to some implementations of this disclosure. At block 810, a set of constraints associated with a set of data objects in the application is obtained, where each constraint represents a set of conditions for performing actions on the data objects in the set. At block 820, a tree structure is generated based on the set of constraints, the tree structure including a set of paths, where each path represents a constraint in the set of constraints. At block 830, based on the tree structure, a set of instructions is determined for performing a set of actions, respectively, on a set of data objects in the application.
[0070] According to some implementations of this disclosure, generating a tree structure based on a set of constraints includes: in response to receiving a request to add a path to the tree structure, adding a set of condition nodes to the root node of the tree structure, wherein the set of condition nodes corresponds to a set of conditions.
[0071] According to some implementations of this disclosure, adding a set of condition nodes to the root node of a tree structure includes: adding a first condition node to the root node based on the first condition in the set of conditions.
[0072] According to some implementations of this disclosure, the method further includes: in response to receiving a request to add a downstream condition node to a first condition node, adding a second condition node to the first condition node based on a second condition in a set of conditions.
[0073] According to some implementations of this disclosure, the method further includes: in response to receiving a request to add a downstream action node to a set of condition nodes, adding an action node to the set of condition nodes based on the action; and in response to receiving a request to add a downstream information node to the action node, adding an information node to the action node, wherein the information node is a leaf node of a tree structure.
[0074] According to some implementations of this disclosure, determining a set of instructions based on a tree structure includes: generating a set of configurations for a set of actions to be performed in the application based on a set of paths, wherein each set of configurations corresponds to a set of paths; and calling a set of configurations in the application to determine a set of instructions.
[0075] According to some implementations of this disclosure, generating a set of configurations includes: determining the action to be performed on the data object based on the action nodes in the path; and determining a set of conditions to perform the action based on a set of condition nodes in the path.
[0076] According to some implementations of this disclosure, the method further includes: for a first configuration in a set of configurations, generating a first set of condition nodes in a target path in a target tree structure based on a first set of conditions associated with the first configuration; generating action nodes in the path based on actions associated with the first configuration; and generating information nodes in the target path based on metadata associated with the first configuration.
[0077] According to some implementations of this disclosure, generating a first set of condition nodes includes: determining a second set of conditions associated with a second configuration in a set of configurations; in response to determining that there is an intersection between the first set of conditions and the second set of conditions, determining at least one shared condition node based on the intersection; determining at least one non-shared condition based on the difference between the first set of conditions and the intersection; and determining the first set of condition nodes based on at least one shared condition node and at least one non-shared condition node.
[0078] According to some implementations of this disclosure, the conditions in the first set of conditions are ordered according to at least one of the following: the level associated with the condition, the frequency of the condition in a set of configurations, and the attributes of the condition.
[0079] According to some implementations of this disclosure, the method further includes: in response to determining that there is no intersection between the first set of conditions and the second set of conditions, determining the first set of condition nodes based on the first set of conditions.
[0080] Example devices and equipment
[0081] Figure 9 shows a block diagram of an apparatus 900 for performing actions in an application according to some implementations of the present disclosure. The apparatus 900 includes: an acquisition module 910 configured to acquire a set of constraints associated with a set of data objects in the application, wherein the constraints represent a set of conditions for performing actions on the data objects in the set of data objects; a generation module 920 configured to generate a tree structure based on the set of constraints, the tree structure including a set of paths, where each path represents a constraint in the set of constraints; and a determination module 930 configured to determine, based on the tree structure, a set of instructions for performing a set of actions on each set of data objects in the application.
[0082] According to some implementations of this disclosure, the generation module is further configured to: in response to receiving a request to add a path to the tree structure, add a set of condition nodes to the root node of the tree structure, wherein the set of condition nodes corresponds to a set of conditions.
[0083] According to some implementations of this disclosure, the generation module is further configured to: add a first condition node to the root node based on a first condition in a set of conditions.
[0084] According to some implementations of this disclosure, the generation module is further configured to: in response to receiving a request to add a downstream condition node to the first condition node, add a second condition node to the first condition node based on a second condition in a set of conditions.
[0085] According to some implementations of this disclosure, the generation module is further configured to: in response to receiving a request to add a downstream action node to a set of condition nodes, add an action node to a set of condition nodes based on the action; and in response to receiving a request to add a downstream information node to an action node, add an information node to the action node, wherein the information node is a leaf node of a tree structure.
[0086] According to some implementations of this disclosure, the determining module is further configured to: generate a set of configurations for a set of actions to be performed in the application based on a set of paths, each set of configurations corresponding to a set of paths; and call a set of configurations in the application to determine a set of instructions.
[0087] According to some implementations of this disclosure, the determining module is further configured to: determine an action to be performed on a data object based on action nodes in the path; and determine a set of conditions for performing the action based on a set of condition nodes in the path.
[0088] According to some implementations of this disclosure, the apparatus further includes a processing module further configured to: generate a first set of condition nodes in a target path in a target tree structure based on a first set of conditions associated with the first configuration, for a first configuration in a set of configurations; generate action nodes in the path based on actions associated with the first configuration; and generate information nodes in the target path based on metadata associated with the first configuration.
[0089] According to some implementations of this disclosure, the processing module is further configured to: determine a second set of conditions associated with a second configuration in a set of configurations; in response to determining that there is an intersection between the first set of conditions and the second set of conditions, determine at least one shared condition node based on the intersection; determine at least one non-shared condition based on the difference between the first set of conditions and the intersection; and determine the first set of condition nodes based on at least one shared condition node and at least one non-shared condition node.
[0090] According to some implementations of this disclosure, the conditions in the first set of conditions are ordered according to at least one of the following: the level associated with the condition, the frequency of the condition in a set of configurations, and the attributes of the condition.
[0091] According to some implementations of this disclosure, the processing module is further configured to: determine a first set of condition nodes based on the first set of conditions in response to determining that there is no intersection between the first set of conditions and the second set of conditions.
[0092] Figure 10 shows a block diagram of a device 1000 capable of implementing various implementations of the present disclosure. It should be understood that the computing device 1000 shown in Figure 10 is merely exemplary and should not constitute any limitation on the functionality and scope of the implementations described herein. The computing device 1000 shown in Figure 10 can be used to implement the methods described above.
[0093] As shown in Figure 10, the computing device 1000 is in the form of a general-purpose computing device. Components of the computing device 1000 may include, but are not limited to, one or more processors or processing units 1010, memory 1020, storage devices 1030, one or more communication units 1040, one or more input devices 1050, and one or more output devices 1060. The processing unit 1010 may be a physical or virtual processor and is capable of performing various processes according to programs stored in memory 1020. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of the computing device 1000.
[0094] Computing device 1000 typically includes multiple computer storage media. Such media can be any available media accessible to computing device 1000, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 1020 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 1030 can be removable or non-removable media and may include machine-readable media, such as flash drives, disks, or any other media capable of storing information and / or data (e.g., training data for training) and accessible within computing device 1000.
[0095] The computing device 1000 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown in FIG. 10, disk drives for reading from or writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks may be provided. In these cases, each drive may be connected to a bus (not shown) via one or more data media interfaces. The memory 1020 may include a computer program product 1025 having one or more program modules configured to perform various methods or actions of various implementations of this disclosure.
[0096] The communication unit 1040 enables communication with other computing devices via a communication medium. Additionally, the components of the computing device 1000 can function as a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, the computing device 1000 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.
[0097] Input device 1050 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 1060 can be one or more output devices, such as a monitor, speaker, printer, etc. Computing device 1000 can also communicate with one or more external devices (not shown) via communication unit 1040 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with computing device 1000, or with any device (e.g., network card, modem, etc.) that enables computing device 1000 to communicate with one or more other computing devices. Such communication can be performed via input / output (I / O) interface (not shown).
[0098] According to an implementation of this disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an implementation of this disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which are executed by a processor to implement the method described above. According to an implementation of this disclosure, a computer program product is provided, on which a computer program is stored, which, when executed by a processor, implements the method described above.
[0099] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0100] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0101] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0102] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0103] Various implementations of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the various implementations disclosed herein.
Claims
1. A method for performing actions in an application, comprising: obtaining a set of constraints associated with a set of data objects in the application, a constraint in the set of constraints representing a set of conditions for performing an action on a data object in the set of data objects; generating a tree structure based on the set of constraints, the tree structure comprising a set of paths, a path in the set of paths representing the constraint in the set of constraints; and determining a set of instructions for a set of actions to be performed in the application on the set of data objects respectively based on the tree structure.
2. The method of claim 1, wherein generating the tree structure based on the set of constraints comprises: in response to receiving a request for adding a path to the tree structure, adding a set of condition nodes to a root node of the tree structure, the set of condition nodes corresponding to the set of conditions.
3. The method of claim 2, wherein adding the set of conditional nodes to the root node of the tree structure comprises: based on a first condition in the set of conditions, adding a first condition node to the root node.
4. The method of claim 3, further comprising: in response to receiving a request for adding a downstream condition node to the first condition node, based on a second condition in the set of conditions, adding a second condition node to the first condition node.
5. The method of claim 2, further comprising: in response to receiving a request for adding a downstream action node to the set of condition nodes, based on the action, adding an action node to the set of condition nodes; and in response to receiving a request for adding a downstream information node to the action node, adding an information node to the action node, the information node being a leaf node of the tree structure.
6. The method of claim 1, wherein determining the set of instructions based on the tree structure comprises: based on the set of paths, generating a set of configurations for the set of actions to be performed in the application respectively, the set of configurations respectively corresponding to the set of paths; and invoking the set of configurations in the application to determine the set of instructions.
7. The method of claim 6, wherein generating the set of configurations comprises: based on an action node in the path, determining an action to be performed on the data object; and based on a set of condition nodes in the path, determining a set of conditions for performing the action.
8. The method of claim 6, further comprising: for a first configuration in the set of configurations, based on a first set of conditions associated with the first configuration, generating a first set of condition nodes in a target path in the target tree structure; based on an action associated with the first configuration, generating an action node in the path; and based on meta-information associated with the first configuration, generating an information node in the target path.
9. The method of claim 8, wherein generating the first set of condition nodes comprises: determining a second set of conditions associated with a second configuration in the set of configurations; in response to determining that there is an intersection between the first set of conditions and the second set of conditions, based on the intersection, determining at least one shared condition node; based on a difference between the first set of conditions and the intersection, determining at least one non-shared condition; and based on the at least one shared condition node and the at least one non-shared condition node, determining the first set of condition nodes.
10. The method of claim 9, wherein the conditions in the first set of conditions are ordered according to at least one of the following: the level associated with the condition, the frequency of the condition in the set of configurations, and the attributes of the condition.
11. The method of claim 9, further comprising: In response to the determination that there is no intersection between the first set of conditions and the second set of conditions, a first set of condition nodes is determined based on the first set of conditions.
12. An apparatus for performing an action in an application, comprising: The acquisition module is configured to acquire a set of constraints associated with a set of data objects in the application, wherein the constraints represent a set of conditions for performing actions on the data objects in the set of data objects; A generation module is configured to generate a tree structure based on the set of constraints, the tree structure including a set of paths, wherein the paths in the set of paths represent the constraints in the set of constraints; as well as The determination module is configured to determine, based on the tree structure, a set of instructions for performing a set of actions on the set of data objects in the application.
13. An electronic device, comprising: At least one processing unit; as well as At least one memory, coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, which, when executed by the at least one processing unit, cause the electronic device to perform the method according to any one of claims 1 to 11.
14. A computer-readable storage medium having a computer program stored thereon, the computer program causing the processor to implement the method according to any one of claims 1 to 11 when executed by a processor.
15. A computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 11.