An entity management method and device, electronic equipment and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- KINGDEE SOFTWARE(CHINA) CO LTD
- Filing Date
- 2023-04-13
- Publication Date
- 2026-06-26
Smart Images

Figure CN116450895B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to an entity management method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] For managing entities with cascading relationships, relevant technologies typically employ manual review. For example, in a payroll management system, managers need to comprehensively organize the company's job structure, including the cascading relationships between data such as positions, job levels, organizations, workplaces, and job titles, to develop a more reasonable and accurate payroll standard system. However, as the company grows, the job structure is constantly adjusted, and manual review can be unrealistic and inaccurate. In other words, adjustments to the cascading relationships between entities lead to a decrease in the real-time nature and accuracy of management.
[0003] It is evident that the management of entities with cascading relationships in related technologies suffers from technical problems of low efficiency and low accuracy. Summary of the Invention
[0004] The purpose of this application is to provide an entity management method, apparatus, electronic device, and computer-readable storage medium, which improves the management efficiency and accuracy of entities with cascading relationships.
[0005] To achieve the above objectives, this application provides an entity management method, comprising:
[0006] Obtain entity data; wherein, the entity data includes multiple target entities and the values corresponding to the target entities;
[0007] A target constraint graph is constructed based on the entity data; wherein, the nodes in the target constraint graph represent the target entities, and the edges between different nodes represent the constraint relationships between the corresponding different target entities;
[0008] In the target constraint graph, determine the currently active node, the source node that has constraints on the currently active node, and determine the constraint range of the source node on the currently active node;
[0009] Obtain the constraint expression of the currently active node; wherein the constraint expression describes the logical relationship between the constraints imposed by other entities on the current entity corresponding to the currently active node;
[0010] The constraint range of the currently active node after integration is determined using the constraint expression based on the constraint range of the source node on the currently active node.
[0011] The step of constructing the target constraint graph based on the entity data includes:
[0012] Initialize a complete constraint graph; wherein the constraint graph contains all entities and the constraint relationships between all entities;
[0013] Based on the target entity contained in the entity data, set the node corresponding to the target entity in the constraint relationship diagram to be valid;
[0014] Set the edges between different nodes corresponding to different target entities in the constraint relationship graph to be valid;
[0015] Generate the target constraint graph based on valid nodes and valid edges.
[0016] Specifically, setting the edges between different nodes corresponding to different target entities in the constraint relationship graph as valid includes:
[0017] Each node corresponding to the target entity contained in the entity data is determined as the current node;
[0018] In the constraint relationship graph, determine the adjacent nodes of the current node and determine whether the adjacent nodes have been set to be valid;
[0019] If the adjacent node is already set to valid, then the adjacent edge between the current node and the adjacent node is set to valid.
[0020] Specifically, determining the node corresponding to the target entity contained in the entity data as the current node includes:
[0021] The nodes corresponding to the target entities are sequentially determined as the current nodes according to the order of the target entities in the entity data.
[0022] Accordingly, if the adjacent node has already been set to valid, then the adjacent edge between the current node and the adjacent node is set to valid, including:
[0023] If the adjacent node has been set to valid, then determine whether the adjacent node has a subsequent node in the entity data;
[0024] If it exists, the adjacent edge between the current node and the adjacent node is set to be valid, and the direction of the adjacent edge is set.
[0025] After setting the edges between different nodes corresponding to different target entities in the constraint relationship graph to be valid, the method further includes:
[0026] Each edge that has been set as valid in the constraint graph is identified as the current edge in turn;
[0027] The target edge to which the current edge depends is determined based on the edge dependency configuration; wherein, the edge dependency configuration describes the dependency relationships between different constraint relationships corresponding to different edges;
[0028] Determine whether the target edge has been set to valid; if not, set the current edge to invalid.
[0029] Wherein, determining the constraint range of the source node on the currently active node includes:
[0030] The corresponding constraint calculation method is determined based on the constraint type of the source node on the current active node, and the constraint range of the source node on the current active node is determined using the constraint calculation method.
[0031] The constraint types include foreign key constraints, foreign key-bound constraints, and complex constraints. Determining the constraint range of the source node on the currently active node using the constraint calculation method includes:
[0032] When the constraint type is the foreign key constraint, the constraint range of the source node on the currently active node is determined based on the value of the reference attribute of the source node;
[0033] When the constraint type is foreign key constraint, the constraint range of the source node on the current active node is determined based on the primary key of the source node;
[0034] When the constraint type is the complex constraint, the constraint range of the source node on the currently active node is determined based on the constraint service pre-configured by the source node.
[0035] To achieve the above objectives, this application provides an entity management device, comprising:
[0036] The first acquisition module is used to acquire entity data; wherein, the entity data includes multiple target entities and the values corresponding to the target entities;
[0037] A construction module is used to construct a target constraint graph based on the entity data; wherein, the nodes in the target constraint graph represent the target entities, and the edges between different nodes represent the constraint relationships between the corresponding different target entities;
[0038] The first determining module is used to determine the currently active node, the source node that has constraints on the currently active node, and the constraint range of the source node on the currently active node in the target constraint graph.
[0039] The second acquisition module is used to acquire the constraint expression of the currently active node; wherein the constraint expression describes the logical relationship between the constraints imposed by other entities on the current entity corresponding to the currently active node;
[0040] The second determining module is used to determine the integrated constraint range of the current active node based on the constraint range of the source node on the current active node using the constraint expression.
[0041] To achieve the above objectives, this application provides an electronic device, comprising:
[0042] Memory, used to store computer programs;
[0043] A processor is used to implement the steps of the entity management method described above when executing the computer program.
[0044] To achieve the above objectives, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the entity management method described above.
[0045] As can be seen from the above scheme, the entity management method provided in this application includes: acquiring entity data; wherein the entity data includes multiple target entities and values corresponding to the target entities; constructing a target constraint graph based on the entity data; wherein nodes in the target constraint graph represent target entities, and edges between different nodes represent constraint relationships between different target entities; determining a currently active node and source nodes that constrain the currently active node in the target constraint graph, and determining the constraint range of the source nodes on the currently active node; acquiring a constraint expression for the currently active node; wherein the constraint expression describes the logical relationship between constraints imposed by other entities on the current entity corresponding to the currently active node; and using the constraint expression to determine the integrated constraint range of the currently active node based on the constraint range of the source nodes on the currently active node.
[0046] The entity management method provided in this application manages the constraint relationships between target entities through a target constraint graph. When calculating the constraint range of the currently active node, all source nodes with constraint relationships to it are identified in the target constraint graph, and the constraint ranges of all source nodes on the currently active node are determined. Then, based on the constraint expression of the currently active node, the constraint ranges of all source nodes on the currently active node are calculated to obtain the integrated constraint range. Therefore, the entity management method provided in this application can be adapted to the management of entities with cascading relationships. By describing the constraint relationships between entities and the constraint expressions of each entity through a constraint graph, it automatically calculates the constraint range of the currently active node, improving the efficiency and accuracy of determining the constraint range of the corresponding current entity. This application also discloses an entity management device, an electronic device, and a computer-readable storage medium, which can achieve the same technical effects.
[0047] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this application. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The drawings are used to provide a further understanding of this disclosure and constitute a part of the specification. They are used together with the following detailed description to explain this disclosure, but do not constitute a limitation of this disclosure. In the drawings:
[0049] Figure 1 This is a flowchart illustrating an entity management method according to an exemplary embodiment;
[0050] Figure 2 A flowchart illustrating another entity management method according to an exemplary embodiment;
[0051] Figure 3 This is a schematic diagram illustrating a constraint relationship diagram according to an exemplary embodiment;
[0052] Figure 4 This is a flowchart illustrating a specific method for illuminating an edge according to an exemplary embodiment;
[0053] Figure 5 This is a flowchart illustrating a specific method for checking dependencies along an edge, according to an exemplary embodiment.
[0054] Figure 6 This is a flowchart illustrating a specific method for calculating the value range of an active node according to an exemplary embodiment.
[0055] Figure 7 This is a structural diagram illustrating an entity management device according to an exemplary embodiment;
[0056] Figure 8 This is a structural diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0057] 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 a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Furthermore, in the embodiments of this application, "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0058] This application discloses an entity management method that improves the management efficiency and accuracy of entities with cascading relationships.
[0059] See Figure 1 A flowchart illustrating an entity management method according to an exemplary embodiment, such as... Figure 1 As shown, it includes:
[0060] S101: Obtain entity data; wherein, the entity data includes multiple target entities and the values corresponding to the target entities;
[0061] This embodiment can be applied to different application scenarios, which may involve multiple entities with cascading relationships. In this step, entity data is obtained, including multiple target entities with cascading relationships and the corresponding values for each entity; the primary key of the target entity can be used.
[0062] S102: Construct a target constraint graph based on the entity data; wherein, the nodes in the target constraint graph represent the target entities, and the edges between different nodes represent the constraint relationships between the corresponding different target entities;
[0063] In this step, a target constraint graph is constructed based on the entity data. The target constraint graph describes which target entities have constraint relationships and how these constraints are applied. Nodes in the target constraint graph represent target entities in the entity data, the values of the nodes are the values of the corresponding target entities, and the edges between different nodes represent the constraint relationships between the corresponding different target entities.
[0064] If node A imposes a constraint on node B, it means that once the value of node A is determined, the range of values for node B must be within the range of values for A, and vice versa. For example, suppose node A is a country / region and node B is an organization. When node A is set to "China," then the organizations under node B must be organizations within the China region. That is, the constraint range of node A on node B is organizations within the China region. Conversely, if node B is initially set to "Singapore organization" and then "China headquarters," then the constraint range of node B on node A is "Singapore" and then "China."
[0065] As a feasible implementation, constructing the target constraint graph based on the entity data includes: initializing a complete constraint relationship graph; wherein the constraint relationship graph contains all entities and the constraint relationships between all entities; setting the nodes corresponding to the target entities in the constraint relationship graph as valid according to the target entities contained in the entity data; setting the edges between different nodes corresponding to different target entities in the constraint relationship graph as valid; and generating the target constraint graph based on the valid nodes and valid edges.
[0066] In the specific implementation, a complete constraint graph is initialized, which describes all entities and their constraints in the current scenario. Nodes in the constraint graph represent entities, and edges between different nodes represent constraints between different entities. It's important to note that all nodes and edges in the initialized constraint graph are initially invalid (i.e., off). Next, entity data is acquired, including the target entities involved in the calculation. Based on the target entities in the entity data, the nodes corresponding to the target entities in the constraint graph, and the edges between different nodes corresponding to different target entities, are made valid. This means activating the nodes corresponding to the target entities and the edges between different nodes corresponding to different target entities, thereby generating the target constraint graph based on the valid nodes and edges.
[0067] As a feasible implementation method, setting the edges between different nodes corresponding to different target entities in the constraint relationship graph to be valid includes: determining the nodes corresponding to the target entities contained in the entity data as the current node; determining the adjacent nodes of the current node in the constraint relationship graph, and determining whether the adjacent nodes have been set to be valid; if the adjacent nodes have been set to be valid, then setting the adjacent edge between the current node and the adjacent node to be valid.
[0068] In practice, the nodes corresponding to the target entities contained in the entity data are determined as the current nodes. For each current node, its adjacent edges are queried in the constraint graph. The adjacent edges are traversed, and it is determined whether each edge is set to valid (i.e., whether it is already lit). If so, the next adjacent edge is processed; otherwise, the adjacent nodes of the current node are determined from the invalid (i.e., unlit) adjacent edges. The process continues, traversing the adjacent nodes. For each adjacent node, it is determined whether it is set to valid. If not, the next adjacent node is processed; if so, the adjacent edge containing that adjacent node is set to valid (i.e., lit).
[0069] Understandably, the edges in the initial constraint graph are not labeled with directions. When constructing the target constraint graph, the direction of the edges can be set or not based on the input information. That is, in addition to obtaining entity data, the "order" information can also be obtained. When the obtained information is "yes," the nodes corresponding to the target entities are sequentially determined as the current nodes according to the order of the target entities in the entity data, and all target entities are traversed. When the obtained information is "no," the nodes corresponding to the target entities in the entity data are randomly determined as the current nodes, and all target entities are traversed.
[0070] For the current node, query its adjacent edges in the constraint graph, traverse the adjacent edges, and determine if the adjacent edge has been set to valid. If yes, process the next adjacent edge; otherwise, determine the current node's adjacent node from the invalid adjacent edges. During further traversal of adjacent nodes, if the adjacent node has been set to valid, determine its order based on the obtained information. If yes, determine if the adjacent node has a successor node in the entity data. If it does, set the adjacent edge between the current node and the adjacent node to valid and set the pointer of the adjacent edge, i.e., the current node points to the adjacent node. If it does not exist, process the next adjacent node.
[0071] S103: In the target constraint graph, determine the currently active node, the source node that has constraints on the currently active node, and determine the constraint range of the source node on the currently active node;
[0072] In this step, the currently active node for which the constraint range needs to be calculated is identified. The edges pointing to the currently active node are determined in the target constraint graph, thus identifying the source node of this edge, i.e., the source node that imposes a constraint on the currently active node. Further, the constraint range of each source node on the currently active node is determined based on the values corresponding to each source node.
[0073] As a feasible implementation method, determining the constraint range of the source node on the current active node includes: determining the corresponding constraint calculation method according to the constraint type of the source node on the current active node, and using the constraint calculation method to determine the constraint range of the source node on the current active node.
[0074] In practice, the constraints imposed by the source node on the currently active node can be represented by different constraint types, including foreign key constraints, foreign key-based constraints, and complex constraints. Different constraint types correspond to different constraint calculation methods. A foreign key constraint expresses that a certain attribute of the entity corresponding to the source node references the entity corresponding to the currently active node through a foreign key relationship. A foreign key-based constraint expresses the opposite meaning; it means that the entity corresponding to the source node is referenced by a foreign key-based attribute of the entity corresponding to the currently active node. Typically, most relationships between related entities can be expressed using foreign key constraints and foreign key-based constraints. If foreign key constraints and foreign key-based constraints cannot be satisfied, a more complex relational model, i.e., complex constraints, can be used to handle the situation and thus satisfy the constraint logic in various scenarios.
[0075] As a feasible implementation method, the constraint types include foreign key constraints, foreign key-bound constraints, and complex constraints. Determining the constraint range of the source node on the currently active node using the constraint calculation method includes: when the constraint type is a foreign key constraint, determining the constraint range of the source node on the currently active node based on the value of the reference attribute of the source node; when the constraint type is a foreign key-bound constraint, determining the constraint range of the source node on the currently active node based on the primary key of the source node; and when the constraint type is a complex constraint, determining the constraint range of the source node on the currently active node based on the constraint service pre-configured by the source node.
[0076] In practice, if the source node has a foreign key constraint on the currently active node, the value of the reference attribute of the source node can be read and used as the primary key of the currently active node to filter its data. If the constraint is a foreign key constraint on the currently active node, the primary key of the source node can be collected to construct the IN filter condition for the reference attribute of the currently active node. For complex constraints, the filter condition can be returned at the interface level; however, the programmer needs to implement the forward and reverse constraint logic between the two nodes. The forward constraint logic between the source node and the currently active node is the constraint of the source node on the currently active node, and the reverse constraint logic between the source node and the currently active node is the constraint of the currently active node on the source node.
[0077] S104: Obtain the constraint expression of the currently active node; wherein the constraint expression describes the logical relationship between the constraints imposed by other entities on the current entity corresponding to the currently active node;
[0078] In this step, the constraint expression of the currently active node is obtained. It is understood that in the target constraint graph, there may be multiple other entities that constrain the current entity corresponding to the currently active node. The constraint expression describes the logical relationship between the constraints imposed by other entities on the current entity corresponding to the currently active node. Entities in the expression can be connected using operators such as AND, OR, and parentheses.
[0079] For example, the current entity corresponding to the current active node is "the city where the organization is located", and the other entities that have constraints on the current entity are "position" and "administrative organization". The constraint expression of the current active node is "position or administrative organization".
[0080] S105: Using the constraint expression, determine the integrated constraint range of the current active node based on the constraint range of the source node on the current active node.
[0081] In this step, the constraint range of all source nodes on the current active node is calculated based on the constraint expression of the current active node, resulting in the integrated constraint range. For the example given in the previous step, if the "Job" selection range is "Shenzhen R&D Position" and the "Administrative Organization" selection range is "Wuhan R&D Department," then the integrated constraint range of the current active node corresponding to the city where the organization is located is the union of the two constraint ranges mentioned above, i.e., [Shenzhen, Wuhan].
[0082] The entity management method provided in this application manages the constraint relationships between target entities through a target constraint graph. When calculating the constraint range of the currently active node, all source nodes with constraint relationships with it are identified in the target constraint graph, and the constraint ranges of all source nodes on the currently active node are determined. Then, the constraint ranges of all source nodes on the currently active node are calculated based on the constraint expression of the currently active node to obtain the integrated constraint range. Therefore, the entity management method provided in this application can be adapted to the management of entities with cascading relationships. By describing the constraint relationships between entities and the constraint expressions of each entity through a constraint graph, it automatically calculates the constraint range of the currently active node, improving the efficiency and accuracy of determining the constraint range of the corresponding current entity.
[0083] This application discloses an entity management method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically:
[0084] See Figure 2A flowchart illustrating another entity management method according to an exemplary embodiment, such as Figure 2 As shown, it includes:
[0085] S201: Obtain entity data; wherein, the entity data includes multiple target entities and the values corresponding to the target entities;
[0086] S202: Initialize the complete constraint diagram; wherein the constraint diagram contains all entities and the constraint relationships between all entities;
[0087] S203: Based on the target entity contained in the entity data, set the node corresponding to the target entity in the constraint relationship diagram to be valid;
[0088] S204: Set the edges between different nodes corresponding to different target entities in the constraint relationship graph to be valid;
[0089] S205: Sequentially determine the edges that have been set to be valid in the constraint relationship graph as the current edges; determine the target edges that the current edges depend on according to the edge dependency configuration; wherein, the edge dependency configuration describes the dependency relationships between different constraint relationships corresponding to different edges; determine whether the target edge has been set to be valid; if not, set the current edge to be invalid.
[0090] In this embodiment, an edge dependency configuration is added to the target constraint graph. The edge dependency configuration describes the dependency relationship between different constraint relationships corresponding to different edges. That is, although the entity corresponding to a certain node generates a constraint on the entity corresponding to the target node, it exists as well as the constraints of the entities corresponding to other nodes on the entity corresponding to the target node. It cannot unilaterally generate a direct constraint on the entity corresponding to the target node.
[0091] For example, if a "job title" constrains a "job sequence," which in turn depends on the "job system scheme" constraining the "job sequence," then the edge dependency configuration for the node corresponding to the "job sequence" can be defined as: Job → Job System Scheme. Similarly, if a "job family" constrains a "job sequence," which also depends on the "job system scheme" constraining the "job sequence," then the edge dependency configuration for the node corresponding to the "job sequence" can be defined as: Job Family → Job System Scheme. In other words, the complete edge dependency configuration for the node corresponding to the "job sequence" is: Job → Job System Scheme, Job Family → Job System Scheme.
[0092] In practice, after the nodes and edges in the initial constraint graph are illuminated based on the entity data, edge dependency checks are performed on the illuminated edges according to the edge dependency configuration of each node. For the currently illuminated edge, it will be illuminated only if its dependent target edge does not exist or if the dependent target edge exists and is illuminated. That is, the currently illuminated edges are determined sequentially, and it is determined whether the currently illuminated edge has a dependent target edge according to the edge dependency configuration. If it does not exist, the next illuminated edge is processed. If it does exist, it is determined whether the target edge is already illuminated. If it is, the next illuminated edge is processed. If not, the currently illuminated edge is turned off.
[0093] S206: Generate the target constraint graph based on valid nodes and valid edges;
[0094] S207: In the target constraint graph, determine the currently active node, the source node that has constraints on the currently active node, and determine the constraint range of the source node on the currently active node;
[0095] S208: Obtain the constraint expression of the currently active node; wherein the constraint expression describes the logical relationship between the constraints imposed by other entities on the current entity corresponding to the currently active node;
[0096] S209: Using the constraint expression, determine the integrated constraint range of the current active node based on the constraint range of the source node on the current active node.
[0097] The following describes an application embodiment of this application, which utilizes a cascaded control model for managing organizational job positions. The cascaded control model is a three-layer abstract model. The first layer (abstract layer) involves constructing a bidirectional constraint diagram, as shown below. Figure 3 As shown, Figure 3 Each node in the diagram represents an entity within the organizational structure of job positions. The lines connecting the nodes represent cascading constraints between entities, and the descriptions on the lines express the specific manifestation of these relationships. The overall constraint diagram describes which entities are constrained and how these constraints are applied.
[0098] The second layer of the model (business layer) is for constructing constraint expressions. For example, the constraint expressions obtained by constructing some nodes are shown in Table 1:
[0099] Table 1
[0100]
[0101]
[0102] Each node in the system defines a set of expressions, and each set of expressions contains multiple other entities. Entities in the expressions are connected by AND, OR, or parentheses, representing the logical nesting relationships between them. The purpose of configuring such a set of expressions for each node is to address the complex logical relationships arising when an entity node has constraints (connected by lines) with multiple entities. During computation, the constraints imposed on it by each associated node are calculated one by one, then the expressions are parsed and executed to obtain the final synthesized constraints.
[0103] The third layer of the model (business layer) constructs the dependency relationships of the constraint edges. Some of the constructed edge dependencies are shown in Table 2:
[0104] Table 2
[0105]
[0106] Each node defines the constraint dependencies between its connected nodes. According to the detailed requirements of the company's job title system architecture, when an entity node imposes a constraint on a target node, this constraint exists because of the constraints imposed on the target node by other nodes. It is not possible for one entity node to unilaterally impose a direct constraint on the target node, even though there are constraint relationships (connections) between them.
[0107] In practice, the constraint relationship graph is initialized, and the corresponding nodes and edges are illuminated based on the input entities. The specific flowchart for illuminating edges is as follows: Figure 4 As shown, using the given entity data, plus all possible connections and nodes configured during the configuration period, a runtime subgraph containing the given entity nodes with connections is constructed. First, all edges and nodes are loaded. The entities in the entity data are traversed. For the node corresponding to the current entity, the adjacent edges are queried. The adjacent nodes are traversed. For the current adjacent node, it is determined whether the adjacent edge has been lit. If so, the next adjacent node is processed. If not, it is determined whether the current adjacent node has been lit. If not, the next adjacent node is processed. If so, it is determined whether the order should be considered. If not, the adjacent edge is lit. If so, it is determined whether there is a subsequent node. If so, the adjacent edge is lit and its direction is determined. If not, the next adjacent node is processed.
[0108] Furthermore, the dependency configuration for loading edges is checked, and edges that do not meet the dependency requirements are grayed out (not included in the calculation). The specific flowchart is as follows. Figure 5As shown, first, obtain the edges that have been lit up, then obtain all edges, query the dependency configuration, traverse the edges that have been lit up, for the current edge curr, determine whether it has a directed edge dependency. If not, process the next edge that has been lit up. If it does, retrieve the dependent directed edge temp, determine whether temp is lit up in the full set of edges. If it is, process the next edge that has been lit up. If not, turn off the current edge curr.
[0109] During model calculation, the value range of active nodes is calculated based on all participating nodes and the currently active node. The specific flowchart is as follows: Figure 6 As shown, for an active node, it is determined whether it is a whitelist node. If so, the process ends and returns null. The whitelist essentially provides a mechanism that allows certain nodes on the list to be unconstrained by any other nodes. The whitelist is provided by the application layer based on the business scenario. If the active node is not a whitelisted node, then obtain the highlighted directed adjacent edges, i.e., edges pointing to the current active node. Obtain the source node `temp`, iterate through all source nodes `temp`, and check if data exists in the source node `temp`. If not, process the next source node. If data exists, calculate the constraint range `Qfilter` for the current active node (i.e., the target node) based on the constraint type of the source node `temp`, and add it to the `Qfilter` collection. When the constraint type is a foreign key constraint or a foreign key constraint, construct the filter condition based on the reference attribute. The filter condition constructed for a foreign key constraint is `new Qfilter("propname", in, temp.data.ids)`, and the filter condition constructed for a foreign key constraint is `new Qfilter("id", in, temp.data.propvalues)`. When the constraint condition is a complex constraint, instantiate the plugin, construct the input parameters, and execute the method `getQfilter(edge)`, i.e., call the corresponding constraint service to obtain the `Qfilter`. The data structure of the `Qfilter` collection is `{node: Qfilter}`. Obtain the constraint expression of the current active node, calculate the constraint expression based on the data in the `Qfilter` collection, parse it into a `Qfilter`, and return the `Qfilter` and the associated node.
[0110] In the process of constructing the constraint relationship graph and calculating the value range of active nodes, the configuration data used includes node configuration and edge configuration. The node configuration includes the node name, the corresponding entity code, and the constraint expression. For example, the configuration information of some nodes is shown in Table 3:
[0111] Table 3
[0112]
[0113]
[0114] As can be seen, the node configuration contains the constraint expressions of the second-layer model.
[0115] Edge configuration includes edge name, source node entity, target node entity, forward constraint type, reverse constraint type, reference attribute, forward edge dependency, reverse edge dependency, and constraint service. Forward and reverse refer to the pointers between the source and target nodes; forward means the source node points to the target node, and reverse means the target node points to the source node. The constraint service is the service used when the constraint type is complex. For example, some edge configuration information is shown in Table 4:
[0116] Table 4
[0117]
[0118] As can be seen, the edge configuration includes the dependency configuration in the third-layer model.
[0119] As can be seen, relying on the three-layer model construction and key model parsing engine, a constraint control model conforming to a specific architectural system can be established from abstract to concrete, such as the constraint control model under the organizational position system in this embodiment. The model has a wide range of applications. The model is highly adaptable; based on understanding the model, users can replace and adjust the model data to extend it to suit specific business scenarios. The model provides multiple user interfaces and configuration points, allowing for model adaptation and enhancement.
[0120] In this embodiment, an abstract constraint control model is established based on the relationships between various entities in the organizational job system. The constraint control methods are clearly defined, providing three constraint types: foreign key constraints, constraints imposed by foreign keys, and complex constraints, to meet the implementation of constraint logic in various scenarios. The business relationships in the organizational job system are abstracted and transformed into simple, readable, executable, and configurable constraint combination expressions, adapting to constraints combined between different entities.
[0121] The following describes an entity management device provided in an embodiment of this application. The entity management device described below and the entity management method described above can be referred to each other.
[0122] See Figure 7 A structural diagram of an entity management device according to an exemplary embodiment is shown, such as... Figure 7 As shown, it includes:
[0123] The first acquisition module 701 is used to acquire entity data; wherein, the entity data includes multiple target entities and values corresponding to the target entities;
[0124] The construction module 702 is used to construct a target constraint graph based on the entity data; wherein, the nodes in the target constraint graph represent the target entities, and the edges between different nodes represent the constraint relationships between the corresponding different target entities;
[0125] The first determining module 703 is used to determine the currently active node, the source node that has constraints on the currently active node, and the constraint range of the source node on the currently active node in the target constraint graph.
[0126] The second acquisition module 704 is used to acquire the constraint expression of the currently active node; wherein the constraint expression describes the logical relationship between the constraints imposed by other entities on the current entity corresponding to the currently active node;
[0127] The second determining module 705 is used to determine the integrated constraint range of the current active node based on the constraint range of the source node on the current active node using the constraint expression.
[0128] The entity management device provided in this application manages the constraint relationships between target entities through a target constraint graph. When calculating the constraint range of the currently active node, it identifies all source nodes with which it has a constraint relationship in the target constraint graph and determines the constraint range of all source nodes on the currently active node. Then, based on the constraint expression of the currently active node, it calculates the constraint range of all source nodes on the currently active node to obtain the integrated constraint range. Therefore, the entity management device provided in this application can be adapted to the management of entities with cascading relationships. By describing the constraint relationships between entities and the constraint expressions of each entity through a constraint graph, it automatically calculates the constraint range of the currently active node, improving the efficiency and accuracy of determining the constraint range of the corresponding current entity.
[0129] Based on the above embodiments, as a preferred embodiment, the construction module 702 includes:
[0130] An initialization unit is used to initialize a complete constraint graph; wherein the constraint graph contains all entities and the constraint relationships between all entities;
[0131] The first setting unit is used to set the node corresponding to the target entity in the constraint relationship diagram as valid according to the target entity contained in the entity data.
[0132] The second setting unit is used to set the edges between different nodes corresponding to different target entities in the constraint relationship graph as valid.
[0133] The generation unit is used to generate the target constraint graph based on valid nodes and valid edges.
[0134] Based on the above embodiments, as a preferred implementation, the second setting unit is specifically used to: determine the nodes corresponding to the target entities contained in the entity data as the current nodes; determine the adjacent nodes of the current nodes in the constraint relationship graph, and determine whether the adjacent nodes have been set to be valid; if the adjacent nodes have been set to be valid, then set the adjacent edge between the current node and the adjacent nodes to be valid.
[0135] Based on the above embodiments, as a preferred implementation, the second setting unit is specifically used for: determining the nodes corresponding to the target entities as current nodes in the entity data according to the order of the target entities; determining the adjacent nodes of the current node in the constraint relationship diagram, and determining whether the adjacent nodes have been set as valid; if the adjacent nodes have been set as valid, determining whether the adjacent nodes have subsequent nodes in the entity data; if so, setting the adjacent edge between the current node and the adjacent node as valid, and setting the direction of the adjacent edge.
[0136] Based on the above embodiments, as a preferred embodiment, the construction module 702 further includes:
[0137] An edge dependency checking unit is used to sequentially identify the edges that have been set to be valid in the constraint relationship graph as the current edge; determine the target edge that the current edge depends on according to the edge dependency configuration; wherein the edge dependency configuration describes the dependency relationship between different constraint relationships corresponding to different edges; determine whether the target edge has been set to be valid; if not, then set the current edge to be invalid.
[0138] Based on the above embodiments, as a preferred implementation, the first determining module 703 includes:
[0139] The first determining unit is used to determine the currently active node and the source node that has constraints on the currently active node in the target constraint graph.
[0140] The second determining unit is used to determine the corresponding constraint calculation method according to the constraint type of the source node on the current active node, and to determine the constraint range of the source node on the current active node using the constraint calculation method.
[0141] Based on the above embodiments, as a preferred implementation, the constraint types include foreign key constraints, foreign key-bound constraints, and complex constraints. The second determining unit is specifically used for: when the constraint type is the foreign key constraint, determining the constraint range of the source node on the currently active node based on the value of the reference attribute of the source node; when the constraint type is the foreign key-bound constraint, determining the constraint range of the source node on the currently active node based on the primary key of the source node; and when the constraint type is the complex constraint, determining the constraint range of the source node on the currently active node based on the constraint service pre-configured by the source node.
[0142] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0143] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiments of this application, the embodiments of this application also provide an electronic device. Figure 8 This is a structural diagram of an electronic device according to an exemplary embodiment, such as... Figure 8 As shown, the electronic device includes:
[0144] Communication interface 1 enables information exchange with other devices, such as network devices;
[0145] Processor 2 is connected to communication interface 1 to enable information interaction with other devices and, when running a computer program, executes the entity management methods provided by one or more of the above-mentioned technical solutions. The computer program is stored in memory 3.
[0146] Of course, in practical applications, the various components in an electronic device are coupled together through bus system 4. It can be understood that bus system 4 is used to achieve communication and connection between these components. In addition to the data bus, bus system 4 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 8 The general will label all buses as Bus System 4.
[0147] The memory 3 in this embodiment is used to store various types of data to support the operation of the electronic device. Examples of such data include any computer program used to operate on the electronic device.
[0148] It is understood that memory 3 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 3 described in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0149] The methods disclosed in the embodiments of this application can be applied to processor 2, or implemented by processor 2. Processor 2 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 2 or by instructions in the form of software. The processor 2 may be a general-purpose processor, DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 2 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 3. Processor 2 reads the program in memory 3 and completes the steps of the aforementioned method in combination with its hardware.
[0150] When processor 2 executes the program, it implements the corresponding processes in the various methods of the embodiments of this application. For the sake of brevity, these will not be described in detail here.
[0151] In an exemplary embodiment, this application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a memory 3 that stores a computer program, which can be executed by a processor 2 to complete the steps described in the aforementioned method. The computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM.
[0152] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
[0153] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
[0154] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An entity management method, characterized in that, include: Obtain entity data; wherein, the entity data includes multiple target entities and the values corresponding to the target entities; A target constraint graph is constructed based on the entity data; wherein, the nodes in the target constraint graph represent the target entities, and the edges between different nodes represent the constraint relationships between the corresponding different target entities; In the target constraint graph, determine the currently active node, the source node that has constraints on the currently active node, and determine the constraint range of the source node on the currently active node; Obtain the constraint expression of the currently active node; wherein the constraint expression describes the logical relationship between the constraints imposed by other entities on the current entity corresponding to the currently active node; The constraint range of the currently active node after integration is determined using the constraint expression based on the constraint range of the source node on the currently active node; The step of constructing the target constraint graph based on the entity data includes: Initialize a complete constraint graph; wherein the constraint graph contains all entities and the constraint relationships between all entities; Based on the target entity contained in the entity data, set the node corresponding to the target entity in the constraint relationship diagram to be valid; Set the edges between different nodes corresponding to different target entities in the constraint relationship graph to be valid; The process involves sequentially identifying the edges that have already been set to valid in the constraint graph as the current edge; determining the target edge that the current edge depends on based on the edge dependency configuration; wherein the edge dependency configuration describes the dependency relationship between different constraint relationships corresponding to different edges; determining whether the target edge has already been set to valid; if not, then setting the current edge to invalid. Generate the target constraint graph based on valid nodes and valid edges; Wherein, determining the constraint range of the source node on the currently active node includes: The corresponding constraint calculation method is determined based on the constraint type of the source node on the current active node, and the constraint range of the source node on the current active node is determined using the constraint calculation method. The constraint types include foreign key constraints, foreign key-bound constraints, and complex constraints. Determining the constraint range of the source node on the currently active node using the constraint calculation method includes: When the constraint type is the foreign key constraint, the value of the reference attribute of the source node is read as the primary key of the current active node to filter the data of the current active node, so as to determine the constraint range of the source node on the current active node; When the constraint type is the foreign key constraint, the primary key of the source node is collected, and the IN filter condition of the reference attribute of the current active node is constructed to determine the constraint range of the source node on the current active node. When the constraint type is the complex constraint, the constraint range of the source node on the current active node is determined based on the constraint service pre-configured by the source node; wherein, the constraint service includes forward constraint logic and reverse constraint logic between the source node and the current active node, the forward constraint logic is the constraint of the source node on the current active node, and the reverse constraint logic is the constraint of the current active node on the source node.
2. The entity management method according to claim 1, characterized in that, Setting the edges between different nodes corresponding to different target entities in the constraint relationship graph to be valid includes: Each node corresponding to the target entity contained in the entity data is determined as the current node; In the constraint relationship graph, determine the adjacent nodes of the current node and determine whether the adjacent nodes have been set to be valid; If the adjacent node is already set to valid, then the adjacent edge between the current node and the adjacent node is set to valid.
3. The entity management method according to claim 2, characterized in that, The step of determining the node corresponding to the target entity contained in the entity data as the current node includes: The nodes corresponding to the target entities are sequentially determined as the current nodes according to the order of the target entities in the entity data. Accordingly, if the adjacent node has already been set to valid, then the adjacent edge between the current node and the adjacent node is set to valid, including: If the adjacent node has been set to valid, then determine whether the adjacent node has a subsequent node in the entity data; If it exists, the adjacent edge between the current node and the adjacent node is set to be valid, and the direction of the adjacent edge is set.
4. A physical management device, characterized in that, include: The first acquisition module is used to acquire entity data; wherein, the entity data includes multiple target entities and the values corresponding to the target entities; A construction module is used to construct a target constraint graph based on the entity data; wherein, the nodes in the target constraint graph represent the target entities, and the edges between different nodes represent the constraint relationships between the corresponding different target entities; The first determining module is used to determine the currently active node, the source node that has constraints on the currently active node, and the constraint range of the source node on the currently active node in the target constraint graph. The second acquisition module is used to acquire the constraint expression of the currently active node; wherein the constraint expression describes the logical relationship between the constraints imposed by other entities on the current entity corresponding to the currently active node; The second determining module is used to determine the constraint range of the current active node after integration based on the constraint range of the source node on the current active node using the constraint expression; The building module includes: An initialization unit is used to initialize a complete constraint graph; wherein the constraint graph contains all entities and the constraint relationships between all entities; The first setting unit is used to set the node corresponding to the target entity in the constraint relationship diagram as valid according to the target entity contained in the entity data. The second setting unit is used to set the edges between different nodes corresponding to different target entities in the constraint relationship graph as valid. An edge dependency checking unit is used to sequentially identify the edges that have been set to be valid in the constraint relationship graph as the current edge; determine the target edge that the current edge depends on according to the edge dependency configuration; wherein the edge dependency configuration describes the dependency relationship between different constraint relationships corresponding to different edges; determine whether the target edge has been set to be valid; if not, then set the current edge to be invalid. A generation unit is used to generate a target constraint graph based on valid nodes and valid edges; The first determining module includes: The first determining unit is used to determine the currently active node and the source node that has constraints on the currently active node in the target constraint graph. The second determining unit is used to determine the corresponding constraint calculation method according to the constraint type of the source node on the current active node, and to determine the constraint range of the source node on the current active node using the constraint calculation method. The constraint types include foreign key constraints, foreign key-bound constraints, and complex constraints. The second determining unit is specifically used for: when the constraint type is a foreign key constraint, reading the value of the reference attribute of the source node as the primary key of the currently active node to filter the data of the currently active node, thereby determining the constraint range of the source node on the currently active node; when the constraint type is a foreign key-bound constraint, collecting the primary key of the source node and constructing an IN filter condition for the reference attribute of the currently active node, thereby determining the constraint range of the source node on the currently active node; when the constraint type is a complex constraint, determining the constraint range of the source node on the currently active node based on a pre-configured constraint service of the source node; wherein the constraint service includes forward constraint logic and reverse constraint logic between the source node and the currently active node, the forward constraint logic being the constraint of the source node on the currently active node, and the reverse constraint logic being the constraint of the currently active node on the source node.
5. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the entity management method as described in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the entity management method as described in any one of claims 1 to 3.