Complex event rule description method and compiling system based on Flink

By introducing the complex event rule description method and compilation system based on Flink into the complex event processing system, and using text language to define and compile complex event rules, the problem of difficulty in rule definition and management and the inability to dynamically load rules in the existing system is solved. , improving the universality and clarity of the system.

CN118778949AActive Publication Date: 2024-10-15SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410662396.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-10-15
Estimated Expiration
2044-05-27

AI Technical Summary

Technical Problem

Existing complex event processing systems lack text language to describe complex event rules, making rule definition and management difficult. Especially for users without programming foundation, it is difficult to edit complex event rules, and rules cannot be dynamically loaded.

Method used

Provides a complex event rule description method and compilation system based on Flink. It defines complex events and their processing methods through text language, including input modules, parsing units and compilation units. It can extract and compile a single pattern or pattern from the text rule description text. Group, generate a single pattern or pattern group in Flink, and implement dynamic rule loading.

Benefits of technology

It reduces the difficulty of use and management for operators, improves the universality of complex event rules and the clarity of the system, allows users without programming foundation to edit complex event rules, and realizes dynamic loading of rules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118778949A_ABST
    Figure CN118778949A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of event processing rules, in particular to an Flink-based event rule description method and a compiling system thereof, which comprises the following steps: compiling a single mode description text, reading the rule description text by an input module of the compiling system, judging whether the text belongs to a single mode or a mode group by the input module, and selecting a corresponding compiling module; an analysis unit of the compiling module receives the input text, the analysis unit segments the text conforming to the format to extract components, and the components are transmitted to a compiling unit of the compiling module; the compiling unit compiles the components into single modes or mode groups; transmitting the successfully compiled single mode or mode group to an output module; the output module receives the single mode and the mode group, and finally outputs the single mode and the mode group together in the form of a dictionary, the complex event and the processing method thereof are defined through a text language, the use difficulty is reduced, the use universality is improved, and in addition, a dynamic loading rule can be realized by providing a textualized description method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of event processing rules, and in particular to an event rule description method based on FlinkCEP and a compilation system thereof. Background Art

[0002] Complex Event Processing (CEP) refers to the process of analyzing and processing a large amount of event data in real time to identify meaningful patterns and associations, thereby making decisions quickly or triggering corresponding actions. Complex event processing systems in the prior art usually use event stream models and rule engines to process events, such as the Flink framework. The Flink framework is a distributed processing engine that can process unbounded and bounded data streams and perform stateful calculations. A submodule of the framework, Flink CEP, enables it to apply complex event processing technology on the basis of stateful data stream calculations, and obtain the data that users want from the data stream using user-defined complex event rules, that is, output complex events that meet the rules. Although Flink provides related methods for complex event processing, it does not provide a text language to describe this method. It can only define complex events at the code level, and cannot dynamically load rules during program execution. This makes it difficult to define and manage complex event rules, and the programs written using this method are less flexible. At the same time, for users without programming foundation, it is quite difficult to edit complex event rules using the interface provided by Flink CEP.

[0003] In order to solve the problem that complex event rules in related technologies do not provide a textual description method and cannot dynamically load rules, the present invention proposes a complex event rule description method and compilation system based on Flink. Summary of the invention

[0004] To solve the above problems, the present invention provides a complex event rule description method and compilation system based on Flink, which defines complex events and their processing methods through text language, reducing the difficulty of use. Users without programming knowledge can also use the interface provided by Flink CEP to edit complex event rules, which improves the universality of use. In addition, dynamic loading of rules can be achieved by providing a textual description method.

[0005] To achieve the above object, the technical solution adopted by the present invention is:

[0006] A method for describing event rules based on FlinkCEP, including:

[0007] A rule description text of a single pattern or a pattern group is written, and an input module of the compilation system reads the rule description text, determines whether the rule description text belongs to a single pattern rule description text or a pattern group rule description text, and calls a first compilation module for a single pattern or a second compilation module for a pattern group, and calls a first parsing unit for a single pattern or a second parsing unit for a pattern group;

[0008] After receiving the corresponding rule description text, the first parsing unit or the second parsing unit checks whether the corresponding rule description text conforms to the corresponding format, and if so, segments the corresponding rule description text and extracts components, and transmits the components to the first compiling unit or the second compiling unit;

[0009] The first compilation unit or the second compilation unit compiles the components into a single mode or a mode group in Flink by using an interface provided by Flink, and transmits the single mode or the mode group to an output module of the compilation system;

[0010] After receiving the single pattern or the pattern group, the output module outputs the single pattern or the pattern group in the form of a dictionary.

[0011] Preferably, the single pattern rule description text includes a rule name, an event type, a matching condition, a continuity identifier, a quantifier, a greedy identifier, a specified identifier and a termination condition, and the expression of the single pattern rule description text is:

[0012] "Rule name": <Event type> [matching condition] continuity identifier (quantifier, specified identifier greedy identifier) ​​_ [termination condition].

[0013] Preferably, the matching conditions include simple conditions and complex conditions, the simple conditions consist of a binary logic expression, the binary logic expression includes a left operand, a right operand and an operator, and the complex conditions consist of multiple simple conditions, and the multiple simple conditions are connected by logical operators.

[0014] Preferably, the continuity identifier includes a strict continuity identifier, a loose continuity identifier and an uncertain loose continuity identifier.

[0015] Preferably, the quantifier includes three expressions: a specified number of times, a specified number of times range, and greater than a specified number of times.

[0016] Preferably, the pattern group rule description text includes pattern elements and connectors, and the expression of the pattern group rule description text is:

[0017] [schema element] connector [schema element] connector ... [schema element].

[0018] Preferably, the mode element includes a single mode name and a skip strategy.

[0019] A compilation system applied to the above-mentioned FlinkCEP-based event rule description method includes an input module, a first compilation module, a second compilation module and an output module.

[0020] Preferably, the first compilation module includes the first parsing unit and the first compilation unit, the first parsing unit is used to parse the input single pattern rule description text into a single pattern rule component text, and the first compilation unit is used to compile the single pattern rule component text into a single pattern in Flink.

[0021] Preferably, the second compilation module includes a second parsing unit and the second compilation unit, the second parsing unit is used to parse the pattern group rule description text into pattern group rule component text, and the second compilation unit is used to compile the pattern group rule component text into a pattern group in Flink.

[0022] The beneficial effects of the present invention are:

[0023] 1. The present invention writes a rule description text of a single pattern or a pattern group, and the rule description text is segmented and extracted into components by the first parsing unit or the second parsing unit, and the components are output to the first compilation unit or the second compilation unit. The first compilation unit or the second compilation unit compiles the components into a single pattern or a pattern group in Flink by using an interface provided by Flink, and passes the single pattern or the pattern group to the output module of the compilation system. Complex events and their processing methods are defined by a rule text language, which reduces the difficulty of use and management for operators. Users without programming knowledge can also use the interface provided by Flink CEP to edit complex event rules, which improves the universality of use. In addition, dynamic loading of rules can be achieved by providing a textual description method.

[0024] 2. In complex event processing, dividing the rule description text into individual patterns and pattern groups can improve the clarity and readability of the system. By breaking down the complex rule description text into individual patterns, each pattern focuses on processing a specific simple event or event sequence, which makes the rules clearer. At the same time, the pattern group is a logical grouping of these individual patterns, which helps to understand and organize the entire rule set from a macro perspective. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 This is a flowchart of a complex event rule description method in a specific embodiment of the present application;

[0026] Figure 2 A workflow diagram for compiling a single pattern rule description text in a specific embodiment of the present application;

[0027] Figure 3 A workflow diagram for compiling the rule description text of the pattern group in the specific embodiment of the present application;

[0028] Figure 4 This is a workflow diagram of the compilation system in a specific embodiment of the present application. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0030] See also Figure 1-Figure 4 As shown, the present invention relates to a complex event rule description method and compilation system based on Flink.

[0031] Complex Event: A series of simple events that are connected to each other through specific relationships and patterns. In the context of complex event processing (CEP), complex events usually refer to sequences or combinations of events that are identified in a data stream based on specific rules and conditions. These events are not just independent data points, but represent higher-level, meaningful business situations or behavior patterns.

[0032] Complex Event Processing (CEP): A technique for processing, analyzing, and responding to patterns and relationships in event streams.

[0033] Complex event processing rules: logical expressions used to identify specific patterns and relationships in event streams. These rules define patterns based on event attributes, order, time windows, and other conditions. When the event sequence in the data stream matches the pattern defined by the rules, the CEP system triggers corresponding actions or generates alarms. The design and application of rules are the core of the CEP system. They enable the CEP system to extract valuable information from large amounts of real-time data and respond quickly. Complex event processing rules are also called event patterns in Flink.

[0034] Flink: An open source stream processing framework designed to process large-scale data streams, providing high throughput, low latency, and high reliability in real-time data stream processing. Flink has a wide range of application scenarios, including but not limited to real-time data analysis, online advertising, financial market monitoring, IoT data processing, etc. Due to its powerful functions and flexibility, Flink has become one of the important tools in the field of big data processing.

[0035] Flink CEP (Complex Event Processing): A component of the Apache Flink stream processing framework that is specifically designed to identify and process complex event patterns in real-time data streams. CEP defines a series of event patterns, allowing users to detect complex event sequences occurring in data streams that may represent specific business logic or abnormal behavior.

[0036] Example 1

[0037] A method for describing event rules based on FlinkCEP, including:

[0038] Write rule description text for a single pattern or pattern group;

[0039] The input module of the compilation system reads the rule description text, determines whether the rule description text belongs to a single pattern rule description text or a pattern group rule description text, and calls a first compilation module for the single pattern or a second compilation module for the pattern group, and calls a first parsing unit for the single pattern or a second parsing unit for the pattern group;

[0040] After receiving the corresponding rule description text, the first parsing unit or the second parsing unit checks whether the corresponding rule description text conforms to the corresponding format, and if so, segments the corresponding rule description text and extracts components, and transmits the components to the first compiling unit or the second compiling unit;

[0041] The first compilation unit or the second compilation unit compiles the components into a single mode or a mode group in Flink by using an interface provided by Flink, and transmits the single mode or the mode group to an output module of the compilation system;

[0042] After receiving the single pattern or the pattern group, the output module outputs the single pattern or the pattern group in the form of a dictionary.

[0043] The expression of the rule description text of a single pattern is:

[0044] "Rule name": <event type> [matching condition] continuity identifier (quantifier, specified identifier greedy identifier) ​​_ [termination condition], where the symbols """, "<>", "[]", "()", "_[]" are identifiers used by the compilation system to extract the corresponding text language components.

[0045] Rule name, which is the part used to describe the name of the rule in a single pattern rule description statement. This part is a required part of the description statement and can be set according to user needs.

[0046] Event type, which is used in the rule description statement to describe the event type matched by the rule.

[0047] Matching condition: the part used to describe the matching condition in the rule description statement.

[0048] Continuity identifier: The part used to describe the continuity of the rule in the rule description statement.

[0049] Quantifier, used in the rule description statement to describe the number of times the rule is repeated.

[0050] Greedy identifier, used in rule description to describe whether the rule is greedy matching. It is represented by the letter g in rule description.

[0051] Specifies an identifier used in a rule description statement to describe whether the rule is optional. It is represented by the letter o in a rule description statement.

[0052] The termination condition is the part of the rule description statement used to describe the termination condition of the rule. This part starts with the symbol "_" and is followed by the above-mentioned matching condition to indicate the termination condition.

[0053] A simple condition consists of a binary logical expression, which includes a left operand, a right operand and an operator. The left and right operands can be constants or attributes of instances generated by the event type specified by the rule, and the operator can be “>(greater than)”, “<(less than)”, “=(equal to)”, “>=(greater than or equal to)”, “<=(less than or equal to)”, or “!=(not equal to)”.

[0054] A compound condition is composed of multiple simple conditions and is represented by connecting them using the “∨ (or)” and “∧ (and)” logical operators.

[0055] The continuity identifier can be of the following three types:

[0056] Strict continuity is indicated by “·” in the rule description statement.

[0057] Loose continuity is indicated by “~” in the rule description statement.

[0058] Uncertain loose continuity is represented by “~~” in the rule description statement.

[0059] There are three forms of quantifiers:

[0060] Specify the number of times. Specify a constant n in the rule description statement so that the number of matches of the described rule is n.

[0061] To specify a number range, specify two constants n and m in the rule description statement so that the number of matches of the described rule is between n and m.

[0062] Greater than the specified number of times: specify a constant n in the rule description statement and add a symbol ":" after the number to make the number of matches of the described rule greater than n.

[0063] In Flink CEP, there is no direct interface for less than the specified number of times. You can express less than the specified number of times by specifying the number range (0, n).

[0064] It also includes a pattern group rule description text, which is used to describe the sentence of the pattern group rule, and is composed of a number of pattern elements and a number of connectors. Its complete form is as follows: [pattern element] connector [pattern element] connector…[pattern element];

[0065] The pattern element is used to indicate the position of a single pattern in the pattern group and its skip strategy in the pattern group rule description statement;

[0066] A connector is used to describe how the single pattern after the connector connects the pattern group before the single pattern.

[0067] Example 2

[0068] refer to Figure 2 As shown, this embodiment is the compilation workflow of the single pattern rule description text described in the above embodiment 1, and the steps are as follows:

[0069] Step S201, the compiling module starts running and waits for data input;

[0070] Step S202, reading in a text list of rule descriptions of a single pattern, the text list being defined by the user and storing rule description texts of multiple single patterns of complex conditions;

[0071] Step S203, creating an empty pattern list for storing successfully compiled patterns in subsequent steps;

[0072] Step S204, check whether the rule description text list is empty, if it is empty, skip the compilation process directly until the output step S226, otherwise enter the compilation step S205;

[0073] Step S205, check whether a rule text can be parsed out in the list, if it can be parsed out, jump to S206, otherwise jump to output step S226;

[0074] Step S206, parsing the first rule description text from the list;

[0075] Step S207, check whether the parsed rule description text has format errors, if yes, skip parsing of the rule and jump to S208, otherwise continue the compilation process and jump to S209, whether the format is wrong, specifically refers to:

[0076] "Rule name" and "Event type" are required parts of the description statement. If these parts do not exist, the statement is incorrect.

[0077] "Continuity Identifier" and "Quantifier" are optional components and must exist at the same time, and the existence of "matching condition" is a prerequisite, so the statement is wrong;

[0078] Step S208, discarding the rule description text that failed to compile;

[0079] Step S209, extracting the "rule name" from the rule description text, removing the extracted part from the original rule description text, using it as the processed rule description text, and passing the processed rule text downward;

[0080] Step S210, extracting the "event type" from the rule description text obtained in S209, removing the "event type" from the rule description text, and passing the removed rule description text downward. At this time, the rule initialization conditions are met, and the Flink-related pattern definition statement is called to obtain an initialized pattern, which is passed downward. The initialization uses the "event type" to set the generic type of the pattern, and uses the "rule name" to set the name of the pattern.

[0081] Step S211, extracting the text describing the "matching condition" from the rule description text obtained in S210, the text describing the "matching condition" may be a "compound condition", that is, the "matching condition" is composed of n "simple conditions" and n-1 "∨ (or)" and "∧ (and)" alternately, removing the "matching condition" from the rule description text, and passing the text describing the "matching condition" and the rule description text with the "matching condition" removed to step S212;

[0082] Step S212, check whether the text describing the current "matching condition" can extract a "simple condition", if yes, jump to step S213, otherwise jump to step S215 and pass the current mode to step S215;

[0083] Step S213, extracting a "simple condition" from the text describing the "matching condition", removing the "simple condition" from the text describing the "matching condition", and passing the "simple condition" and the text describing the "matching condition" to S214;

[0084] Step S214, compile the "simple condition", add the compiled "simple condition" to the previous pattern, update the pattern, and pass the pattern to step S212. Specifically, the compilation process is to parse the "simple condition" into a left operand, a right operand and an operator, and use it as a binary logic operation function so that it can produce a Boolean value type result. This function is passed to the simpleCondition class in Flink to obtain an instance, and according to the "∨ (or)" and "∧ (and)" operators before the "matching condition", the method of connecting the instance with the previous pattern is determined, that is, if it is "∨ (or)", use "or()" to connect, and if it is "∧ (and)", use "where()" to connect;

[0085] Step S215, check whether the rule description text obtained from S212 has a "continuity identifier", if yes, jump to S216, if not, pass the pattern and rule description text downward, jump to S218;

[0086] Step S216, obtaining a "continuity identifier", and removing the "continuity identifier" in the rule description text, and at the same time passing the rule description text after removing the "continuity identifier" downward;

[0087] Step S217, compile the "continuity identifier", add continuity to the pattern obtained in step S215, and pass the pattern to step S218, the compilation, that is, according to the specific type of the continuity identifier, if it is "·", call the "consecutive()" method of the pattern to add strict continuity, if it is "~~", call the "allowCombinations()" method of the pattern to add uncertain loose continuity, if it is "~", it means using the default loose continuity, no operation is required;

[0088] Step S218, check whether the rule description text obtained from S215 contains "quantifier", "greedy identifier" or "optional identifier", if yes, jump to S219, otherwise jump to S221, and pass the pattern and rule description text to 221;

[0089] Step S219, parse out the "quantifier", "greedy identifier", and "optional identifier" in the rule description text, and remove the "quantifier", "greedy identifier", and "optional identifier" from the rule description text, and pass the pattern and the rule description text after removal to step S220;

[0090] Step S220, according to the contents of "quantifier", "greedy identifier" and "optional identifier", the pattern is updated, and the pattern and rule description text are passed to step S221. The update is to set the quantifier, greedy identifier and optional identifier of the current rule according to the type of "quantifier". If it is "specified number of times" or "specified number range", the "times()" method is called on the basis of the original pattern. If it is "greater than the specified number of times", the "timesOrMore()" method is called on the basis of the pattern of S215, and the pattern is updated. According to the existence of the "greedy identifier", it is decided whether to call the "greedy() method" on the basis of the updated pattern, and the pattern is updated. According to the existence of the "optional identifier", it is decided whether to call the "optional()" method, and the pattern is updated.

[0091] Step S221, check whether the passed rule description text has a "termination condition", if yes, jump to step S222, pass the mode and rule description text to step S222, otherwise jump to step S224, pass the mode and rule description text to step S224;

[0092] Step S222, obtaining the "termination condition" in the passed rule description text, parsing the "termination condition" text, removing the "termination condition" in the rule description text, and updating the rule description text, and passing the updated rule description text, the parsed "termination condition" text and the pattern to S223;

[0093] Step S223, set the "termination condition" of the current rule, call the "untill()" method of the pattern, pass the compiled condition in, update the pattern, pass the updated pattern and rule description text to step S224, the compilation is to parse the "simple condition" in the "termination condition" into a left operand, a right operand and an operator, and use it as a binary logic operation function to enable it to produce a Boolean value type result, pass this function into the simpleCondition class in Flink, and obtain an instance to pass into the "untill()" method;

[0094] Step S224, adding the current rule to the list created in step S203;

[0095] Step S225, outputting a compiled singleton pattern list;

[0096] Step S226, end the compilation process.

[0097] Example 3

[0098] refer to Figure 3 As shown, this embodiment is the compilation workflow of the pattern group rule description text described in the above embodiment 1, and the steps are as follows:

[0099] Step S301, the compiling module starts running and waits for data input;

[0100] Step S302, inputting a complex event pattern group rule description text and a compiled singleton pattern list, wherein the complex event pattern group rule description text is defined by the user and may contain multiple complex event pattern group rules, and the compiled singleton pattern list is the output of a text compilation module for a description method of a single pattern;

[0101] Step S303, check the complex event pattern group rule description text or the compiled singleton pattern list. If the complex event pattern group rule description text is empty, it means that no compilation operation is required. If the compiled singleton pattern list is empty, it means that no singleton pattern can be provided for subsequent compilation operations. If one of the above two is empty, jump to step S317, otherwise enter the compilation process and jump to step S304;

[0102] Step S304, creating an empty pattern group list to store the results of the pattern group compilation module;

[0103] Step S305, checking whether the complex event pattern group rule description text contains the next pattern group rule, if so, jump to step S306, otherwise jump to step S316;

[0104] Step S306, taking out a pattern group rule from the complex event pattern group rule description text, and removing the pattern group rule from the complex event pattern group rule description text, updating the complex event pattern group rule description text, and transferring the complex event pattern group rule description text and the pattern group rule in step S307;

[0105] Step S307, check whether the extracted pattern group rules have format errors, if yes, jump to step S308, otherwise jump to step S309, and pass the complex event pattern group rule description text and pattern group rules to step S309, the format error means that the pattern group rule shall not start with a connector, and must be organized in the form of "[pattern name of a single pattern, skip strategy] connector [pattern name of a single pattern, skip strategy] connector ... [pattern name of a single pattern, skip strategy]";

[0106] Step S308, discarding rules with format errors;

[0107] Step S309, initializing the mode group, which is now an empty mode group, so that subsequent steps can add content to the mode group;

[0108] Step S310, check whether the pattern group rule text starts with a connector. If it starts with a connector, it means that the currently processed pattern group is not compiled from the beginning but is being compiled. Jump to step S311 and pass the complex event pattern group rule description text and pattern group to step S311. Otherwise, jump to step S312 and pass the complex event pattern group rule description text and pattern group to step S313.

[0109] Step S311, according to the connector, select the "connection mode" to connect the subsequent pattern elements, the "connection mode" refers to:

[0110] Strictly continuous connection: The event matched by the pattern defined after this connection mode must directly follow the previously matched event (strictly continuous);

[0111] Loose continuation: The pattern defined after this connector can have other events appearing between the matched event and the previously matched event (loose continuation);

[0112] Uncertain loose continuation connection: The pattern defined after this connector can have other events appearing between the matched event and the previously matched event. Each optional matching event will be output as an optional matching result (uncertain loose continuation);

[0113] Anti-strict continuation connection: the (negated) event matched by the pattern defined after this connector must directly follow the previously matched event (strict continuation) to discard these partial matches;

[0114] Anti-loose continuation connection: The pattern defined after this connector will discard the partially matched event sequence (loose continuation) even if other events occur between the matched (negated) event and the previously matched event.

[0115] Step S312, check whether the pattern group rule text at this time starts with a pattern element, if not, jump to step S318, otherwise jump to step S313,

[0116] Step S313, parsing the pattern element, obtaining the string variable "pattern name of single pattern" and the string variable "skip strategy". If the pattern element does not contain "skip strategy", the "skip strategy" is empty;

[0117] Step S314, check whether there is a "skip strategy" in the pattern element, that is, whether the skip strategy is empty. If so, jump to step S315 and pass the connection mode, complex event pattern group rule description text and pattern group to step S315; otherwise, jump to step S316 and pass the connection mode, complex event pattern group rule description text and pattern group rule to step S316;

[0118] Step S315, adding a "skip strategy" for the current single pattern, and passing the "skip strategy", "pattern name of the single pattern", "skip strategy", "connection mode", complex event pattern group rule description text and pattern group to step S316, the skip strategy includes:

[0119] NO_SKIP: Each successful match is output, indicated by "NS" in the description method for the pattern group.

[0120] SKIP_TO_NEXT: discards all partial matches that start with the same event, indicated by "S2N" in the description method for pattern groups.

[0121] SKIP_PAST_LAST_EVENT: Discard all partial matches starting between the start and end of this match, represented by "SPLE" in the description method for the pattern group.

[0122] SKIP_TO_FIRST: Discard all partial matches between the start of this match and the first occurrence of a single pattern name, indicated by "S2F" in the description method for pattern groups.

[0123] SKIP_TO_LAST: Discard all partial matches between the start of this match and the last occurrence of a single pattern name, represented by "STL" in the description method for pattern groups.

[0124] Step S316, adding the current pattern element to the current pattern group, obtaining the singleton pattern from the compiled singleton pattern list through the "pattern name of the single pattern", adding the singleton pattern to the current pattern group, and passing the complex event pattern group rule description text and pattern group to S317;

[0125] Step S317, removing the currently parsed content from the rule description text, that is, removing the currently parsed content from the "pattern group rule description text" so that the next round of parsing can be continued;

[0126] Step S318, adding the compiled pattern group to the pattern group list for output;

[0127] Step S319, outputting the compiled pattern group list to the outside of the compilation module;

[0128] Step S320, ending the compilation process.

[0129] Example 4

[0130] The above-mentioned embodiment 2 and embodiment 3 are combined to realize the function of expressing complex event processing rules in Flink through text language. The collaborative workflow of the two modules is shown in the following figure: Figure 4 As shown, the steps are as follows:

[0131] Step S401, the system starts running and waits for input;

[0132] Step S402, inputting a pattern rule description statement, which may be a description statement for a single pattern or a description statement for a pattern group;

[0133] Step S403, check whether the statement can be compiled into a singleton mode, if yes, jump to S404, if no, jump to S405;

[0134] Step S404, running a compilation module for a description method for a single mode;

[0135] Step S405, running a compilation module for the description method of the pattern group;

[0136] Step S406, integrating and outputting the outputs of the two modules;

[0137] Step S407, end the system operation.

[0138] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0139] The above implementation modes are merely descriptions of the preferred implementation modes of the present invention, and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary engineering and technical personnel in the field shall fall within the protection scope determined by the claims of the present invention.

Claims

1. A method for describing event rules based on FlinkCEP, characterized in that: include: A rule description text for a single pattern or a pattern group is written, and an input module of the compilation system reads the rule description text, determines whether the rule description text belongs to a single pattern rule description text or a pattern group rule description text, and calls a first parsing unit for the single pattern or a second parsing unit for the pattern group; After receiving the corresponding rule description text, the first parsing unit or the second parsing unit checks whether the corresponding rule description text conforms to the corresponding format, and if so, segments the corresponding rule description text and extracts components, and transmits the components to the first compiling unit or the second compiling unit; The first compilation unit or the second compilation unit compiles the components into a single mode or a mode group in Flink by using an interface provided by Flink, and transmits the single mode or the mode group to an output module of the compilation system; After receiving the single pattern or the pattern group, the output module outputs the single pattern or the pattern group in the form of a dictionary.

2. The event rule description method based on FlinkCEP according to claim 1 is characterized in that: The single pattern rule description text includes a rule name, an event type, a matching condition, a continuity identifier, a quantifier, a greedy identifier, a specified identifier, and a termination condition. The expression of the single pattern rule description text is: "Rule name": <Event type> [matching condition] continuity identifier (quantifier, specified identifier greedy identifier) ​​_ [termination condition].

3. The event rule description method based on FlinkCEP according to claim 2 is characterized in that: The matching conditions include simple conditions and complex conditions. The simple conditions are composed of a binary logic expression, which includes a left operand, a right operand and an operator. The complex conditions are composed of multiple simple conditions, which are connected by logical operators.

4. The event rule description method based on FlinkCEP according to claim 2 is characterized in that: The continuity identifier includes a strict continuity identifier, a loose continuity identifier and an indeterminate loose continuity identifier.

5. The event rule description method based on FlinkCEP according to claim 2 is characterized in that: The quantifier includes three expressions: a specified number of times, a specified number of times range, and greater than a specified number of times.

6. The event rule description method based on FlinkCEP according to claim 1 is characterized in that: The pattern group rule description text includes pattern elements and connectors, and the expression of the pattern group rule description text is: [schema element] connector [schema element] connector ... [schema element].

7. The event rule description method based on FlinkCEP according to claim 6 is characterized in that: The pattern element includes a single pattern name and a skip strategy.

8. A compilation system applied to the FlinkCEP-based event rule description method according to any one of claims 1 to 7, characterized in that: It includes an input module, a first compiling module, a second compiling module and an output module.

9. The compilation system of the event rule description method based on FlinkCEP according to claim 8, characterized in that: The first compilation module includes the first parsing unit and the first compilation unit, the first parsing unit is used to parse the input single pattern rule description text into a single pattern rule component text, and the first compilation unit is used to compile the single pattern rule component text into a single pattern in Flink.

10. The compilation system of the event rule description method based on FlinkCEP according to claim 8, characterized in that: The second compilation module includes a second parsing unit and the second compilation unit, the second parsing unit is used to parse the pattern group rule description text into pattern group rule component text, and the second compilation unit is used to compile the pattern group rule component text into a pattern group in Flink.

Citation Information

Patent Citations

  • Event processing method and system, electronic equipment and computer readable medium

    CN116049234A

  • Event processing method and device, electronic equipment and storage medium

    CN117009039A

  • Compiler and method for compiling business rules for a serverless runtime environment

    US10678522B1

  • Generating control commands from schematized rule sets

    US20220083740A1