Data processing methods, apparatus, equipment and storage media
By employing multi-round matching and depth-first search algorithms, the problem of low transaction efficiency was solved, enabling rapid location of permission rules and reducing storage space and time complexity.
Patent Information
- Application Number
- CN202211509734.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-29
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-11-29
AI Technical Summary
Existing technology cannot quickly locate the matching permission rules for each transaction, affecting transaction efficiency.
By performing N rounds of matching between transaction element identifiers and permission rules for multiple element matching patterns, a depth-first memoized search algorithm is adopted, and a dynamic programming algorithm is used to mark the contextual relationships of preset rules, thereby reducing space consumption and time complexity.
It implements permission rules for quickly locating transaction requests, improving transaction efficiency and reducing storage space and matching time complexity.
Smart Images

Figure CN115796886B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of payment technology, and in particular relates to a data processing method, apparatus, device and storage medium. Background Technology
[0002] With the development of technology, the trading industry is rapidly becoming more internet-based. During the trading process, access control across different elements is a crucial means of ensuring transaction security. Therefore, how to quickly locate the matching access rules for each transaction and determine whether to allow the transaction to continue based on those rules has become a pressing issue.
[0003] In related technologies, pre-stored rules can be matched with each transaction. However, as transaction scenarios and business permission requirements continue to increase, the number of controllable elements also increases, leading to an increase in the number of permission rules. As a result, the above method cannot quickly locate the matching permission rule for each transaction, affecting transaction efficiency. Summary of the Invention
[0004] This application provides a data processing method, apparatus, device, and storage medium that can solve the problem in related technologies where it is impossible to quickly locate the matching permission rules for each transaction, thus affecting transaction efficiency.
[0005] In a first aspect, embodiments of this application provide a data processing method, including:
[0006] Receive a transaction request. The transaction request includes M transaction elements. Each of the M transaction elements corresponds to a transaction element identifier, where M is an integer greater than 1.
[0007] The transaction element identifier is matched with the permission rules corresponding to each element matching pattern in multiple element matching patterns for N rounds to obtain the matching result of each round of N rounds of matching; wherein, the matching result of the i-th round of N rounds of matching is used as the matching input of the (i+1)-th round. The matching result includes the permission rule range data of each element matching pattern in the current round and the transaction element identifier of the next round, where N is an integer greater than 1 and i is an integer greater than or equal to 1.
[0008] If the value of the transaction element identifier in the (i+1)th round is greater than M, the target permission rule for the transaction request is determined based on the matching result of the i-th round.
[0009] Secondly, embodiments of this application provide a data processing apparatus, which may include:
[0010] The receiving module is used to receive transaction requests. The transaction request includes M transaction elements, each of which corresponds to a transaction element identifier, where M is an integer greater than 1.
[0011] The matching module is used to perform N rounds of matching between the transaction element identifier and the permission rules corresponding to each element matching pattern in multiple element matching patterns, to obtain the matching result of each round of matching in N rounds; wherein, the matching result of the i-th round in N rounds of matching is used as the matching input of the (i+1)-th round. The matching result includes the permission rule range data of each element matching pattern in the current round and the transaction element identifier of the next round, where N is an integer greater than 1 and i is an integer greater than or equal to 1;
[0012] The determination module is used to determine the target permission rule for the transaction request based on the matching result of the i-th round if the value of the transaction element identifier in the (i+1)-th round is greater than M.
[0013] Thirdly, embodiments of this application provide a computer device, which includes: a processor and a memory storing computer program instructions;
[0014] When the processor executes computer program instructions, it implements the data processing method as described in the first aspect.
[0015] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the data processing method as described in the first aspect.
[0016] Fifthly, embodiments of this application provide a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the data processing method as shown in the first aspect.
[0017] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the data processing method as described in the first aspect.
[0018] The data processing method, apparatus, device, and storage medium of this application embodiment receive a transaction request including M transaction elements, each of the M transaction elements corresponding to a transaction element identifier; then, the transaction element identifier is matched with the permission rules corresponding to each of the multiple element matching modes in N rounds to obtain the matching result of each round of N rounds of matching, wherein the matching result of the i-th round of N rounds of matching is used as the matching input of the i+1-th round, and the matching result includes the permission rule range data of each element matching mode in the current round of matching and the transaction element identifier of the next round; then, if the value of the transaction element identifier in the i+1-th round is greater than M, the target permission rule of the transaction request is determined according to the matching result of the i-th round. Therefore, for each transaction element, permission rules for each of the multiple element matching modes are matched in each round of matching. This allows for the matching of permission rules for multiple element matching modes with a single filter, reducing space consumption and mitigating the impact of newly added permission rules and duplicate element values on matching efficiency. Furthermore, by employing a depth-first memoized search algorithm to perform N rounds of permission rule matching, when a transaction element is found to have an equal value, the permission rule range data of the matched permission rule can be directly obtained, ensuring low time complexity for querying each transaction element. In this way, the matching permission rule for each transaction request can be quickly located, improving transaction efficiency. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a diagram illustrating the differences in matching permission rules in related technologies;
[0021] Figure 2 This application provides a schematic diagram of a data processing architecture for a data processing method.
[0022] Figure 3 A schematic diagram of the state transition equation of a data processing method provided in an embodiment of this application;
[0023] Figure 4 A flowchart illustrating a data processing method provided in an embodiment of this application;
[0024] Figure 5 This is a schematic diagram of the rule structure table in a data processing method provided in one embodiment of this application;
[0025] Figure 6This is a flowchart illustrating the process of determining preset permission rules in a data processing method provided in one embodiment of this application;
[0026] Figure 7 This is a schematic diagram of the logical structure of a data processing method provided in one embodiment of this application;
[0027] Figure 8 This is a schematic diagram of the structure of a data processing apparatus provided in one embodiment of this application;
[0028] Figure 9 This is a schematic diagram of the structure of a computer device provided in one embodiment of this application. Detailed Implementation
[0029] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0030] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0031] In related technologies, permission rules can be matched in three ways. Method one involves sequentially matching each element in the request against each preset rule. The rules do not need to be sorted; all rules are iterated sequentially, and this process is repeated multiple times based on the number of elements to determine the matching rule corresponding to the request. However, this sequential matching method has a time complexity of O(L) to O(L*H) for single-element queries, where L is the number of rules, L*H is the storage space, and H is the number of element dimensions. Thus, the time consumption increases linearly with the number of rules, increasing matching time and impacting matching efficiency. Method 2 involves sorting all rules according to the composite index and using a fast search algorithm to find the corresponding rule. If there are multiple corresponding rules, it is necessary to traverse back and forth to scan and obtain all the matching rules. However, this method using composite indexes requires each index to provide an explicit value during matching, only supports the equals pattern, and its matching efficiency is affected by the index order. For each feature, when there are a large number of features with the same value, after the fast search algorithm finds the corresponding rule, it is necessary to traverse back and forth to find the range of rules with the same value, causing the time complexity of single feature matching to deteriorate from O(L) at worst to O(L*H). Similarly, this method will still increase the matching time and affect the matching efficiency. Method three involves sorting the rules separately for each dimension and using a fast search algorithm to obtain the retrieval rules within each individual rule set. Finally, the intersection of the matching results for each dimension is taken. While some dimensions might match all rules, this method requires sorting and storing all rules for each feature dimension, resulting in H repeated storage of rules. This increases the storage space to L*H*2. Consequently, the time complexity of taking the intersection after determining the matching rules for each feature is O(L^H), making it unsuitable for situations where many feature dimensions match, and it also consumes significant storage space. Therefore, the above method supports modes, storage space, and matching time complexity as described above. Figure 1 As shown, it can be seen that the current method of matching permission rules will have a significantly increased complexity as the number and dimensions of rules increase, making it impossible to quickly match permission rules.
[0032] Based on this, in order to solve the above-mentioned problems, this application provides a data processing method that abstracts the rule object into three dimensions, namely, permission rules, element matching modes, and element values, and provides three element matching conditions: equal to element matching mode, belonging to element matching mode, and any element matching mode. Each transaction element of the permission rule is grouped according to different element matching modes. Then, for each transaction element, rule matching is performed according to the equal to element matching mode, belonging to element matching mode, and any element matching mode. Multiple element matching modes of permission rules can be matched in a single filtering, reducing space consumption and mitigating the impact of newly added permission rules and duplicate element values on matching efficiency. Furthermore, by employing a depth-first memoized search algorithm to perform N rounds of permission rule matching, when a transaction element is located with an equal value, the permission rule range data of the matched permission rule can be directly obtained, ensuring low time complexity for querying each transaction element. Thus, the matching permission rule for each transaction request can be quickly located, improving transaction efficiency.
[0033] Based on this, embodiments of this application provide a data processing method, apparatus, device, and storage medium. The following will describe in conjunction with the appendix... Figures 2 to 6 This application describes in detail the data processing methods, apparatus, servers, and storage media of the embodiments thereof. It should be noted that these embodiments are not intended to limit the scope of this application.
[0034] First, the data processing architecture of the data processing method provided in the embodiments of this application will be described.
[0035] like Figure 2 As shown, the data processing architecture 10 may include a rule preprocessing module 101 and a rule matching module 102. The data processing architecture 10 described above will be described in detail below.
[0036] The rule preprocessing module 101 can be used to read all preset permission rules from the database in the data processing architecture 10 into memory, and sort the preset permission rules in sequence according to the preset rule data such as the mode identifier and preset element value corresponding to the preset element matching mode of each preset element. Furthermore, the rule preprocessing module 101 can also be used to traverse the entire sorted memory structure, mark the preset context relationship of the preset permission rules based on the dynamic programming algorithm, and store it in a three-dimensional array dp[3][L][P], where P is the element dimension, P is the total number of preset permission rules, for example, t is the sequence number of the preset permission rule, j is the preset element identifier, and dp[0][t][j] is the mode identifier number of the preset element matching mode (item_gruop) after the t-th preset permission rule of preset element j. The number of preset permission rules whose values are consecutive and identical to the preset permission rule, dp[1][t][j] is the number of preset permission rules whose mode identifier values of item_gruop are consecutive and different after the t-th preset permission rule of preset element j (all values greater than 0 are considered to be different, i.e., the number of rules belonging to the mode), dp[2][t][j] is the number of preset permission rules whose preset element value (item_value) is consecutive and identical to the preset permission rule after the t-th rule of preset element j, and its state transition equation is as follows Figure 3 As shown.
[0037] It should be noted that the rule preprocessing module 101 can arbitrarily expand the dimensions of preset elements, the preset elements in each dimension, and the total number of preset permission rules during the preprocessing process. Subsequently, based on the contextual relationship of the preset rules obtained through preprocessing, a memoized search algorithm is used to quickly locate the permission rule range data of the matched rule number, so as to quickly converge the rule search domain. Among them, the dimensions of preset elements can include regular dimensions and virtual dimensions. Further, regular dimensions can include at least one of the following: merchant, institution, resource card, user, transaction type; virtual dimensions can include at least one of the following: dynamic and static QR code identifier, cross-border merchant identifier, cross-border resource card identifier.
[0038] The rule matching module 102 can be used to receive transaction requests. The transaction request includes M transaction elements, each of which corresponds to a transaction element identifier, where M is an integer greater than 1. In one example, the rule matching module 102 can employ a depth-first memoized search algorithm. The set of permission rules matched by the previous transaction element is used as the input for matching the next transaction element. For each transaction element matching stage, multiple element matching modes, such as equal to element matching mode, belonging to element matching mode, and any element matching mode, are matched in multiple rounds. That is, multi-stage dynamic decision-making is performed. Under various element matching modes, the starting and ending matching positions of the binary search are determined according to the pre-processed record of the preset rule context relationship dp[0][t][j], dp[1][t][j], and dp[2][t][j], ensuring that the matching time complexity of each transaction element is O(logL). The permission rule range data matched in the current round is used as the input for the next stage. The depth-first search completes the matching of all transaction elements until all transaction elements are matched, and then the target permission rule corresponding to the transaction request is determined. In addition, when the matching result corresponding to a certain transaction element is an empty set, the matching ends, indicating that no rule is matched.
[0039] In this way, by preprocessing massive amounts of preset rules, such as through classification and aggregation, multiple element matching patterns can be obtained, making the transaction elements to be matched highly flexible. A single search can hit the target permission rules of multiple element matching patterns, improving the high flexibility of rule matching. By configuring the number of preset elements and the dimensions of each preset element, it can be expanded into a data processing architecture of arbitrary dimensions, thus improving the scalability of the data processing architecture. Furthermore, by using dynamic programming and memoized search algorithms, space consumption can be reduced to ensure that the matching time complexity of each transaction element is O(logN), unaffected by the number of preset permission rules or the duplication of element values, effectively reducing storage space and matching time complexity.
[0040] Based on the above, Figure 2 The data processing architecture shown below, combined with Figures 4 to 7 The data processing method provided in the embodiments of this application will be described.
[0041] First, the following combination Figure 4 The data processing method provided in the embodiments of this application will be described in detail.
[0042] Figure 4 This is a flowchart of a data processing method provided in an embodiment of this application.
[0043] like Figure 4 As shown, this data processing method can be applied to, for example... Figure 2The data processing architecture shown may include the following steps in its specific data processing method:
[0044] Step 410: Receive a transaction request. The transaction request includes M transaction elements, each of which corresponds to a transaction element identifier, where M is an integer greater than 1. Step 420: Perform N rounds of matching between the transaction element identifier and the permission rules corresponding to each of the multiple element matching patterns, obtaining the matching result for each of the N rounds. The matching result of the i-th round in the N rounds is used as the matching input for the (i+1)-th round. The matching result includes the permission rule range data for each element matching pattern in the current round and the transaction element identifier for the next round, where N is an integer greater than 1 and i is an integer greater than or equal to 1. Step 430: If the value of the transaction element identifier in the (i+1)-th round is greater than M, determine the target permission rule for the transaction request based on the matching result of the i-th round.
[0045] Therefore, for each transaction element, permission rules for each of the multiple element matching modes are matched in each round of matching. This allows for the matching of permission rules for multiple element matching modes with a single filter, reducing space consumption and mitigating the impact of newly added permission rules and duplicate element values on matching efficiency. Furthermore, by employing a depth-first memoized search algorithm to perform N rounds of permission rule matching, when a transaction element is found to have an equal value, the permission rule range data of the matched permission rule can be directly obtained, ensuring low time complexity for querying each transaction element. In this way, the matching permission rule for each transaction request can be quickly located, improving transaction efficiency.
[0046] The above steps are explained in detail below:
[0047] First, regarding step 420, in one or more possible embodiments, the N rounds of matching include the i-th round of matching and the (i+1)-th round of matching. Based on this, step 420 may specifically include:
[0048] Step 4201: Match the transaction element identifier with the permission rules corresponding to each of the multiple element matching patterns in the i-th round to obtain the matching result of the i-th round. The matching result of the i-th round includes the first permission rule range data of each element matching pattern in the i-th round and the transaction element identifier of the (i+1)-th round.
[0049] Based on this possible embodiment, step 430 may specifically include:
[0050] The first permission rule corresponding to the data within the first permission rule's scope is used to determine the target permission rule.
[0051] Furthermore, in one or more possible embodiments, the numerical value of the transaction element identifier corresponds to the number of matching rounds, and step 4201 mentioned above may specifically include:
[0052] Step 42011: Based on the transaction element identifier and the preset rule context relationship of each element matching pattern, calculate the starting and ending matching positions of each element matching pattern in the i-th round of matching.
[0053] Step 42012: Determine the starting matching position and the ending matching position as the first permission rule range data; and adjust the value of the transaction element identifier of the i-th round to the round number of the (i+1)-th round to obtain the transaction element identifier of the (i+1)-th round.
[0054] It should be noted that the number of rounds in the embodiments of this application can be cyclical. That is, the next round after the i-th round can be represented by either the (i+1)-th round or the (i=i+1)-th round. For example, if i=1, then the (i+1)-th round can be the 2nd round, and the (i=i+1)-th round can also be represented as the 2nd round. Similarly, continuing the cycle, the next round after the second round, if i is 2, then the (i+1)-th round can be the 3rd round, and the (i=i+1)-th round can also be represented as the 3rd round.
[0055] Specifically, in one example, each feature matching pattern is an arbitrary feature matching pattern, and the preset rule context relationship includes a first preset rule context relationship. Based on this, step 42011 above may specifically include:
[0056] Based on the context relationship of the first preset rule corresponding to the arbitrary element matching mode, determine whether the first preset permission rule corresponding to the context relationship of the first preset rule is associated with the transaction element identifier;
[0057] If the first preset permission rule is not associated with a transaction element identifier, the starting position of the first preset permission rule is determined as the starting matching position of the arbitrary element matching pattern in the i-th round of matching, and the ending position of the first preset permission rule is determined as the ending matching position of the arbitrary element matching pattern in the i-th round of matching.
[0058] In another example, each feature matching pattern is equal to the feature matching pattern, and the preset rule context relationship includes the second preset rule context relationship. Based on this, step 42011 above can specifically include:
[0059] By using a binary search method, based on the context relationship of the second preset rule corresponding to the element matching pattern, the element value of the second preset permission rule corresponding to the context relationship of the second preset rule is obtained;
[0060] When the element value of the second preset permission rule matches the transaction element value corresponding to the transaction element identifier, the starting position of the second preset permission rule is determined to be equal to the starting matching position of the element matching mode in the i-th round of matching, and the rule ending position of the second preset permission rule is determined to be equal to the ending matching position of the element matching mode in the i-th round of matching.
[0061] Conversely, if the element value of the second preset permission rule does not match the transaction element value corresponding to the transaction element identifier, a first prompt message is output. The first prompt message is used to indicate that no permission rule corresponding to the transaction request was matched in the equal element matching mode.
[0062] In another example, each feature matching pattern belongs to the feature matching pattern, and the preset rule context relationship includes the third preset rule context relationship. Based on this, step 42011 above may specifically include:
[0063] By using a binary search method, based on the context relationship of the third preset rule corresponding to the element matching mode, the mode identifier of the element matching mode of the third preset permission rule corresponding to the context relationship of the third preset rule is obtained.
[0064] If the pattern identifier of the element matching mode of the third preset permission rule matches the pattern identifier corresponding to the transaction element identifier, the starting position of the third preset permission rule is determined as the starting matching position of the element matching mode in the i-th round of matching, and the ending position of the rule of the third preset permission rule is determined as the ending matching position of the element matching mode in the i-th round of matching.
[0065] Conversely, if the pattern identifier of the element matching mode of the third preset permission rule does not match the pattern identifier corresponding to the transaction element identifier, a second prompt message is output. The second prompt message is used to indicate that no permission rule corresponding to the transaction request was matched in the element matching mode.
[0066] Therefore, by preprocessing the preset rules, using a dynamic programming algorithm, marking the preset context relationships, and recording the matching patterns of the same elements and the range of rule numbers with the same values, lower time complexity is achieved with less space storage. When matching rules, a depth-first memoized search algorithm is used. When an element is located with an equal value, the range of its matching rule numbers can be directly obtained, ensuring that the time complexity of each element query is always O(logL). Thus, it is not affected by the number of preset permission rules or the repetition of element values of preset elements, effectively reducing storage space and matching time complexity.
[0067] Based on this, in another or more possible embodiments, the preset rule context relationship involved in step 42011 can be determined through the following steps. Based on this, before step 32011, the data processing method may further include:
[0068] Step 42012: Obtain multiple preset elements and multiple preset permission rules respectively;
[0069] Step 42013: Preprocess the multiple preset elements and multiple preset permission rules to obtain preset rule data corresponding to each preset element among the multiple preset elements. The preset rule data includes preset element identifier, preset element matching mode, preset element value and a first preset permission rule including the preset element. The preset element matching mode corresponds to the mode identifier.
[0070] For example, each preset element can be stored as follows: Figure 5 The rule table data shown may include an auto-incrementing index (id), a preset feature identifier (item_def_id), a preset feature matching mode (item_group), a preset feature value (item_value), and a preset rule identifier (rule_id). Further, the preset feature matching mode may include any feature matching mode, equal feature matching mode, and belong feature matching mode, wherein the pattern identifier corresponding to the any feature matching mode can be recorded as -1, the pattern identifier corresponding to the equal feature matching mode can be recorded as 0, and the pattern identifier corresponding to the belong feature matching mode can be recorded as >0.
[0071] Step 42014: Sort multiple preset permission rules according to the preset order of the pattern identifiers of the preset element matching mode and the preset element values from largest to smallest.
[0072] Step 42015: Based on the dynamic programming algorithm, the preset rule context relationship of multiple preset permission rules after sorting is marked by preset markers.
[0073] The following provides a detailed explanation of steps 42012 to 42015 mentioned above.
[0074] In one example, the preset feature matching modes include any feature matching mode, equal to feature matching mode, and belong to feature matching mode. Step 42013 above may specifically include:
[0075] If the preset element in each preset permission rule meets the first preset condition, the preset element identifier of the preset element is associated with any element matching pattern.
[0076] If the preset elements in each preset permission rule do not meet the first preset condition, determine whether the preset elements in each preset permission rule meet the second preset condition.
[0077] If the preset elements in the preset permission rules meet the second preset condition, the preset element identifier of the preset element is associated with the equal element matching pattern.
[0078] Furthermore, if it is determined that a preset element in the preset permission rules does not meet the second preset condition, the preset element identifier of the preset element is associated with the element matching pattern to which it belongs; wherein,
[0079] The preset element in each preset permission rule does not meet the first preset condition including at least one of the following: the preset element in each preset permission rule is not an arbitrary value, or the preset element in each preset permission rule does not exist;
[0080] The second preset condition includes at least one of the following: the preset elements in each preset permission rule have been grouped, and the element identifier corresponding to the preset element in each preset permission rule is in the preset element identifier group.
[0081] In another example, the preset markers include a first preset marker, a second preset marker, and a third preset marker; the preset rule context relationships include consecutive and identical pattern identifiers, consecutive and dissimilar pattern identifiers, and identical preset element values. Based on this, step 42015 mentioned above may specifically include:
[0082] Based on the dynamic programming algorithm, the preset permission rules with consecutive and identical pattern identifiers of preset element matching patterns in multiple preset permission rules after sorting are marked by the first preset marker character.
[0083] The second preset marker character is used to mark the preset permission rules in which the pattern identifiers of the preset element matching patterns are consecutive and different among the multiple preset permission rules after sorting.
[0084] In addition, a third preset marker character is used to mark preset permission rules in which preset element values are the same among multiple preset permission rules after sorting.
[0085] For example, such as Figure 6 As shown, select preset element X, and determine whether preset permission rules do not include preset element X.
[0086] If the preset permission rules do not include the preset element X, then the preset element X will be associated with any element matching pattern, and the preset permission rules corresponding to any element matching pattern will be marked by the first preset marker character, such as =-1.
[0087] If a preset permission rule includes a preset element X, then determine whether the element identifier corresponding to the preset element X in each preset permission rule is in the preset element identifier group.
[0088] If the element identifier corresponding to preset element X is in the preset element identifier group, then preset element X is associated with the element matching pattern, and the preset permission rule corresponding to the element matching pattern is marked by a second preset marker character such as >0. If the element identifier corresponding to preset element X is not in the preset element identifier group, then preset element X is associated with the equal element matching pattern, and the preset permission rule corresponding to the equal element matching pattern is marked by a third preset marker character such as =0.
[0089] Furthermore, in one or more possible embodiments, after step 420, the data processing method may further include:
[0090] If the range of permission rules in the matching results of each of the N rounds of matching is an empty set, a third prompt message is output. The third prompt message is used to indicate that the transaction request did not match any permission rules.
[0091] In one or more possible embodiments, after step 430, the data processing method may further include:
[0092] Receive the first input for the target permission rule;
[0093] In response to the first input, adjust the target permission rules to obtain the adjusted target permission rules;
[0094] The target permission rule will be adjusted to be the permission rule for the transaction request.
[0095] Therefore, users can adjust the matched target permission rules according to their actual needs, improving adaptability to suit various scenarios.
[0096] To better illustrate the data processing method provided in the embodiments of this application, the following will be combined with... Figure 7 Examples of the above content are shown below.
[0097] like Figure 7 As shown, taking M as 2 as an example, based on this, a transaction request A is received. The transaction request A includes two transaction elements, such as transaction element 1 and transaction element 2. Each of the two transaction elements corresponds to a transaction element identifier, such as transaction element 1 corresponding to transaction element identifier ID1 and transaction element 2 corresponding to transaction element identifier ID2.
[0098] Next, the process of matching weight rules is initiated, the transaction element identifier ID1 is obtained, and it is determined whether the value of transaction element identifier ID1, i.e., 1, is greater than 2.
[0099] In the first round of matching, if the value of transaction element identifier ID1 is not greater than 2, the transaction element identifier ID1 is matched with the permission rules corresponding to each of the three element matching modes, namely equal to element matching mode, belonging to element matching mode, and any element matching mode, where i = 1.
[0100] Furthermore, when ID1 is matched with any element matching pattern, based on the context relationship of the first preset rule corresponding to the any element matching pattern (such as dp[0][t][j], dp[1][t][j], dp[2][t][j]), it is determined whether the first preset permission rule corresponding to the context relationship of the first preset rule is associated with ID1; if the first preset permission rule is not associated with ID1, the starting position of the rule of the first preset permission rule is determined as the starting matching position of the any element matching pattern in the first round of matching, and the ending position of the rule of the first preset permission rule is determined as the ending matching position of the any element matching pattern in the first round of matching; conversely, if the first preset permission rule is associated with ID1, the starting position of the rule of the first preset permission rule is determined as the starting matching position of the any element matching pattern in the first round of matching, and the ending position of the rule of the first preset permission rule is determined as the ending matching position of the any element matching pattern in the first round of matching, and the transaction element identifier of the second round is adjusted to ID2.
[0101] Furthermore, when matching ID1 with the equal-element matching pattern, a binary search is used to obtain the element value of the second preset permission rule corresponding to the second preset rule context relationship (e.g., dp[0][t][j], dp[1][t][j], dp[2][t][j]) based on the equal-element matching pattern, and it is determined whether the element value of the second preset permission rule matches the transaction element value corresponding to ID1. If the element value of the second preset permission rule matches the transaction element value corresponding to ID1, the starting position of the second preset permission rule is determined as the starting matching position of the equal-element matching pattern in the first round of matching, and the ending position of the second preset permission rule is determined as the ending matching position of the equal-element matching pattern in the first round of matching, and the transaction element identifier for the second round is adjusted to ID2. It should be noted that if the element value of the second preset permission rule does not match the transaction element value corresponding to ID1, a first prompt message is output. The first prompt message indicates that no permission rule corresponding to the transaction request was matched in the equal-element matching pattern.
[0102] Furthermore, when ID1 is matched with the element matching mode, a binary search is used to obtain the mode identifier of the element matching mode of the third preset permission rule corresponding to the element matching mode (e.g., dp[0][t][j], dp[1][t][j], dp[2][t][j]) based on the context relationship of the third preset rule corresponding to the element matching mode, and it is determined whether the mode identifier of the element matching mode of the third preset permission rule matches the mode identifier corresponding to ID1. When the mode identifier of the element matching mode of the third preset permission rule matches the mode identifier corresponding to ID1, the starting position of the third preset permission rule is determined as the starting matching position of the element matching mode in the first round of matching, and the ending position of the rule of the third preset permission rule is determined as the ending matching position of the element matching mode in the first round of matching. Here, it should be noted that when the mode identifier of the element matching mode of the third preset permission rule does not match the mode identifier corresponding to the transaction element identifier, a second prompt message is output. The second prompt message is used to indicate that no permission rule corresponding to the transaction request was matched in the element matching mode.
[0103] In the second round of matching, if the value of transaction element identifier ID2 is not greater than 2, the transaction element identifier ID2 is matched again with the permission rules corresponding to each of the three element matching modes, namely equal to element matching mode, belonging to element matching mode, and any element matching mode, where i = i + 1.
[0104] Furthermore, when ID2 is matched with any element matching pattern, based on the context relationship of the first preset rule corresponding to the any element matching pattern (such as dp[0][t][j], dp[1][t][j], dp[2][t][j]), it is determined whether the first permission rule between the starting matching position and the ending matching position of the first round of matching is associated with ID2. If the first permission rule is not associated with ID1, the starting position of the first preset permission rule is determined as the starting matching position of the any element matching pattern in the second round of matching, and the ending position of the first preset permission rule is determined as the ending matching position of the any element matching pattern in the second round of matching. Conversely, if the first permission rule is associated with ID2, the starting position of the first preset permission rule is determined as the starting matching position of the any element matching pattern in the second round of matching, and the ending position of the first preset permission rule is determined as the ending matching position of the any element matching pattern in the second round of matching, and the transaction element identifier of the third round is adjusted to ID3.
[0105] Furthermore, when matching ID2 with the equal-element matching pattern, a binary search is used to obtain the element value of the second permission rule between the start and end positions of the first round of matching for the equal-element matching pattern, based on the context of the second preset rule corresponding to the equal-element matching pattern (e.g., dp[0][t][j], dp[1][t][j], dp[2][t][j]). It is then determined whether the element value of the second permission rule matches the transaction element value corresponding to ID2. If the element value of the second permission rule matches the transaction element value corresponding to ID1, the rule start position of the second permission rule is determined as the start matching position of the equal-element matching pattern in the second round of matching, and the rule end position of the second permission rule is determined as the end matching position of the equal-element matching pattern in the second round of matching. The transaction element identifier for the third round is then adjusted to ID3. It should be noted that if the element value of the second permission rule does not match the transaction element value corresponding to ID2, a first prompt message is output. This first prompt message indicates that no permission rule corresponding to the transaction request was matched in the equal-element matching pattern.
[0106] Furthermore, when ID2 is matched with the element matching pattern, a binary search is used to obtain the pattern identifier of the element matching pattern of the third permission rule between the start matching position and the end position of the rule in the first round of matching, based on the context relationship of the third preset rule corresponding to the element matching pattern (e.g., dp[0][t][j], dp[1][t][j], dp[2][t][j]). It is then determined whether the pattern identifier of the element matching pattern of the third permission rule matches the pattern identifier corresponding to ID2. If the pattern identifier of the element matching pattern of the third permission rule matches the pattern identifier corresponding to ID2, the rule start position of the third permission rule is determined as the start matching position of the element matching pattern in the second round of matching, and the rule end position of the third permission rule is determined as the end matching position of the element matching pattern in the second round of matching. It should be noted that if the pattern identifier of the element matching pattern of the third permission rule does not match the pattern identifier corresponding to the transaction element identifier, a second prompt message is output. This second prompt message indicates that no permission rule corresponding to the transaction request was matched in the element matching pattern.
[0107] Based on this, in the third round of matching, if the value of the transaction element identifier ID3 is greater than 2, the target permission rule is determined by the permission rules between the start and end matching positions of each element matching mode output by the second round of matching process, which is equal to the element matching mode, belongs to the element matching mode, and any element matching mode.
[0108] Based on the same inventive concept, this application also provides a data processing device. (Specifically combined with...) Figure 8 Please provide a detailed explanation.
[0109] Figure 8 This is a schematic diagram of the structure of a data processing apparatus provided in one embodiment of this application.
[0110] In some embodiments of this application, Figure 8 The data processing device shown can be set in, for example Figure 9 The computer equipment shown.
[0111] like Figure 8 As shown, the data processing device 80 may specifically include:
[0112] The receiving module 801 is used to receive a transaction request, which includes M transaction elements. Each of the M transaction elements corresponds to a transaction element identifier, and M is an integer greater than 1.
[0113] The matching module 802 is used to perform N rounds of matching between the transaction element identifier and the permission rules corresponding to each element matching mode in multiple element matching modes, to obtain the matching result of each round of matching in N rounds; wherein, the matching result of the i-th round in N rounds of matching is used as the matching input of the (i+1)-th round, and the matching result includes the permission rule range data of each element matching mode in the current round and the transaction element identifier of the next round, where N is an integer greater than 1 and i is an integer greater than or equal to 1;
[0114] The determination module 803 is used to determine the target permission rule of the transaction request based on the matching result of the i-th round if the value of the transaction element identifier in the (i+1)-th round is greater than M.
[0115] The data processing device 80 in the embodiments of this application will be described in detail below.
[0116] In one or more optional embodiments, the matching module 802 may be specifically used to, in the case that N rounds of matching include the i-th round of matching and the (i+1)-th round of matching, match the transaction element identifier with the permission rule corresponding to each of the multiple element matching modes in the i-th round to obtain the matching result of the i-th round. The matching result of the i-th round includes the first permission rule range data of each element matching mode in the i-th round of matching and the transaction element identifier of the (i+1)-th round.
[0117] In another or more alternative embodiments, the determining module 803 may be specifically used to determine the target permission rule from the first permission rule corresponding to the first permission rule range data.
[0118] In another or more alternative embodiments, the data processing device 80 in this application embodiment may further include a calculation module and a first adjustment module;
[0119] The calculation module is used to calculate the starting and ending matching positions of each element matching pattern in the i-th round of matching, based on the context of the transaction element identifier and the preset rule of each element matching pattern, when the value of the transaction element identifier corresponds to the number of matching rounds.
[0120] The determination module 803 can also be used to determine the start matching position and the end matching position as the first permission rule range data;
[0121] The first adjustment module is used to adjust the value of the transaction element identifier in the i-th round to the round number of the (i+1)-th round, so as to obtain the transaction element identifier in the (i+1)-th round.
[0122] In another or more alternative embodiments, the determining module 803 may also be used to determine, in the case where each element matching mode is any element matching mode and the preset rule context relationship includes the first preset rule context relationship, whether the first preset permission rule corresponding to the first preset rule context relationship is associated with the transaction element identifier based on the first preset rule context relationship corresponding to the any element matching mode.
[0123] If the first preset permission rule is not associated with a transaction element identifier, the starting position of the first preset permission rule is determined as the starting matching position of the arbitrary element matching pattern in the i-th round of matching, and the ending position of the first preset permission rule is determined as the ending matching position of the arbitrary element matching pattern in the i-th round of matching.
[0124] In another or more alternative embodiments, the data processing device 80 in this application embodiment may further include a first acquisition module;
[0125] The first acquisition module is used to acquire the element value of the second preset permission rule corresponding to the second preset rule context relationship by means of a binary search method when the element matching mode is equal to the element matching mode and the preset rule context relationship includes the second preset rule context relationship.
[0126] The determining module 803 can also be used to, when the element value of the second preset permission rule matches the transaction element value corresponding to the transaction element identifier, determine the starting position of the second preset permission rule to be equal to the starting matching position of the element matching mode in the i-th round of matching, and determine the rule ending position of the second preset permission rule to be equal to the ending matching position of the element matching mode in the i-th round of matching.
[0127] In another or more alternative embodiments, the data processing device 80 in this application embodiment may further include a first output module;
[0128] The first output module is used to output a first prompt message when the element value of the second preset permission rule does not match the transaction element value corresponding to the transaction element identifier. The first prompt message is used to indicate that no permission rule corresponding to the transaction request was matched in the equal element matching mode.
[0129] In another or more alternative embodiments, the data processing device 80 in this application embodiment may further include a second acquisition module;
[0130] The second acquisition module is used to, in the case where each element matching mode belongs to the element matching mode and the preset rule context relationship includes the third preset rule context relationship, obtain the mode identifier of the element matching mode of the third preset permission rule corresponding to the third preset rule context relationship by means of a binary search method.
[0131] The determining module 803 can also be used to, when the pattern identifier of the element matching mode of the third preset permission rule matches the pattern identifier corresponding to the transaction element identifier, determine the starting position of the third preset permission rule as the starting matching position of the element matching mode in the i-th round of matching, and determine the rule ending position of the third preset permission rule as the ending matching position of the element matching mode in the i-th round of matching.
[0132] In another or more alternative embodiments, the data processing device 80 in this application embodiment may further include a second output module;
[0133] The second output module is used to output a second prompt message when the pattern identifier of the element matching mode of the third preset permission rule does not match the pattern identifier corresponding to the transaction element identifier. The second prompt message is used to indicate that no permission rule corresponding to the transaction request was matched in the element matching mode.
[0134] In another or more alternative embodiments, the data processing device 80 in this application embodiment may further include a third output module, a processing module, a sorting module and a marking module;
[0135] The third output module is used to obtain multiple preset elements and multiple preset permission rules respectively;
[0136] The processing module is used to preprocess multiple preset elements and multiple preset permission rules to obtain preset rule data corresponding to each preset element among the multiple preset elements. The preset rule data includes a preset element identifier, a preset element matching mode, a preset element value, and a first preset permission rule including the preset element. The preset element matching mode corresponds to the mode identifier.
[0137] The sorting module is used to sort multiple preset permission rules according to the preset order of the pattern identifiers of the preset element matching mode and the preset element values in descending order.
[0138] The tagging module is used to mark the preset rule context relationship of multiple preset permission rules after sorting, based on the dynamic programming algorithm and using preset tags.
[0139] In another or more alternative embodiments, the marking module may be specifically used to, when the preset markers include a first preset marker, a second preset marker, and a third preset marker, and the preset rule context relationship includes a relationship of continuous and identical pattern identifiers, a relationship of continuous and different pattern identifiers, and a relationship of identical preset element values, mark the preset permission rules with continuous and identical pattern identifiers among the sorted preset permission rules based on a dynamic programming algorithm, using the first preset marker character;
[0140] The second preset marker character is used to mark the preset permission rules in which the pattern identifiers of the preset element matching patterns are consecutive and different among the multiple preset permission rules after sorting.
[0141] In addition, a third preset marker character is used to mark preset permission rules in which preset element values are the same among multiple preset permission rules after sorting.
[0142] In another or more alternative embodiments, the processing module can also be used to associate the preset element identifier of the preset element with the arbitrary element matching mode when the preset element matching mode includes any element matching mode, equal to element matching mode and belonging to element matching mode, and when the preset element in each preset permission rule satisfies the first preset condition.
[0143] If the preset elements in each preset permission rule do not meet the first preset condition, determine whether the preset elements in each preset permission rule meet the second preset condition.
[0144] If the preset elements in the preset permission rules meet the second preset condition, the preset element identifier of the preset element is associated with the equal element matching pattern.
[0145] Furthermore, if it is determined that a preset element in the preset permission rules does not meet the second preset condition, the preset element identifier of the preset element is associated with the element matching pattern to which it belongs; wherein,
[0146] The preset element in each preset permission rule does not meet the first preset condition including at least one of the following: the preset element in each preset permission rule is not an arbitrary value, or the preset element in each preset permission rule does not exist;
[0147] The second preset condition includes at least one of the following: the preset elements in each preset permission rule have been grouped, and the element identifier corresponding to the preset element in each preset permission rule is in the preset element identifier group.
[0148] In another or more alternative embodiments, the data processing device 80 in this application embodiment may further include a third output module; wherein,
[0149] The third output module is used to output a third prompt message when the range of permission rules in the matching results of each round of matching in N rounds is an empty set. The third prompt message is used to indicate that the transaction request did not match any permission rules.
[0150] In another or more alternative embodiments, the data processing device 80 in this application embodiment may further include a second adjustment module; wherein,
[0151] The receiving module 801 is also used to receive the first input on the target permission rule;
[0152] The second adjustment module is used to adjust the target permission rules in response to the first input, and obtain the adjusted target permission rules;
[0153] The determination module 803 can also be used to determine the target permission rule to be the permission rule for the transaction request.
[0154] Therefore, by receiving a transaction request containing M transaction elements, each of the M transaction elements corresponds to a transaction element identifier; then, the transaction element identifier is matched with the permission rules corresponding to each of the multiple element matching patterns in N rounds to obtain the matching result of each round of N rounds. The matching result of the i-th round in the N rounds is used as the matching input of the (i+1)-th round. The matching result includes the permission rule range data of each element matching pattern in the current round and the transaction element identifier of the next round. Then, if the value of the transaction element identifier in the (i=i+1)-th round is greater than M, the target permission rule of the transaction request is determined according to the matching result of the (i+1)-th round. Therefore, for each transaction element, permission rules for each of the multiple element matching modes are matched in each round of matching. This allows for the matching of permission rules for multiple element matching modes with a single filter, reducing space consumption and mitigating the impact of newly added permission rules and duplicate element values on matching efficiency. Furthermore, by employing a depth-first memoized search algorithm to perform N rounds of permission rule matching, when a transaction element is found to have an equal value, the permission rule range data of the matched permission rule can be directly obtained, ensuring low time complexity for querying each transaction element. In this way, the matching permission rule for each transaction request can be quickly located, improving transaction efficiency.
[0155] Based on the same inventive concept, this application also provides a computer device. (Specifically combined with...) Figure 9 Please provide a detailed explanation.
[0156] Figure 9 This is a schematic diagram of the structure of a computer device provided in one embodiment of this application.
[0157] like Figure 9 As shown, the computer device may include at least one of the following as described in the embodiments of this application: an electronic device, a server. The computer device may include a processor 901 and a memory 902 storing computer program instructions.
[0158] Specifically, the processor 901 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0159] Memory 902 may include a large-capacity memory for data or instructions. For example, and not limitingly, memory 902 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 902 may include removable or non-removable (or fixed) media. Where appropriate, memory 902 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 902 is non-volatile solid-state memory. In a particular embodiment, memory 902 includes solid-state storage (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0160] The processor 901 implements any of the data processing methods described in the above embodiments by reading and executing computer program instructions stored in the memory 902.
[0161] In one example, the computer device may also include a communication interface 903 and a bus 910. Wherein, as... Figure 9 As shown, the processor 901, memory 902, and communication interface 903 are connected through bus 910 and complete communication with each other.
[0162] The communication interface 903 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0163] Bus 910 includes hardware, software, or both, that couples components of a flow control device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 910 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.
[0164] The data processing device can execute the data processing method described in the embodiments of this application, thereby achieving the combination Figures 2 to 7 The data processing methods and apparatus described.
[0165] Furthermore, in conjunction with the data processing methods in the above embodiments, this application embodiment can provide a computer-readable storage medium for implementation. This computer-readable storage medium stores computer program instructions; when executed by a processor, these computer program instructions implement any of the data processing methods in the above embodiments.
[0166] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0167] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0168] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0169] The above are merely specific embodiments of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A data processing method, comprising: Receive a transaction request, which includes M transaction elements, each of the M transaction elements corresponding to a transaction element identifier, where M is an integer greater than 1; The transaction element identifier is matched with the permission rules corresponding to each element matching pattern in the multiple element matching patterns in the i-th round to obtain the matching result of the i-th round. The matching result of the i-th round includes the first permission rule range data matched by each element matching pattern in the i-th round and the transaction element identifier of the (i+1)-th round. The matching result of the i-th round serves as the matching input for the (i+1)-th round. The matching result includes the permission rule range data matched by each element matching pattern in the current round and the transaction element identifier of the next round, where i is an integer greater than or equal to 1. The permission rule range includes the starting matching position and the ending matching position of each element matching pattern in the i-th round. The starting matching position is the rule start position of the preset permission rule, and the ending matching position is the rule end position of the preset permission rule. The preset permission rules are arranged according to the preset order of the pattern identifiers of the preset element matching patterns and the preset element values in descending order. If the value of the transaction element identifier in the (i+1)th round is greater than M, the target permission rule for the transaction request is determined based on the matching result of the i-th round.
2. The method according to claim 1, characterized in that, The step of determining the target permission rule for the transaction request based on the matching result of the i-th round includes: The target permission rule is determined by the first permission rule corresponding to the first permission rule range data.
3. The method according to claim 1, characterized in that, The numerical value of the transaction element identifier corresponds to the number of matching rounds; The step of performing the i-th round of matching between the transaction element identifier and the permission rule corresponding to each of the multiple element matching patterns to obtain the matching result for the i-th round includes: Based on the transaction element identifier and the preset rule context relationship of each element matching pattern, calculate the starting matching position and ending matching position of each element matching pattern in the i-th round of matching; The starting matching position and the ending matching position are determined as the first permission rule range data; In addition, the value of the transaction element identifier of the i-th round is adjusted to the round number of the (i+1)-th round to obtain the transaction element identifier of the (i+1)-th round.
4. The method according to claim 3, characterized in that, Each element matching mode is an arbitrary element matching mode, and the preset rule context relationship includes the first preset rule context relationship; The step of calculating the start and end matching positions of each element matching pattern in the i-th round of matching, based on the contextual relationship between the transaction element identifier and the preset rules of each element matching pattern, includes: Based on the first preset rule context relationship corresponding to the arbitrary element matching mode, determine whether the first preset permission rule corresponding to the first preset rule context relationship is associated with the transaction element identifier; When the first preset permission rule is not associated with the transaction element identifier, the starting position of the first preset permission rule is determined as the starting matching position of the arbitrary element matching mode in the i-th round of matching, and the ending position of the first preset permission rule is determined as the ending matching position of the arbitrary element matching mode in the i-th round of matching.
5. The method according to claim 3, characterized in that, Each element matching mode is equal to the element matching mode, and the preset rule context relationship includes the second preset rule context relationship; The step of calculating the start and end matching positions of each element matching pattern in the i-th round of matching, based on the contextual relationship between the transaction element identifier and the preset rules of each element matching pattern, includes: By using a binary search method, based on the context relationship of the second preset rule corresponding to the equal element matching pattern, the element value of the second preset permission rule corresponding to the context relationship of the second preset rule is obtained; When the element value of the second preset permission rule matches the transaction element value corresponding to the transaction element identifier, the starting position of the second preset permission rule is determined as the starting matching position of the equal element matching mode in the i-th round of matching, and the rule ending position of the second preset permission rule is determined as the ending matching position of the equal element matching mode in the i-th round of matching.
6. The method according to claim 5, characterized in that, The method further includes: If the element value of the second preset permission rule does not match the transaction element value corresponding to the transaction element identifier, a first prompt message is output. The first prompt message is used to indicate that no permission rule corresponding to the transaction request was matched in the equal element matching mode.
7. The method according to claim 3, characterized in that, Each element matching mode is a feature matching mode, and the preset rule context relationship includes a third preset rule context relationship; The step of calculating the start and end matching positions of each element matching pattern in the i-th round of matching, based on the contextual relationship between the transaction element identifier and the preset rules of each element matching pattern, includes: By using a binary search method, based on the context relationship of the third preset rule corresponding to the element matching mode, the mode identifier of the element matching mode of the third preset permission rule corresponding to the context relationship of the third preset rule is obtained. If the pattern identifier of the element matching mode of the third preset permission rule matches the pattern identifier corresponding to the transaction element identifier, the starting position of the third preset permission rule is determined as the starting matching position of the element matching mode in the i-th round of matching, and the ending position of the rule of the third preset permission rule is determined as the ending matching position of the element matching mode in the i-th round of matching.
8. The method according to claim 7, characterized in that, The method further includes: If the pattern identifier of the element matching mode of the third preset permission rule does not match the pattern identifier corresponding to the transaction element identifier, a second prompt message is output. The second prompt message is used to indicate that no permission rule corresponding to the transaction request was matched in the element matching mode.
9. The method according to claim 3, characterized in that, The method further includes calculating the start and end matching positions of each element matching pattern before the i-th round of matching, based on the context relationship between the transaction element identifier and the preset rule of each element matching pattern. Retrieve multiple preset elements and multiple preset permission rules respectively; The plurality of preset elements and the plurality of preset permission rules are preprocessed to obtain preset rule data corresponding to each preset element among the plurality of preset elements. The preset rule data includes a preset element identifier, a preset element matching mode, a preset element value, and a first preset permission rule including the preset element. The preset element matching mode corresponds to a mode identifier. The multiple preset permission rules are sorted according to the preset order of the pattern identifiers of the preset element matching mode and the preset element values in descending order. Based on the dynamic programming algorithm, the preset rule context relationship of multiple preset permission rules after sorting is marked by preset markers.
10. The method according to claim 9, characterized in that, The preset markers include a first preset marker, a second preset marker, and a third preset marker; the preset rule context relationships include a relationship where pattern identifiers are consecutive and identical, a relationship where pattern identifiers are consecutive and different, and a relationship where preset element values are identical; The dynamic programming algorithm-based method uses preset markers to mark the contextual relationships of multiple preset permission rules after sorting, including: Based on the dynamic programming algorithm, the first preset marker is used to mark the preset permission rules in the sorted preset permission rules whose preset element matching patterns are continuous and have the same relationship. The second preset marker is used to mark preset permission rules in which the pattern identifiers of preset element matching patterns are continuous and different among multiple preset permission rules after sorting. In addition, the third preset marker marks the preset permission rules in the sorted plurality of preset permission rules that have the same preset element value relationship.
11. The method according to claim 9, characterized in that, The preset element matching modes include any element matching mode, equal to element matching mode, and belonging to element matching mode. The preprocessing of the plurality of preset elements and the plurality of preset permission rules to obtain preset rule data corresponding to each of the plurality of preset elements includes: If the preset element in each of the plurality of preset permission rules satisfies the first preset condition, the preset element identifier of the preset element is associated with the arbitrary element matching pattern. If the preset element in each preset permission rule does not meet the first preset condition, determine whether the preset element in each preset permission rule meets the second preset condition. If it is determined that the preset element in the preset permission rule meets the second preset condition, the preset element identifier of the preset element is associated with the equal element matching pattern; Furthermore, if it is determined that a preset element in the preset permission rule does not meet the second preset condition, the preset element identifier of the preset element is associated with the element matching pattern to which it belongs; wherein, The fact that the preset element in each preset permission rule does not satisfy the first preset condition includes at least one of the following: the preset element in each preset permission rule is not an arbitrary value, or the preset element in each preset permission rule does not exist; The second preset condition includes at least one of the following: the preset elements in each preset permission rule have been grouped, and the element identifier corresponding to the preset element in each preset permission rule is in the preset element identifier group.
12. The method according to claim 1, characterized in that, The method further includes: If the range of permission rules in the matching results of each round is an empty set, a third prompt message is output, which indicates that the transaction request has not matched any permission rules.
13. The method according to claim 1, characterized in that, The method further includes: Receive the first input for the target permission rule; In response to the first input, the target permission rule is adjusted to obtain the adjusted target permission rule; The adjusted target permission rule is determined as the permission rule for the transaction request.
14. A data processing apparatus, comprising: A receiving module is used to receive a transaction request, the transaction request including M transaction elements, each of the M transaction elements corresponding to a transaction element identifier, where M is an integer greater than 1; A matching module is used to perform an i-th round of matching between the transaction element identifier and the permission rules corresponding to each element matching mode in a plurality of element matching modes, to obtain the matching result of the i-th round. The matching result of the i-th round includes the first permission rule range data of each element matching mode in the i-th round and the transaction element identifier of the (i+1)-th round. The matching result of the i-th round serves as the matching input for the (i+1)-th round. The matching result includes the permission rule range data of each element matching mode in the current round and the transaction element identifier of the next round, where i is an integer greater than or equal to 1. The permission rule range includes the starting matching position and the ending matching position of each element matching mode in the i-th round. The starting matching position is the rule start position of a preset permission rule, and the ending matching position is the rule end position of a preset permission rule. The preset permission rules are arranged according to a preset order of the mode identifiers of the preset element matching modes and a preset element value in descending order. The determination module is used to determine the target permission rule of the transaction request based on the matching result of the i-th round if the value of the transaction element identifier in the (i+1)-th round is greater than M.
15. A computer device, the device comprising: Processor and memory storing computer program instructions; When the processor executes the computer program instructions, it implements the data processing method as described in any one of claims 1-13.
16. A storage medium storing computer program instructions, which, when executed by a processor, implement the data processing method as described in any one of claims 1-13.
Citation Information
Patent Citations
Rule matching method and device
CN106874255A
Transaction data matching method and device
CN112862608A