Airway availability document processing method, device, equipment, medium and product
By preprocessing and stacking the route availability document and directly performing logical calculations, the problem of lengthy processing processes in the existing technology is solved, and more efficient rule analysis and processing is achieved.
Patent Information
- Application Number
- CN202410878162.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2025-04-18
AI Technical Summary
The process of the existing technology of AVR availability document processing methods is relatively lengthy and it is difficult to achieve efficient rule analysis.
By preprocessing the route availability document to be processed, the preprocessed document is obtained; then the preprocessed document is scanned, the operator is pushed into the operator stack, and the sub-rule template is pushed into the rule stack; according to the operator priority in the operator stack, the rules in the rule stack are logically calculated to obtain the final rule result.
Simplifies the process of route availability document processing, avoids the steps of generating abstract syntax trees and establishing virtual machines, and improves processing efficiency and performance.
Smart Images

Figure CN119847529A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment, medium and product for processing route availability documents. Background Art
[0002] In order to unify the management of airspace, make more rational use of airspace resources, reduce flow control and improve flight regularity, the European Union proposed the ONESKY concept. The Route Availability Document (RAD) was created by the European Organization for the Safety of Air Navigation (EUROCONTROL) based on the ONESKY concept. It describes the rules and constraints that must be followed to achieve legal route selection. However, although RAD has customized rule grammar to describe business rules, it is still a human-oriented language and has not formed strict structured grammar rules, which makes it impossible for machines to process directly.
[0003] Currently, the target code of RAD is generated mainly through the steps of preprocessing, lexical analysis, syntax analysis to generate an abstract syntax tree and parse the abstract syntax tree. Finally, a virtual machine is constructed to parse the target code to achieve the parsing of RAD. However, this method is relatively lengthy. Summary of the invention
[0004] The present application provides a route availability document processing method, device, equipment, medium and product to solve the problem that the process of the route availability document processing method in the prior art is relatively lengthy.
[0005] To achieve the above object, an embodiment of the present application provides a method for processing a route availability document, comprising:
[0006] Preprocessing the route availability document to be processed to obtain a preprocessed route availability document;
[0007] Scanning the preprocessed route availability document, pushing the scanned operators into an operator stack, and pushing the scanned sub-rule templates into a rule stack;
[0008] According to the priorities of the operators in the operator stack, logical calculations are performed on the rules in the rule stack to obtain final rule results.
[0009] As an improvement of the above solution, the logic calculation is performed on the rules in the rule stack according to the priority of the operators in the operator stack to obtain the final rule result, including:
[0010] When a new operator is pushed into the operator stack, if a first start-up calculation condition is met, the current top operator and the previous operator of the current top operator are popped from the operator stack, and are recorded as the first operator and the second operator respectively; wherein the first start-up calculation condition includes: the priority of the current top operator in the operator stack is less than or equal to the previous operator of the current top operator, and the current top operator and the previous operator of the current top operator are not operator seq;
[0011] When the scanning is completed, if the second start calculation condition is met, the current top operator is popped from the operator stack, and it is determined whether the popped current top operator is an operator represented by a right bracket. If so, it is recorded as the first operator, and the current top operator is continuously popped from the operator stack and recorded as the second operator. If not, it is recorded as the second operator. The second start calculation condition includes: the operator stack has an operator;
[0012] The rules in the rule stack are logically calculated according to the second operator to obtain a rule result, which is pushed into the rule stack until there is no operator in the operator stack after the scanning is completed, thereby obtaining a final rule result.
[0013] As an improvement of the above solution, the second operator is used to perform a logical calculation on the rules in the rule stack to obtain a rule result, which is pushed into the rule stack until the operator stack has no operators after the scanning is completed, and a final rule result is obtained, including:
[0014] When the second operator is operator seq, continue to pop the current top operator from the operator stack until the current top operator popped is not operator seq, and count the first number of the continuously popped operator seq; pop the current top sub-rule templates from the rule stack in sequence until the second number of the current top sub-rule templates popped is 1 more than the first number;
[0015] Calculation rule results In the formula, array[i] represents the i-th current stack top sub-rule template popped out, array[i+1] represents the i+1-th current stack top sub-rule template popped out, and counter represents the second quantity;
[0016] When the second operator is an operator characterized as a left parenthesis, the rule result is not evaluated;
[0017] When the second operator is the operator not, the top rule template of the current stack is popped from the rule stack and recorded as the first rule, and the rule result result = not rule is calculated; wherein rule represents the first rule, and not is the operator;
[0018] When the second operator is other operators, the current top sub-rule template is popped from the rule stack and recorded as the second rule, and the current top sub-rule template is continuously popped from the rule stack and recorded as the third rule, and the rule result result = leftRule curOp rightRule is calculated; wherein leftRule represents the third rule, rightRule represents the second rule, and curOp represents the second operator;
[0019] The rule result is pushed into the rule stack. If the first operator exists, the first operator is pushed into the operator stack, and the current top operator is continuously popped from the operator stack to calculate the rule result until there is no operator in the operator stack after the scan is completed, thereby obtaining the final rule result.
[0020] As an improvement of the above scheme, the priority of the operators in the operator stack is from high to low: first-level operators, second-level operators and third-level operators; among which, the first-level operators are operators represented by brackets and operator seq; the second-level operator is operator not, and the third-level operators are operator and and operator or.
[0021] As an improvement of the above solution, the process of preprocessing the route availability document to be processed to obtain the preprocessed route availability document includes:
[0022] According to the preset restoration rules, the hidden logical operators in the route availability document to be processed are restored to obtain the preprocessed route availability document.
[0023] As an improvement of the above solution, the restoration rules include:
[0024] When it is determined that the first sub-rule templates in the route availability document to be processed are directly connected, restoring the hidden logical operator and between the first sub-rule templates;
[0025] When it is determined that the second sub-rule templates in the route availability document to be processed are separated by a digital sequence number as a prefix, the hidden logical operator or between the second sub-rule templates is restored;
[0026] When it is determined that the sub-rule template except-via exists in the route availability document to be processed, a not operation is performed on all sub-rule template results after the sub-rule template except-via.
[0027] To achieve the above purpose, the embodiment of the present application further provides a route availability document processing device, including:
[0028] A preprocessing module, used for preprocessing the route availability document to be processed to obtain a preprocessed route availability document;
[0029] A stacking module, configured to scan the preprocessed route availability document, push the scanned operators into an operator stack, and push the scanned sub-rule templates into a rule stack;
[0030] The final rule result generating module is used to perform logical calculations on the rules in the rule stack according to the priorities of the operators in the operator stack to obtain the final rule result.
[0031] To achieve the above-mentioned purpose, an embodiment of the present application also provides a route availability document processing device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and the processor implements the route availability document processing method as described above when executing the computer program.
[0032] To achieve the above-mentioned purpose, an embodiment of the present application also provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute the route availability document processing method as described above.
[0033] To achieve the above objectives, an embodiment of the present application further provides a computer program product including a computer program / instructions, which, when executed by a processor, implements the route availability document processing method as described above.
[0034] Compared with the prior art, the embodiments of the present application provide a route availability document processing method, apparatus, device, medium and product, which preprocesses the route availability document to be processed to obtain a preprocessed route availability document; scans the preprocessed route availability document, pushes the scanned operators into an operator stack, and pushes the scanned sub-rule templates into a rule stack; and performs logical calculations on the rules in the rule stack according to the priorities of the operators in the operator stack to obtain final rule results. There is no need to generate an abstract syntax tree or to establish a virtual machine to parse the target code. The process is more concise, the difficulty of implementation is greatly reduced, and the performance is also improved to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is a flow chart of a method for processing route availability documents provided by an embodiment of the present application;
[0036] Figure 2 is another flow chart of a method for processing a route availability document provided by an embodiment of the present application;
[0037] Figure 3 is a first flow chart of a specific example provided in an embodiment of the present application;
[0038] Figure 4 is a specific example second flow chart provided in the embodiment of the present application;
[0039] Figure 5 is a third flow chart of a specific example provided in an embodiment of the present application;
[0040] Figure 6 is a fourth flow chart of a specific example provided in an embodiment of the present application;
[0041] Figure 7 is a fifth flow chart of a specific example provided in an embodiment of the present application;
[0042] Figure 8 is the sixth flow chart of a specific example provided in the embodiment of the present application;
[0043] Fig. 9 is the seventh flow chart of a specific example provided in the embodiment of the present application;
[0044] Fig.10 This is the eighth flow chart of the specific example provided in the embodiment of the present application;
[0045] Fig.11 is the ninth flow chart of the specific example provided in the embodiment of the present application;
[0046] Fig.12 is the tenth flow chart of a specific example provided in the embodiment of the present application;
[0047] Fig.13 is a specific example eleventh flow chart provided in the embodiment of the present application;
[0048] Fig.14 is a twelfth flow chart of a specific example provided in an embodiment of the present application;
[0049] Fig.15 is a thirteenth flow chart of a specific example provided in an embodiment of the present application;
[0050] Fig.16 is a structural block diagram of a route availability document processing device provided by an embodiment of the present application;
[0051] Fig.17 It is a structural block diagram of a route availability document processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0053] It is worth mentioning that the number of RAD rules is extremely large. In order to make it easier to interpret, the rule system has defined basic grammatical rules, which specifically include three parts: sub-rule templates, logical operators, and special symbols (left bracket "(", right bracket ")"). The logical operators and special symbols have hidden meanings and are not directly described in the grammar. The embodiments of the present application define both logical operators and special symbols as operators. Each rule consists of several sub-rule templates, logical operators and brackets. Multiple simple sub-rules are combined through logical operators and brackets to construct specific business rules.
[0054] (1) Some common sub-rule templates are described as follows using regular expressions:
[0055] a.ARR[a-zA-Z_]+(_GROUP)
[0056] Arrived at an airport [group];
[0057] Such as: ARR FRANKFURT_YZ_GROUP
[0058] b.with-RFL-(above|below|betewwn)FL[0-9]+(FL[0-9]+)
[0059] The flight altitude must be above or below X, or between X and Y;
[0060] For example: With-RFL-above FL245
[0061] c.in[a-zA-Z_]+
[0062] Must pass through waypoint X;
[0063] Such as: in EDVVUIR
[0064] d.[a-zA-Z_]+T[0-9]+[a-zA-Z_]+
[0065] The route segment passing through Txx must pass through waypoint X to waypoint Y;
[0066] Such as: LIPMI T911 COL
[0067] e. VIA OBJ AND THEN OBJ
[0068] OBJ represents the object that the route passes through, which may be a waypoint, airspace, altitude restriction, landing airport, departure airport, etc. This template indicates that the route must pass through one object to reach another object.
[0069] Such as: VIA EDUUHVL1H AND THEN POZUM
[0070] f.VIA OBJ AND THEN(OBJ[,OBJ]+)
[0071] Similar to the above e, it means that the route must pass through an object and then reach any one of the other object lists.
[0072] Such as: VIA POZUM AND THEN (HDO,OMELO,LALUK,MAREM)
[0073] (2) Operator:
[0074] and, or, not, seq, (,).
[0075] Among them, seq is a logical operator unique to the European Control Rules, which operates the sub-rule template in sequence, where the sub-rule template can be an airport, waypoint, airspace, etc. For example: a seq b seq c, when a, b, c are waypoints, it means that the aircraft must first pass through waypoint a before passing through waypoint b, and then passing through waypoint c. The general and / or / not operators, whose associated operands are uniformly bool type data, make these operators very flexible when combining rules. Different from this, the operands associated with seq are entities such as waypoints, which requires special processing during parsing. Specifically, when a seq rule fragment appears, it must be fully identified and then processed uniformly, otherwise an error will occur. For example, aseq bseq c, assuming that a seq b is calculated first to obtain a bool result, it is meaningless to perform the seq c operation.
[0076] See also Figure 1 , Figure 1 : is a flow chart of a route availability document processing method provided by an embodiment of the present application, the route availability document processing method comprising:
[0077] S1. Preprocessing the route availability document to be processed to obtain a preprocessed route availability document;
[0078] S2, scanning the preprocessed route availability document, pushing the scanned operators into an operator stack, and pushing the scanned sub-rule templates into a rule stack;
[0079] S3. Performing logical calculations on the rules in the rule stack according to the priorities of the operators in the operator stack to obtain final rule results.
[0080] The embodiment of the present application scans the pre-processed route availability document and saves the scanned information into two stacks, one of which stores the sub-rule template and is declared as RuleStack; the other stack stores the operator and is declared as OpStack. Then, according to the priority of the operator in the operator stack, the rules in the rule stack are logically calculated to obtain the final rule result. It can be seen that the embodiment of the present application simplifies the rule logic by continuous folding, thereby ultimately achieving complete parsing of the rules. There is no need to generate an abstract syntax tree or establish a virtual machine to parse the target code. The process is more concise, the difficulty of implementation is greatly reduced, and the performance is also improved to a certain extent.
[0081] In an optional embodiment, the preprocessing of the route availability document to be processed to obtain the preprocessed route availability document includes:
[0082] According to the preset restoration rules, the hidden logical operators in the route availability document to be processed are restored to obtain the preprocessed route availability document.
[0083] Furthermore, the restoration rules include:
[0084] When it is determined that the first sub-rule templates in the route availability document to be processed are directly connected, restoring the hidden logical operator and between the first sub-rule templates;
[0085] When it is determined that the second sub-rule templates in the route availability document to be processed are separated by a digital sequence number as a prefix, the hidden logical operator or between the second sub-rule templates is restored;
[0086] When it is determined that the sub-rule template except-via exists in the route availability document to be processed, a not operation is performed on all sub-rule template results after the sub-rule template except-via.
[0087] To better understand the embodiment of the present application, the following European control RAD rule is taken as an example to perform preprocessing so that the preprocessed route availability document is converted into a rule string:
[0088] ARR FRANKFURT_YZ_GROUP With-RFL-above FL245 in EDVVUIR
[0089] except-via
[0090] 1.LIPMI T911 COL
[0091] 2. PESOV T180 NIVNU
[0092] Preprocessing: If multiple sub-rule templates are directly connected, the templates are in an and relationship; if the sub-rule templates are separated by a numerical prefix, the templates are in an or relationship; if it is except-via, it means that the rule results under it are not taken.
[0093] The results after restoring the hidden logical operators of the example European Control RAD rule are as follows:
[0094] ARR FRANKFURT_YZ_GROUP
[0095] and
[0096] With-RFL-above FL245
[0097] and
[0098] in EDVVUIR
[0099] and
[0100] not
[0101] (LIPMI T911 COL
[0102] or
[0103] PESOV T180 NIVNU )
[0105] This example means: flights whose arrival airport is FRANKFURT_YZ_GROUP, whose altitude is greater than FL245 when passing through the EDVVUIR information region, and except for flights that pass through the route segment of T911 from LIPMI waypoint to COL waypoint or the route segment of T180 from PESOV waypoint to NIVNU waypoint. This rule contains 5 sub-rules, 3 logical operators of AND, OR, and NOT, and implicit brackets.
[0106] In an optional embodiment, performing logical calculation on the rules in the rule stack according to the priority of the operators in the operator stack to obtain the final rule result includes:
[0107] When a new operator is pushed into the operator stack, if a first start-up calculation condition is met, the current top operator and the previous operator of the current top operator are popped from the operator stack, and are recorded as the first operator and the second operator respectively; wherein the first start-up calculation condition includes: the priority of the current top operator in the operator stack is less than or equal to the previous operator of the current top operator, and the current top operator and the previous operator of the current top operator are not operator seq;
[0108] When the scanning is completed, if the second start calculation condition is met, the current top operator is popped from the operator stack, and it is determined whether the popped current top operator is an operator represented by a right bracket. If so, it is recorded as the first operator, and the current top operator is continuously popped from the operator stack and recorded as the second operator. If not, it is recorded as the second operator. The second start calculation condition includes: the operator stack has an operator;
[0109] The rules in the rule stack are logically calculated according to the second operator to obtain a rule result, which is pushed into the rule stack until there is no operator in the operator stack after the scanning is completed, thereby obtaining a final rule result.
[0110] In an optional embodiment, the priority of the operators in the operator stack is from high to low: first-level operators, second-level operators and third-level operators; among which, the first-level operators are operators represented by brackets and operator seq; the second-level operator is operator not, and the third-level operators are operator and and operator or.
[0111] To better understand the embodiments of the present application, Figure 2 The process of route availability document processing is described in detail:
[0112] (1) Scanning rules:
[0113] Assuming that the pre-processed route availability document is RuleStr, traverse it.
[0114] (2) Operator detected:
[0115] If the operator and / or / not / seq / ( / ) is detected, jump to (3), otherwise jump to (1).
[0116] (3) Operator push:
[0117] Push the operator into the operator stack (hereinafter referred to as OpStack) and delete the operator from RuleStr.
[0118] (4) Sub-rule template is pushed into the stack:
[0119] The scanned sub-rule template is pushed into the rule stack (hereinafter referred to as RuleStack), and the sub-rule template is deleted from RuleStr.
[0120] (5) Determine whether the start calculation condition (the first start calculation condition or the second start calculation condition) is met:
[0121] The priority relationship of the operators in the OpStack determines whether the conditions for starting the calculation are met.
[0122] It is divided into three levels from high to low priority: the first level: (,), seq; the second level: not; the third level: and, or.
[0123] The judgment logic for starting the calculation condition is:
[0124] ① If it is a newly stacked operator (that is, a new operator is pushed into the operator stack):
[0125] 1) Determine the priority relationship between the current top operator Op[top] of OpStack and the previous operator Op[top-1] of the current top operator. If Op[top] has a higher priority than Op[top-1], or Op[top] and Op[top-1] are both equal to seq, jump to (1) and continue scanning. Continuing to scan backward is to calculate the operator with higher priority first.
[0126] 2) Otherwise, jump to (6) to start the calculation. That is, if Op[top] has a priority less than or equal to Op[top-1], and Op[top] and Op[top-1] are not seq, the calculation can be started first.
[0127] ② After the scan is completed (i.e. no new operators are pushed into the stack), if there are still operators in OpStack, jump to (6) to start the calculation.
[0128] (6) Pop the stack and get the operator:
[0129] ① If it is a newly pushed operator, pop the current top operator and save the top variable, which is recorded as the first operator tmpOp. The top variable is saved here in order to push it back to the stack later; continue to pop the current top operator and save the top variable, which is recorded as the second operator curOp. That is, if it is a newly pushed operator, pop the current top operator and the previous operator of the current top operator in succession;
[0130] ② If it is not a newly pushed operator, determine whether the current top operator is ")", that is, the operator represented by a right bracket; if so, pop the current top operator, save the top variable, and record it as the first operator tmpOp (the top variable is saved here in order to pop the stack to match "(", that is, the operator represented by a left bracket, and then remove the brackets), continue to pop the current top operator, save the top variable, and record it as the second operator curOp; if not, pop the current top operator, save the top variable, and record it as the second operator curOp.
[0131] The operator that meets the conditions is recorded as the second operator curOp, in order to facilitate the calculation of the second operator curOp.
[0132] In an optional embodiment, performing logical calculation on the rules in the rule stack according to the second operator to obtain a rule result, and pushing the rule result into the rule stack until there is no operator in the operator stack after the scanning is completed, and obtaining a final rule result includes:
[0133] When the second operator is operator seq, continue to pop the current top operator from the operator stack until the current top operator popped is not operator seq, and count the first number of the continuously popped operator seq; pop the current top sub-rule templates from the rule stack in sequence until the second number of the current top sub-rule templates popped is 1 more than the first number;
[0134] Calculation rule results In the formula, array[i] represents the i-th current stack top sub-rule template popped out, array[i+1] represents the i+1-th current stack top sub-rule template popped out, and counter represents the second quantity;
[0135] When the second operator is an operator characterized as a left parenthesis, the rule result is not evaluated;
[0136] When the second operator is the operator not, the top rule template of the current stack is popped from the rule stack and recorded as the first rule, and the rule result result = not rule is calculated; wherein rule represents the first rule, and not is the operator;
[0137] When the second operator is other operators, the current top sub-rule template is popped from the rule stack and recorded as the second rule, and the current top sub-rule template is continuously popped from the rule stack and recorded as the third rule, and the rule result result = leftRule curOp rightRule is calculated; wherein leftRule represents the third rule, rightRule represents the second rule, and curOp represents the second operator;
[0138] The rule result is pushed into the rule stack. If the first operator exists, the first operator is pushed into the operator stack, and the current top operator is continuously popped from the operator stack to calculate the rule result until there is no operator in the operator stack after the scan is completed, thereby obtaining the final rule result.
[0139] For example, Figure 2 shown.
[0140] (7) and the sub-rule template are calculated:
[0141] ① If curOp is "seq", perform continuous calculation of seq operations:
[0142] 1) Create a new counter counter to count how many seq operators are popped up continuously. Each time a seq operator is popped up, the counter value increases by 1.
[0143] 2) Create a new array array to save the number of sub-rule templates that pop up;
[0144] 3) Popping up the current stack top sub-rule template Rule[top] from RuleStack in sequence, until the second number of the current stack top sub-rule templates popped up is 1 more than the first number of the popped seq; specifically, saving the current stack top sub-rule templates popped up in sequence in the array array[];
[0145] 4) Determine whether the current top operator Op[top] is equal to seq. If it is equal to seq, the counter value increases by 1; repeat step 4) until the current top operator is not equal to seq;
[0146] 6) Calculate the rule results In the formula, array[i] represents the i-th current stack top sub-rule template popped up, array[i+1] represents the i+1-th current stack top sub-rule template popped up, and counter represents the second quantity. The actual meaning of this formula is to check whether the aircraft has passed all the waypoints or airspaces recorded in the array array in sequence. If so, the value of result is true, otherwise the value of result is false.
[0147] ②If curOp is "(", remove the brackets:
[0148] 1) The value in the brackets has been calculated, so there is no need to calculate the value of the rule result;
[0149] 2) Remove the brackets and clear the value of curOp "(" and the value of tmpOp ")";
[0150] 3) Jump to (1) to continue checking the rule string.
[0151] ③If curOp is not, perform a unary operation:
[0152] 1) Pop up the current top rule template Rule[top] and assign the first rule rule;
[0153] 2) Calculate the rule result result = not rule.
[0154] ④ Otherwise, curOp is another operator, and a binary operation is performed:
[0155] 1) Pop up the current stack top rule template Rule[top] and assign the second rule rightRule;
[0156] 2) Continue to pop up the current stack top rule template Rule[top] and assign the third rule leftRule;
[0157] 3) Calculate and obtain the rule result result = leftRule curOp rightRule.
[0158] (8) Push rule results into the stack
[0159] ①Push the rule result into RuleStack;
[0160] ② If the value of tmpOp is saved in step (6), then the value of tmpOp is pushed into OpStack.
[0161] (9) Is OpStack empty?
[0162] ① If it is not empty, continue to jump to (5) to determine whether the conditions for starting calculation are met;
[0163] ②If it is empty, the current top rule template Rule[top] is the final rule result.
[0164] In order to better understand the embodiment of the present application, taking ARR FRANKFURT_YZ_GROUP and With-RFL-aboveFL245 in EDVVUIR and not (LIPMI T911 COL or PESOV T180NIVNU) as an example, a graphic illustration is given to demonstrate how to use the route availability document processing method provided in the embodiment of the present application to obtain the final rule result. The process is shown in Figure 3-Figure 15 ;in, Figure 3-Figure 4 To detect the operator, push the operation into the stack; Figure 5To determine whether the conditions for starting calculation are met, calculation is performed and the rule results are pushed into the RuleStack; Figure 6 To detect the operator, push the operation into the stack; Figure 7 To determine whether the conditions for starting calculation are met, calculation is performed and the rule results are pushed into the RuleStack; Figure 8-Figure 11 To detect the operator, push the operation into the stack; Fig.12 To determine whether the conditions for starting calculation are met, calculation is performed and the rule results are pushed into the RuleStack; Fig.13 Since no new operators are pushed into the stack, the calculation start condition is met, curOp is "(", and the brackets are removed: Fig.14 Since there are no new operators on the stack, the calculation conditions are met, the calculation is performed, and the rule results are pushed into the RuleStack; Fig.15 To meet the conditions for starting calculation, the calculation continues, and when it is determined that OpStack is empty, the calculation ends, and the final rule result is the value of RuleStack[top].
[0165] See also Fig.16 , Fig.16 : is a structural block diagram of a route availability document processing device 10 provided in an embodiment of the present application, wherein the route availability document processing device 10 comprises:
[0166] A preprocessing module 11 is used to preprocess the route availability document to be processed to obtain a preprocessed route availability document;
[0167] A stacking module 12, configured to scan the pre-processed route availability document, push the scanned operators into an operator stack, and push the scanned sub-rule templates into a rule stack;
[0168] The final rule result generating module 13 is used to perform logic calculations on the rules in the rule stack according to the priorities of the operators in the operator stack to obtain the final rule result.
[0169] Optionally, the final rule result generating module 13 is further used for:
[0170] When a new operator is pushed into the operator stack, if a first start-up calculation condition is met, the current top operator and the previous operator of the current top operator are popped from the operator stack, and are recorded as the first operator and the second operator respectively; wherein the first start-up calculation condition includes: the priority of the current top operator in the operator stack is less than or equal to the previous operator of the current top operator, and the current top operator and the previous operator of the current top operator are not operator seq;
[0171] When the scanning is completed, if the second start calculation condition is met, the current top operator is popped from the operator stack, and it is determined whether the popped current top operator is an operator represented by a right bracket. If so, it is recorded as the first operator, and the current top operator is continuously popped from the operator stack and recorded as the second operator. If not, it is recorded as the second operator. The second start calculation condition includes: the operator stack has an operator;
[0172] The rules in the rule stack are logically calculated according to the second operator to obtain a rule result, which is pushed into the rule stack until there is no operator in the operator stack after the scanning is completed, thereby obtaining a final rule result.
[0173] Optionally, the final rule result generating module 13 is further used for:
[0174] When the second operator is operator seq, continue to pop the current top operator from the operator stack until the current top operator popped is not operator seq, and count the first number of the continuously popped operator seq; pop the current top sub-rule templates from the rule stack in sequence until the second number of the current top sub-rule templates popped is 1 more than the first number;
[0175] Calculation rule results In the formula, array[i] represents the i-th current stack top sub-rule template popped out, array[i+1] represents the i+1-th current stack top sub-rule template popped out, and counter represents the second quantity;
[0176] When the second operator is an operator characterized as a left parenthesis, the rule result is not evaluated;
[0177] When the second operator is the operator not, the top rule template of the current stack is popped from the rule stack and recorded as the first rule, and the rule result result = not rule is calculated; wherein rule represents the first rule, and not is the operator;
[0178] When the second operator is other operators, the current top sub-rule template is popped from the rule stack and recorded as the second rule, and the current top sub-rule template is continuously popped from the rule stack and recorded as the third rule, and the rule result result = leftRule curOp rightRule is calculated; wherein leftRule represents the third rule, rightRule represents the second rule, and curOp represents the second operator;
[0179] The rule result is pushed into the rule stack. If the first operator exists, the first operator is pushed into the operator stack, and the current top operator is continuously popped from the operator stack to calculate the rule result until there is no operator in the operator stack after the scan is completed, thereby obtaining the final rule result.
[0180] Optionally, the priority of the operators in the operator stack is from high to low: first-level operators, second-level operators and third-level operators; among which, the first-level operators are operators represented by brackets and operator seq; the second-level operator is operator not, and the third-level operators are operator and and operator or.
[0181] Optionally, the preprocessing module 11 is further used for:
[0182] According to the preset restoration rules, the hidden logical operators in the route availability document to be processed are restored to obtain the preprocessed route availability document.
[0183] Optionally, the restoration rule includes:
[0184] When it is determined that the first sub-rule templates in the route availability document to be processed are directly connected, restoring the hidden logical operator and between the first sub-rule templates;
[0185] When it is determined that the second sub-rule templates in the route availability document to be processed are separated by a digital sequence number as a prefix, the hidden logical operator or between the second sub-rule templates is restored;
[0186] When it is determined that the sub-rule template except-via exists in the route availability document to be processed, a not operation is performed on all sub-rule template results after the sub-rule template except-via.
[0187] It is worth noting that the working process of each module in the route availability document processing device 10 described in the embodiment of the present application can refer to the working process of the route availability document processing method described in the above embodiment, and will not be repeated here.
[0188] A route availability document processing device 10 provided in an embodiment of the invention pre-processes a route availability document to be processed to obtain a pre-processed route availability document; scans the pre-processed route availability document, pushes the scanned operators into an operator stack, and pushes the scanned sub-rule templates into a rule stack; and performs logical calculations on the rules in the rule stack according to the priorities of the operators in the operator stack to obtain final rule results. There is no need to generate an abstract syntax tree or to establish a virtual machine to parse the target code, so the process is more concise and the difficulty of implementation is greatly reduced.
[0189] To achieve the above-mentioned purpose, an embodiment of the present application also provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute the route availability document processing method as described in the above-mentioned embodiment.
[0190] In addition, an embodiment of the present application further provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the route availability document processing method as described in the above embodiment.
[0191] See also Fig.17 , Fig.17 : is a structural block diagram of a route availability document processing device 20 provided in an embodiment of the present application, and the route availability document processing device 20 includes: a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, the steps in the above-mentioned route availability document processing method embodiment are implemented. Alternatively, when the processor 21 executes the computer program, the functions of each module / unit in the above-mentioned device embodiments are implemented.
[0192] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the route availability document processing device 20.
[0193] The route availability document processing device 20 may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art may understand that the schematic diagram is merely an example of the route availability document processing device 20 and does not constitute a limitation on the route availability document processing device 20. The route availability document processing device 20 may include more or less components than those shown in the diagram, or may combine certain components, or different components. For example, the route availability document processing device 20 may also include input and output devices, network access devices, buses, etc.
[0194] The processor 21 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 21 is the control center of the route availability document processing device 20, and uses various interfaces and lines to connect various parts of the entire route availability document processing device 20.
[0195] The memory 22 can be used to store the computer program and / or module. The processor 21 implements various functions of the route availability document processing device 20 by running or executing the computer program and / or module stored in the memory 22 and calling the data stored in the memory 22. The memory 22 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0196] Wherein, if the module / unit integrated in the route availability document processing device 20 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor 21. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0197] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0198] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications are also considered to be within the scope of protection of the present application.
Claims
1. A method for processing route availability documents, characterized in that: include: Preprocessing the route availability document to be processed to obtain a preprocessed route availability document; Scanning the preprocessed route availability document, pushing the scanned operators into an operator stack, and pushing the scanned sub-rule templates into a rule stack; According to the priorities of the operators in the operator stack, logical calculations are performed on the rules in the rule stack to obtain final rule results.
2. The method for processing route availability documents according to claim 1, wherein: The logic calculation of the rules in the rule stack is performed according to the priority of the operators in the operator stack to obtain the final rule result, including: When a new operator is pushed into the operator stack, if a first start-up calculation condition is met, the current top operator and the previous operator of the current top operator are popped from the operator stack, and are recorded as the first operator and the second operator respectively; wherein the first start-up calculation condition includes: the priority of the current top operator in the operator stack is less than or equal to the previous operator of the current top operator, and the current top operator and the previous operator of the current top operator are not operator seq; When the scanning is completed, if the second start calculation condition is met, the current top operator is popped from the operator stack, and it is determined whether the popped current top operator is an operator represented by a right bracket. If so, it is recorded as the first operator, and the current top operator is continuously popped from the operator stack and recorded as the second operator. If not, it is recorded as the second operator. The second start calculation condition includes: the operator stack has an operator; The rules in the rule stack are logically calculated according to the second operator to obtain a rule result, which is pushed into the rule stack until there is no operator in the operator stack after the scanning is completed, thereby obtaining a final rule result.
3. The method for processing route availability documents according to claim 2, wherein: The logic calculation is performed on the rules in the rule stack according to the second operator to obtain a rule result, and the rule result is pushed into the rule stack until there is no operator in the operator stack after the scanning is completed, and a final rule result is obtained, including: When the second operator is operator seq, continue to pop the current top operator from the operator stack until the current top operator popped is not operator seq, and count the first number of the continuously popped operator seq; pop the current top sub-rule templates from the rule stack in sequence until the second number of the current top sub-rule templates popped is 1 more than the first number; Calculation rule results In the formula, array[i] represents the i-th current stack top sub-rule template popped out, array[i+1] represents the i+1-th current stack top sub-rule template popped out, and counter represents the second quantity; When the second operator is an operator characterized as a left parenthesis, the rule result is not evaluated; When the second operator is the operator not, the top rule template of the current stack is popped from the rule stack and recorded as the first rule, and the rule result result = not rule is calculated; wherein rule represents the first rule, and not is the operator; When the second operator is other operators, the current top sub-rule template is popped from the rule stack and recorded as the second rule, and the current top sub-rule template is continuously popped from the rule stack and recorded as the third rule, and the rule result result = leftRule curOp rightRule is calculated; wherein leftRule represents the third rule, rightRule represents the second rule, and curOp represents the second operator; The rule result is pushed into the rule stack. If the first operator exists, the first operator is pushed into the operator stack, and the current top operator is continuously popped from the operator stack to calculate the rule result until there is no operator in the operator stack after the scan is completed, thereby obtaining the final rule result.
4. The method for processing route availability documents according to claim 1, wherein: The priority of the operators in the operator stack is from high to low: first-level operators, second-level operators and third-level operators; among them, the first-level operators are operators represented by brackets and operator seq; the second-level operator is operator not, and the third-level operators are operator and and operator or.
5. The method for processing route availability documents according to claim 1, wherein: The preprocessing of the route availability document to be processed to obtain the preprocessed route availability document includes: According to the preset restoration rules, the hidden logical operators in the route availability document to be processed are restored to obtain the preprocessed route availability document.
6. The method for processing route availability documents according to claim 5, characterized in that: The restoration rules include: When it is determined that the first sub-rule templates in the route availability document to be processed are directly connected, restoring the hidden logical operator and between the first sub-rule templates; When it is determined that the second sub-rule templates in the route availability document to be processed are separated by a digital sequence number as a prefix, the hidden logical operator or between the second sub-rule templates is restored; When it is determined that the sub-rule template except-via exists in the route availability document to be processed, a not operation is performed on all sub-rule template results after the sub-rule template except-via.
7. A route availability document processing device, characterized in that: include: A preprocessing module, used for preprocessing the route availability document to be processed to obtain a preprocessed route availability document; A stacking module, configured to scan the preprocessed route availability document, push the scanned operators into an operator stack, and push the scanned sub-rule templates into a rule stack; The final rule result generating module is used to perform logical calculations on the rules in the rule stack according to the priorities of the operators in the operator stack to obtain the final rule result.
8. A route availability document processing device, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the route availability document processing method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program; wherein, when the computer program is run, it controls the device where the computer-readable storage medium is located to execute the route availability document processing method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the route availability document processing method as claimed in any one of claims 1 to 6.