Object acquisition method, device, electronic device, and computer-readable medium
By analyzing the key-value pairs and logical statements in the rule configuration document, the problem of high difficulty in configuration of CEP rules is solved, and the user experience and configuration efficiency is improved, which is suitable for users with weak programming foundations.
Patent Information
- Application Number
- CN202211730074.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2042-12-30
AI Technical Summary
The configuration of existing composite event processing (CEP) rules is difficult, especially for users with weak programming foundations, which are inefficient in configuration efficiency, poor readability, and poor system ease of use and rule life cycle management.
By parsing key-value pairs and logical representation statements in the rule configuration document, generate rule-matching granular extractors, rule-matching logic executors, and rule-matching result processing logic executors, allowing users to use simple key-value pair inputs and familiar programming languages (such as SQL) edit the CEP rule configuration document to reduce the configuration difficulty.
It improves the user experience, simplifies the CEP rule configuration process, is suitable for users with weak programming foundations, and improves configuration efficiency and convenience of rule management.
Smart Images

Figure CN116303529B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to an object acquisition method, device, electronic device, and computer-readable medium. Background Art
[0002] Complex Event Processing (CEP) is an analysis technology based on event streams in a dynamic environment. Events here are usually meaningful state changes. By analyzing the relationship between events, using filtering, association, aggregation and other technologies, and formulating query rules based on the temporal relationship and aggregation relationship between events, we can continuously query the event sequence that meets the requirements from the event stream, and finally analyze more complex compound events.
[0003] In addition, CEP can generally involve three aspects: event sequence matching, event combination matching, and event window aggregation. Among them, the event sequence matching refers to finding a certain event sequence from a disorganized event stream (for example, a sequence of a first event followed by a preset number of second events, followed by a third event once). The event combination matching refers to finding a certain event combination from the event stream (for example, a combination of the first event or the second event). The event window aggregation refers to whether the first event exists among the N adjacent events continuously extracted from the event stream. N is a positive integer, and N represents the window size.
[0004] In addition, in some application fields, the event stream can usually be analyzed and processed with the help of pre-configured CEP rules. Among them, CEP rules can usually include three core elements: rule matching granularity, rule matching logic, and rule matching result processing logic. The rule matching granularity is usually used to aggregate events with the same attributes for analysis (for example, events occurring at the same location, the price of the same stock, etc.), so that the rule matching granularity can indicate which attribute (for example, location or stock identification, etc.) is used to group the event stream. The rule matching logic refers to the logic for sequence matching for event sequences (for example, from the event sequence of "event 1→event 2→event 4→event 9→event 1", detect whether there is a sequence of "event 2→event 4→event 1"). The rule matching result processing logic refers to the logic for processing the results determined based on the rule matching logic (for example, after matching the sequence of "event 2→event 4→event 1", calculate the time interval between event 2→event 1, etc.).
[0005] However, how to configure CEP rules has become a technical problem that needs to be solved urgently. Summary of the invention
[0006] In order to solve the above technical problems, the present application provides an object acquisition method, device, electronic device, and computer-readable medium.
[0007] In order to achieve the above objectives, the technical solutions provided by this application are as follows:
[0008] The present application provides an object acquisition method, the method comprising:
[0009] Obtaining a rule configuration document for a rule input to be used; the rule configuration document includes at least one key-value pair and at least one logical representation statement;
[0010] The rule configuration document is parsed to obtain a rule matching granularity extractor, a rule matching logic executor, and a rule matching result processing logic executor corresponding to the rule to be used.
[0011] In one possible implementation, the rules to be used include at least one first data processing logic and at least one second data processing logic; the at least one key-value pair is determined based on the at least one first data processing logic; and the at least one logical representation statement is determined based on the at least one second data processing logic.
[0012] In a possible implementation manner, the at least one key-value pair includes at least one rule attribute description pair; the at least one rule attribute description pair is used to describe at least one attribute information of the rule to be used.
[0013] In a possible implementation, the logic representation statement belongs to the language to be used;
[0014] The parsing process of the rule configuration document to obtain a rule matching granularity extractor, a rule matching logic executor and a rule matching result processing logic executor corresponding to the rule to be used includes:
[0015] The rule configuration document is parsed according to the language to be used to obtain a rule matching granularity extractor, a rule matching logic executor and a rule matching result processing logic executor corresponding to the rule to be used.
[0016] In a possible implementation manner, the at least one key-value pair includes a language description pair; the language description pair is used to describe the language to be used.
[0017] In a possible implementation manner, the language to be used is structured query language.
[0018] In a possible implementation manner, the method further includes:
[0019] After the language input operation triggered by the rule to be used is acquired, the language to be used is determined according to the language input operation.
[0020] In a possible implementation, the logic representation statement belongs to a structured query language;
[0021] The method further comprises:
[0022] After obtaining the event to be processed, the event to be processed is processed according to the rule matching granularity extractor, the rule matching logic executor, the rule matching result processing logic executor, and at least one data set constructed for the rule to be used; the data set includes at least one event to be referenced; the matching status of each event to be referenced under the reference condition is the same.
[0023] In a possible implementation manner, the method further includes:
[0024] Display the document to be edited;
[0025] In response to a key-value pair input operation and a statement input operation triggered by the rule to be used in the document to be edited, updating character content in the document to be edited;
[0026] The step of obtaining a rule configuration document for the rule input to be used includes:
[0027] In response to a document generation operation triggered for the document to be edited, the rule configuration document is generated according to character content in the document to be edited.
[0028] The present application also provides an object acquisition device, comprising:
[0029] A document acquisition unit, used to acquire a rule configuration document for a rule to be used; the rule configuration document includes at least one key-value pair and at least one logical representation statement;
[0030] The document parsing unit is used to parse the rule configuration document to obtain a rule matching granularity extractor, a rule matching logic executor and a rule matching result processing logic executor corresponding to the rule to be used.
[0031] The present application also provides an electronic device, the device comprising: a processor and a memory;
[0032] The memory is used to store instructions or computer programs;
[0033] The processor is used to execute the instructions or computer programs in the memory so that the electronic device executes the object acquisition method provided in the present application.
[0034] The present application also provides a computer-readable medium, in which instructions or computer programs are stored. When the instructions or computer programs are executed on a device, the device executes the object acquisition method provided by the present application.
[0035] The present application provides a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program codes for executing the object acquisition method provided by the present application.
[0036] Compared with the prior art, this application has at least the following advantages:
[0037] In the technical solution provided by the present application, after obtaining the rule configuration document (e.g., *.josn file, etc.) input for the rule to be used (e.g., a CEP rule to be created, etc.), the rule configuration document is parsed and processed to obtain the rule matching granularity extractor, rule matching logic executor, and rule matching result processing logic executor corresponding to the rule to be used. Among them, because the rule configuration document includes at least one key-value pair and at least one logical representation statement, the rule configuration document can use these key-value pairs and these logical representation statements to represent the relevant configuration content of the rule to be used (e.g., the three core elements of rule matching granularity, rule matching logic, and rule matching result processing logic, etc.), so that the relevant personnel can complete the configuration process for a CEP rule by using some simple key-value pair input operations and some simple statement editing operations in a programming language (e.g., SQL language) that they are familiar with, so as to effectively meet the CEP rule configuration needs of those relevant personnel with relatively weak programming foundation, thereby helping to improve the user's CEP rule configuration experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 A flowchart of an object acquisition method provided in an embodiment of the present application;
[0040] Figure 2 A schematic diagram of a rule configuration document provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of at least one data set provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of an event stream processing process provided in an embodiment of the present application;
[0043] Figure 5 A schematic diagram of the structure of an object acquisition device provided in an embodiment of the present application;
[0044] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to better understand the technical solution of the present application, some technical terms involved in the present application are introduced below.
[0046] Flink refers to a framework and distributed processing engine, and Flink can be used for stateful computations on unbounded and bounded data streams. In addition, Flink is designed to run in all common cluster environments, performing computations at in-memory execution speeds and at any scale. In addition, Flink can be used to implement CEP rules.
[0047] Structured Query Language (SQL) is a database query and programming language, and SQL can be used to access data as well as query, update and manage relational database systems.
[0048] Flink CEP refers to the complex event processing library in Flink, so that Flink can implement analysis and processing based on a series of behavioral information (events) based on the complex event processing library. For example, by analyzing the relationship between events: timing relationship, time interval, progressive relationship, and aggregation relationship, it can continuously query the event sequence that meets the requirements from the event stream, and finally obtain more complex composite events.
[0049] Java is an object-oriented programming language, and Java has the characteristics of simplicity, object-oriented, distributed, robust, security, platform independence and portability, multi-threading, and dynamism.
[0050] JSON (JavaScript Object Notation) is a lightweight data exchange format. It uses a text format that is completely independent of programming languages to store and represent data. The simplicity and clear hierarchical structure make JSON an ideal data exchange language, which is easy for humans to read and write, as well as easy for machines to parse and generate, and effectively improves network transmission efficiency.
[0051] Based on the relevant contents of the above technical terms, the relevant contents of the technical solution of this application are introduced below.
[0052] In fact, in some application scenarios, for the open source Flink CEP, the rule configuration process for a CEP rule can be implemented using the Flink code method (for example, a Java-based code method, etc.) and the Flink SQL method. For ease of understanding, the following is an explanation in conjunction with Tables 1 to 3.
[0053] As an example, for an event stream, when the event stream includes the events shown in Table 1 below, if the relevant personnel want to configure the CEP rule of "find a period when the performance of a single item continues to decline", the relevant personnel can use the configuration method shown in Table 2 below or the configuration method shown in Table 3 to configure the CEP rule.
[0054] Item symbol Information collection time (rowtime) Resource value (price) Consumption value (tax) 'Item 1' '01-Apr-11 10:00:00' 12 1 'Item 1' '01-Apr-11 10:00:01' 17 2 …… …… …… …… 'Item 1' '01-Apr-11 10:00:02' 19 1
[0055] Table 1 Event flow with Ticker as the identifier
[0056]
[0057] Table 2 A CEP rule expressed in Flink code (Flink Java API)
[0058] As shown in Table 2 above, in one possible implementation, relevant personnel can use Java language to configure a CEP rule, but this configuration method has the following defects:
[0059] (1) Low rule iteration efficiency: Since the CEP rule configuration is coupled with the Flink code, each modification of the CEP rule requires iterating the Flink code and re-launching it, which is inefficient.
[0060] (2) Poor readability of rules: The core information of CEP rules (rule matching granularity, rule matching logic, matching result processing logic, etc.) is distributed in the code, which is not conducive to managing the rule logic of the current system operation.
[0061] (3) The CEP system is not user-friendly: The rule configuration lacks information such as “rule validity identification” and “start and stop time”, making it impossible to effectively manage the life cycle of CEP rules.
[0062]
[0063] Table 3 A CEP rule expressed through Flink SQL
[0064] As shown in Table 3 above, in one possible implementation, relevant personnel can use SQL language to configure a CEP rule, but this configuration method has the following defects:
[0065] ① Limited support functions: For example, when it is necessary to "calculate the number of events with item consumption value > 2 from all item price change events matched by PRICE_DOWN after CEP rule matching is completed", Flink SQL cannot support the configuration of this function.
[0066] ②Rule configuration is prone to errors: In the CEP rule configuration syntax based on Flink SQL, there are some complex syntax conventions, which can easily lead to rule configuration errors.
[0067] ③ The CEP system is not easy to use: the rule configuration lacks information such as "rule validity identification" and "start and stop time", and cannot effectively control the life cycle of CEP rules.
[0068] Based on the CEP rule configuration methods shown in Table 2 and Table 3 above, it can be seen that these configuration methods have defects, resulting in a poor CEP rule matching experience for relevant personnel (especially those with poor programming foundation).
[0069] Based on the relevant content of the above example, in order to solve the technical problems shown in the background technology part, the embodiment of the present application provides an object acquisition method, which includes: after obtaining the rule configuration document (for example, *.josn file, etc.) input for the rule to be used (for example, a CEP rule to be created, etc.), the rule configuration document is parsed to obtain the rule matching granularity extractor, rule matching logic executor and rule matching result processing logic executor corresponding to the rule to be used. Among them, because the rule configuration document includes at least one key-value pair and at least one logical representation statement, the rule configuration document can use these key-value pairs and these logical representation statements to represent the relevant configuration content of the rule to be used (for example, the three core elements of rule matching granularity, rule matching logic and rule matching result processing logic, etc.), so that the relevant personnel can use some simple key-value pair input operations and use some simple statement editing operations in a programming language (for example, SQL language) that they are familiar with to complete the configuration process for a CEP rule, thereby effectively meeting the CEP rule configuration needs of those relevant personnel with poor programming foundation, thereby helping to improve the user's CEP rule configuration experience.
[0070] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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.
[0071] In order to better understand the technical solution provided by the present application, the object acquisition method provided by the present application is described below with reference to some drawings. Figure 1 As shown, the object acquisition method provided in the embodiment of the present application includes the following S1-S2. Among them, Figure 1 A flowchart of an object acquisition method provided in an embodiment of the present application.
[0072] S1: Obtain a rule configuration document for a rule input to be used; the rule configuration document includes at least one key-value pair and at least one logic representation statement.
[0073] The rule to be used refers to a CEP rule that needs to be configured by relevant personnel. For example, the rule to be used may be the CEP rule of "finding a period during which the performance of a single item is continuously declining" mentioned above.
[0074] A rule configuration document refers to a document configured by relevant personnel for the rules to be used, so that the rule configuration document can express the relevant content configured for the rules to be used (for example, the three core elements of rule matching granularity, rule matching logic, and rule matching result processing logic, etc.). For example, the rule configuration document can be Figure 2 The josn documentation shown.
[0075] In addition, in order to reduce the configuration difficulty of CEP rules as much as possible, the embodiment of the present application also provides a possible implementation of the above "rule configuration document", in which the rule configuration document may include at least one key-value pair (for example, Figure 2 A key-value pair with a string structure similar to ""rule_id":"1"" as shown) and at least one logical representation statement (for example, Figure 2This is similar to the string "select * from events where price>0" shown in the figure), which is conducive to enabling the relevant personnel to complete the configuration process for a CEP rule by using some simple key-value pair input operations and editing operations of some simple statements in a programming language they are familiar with (for example, SQL language). It can be seen that because the rule configuration document can be composed of a large number of key-value pairs and a small number of programming statements, the programming level requirements of the rule configuration document for the relevant personnel are relatively low, which can effectively reduce the configuration difficulty of the CEP rules, thereby effectively improving the CEP rule configuration experience of the relevant personnel.
[0076] To facilitate understanding of the above "rule configuration document", the following is an explanation with examples.
[0077] As an example, when the above rules to be used include at least one first data processing logic and at least one second data processing logic, and the above rule configuration document includes at least one key-value pair and at least one logical characterization statement, the at least one key-value pair can be determined based on the at least one first data processing logic, and the at least one logical characterization statement can be determined based on the at least one second data processing logic.
[0078] The first data processing logic refers to the data processing logic involved in the above-mentioned rules to be used, which can be expressed by means of key-value pairs. For example, the first data processing logic can be Figure 2 The data processing logic expressed by the various key-value pairs shown.
[0079] The i-th key-value pair refers to a string existing in the above rule configuration document and used to express the i-th first data processing logic in a key-value pair manner. i is a positive integer, i≤I, I is a positive integer, and I represents the number of key-value pairs in the above "at least one key-value pair".
[0080] The second data processing logic refers to the data processing logic involved in the above-mentioned rules to be used, which cannot be expressed by means of key-value pairs. For example, the second data processing logic can be Figure 2 The various SQL statements shown express the data processing logic.
[0081] The jth logical representation statement refers to a string existing in the above rule configuration document, which is used to express the jth second data processing logic in a certain programming language. j is a positive integer, j≤J, J is a positive integer, and J represents the number of statements in the above "at least one logical representation statement".
[0082] Based on the above five paragraphs, it can be known that in a possible implementation, the above rule configuration document may include a large number of key-value pairs and a small number of logical representation statements. Among them, because these key-value pairs can represent some simple data processing logic involved in the above rules to be used, and these logical representation statements can represent some complex data processing logic involved in the rules to be used, the combination of these key-value pairs and these logical representation statements can realize the configuration process for the rules to be used, which can effectively reduce the configuration difficulty for CEP rules, thereby effectively improving the CEP rule configuration experience of relevant personnel.
[0083] In addition, the embodiments of the present application do not limit the programming language to which the above "at least one logical representation statement" belongs, for example, it can specifically be a language to be used. The language to be used refers to the programming language to which these logical representation statements belong; and the embodiments of the present application do not limit the language to be used, for example, it can be any relatively simple programming language (for example, SQL, etc.).
[0084] In addition, the embodiment of the present application does not limit the process of obtaining the language to be used above. For example, the language to be used can be set in advance according to the application scenario.
[0085] In fact, in order to better improve the user's CEP rule configuration experience, the embodiment of the present application also provides a possible implementation method of the above-mentioned process of obtaining the language to be used, which can be specifically: after obtaining the language input operation triggered by the rule to be used, the language to be used is determined according to the language input operation, so that the language to be used can represent the programming language pointed to by the language input operation. Among them, the language input operation is used to indicate which programming language the user wants to use to configure the complex data processing logic involved in the rule to be used; and the embodiment of the present application does not limit the implementation method of the language input operation, for example, it can be implemented by outputting a string to a text box. For example, it can also be implemented by selecting a language option you want to use from a plurality of pre-set programming language options.
[0086] It can be seen that in some application scenarios, users can not only edit the configuration document of a CEP rule, but also select a programming language according to their personal needs (for example, which programming language they are more familiar with, etc.), so that the user can subsequently use statements under the programming language to complete the configuration process of the complex data processing logic in the CEP rule. This can better meet the user's CEP rule configuration needs, thereby better improving the user's CEP rule configuration experience.
[0087] In fact, different users may use different programming languages to complete the configuration process for complex data processing logic. Based on this, the embodiment of the present application also provides a possible implementation of the above "at least one key-value pair". In this implementation, when the above "at least one logical representation statement" belongs to the language to be used, the "at least one key-value pair" not only includes the key-value pair determined according to the above at least one first data processing logic, but also includes a language description pair (for example, Figure 2 The language description pair is used to describe the language to be used, so that the programming language used by the user to configure complex data processing logic can be learned from the language description pair, and document parsing can be performed based on the programming language, which is conducive to meeting the programming language requirements of different users, thereby improving the user's CEP rule configuration experience.
[0088] In fact, for a CEP rule, the CEP rule may contain some attribute information (for example, identification information, version information, whether it is in an available state, validity period description information, etc.), so in order to better improve the configuration effect of the CEP rule, the embodiment of the present application also provides a possible implementation of the above "at least one key-value pair", in which the "at least one key-value pair" may also include at least one rule attribute description pair. Among them, the at least one rule attribute description pair is used to describe at least one attribute information of the above rule to be used (for example, identification information, version information, whether it is in an available state, validity period description information, etc.). That is, the kth rule attribute description pair (for example, Figure 2 The string similar to ""rule_id":"1"" shown in the figure is used to describe the k-th attribute information of the rule to be used. k is a positive integer, k≤K, K is a positive integer, and K represents the number of key-value pairs in the "at least one rule attribute description pair".
[0089] Based on the relevant content of the rule configuration document above, it can be known that in one possible implementation mode, the rule configuration document can describe all the data processing logic involved in a CEP rule with the help of a large number of key-value pairs and a small number of programming statements, so that the rule configuration document can represent all the data processing logic involved in the CEP rule.
[0090] In addition, the embodiment of the present application does not limit the acquisition process of the above rule configuration document. For example, it may specifically include the following steps 11 to 13.
[0091] Step 11: Display the document to be edited.
[0092] Among them, the document to be edited refers to a document that needs to be edited; and the embodiment of the present application does not limit the document to be edited. For example, it can refer to a document being displayed in any document editor (for example, a text editor, etc.).
[0093] Step 12: In response to the key-value pair input operation and the statement input operation triggered by the to-be-used rule in the to-be-edited document, the character content in the to-be-edited document is updated.
[0094] The key-value pair input operation is used to input a key-value pair into the document to be edited in the previous context, so that the key-value pair can represent a simple data processing logic involved in the rule to be used in the previous context.
[0095] The statement input operation is used to input a logic representation statement into the document to be edited in the previous context, so that the logic representation statement can express a certain complex data processing logic involved in the rule to be used in the previous context.
[0096] The “character contents in the document to be edited” mentioned above refers to the characters recorded in the document to be edited.
[0097] In addition, the embodiment of the present application does not limit the implementation method of the above step 12. For example, it can be implemented by using any existing or future method that can update the characters in the document according to user operations.
[0098] Step 13: In response to the document generation operation triggered for the document to be edited, a rule configuration document is generated according to the character content in the document to be edited, so that the character content in the rule configuration document is consistent with the character content in the document to be edited.
[0099] Among them, the document generation operation is used to trigger the generation process for a document; and the embodiment of the present application does not limit the document generation operation. For example, it can be implemented for any existing or future operation that can trigger the document generation process (for example, clicking a save button, etc.).
[0100] Based on the relevant content of steps 11 to 13 above, it can be known that the user can use any document editor (for example, a text editor, etc.) to implement the configuration process for a CEP rule, which can effectively reduce the requirements of the CEP rule configuration process for the configuration device, thereby helping to better improve the user's CEP rule configuration experience.
[0101] Based on the relevant content of S1 above, it can be known that in one possible implementation, if a user wants to configure the rules to be used, the user can trigger some editing operations on any device with document editing function to obtain a rule configuration document input for the rules to be used, so that the rule configuration document can express all the data processing logic involved in the rules to be used with the help of a large number of key-value pairs or a small number of programming statements, so that some components corresponding to the rules to be used (for example, rule matching granularity extractor, rule matching logic executor and rule matching result processing logic executor) can be generated based on the rule configuration document.
[0102] S2: Parse the rule configuration document to obtain a rule matching granularity extractor, a rule matching logic executor, and a rule matching result processing logic executor corresponding to the rule to be used.
[0103] Among them, the rule matching granularity extractor is used to extract the grouping key of an event according to the rule matching granularity configured for the rule to be used, so that the grouping key can represent a certain attribute of the event, so that some processing can be performed based on the grouping key later (for example, hash grouping processing, etc.).
[0104] The rule matching logic executor is used to perform event matching processing on the event stream according to the rule matching logic configured for the rule to be used. For example, the rule matching logic executor can be implemented by means of a nondeterministic finite state machine (NFA).
[0105] The rule matching result processing logic executor is used to process some event matching results according to the rule matching result processing logic configured for the rule to be used. For example, the rule matching result processing logic executor can be implemented with the help of the event matching result processing function.
[0106] In addition, the embodiments of the present application do not limit the implementation methods of S2. For example, in one possible implementation method, when the above "at least one logical representation statement" belongs to the language to be used, S2 can specifically be: according to the language to be used, the above rule configuration document is parsed and processed to obtain the rule matching granularity extractor, rule matching logic executor and rule matching result processing logic executor corresponding to the rule to be used.
[0107] It can be seen that in some cases, if the language to be used in the above text is SQL, after obtaining the above rule configuration document, the SQL statements in the rule configuration document can be parsed with the help of the SQL parsing method, so that the rule matching granularity extractor, rule matching logic executor and rule matching result processing logic executor corresponding to the above rules to be used can be determined based on the parsing results of these SQL statements.
[0108] Based on the relevant contents of S1 to S2 above, it can be known that for the object acquisition method provided in the embodiment of the present application, after obtaining the rule configuration document (e.g., *.josn file, etc.) input for the rule to be used (e.g., a CEP rule to be created, etc.), the rule configuration document is parsed and processed to obtain the rule matching granularity extractor, rule matching logic executor, and rule matching result processing logic executor corresponding to the rule to be used. Among them, because the rule configuration document includes at least one key-value pair and at least one logical representation statement, the rule configuration document can use these key-value pairs and these logical representation statements to represent the relevant configuration content of the rule to be used (e.g., the three core elements of rule matching granularity, rule matching logic, and rule matching result processing logic, etc.), so that the relevant personnel can use some simple key-value pair input operations and use some simple statement editing operations in a programming language (e.g., SQL language) that they are familiar with to complete the configuration process for a CEP rule, thereby effectively meeting the CEP rule configuration needs of those relevant personnel with relatively weak programming foundation, thereby helping to improve the user's CEP rule configuration experience.
[0109] In fact, when the language to be used in the above text is SQL, in order to better adapt to the data processing requirements of the SQL language, the embodiment of the present application also provides a possible implementation method of the above object acquisition method, under which the object acquisition method not only includes the above S1-S2, but also includes the following step 21. The execution time of step 21 is later than the execution time of S2 above.
[0110] Step 21: After obtaining the event to be processed, the event to be processed is processed according to the rule matching granularity extractor, rule matching logic executor, rule matching result processing logic executor corresponding to the rule to be used above, and at least one data set constructed for the rule to be used.
[0111] Wherein, the pending event refers to an event obtained from the event stream; and the embodiment of the present application does not limit the pending event. For example, in some application scenarios (for example, when real-time processing is performed on events in the event stream), the pending event may refer to a newly generated event in the event stream. It should be noted that the embodiment of the present application does not limit the acquisition method of the above-mentioned pending event. In addition, the embodiment of the present application does not limit the implementation method of the event. For example, it can be any type of data (for example, structured data, unstructured data, image data, video data, audio data, etc.).
[0112] A data set refers to a database set for the SQL statement in the rule configuration document, so that the SQL statement in the rule configuration document can use the data set to implement the complex data processing logic represented by the SQL statement. For example, when the above event to be processed comes from the event stream shown in Table 1, and the above rule to be used is the CEP rule of "find a period when the performance of a single item continues to decline", the above "at least one data set" can be Figure 3 The four data tables are shown.
[0113] It should be noted that for Figure 3 For the four data tables shown, the "event table" is used to record events that carry the resource value attributes of items, so that the "event table" can indicate changes in the resource values of items; the "start matching event table" is used to record events in which the resource value is greater than 0; the "resource value decrease event table" is used to record events in which the resource value of an item decreases continuously after the last event in which the resource value of an item is greater than 0; the "resource value increase event table" is used to record events in which the resource value of an item increases continuously after the last event in which the resource value of an item is greater than 0.
[0114] In fact, different data sets are used to record different types of data, and all events under the same data set have something in common. Based on this, it can be seen that in a possible implementation, the above data set may include at least one event to be referenced. Among them, the event to be referenced refers to an event that exists in the data set. In addition, the matching status of each event to be referenced in the data set under the condition to be referenced is the same. The condition to be referenced refers to a condition that is pre-set for the data set and required to be referenced when matching the event. The matching status is used to indicate whether an event meets the condition to be referenced. For ease of understanding, the following is an example.
[0115] As an example, different data sets correspond to different reference conditions, which can be specifically: if a data set is Figure 3The "event table" shown in the figure, the reference condition corresponding to the data set can be that the event carries a resource value, so that the above "matching status of the reference event under the reference condition" is used to indicate that the reference event carries a resource value; if a data set is Figure 3 The "start matching event table" shown in the figure, the reference condition corresponding to the data set is resource value>0, so that the above "matching status of the reference event under the reference condition" is used to indicate that the resource value carried by the reference event is greater than 0; if a data set is Figure 3 If the “Event table of resource value decrease” is shown, the reference condition corresponding to the data set can be that the resource value carried by the event is in a decreasing state, so that the above “matching state of the reference event under the reference condition” is used to indicate that the resource value carried by the reference event is in a decreasing state; if a data set is Figure 3 As shown in the “event table of rising resource values”, the reference condition corresponding to the data set can be that the resource value carried by the event is in an increasing state, so that the above “matching state of the event to be referenced under the reference condition” is used to indicate that the resource value carried by the event to be referenced is in an increasing state.
[0116] Based on the relevant content of step 21 above, it can be known that in a possible implementation mode, after parsing some components of the rule to be used (for example, a rule matching granularity extractor, a rule matching logic executor, and a rule matching result processing logic executor) from the rule configuration document corresponding to the rule to be used, if the document involves SQL statements, the event stream can be processed according to these components and some data sets (for example, Figure 4 This helps improve the event processing effect.
[0117] Based on the object acquisition method provided in the embodiment of the present application, the embodiment of the present application also provides an object acquisition device. Figure 5 Explain and illustrate. Figure 5 This is a schematic diagram of the structure of an object acquisition device provided in an embodiment of the present application. It should be noted that for the technical details of the object acquisition device provided in an embodiment of the present application, please refer to the relevant content of the object acquisition method above.
[0118] like Figure 5 As shown, the object acquisition device 500 provided in the embodiment of the present application includes:
[0119] The document acquisition unit 501 is used to acquire a rule configuration document for the rule input to be used; the rule configuration document includes at least one key-value pair and at least one logical representation statement;
[0120] The document parsing unit 502 is used to parse the rule configuration document to obtain a rule matching granularity extractor, a rule matching logic executor and a rule matching result processing logic executor corresponding to the rule to be used.
[0121] In one possible implementation, the rules to be used include at least one first data processing logic and at least one second data processing logic; the at least one key-value pair is determined based on the at least one first data processing logic; and the at least one logical representation statement is determined based on the at least one second data processing logic.
[0122] In a possible implementation manner, the at least one key-value pair includes at least one rule attribute description pair; the at least one rule attribute description pair is used to describe at least one attribute information of the rule to be used.
[0123] In a possible implementation, the logic representation statement belongs to the language to be used;
[0124] The document parsing unit 502 is specifically used to parse the rule configuration document according to the language to be used, and obtain a rule matching granularity extractor, a rule matching logic executor and a rule matching result processing logic executor corresponding to the rule to be used.
[0125] In a possible implementation manner, the at least one key-value pair includes a language description pair; the language description pair is used to describe the language to be used.
[0126] In a possible implementation manner, the language to be used is structured query language.
[0127] In a possible implementation manner, the object acquisition device 500 further includes:
[0128] The language acquisition unit is used to determine the language to be used according to the language input operation after acquiring the language input operation triggered by the rule to be used.
[0129] In a possible implementation, the logic representation statement belongs to a structured query language;
[0130] The object acquisition device 500 further includes:
[0131] An event processing unit is used to process the event to be processed after obtaining the event to be processed according to the rule matching granularity extractor, the rule matching logic executor, the rule matching result processing logic executor, and at least one data set constructed for the rule to be used; the data set includes at least one event to be referenced; and the matching status of each event to be referenced under the reference condition is the same.
[0132] In a possible implementation manner, the object acquisition device 500 further includes:
[0133] A document display unit, used to display the document to be edited;
[0134] A document editing unit, configured to update character content in the document to be edited in response to a key-value pair input operation and a statement input operation triggered by the rule to be used in the document to be edited;
[0135] The document acquisition unit 501 is specifically configured to generate the rule configuration document according to character contents in the document to be edited in response to a document generation operation triggered for the document to be edited.
[0136] Based on the relevant contents of the above-mentioned object acquisition device 500, it can be known that for the object acquisition device 500 provided in the embodiment of the present application, after obtaining the rule configuration document (e.g., *.josn file, etc.) input for the rule to be used (e.g., a CEP rule to be created, etc.), the rule configuration document is parsed and processed to obtain the rule matching granularity extractor, rule matching logic executor and rule matching result processing logic executor corresponding to the rule to be used. Among them, because the rule configuration document includes at least one key-value pair and at least one logical representation statement, the rule configuration document can use these key-value pairs and these logical representation statements to represent the relevant configuration content of the rule to be used (e.g., the three core elements of rule matching granularity, rule matching logic and rule matching result processing logic, etc.), so that the relevant personnel can complete the configuration process for a CEP rule by using some simple key-value pair input operations and editing operations of some simple statements in a programming language (e.g., SQL language) that they are familiar with, so as to effectively meet the CEP rule configuration needs of those relevant personnel with relatively weak programming foundation, thereby helping to improve the user's CEP rule configuration experience.
[0137] In addition, an embodiment of the present application also provides an electronic device, which includes a processor and a memory: the memory is used to store instructions or computer programs; the processor is used to execute the instructions or computer programs in the memory, so that the electronic device executes any implementation of the object acquisition method provided in the embodiment of the present application.
[0138] See also Figure 6 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0139] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0140] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0141] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0142] The electronic device provided by the embodiment of the present disclosure and the method provided by the above embodiment belong to the same inventive concept, and the technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0143] The embodiment of the present application also provides a computer-readable medium, in which instructions or computer programs are stored. When the instructions or computer programs are executed on a device, the device executes any implementation of the object acquisition method provided in the embodiment of the present application.
[0144] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0145] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0146] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0147] The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device can execute the method.
[0148] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0149] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0150] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit / module does not, in some cases, constitute a limitation on the unit itself.
[0151] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0152] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0153] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0154] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0155] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0156] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0157] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for acquiring an object, characterized in that: The method comprises: Obtaining a rule configuration document for a rule to be used; the rule configuration document includes at least one key-value pair and at least one logical representation statement, and the logical representation statement belongs to a structured query language; Parsing the rule configuration document to obtain a rule matching granularity extractor, a rule matching logic executor, and a rule matching result processing logic executor corresponding to the rule to be used; After obtaining the event to be processed, the event to be processed is processed according to the rule matching granularity extractor, the rule matching logic executor, the rule matching result processing logic executor, and at least one data set constructed for the rule to be used; the data set includes at least one event to be referenced; the matching states of the events to be referenced under the reference conditions are the same; The rule matching granularity extractor is used to extract the grouping key of the event to be processed according to the rule matching granularity configured for the rule to be used, wherein the grouping key is used to represent the attribute of the event to be processed; The rule matching logic executor is used to perform event matching processing on the event stream including the event to be processed according to the rule matching logic configured for the rule to be used, so as to obtain an event matching result; The rule matching result processing logic executor is used to process the event matching result according to the rule matching result processing logic configured for the rule to be used.
2. The method according to claim 1, characterized in that: The rule to be used includes at least one first data processing logic and at least one second data processing logic; the at least one key-value pair is determined according to the at least one first data processing logic; the at least one logic representation statement is determined according to the at least one second data processing logic; and / or, The at least one key-value pair includes at least one rule attribute description pair; the at least one rule attribute description pair is used to describe at least one attribute information of the rule to be used.
3. The method according to claim 1, characterized in that The logical representation statement belongs to the language to be used; The parsing process of the rule configuration document to obtain a rule matching granularity extractor, a rule matching logic executor and a rule matching result processing logic executor corresponding to the rule to be used includes: The rule configuration document is parsed according to the language to be used to obtain a rule matching granularity extractor, a rule matching logic executor and a rule matching result processing logic executor corresponding to the rule to be used.
4. The method according to claim 3, characterized in that The at least one key-value pair includes a language description pair; the language description pair is used to describe the language to be used; and / or, The language to be used is structured query language.
5. The method according to claim 3, characterized in that: The method further comprises: After the language input operation triggered by the rule to be used is acquired, the language to be used is determined according to the language input operation.
6. The method according to claim 1, characterized in that The method further comprises: Display the document to be edited; In response to a key-value pair input operation and a statement input operation triggered by the rule to be used in the document to be edited, updating character content in the document to be edited; The step of obtaining a rule configuration document for the rule input to be used includes: In response to a document generation operation triggered for the document to be edited, the rule configuration document is generated according to character content in the document to be edited.
7. An object acquisition device, characterized in that: include: A document acquisition unit, used to acquire a rule configuration document for a rule to be used; the rule configuration document includes at least one key-value pair and at least one logical representation statement, and the logical representation statement belongs to a structured query language; A document parsing unit, used to parse the rule configuration document to obtain a rule matching granularity extractor, a rule matching logic executor and a rule matching result processing logic executor corresponding to the rule to be used; An event processing unit, configured to process the event to be processed after acquiring the event to be processed according to the rule matching granularity extractor, the rule matching logic executor, the rule matching result processing logic executor, and at least one data set constructed for the rule to be used; the data set includes at least one event to be referenced; The matching status of each of the events to be referenced under the reference conditions is the same; the rule matching granularity extractor is used to extract the grouping key of the event to be processed according to the rule matching granularity configured for the rule to be used, and the grouping key is used to represent the attribute of the event to be processed; the rule matching logic executor is used to perform event matching processing on the event stream including the event to be processed according to the rule matching logic configured for the rule to be used, and obtain the event matching result; the rule matching result processing logic executor is used to process the event matching result according to the rule matching result processing logic configured for the rule to be used.
8. An electronic device, characterized in that: The device comprises: a processor and a memory; The memory is used to store instructions or computer programs; The processor is used to execute the instructions or computer programs in the memory so that the electronic device executes the method according to any one of claims 1 to 6.
9. A computer-readable medium, characterized in that The computer-readable medium stores instructions or computer programs, and when the instructions or computer programs are executed on a device, the device is enabled to execute the method according to any one of claims 1 to 6.
10. A computer program product, characterized in that It comprises a computer program carried on a non-transitory computer-readable medium, the computer program comprising a program code for executing the method according to any one of claims 1 to 6.
