Protocol adaptation method and system based on rule engine, terminal and storage medium

Through the protocol adaptation method based on the rule engine, the protocol adaptation is automatically processed, which solves the problem of low efficiency of protocol adaptation in the existing technology and realizes an efficient protocol adaptation process.

CN118540388APending Publication Date: 2024-08-23BEIJING UNISOUND INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410724944.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

The protocol adaptation efficiency in the existing technology is low and requires manual coding and mapping, resulting in cumbersome operations.

Method used

The protocol adaptation method based on the rule engine is used to perform template matching by obtaining the logical expression of the protocol information to be adapted, determine the target data source and call the parameter adaptation information, automatically perform parameter and protocol adaptation, and generate the target adaptation protocol.

Benefits of technology

There is no need for manual coding and mapping, which improves the efficiency of protocol adaptation. Automated processing reduces the possibility of errors and simplifies the protocol adaptation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540388A
    Figure CN118540388A
Patent Text Reader

Abstract

The invention provides a protocol adaptation method and system based on a rule engine, a terminal and a storage medium, and the method comprises the steps: obtaining to-be-adapted protocol information, inputting a logic expression in the to-be-adapted protocol information into the rule engine for template matching, and obtaining a protocol adaptation template; determining a target data source according to the protocol adaptation template, and calling parameter adaptation information and protocol adaptation information corresponding to the target data source; and performing parameter adaptation on the to-be-adapted protocol information according to the parameter adaptation information to obtain parameter adaptation protocol information, and performing protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain a target adaptation protocol. According to the embodiment of the invention, protocol adaptation can be automatically carried out on the to-be-adapted protocol information based on the rule engine, protocol adaptation does not need to be carried out by adopting a manual coding and mapping mode, and the protocol adaptation efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to a protocol adaptation method, system, terminal and storage medium based on a rule engine. Background Art

[0002] The development of the system platform is mainly carried out through development tools such as Eclipse using development languages ​​such as Java and PHP. Usually, it is necessary to understand the business, establish a business database, and implement it through development language programming. The development language is used to program the logic of the business, call and display data. In the process of system development, in order to improve the stability of protocol compatibility in the system, the issue of protocol adaptation has received more and more attention.

[0003] In the existing protocol adaptation process, manual coding and mapping of the protocol are required, which makes user operations cumbersome and reduces the efficiency of protocol adaptation. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a protocol adaptation method, system, terminal and storage medium based on a rule engine to solve the problem of low protocol adaptation efficiency in the prior art.

[0005] The embodiment of the present invention is implemented as follows: a protocol adaptation method based on a rule engine, the method comprising:

[0006] Acquire the protocol information to be adapted, and input the logical expression in the protocol information to be adapted into the rule engine for template matching to obtain a protocol adaptation template;

[0007] Determine the target data source according to the protocol adaptation template, and call the parameter adaptation information and protocol adaptation information corresponding to the target data source;

[0008] The protocol information to be adapted is parameter-adapted according to the parameter adaptation information to obtain parameter adaptation protocol information, and the parameter adaptation protocol information is protocol-adapted according to the protocol adaptation information to obtain a target adaptation protocol.

[0009] Preferably, the logical expression in the protocol information to be adapted is input into a rule engine for template matching to obtain a protocol adaptation template, including:

[0010] According to the rule engine, the data type and expression parameter of each logical expression are respectively obtained, and a logical parameter table is determined according to the data type;

[0011] For each logical expression, matching the expression parameter with the corresponding logical parameter table to obtain an expression identifier;

[0012] Acquire a logical operator in the protocol information to be adapted, and combine each expression identifier according to the logical operator to obtain a combined identifier;

[0013] The combination identifier is matched with the template query table to obtain the protocol adaptation template.

[0014] Preferably, performing protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain a target adaptation protocol includes:

[0015] Acquire the splitting rule in the protocol adaptation information, and perform field splitting on the parameter adaptation protocol information according to the splitting rule to obtain protocol split segments;

[0016] Acquire the combination rule in the protocol adaptation information, and perform field combination on the protocol split segment according to the combination rule to obtain protocol combination information;

[0017] The target data type in the protocol adaptation information is acquired, and the data type is adapted for the protocol combination information according to the target data type to obtain a target adaptation protocol.

[0018] Preferably, after performing protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain the target adaptation protocol, the method further includes:

[0019] Acquire the protocol requirement format of the protocol information to be adapted, and perform format detection on the target adaptation protocol according to the protocol requirement format to obtain a format detection result;

[0020] Obtaining the number of splits corresponding to the split rule, and performing split detection on the protocol split segment according to the number of splits to obtain a split detection result;

[0021] Obtaining the information call result of the target data source, and generating a protocol detection result according to the format detection result, the split detection result and the information call result;

[0022] A protocol adaptation exception prompt is generated according to the protocol detection result.

[0023] Preferably, generating a protocol adaptation abnormality prompt according to the protocol detection result includes:

[0024] If the format detection result in the protocol detection result is unqualified, a format exception log is generated;

[0025] If the split detection result in the protocol detection result is unqualified, generating a split exception log;

[0026] If the information call result in the protocol detection result is unqualified, a call exception log is generated;

[0027] The protocol adaptation exception prompt is generated according to the log information of the format exception log, the split exception log and the call exception log.

[0028] Preferably, performing parameter adaptation on the protocol information to be adapted according to the parameter adaptation information to obtain parameter adaptation protocol information includes:

[0029] A parameter adaptation function in the parameter adaptation information is obtained, and parameter adaptation is performed on the protocol information to be adapted according to the parameter adaptation function to obtain the parameter adaptation protocol information.

[0030] Preferably, determining the target data source according to the protocol adaptation template includes:

[0031] The template identifier of the protocol adaptation template is obtained, and the template identifier is matched with an address query table to obtain the target data source.

[0032] Another object of an embodiment of the present invention is to provide a protocol adaptation system based on a rule engine, the system comprising:

[0033] The template matching module is used to obtain the protocol information to be adapted, and input the logical expression in the protocol information to be adapted into the rule engine for template matching to obtain the protocol adaptation template;

[0034] A data source calling module, used to determine a target data source according to the protocol adaptation template, and call parameter adaptation information and protocol adaptation information corresponding to the target data source;

[0035] The protocol adaptation module is used to perform parameter adaptation on the protocol information to be adapted according to the parameter adaptation information to obtain parameter adaptation protocol information, and perform protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain a target adaptation protocol.

[0036] The embodiment of the present invention can effectively adapt to the protocol information to be adapted to the protocol adaptation template corresponding to the protocol information to be adapted by inputting the logical expression in the protocol information to be adapted into the rule engine for template matching. The target data source can be effectively determined based on the protocol adaptation template. The parameter adaptation information corresponding to the target data source can be used to effectively perform parameter adaptation on the protocol information to be adapted to obtain parameter adaptation protocol information. Based on the protocol adaptation information corresponding to the target data source, the parameter adaptation protocol information can be effectively adapted to obtain the target adaptation protocol. The embodiment of the present invention can automatically perform protocol adaptation on the protocol information to be adapted based on the rule engine, without the need for manual coding and mapping to perform protocol adaptation, thereby improving the protocol adaptation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 is a flow chart of a protocol adaptation method based on a rule engine provided in the first embodiment of the present invention;

[0038] Figure 2 is a schematic diagram of the structure of a protocol adaptation system based on a rule engine provided in a second embodiment of the present invention;

[0039] Figure 3 is a schematic diagram of the structure of a protocol adaptation system based on a rule engine provided in a third embodiment of the present invention;

[0040] Figure 4 It is a schematic diagram of the structure of a terminal device provided in the fourth embodiment of the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0042] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.

[0043] Embodiment 1

[0044] See also Figure 1 , is a flow chart of a protocol adaptation method based on a rule engine provided in a first embodiment of the present invention. The protocol adaptation method based on a rule engine can be applied to any device or system. The protocol adaptation method based on a rule engine comprises the steps of:

[0045] Step S10, obtaining the protocol information to be adapted, and inputting the logical expression in the protocol information to be adapted into the rule engine for template matching to obtain a protocol adaptation template;

[0046] Among them, logical expressions are stored in the protocol information to be adapted. This embodiment converts the logical expressions in the protocol information to be adapted into the target adaptation protocol that can be processed by the target system through automatic protocol adaptation. In this step, the logical expressions in the protocol information to be adapted are input into the rule engine for template matching, so that the protocol adaptation template corresponding to the protocol information to be adapted can be effectively adapted.

[0047] In this embodiment, the rule engine supports various logical expression configurations, and can configure complex logical condition judgments, allowing multiple conditions to be combined through logical operators such as "and (AND)", "or (OR)" and "not (NOT)". The parameter value in each condition can perform various comparison operations, such as judging whether a field is empty (IS NULL / IS NOT NULL), whether it is equal to a specific value (EQUALS), whether it is greater than or less than a threshold value (GREATER THAN / LESSTHAN), or whether a string contains specific content (CONTAINS). The data type support is also diverse, including but not limited to Boolean values, strings, and numbers.

[0048] Optionally, the logical expression in the protocol information to be adapted is input into a rule engine for template matching to obtain a protocol adaptation template, including:

[0049] According to the rule engine, the data type and expression parameter of each logical expression are respectively obtained, and the logical parameter table is determined according to the data type; wherein the data type is matched with the parameter query table to obtain the logical parameter table, and the corresponding relationship between different data types and corresponding logical parameter tables is stored in the parameter query table;

[0050] For each logical expression, the expression parameter is matched with the corresponding logical parameter table to obtain an expression identifier; wherein the logical parameter table stores expression identifiers corresponding to all expression parameters of corresponding data types;

[0051] Acquire a logical operator in the protocol information to be adapted, and combine the expression identifiers according to the logical operator to obtain a combination identifier; wherein the logical operator is used to represent a combination relationship between different logical expressions in the protocol information to be adapted, for example, a combination of logical operators such as "AND", "OR" and "NOT" can be used;

[0052] The combination identifier is matched with a template query table to obtain the protocol adaptation template; wherein the template query table stores the corresponding relationship between different combination identifiers and corresponding protocol adaptation templates.

[0053] Step S20, determining a target data source according to the protocol adaptation template, and calling parameter adaptation information and protocol adaptation information corresponding to the target data source;

[0054] Wherein, the target data source can be effectively determined based on the protocol adaptation template; optionally, determining the target data source according to the protocol adaptation template includes:

[0055] The template identifier of the protocol adaptation template is obtained, and the template identifier is matched with an address query table to obtain the target data source; wherein the address query table stores the corresponding relationship between different template identifiers and corresponding target data sources.

[0056] Step S30, performing parameter adaptation on the protocol information to be adapted according to the parameter adaptation information to obtain parameter adaptation protocol information, and performing protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain a target adaptation protocol;

[0057] Among them, through the parameter adaptation information corresponding to the target data source, the parameter adaptation protocol information can be effectively performed on the parameter adaptation protocol information to obtain the parameter adaptation protocol information, and based on the protocol adaptation information corresponding to the target data source, the protocol adaptation of the parameter adaptation protocol information can be effectively performed to obtain the target adaptation protocol;

[0058] Optionally, performing parameter adaptation on the protocol information to be adapted according to the parameter adaptation information to obtain parameter adaptation protocol information includes:

[0059] Obtain the parameter adaptation function in the parameter adaptation information, and perform parameter adaptation on the protocol information to be adapted according to the parameter adaptation function to obtain the parameter adaptation protocol information; wherein, during parameter adaptation, the rule engine automatically calls and converts according to the pre-configured API address, input parameters, output parameters, and parameter adaptation function to obtain the parameter adaptation protocol information.

[0060] Further, performing protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain a target adaptation protocol includes:

[0061] Obtaining the splitting rules in the protocol adaptation information, and performing field splitting on the parameter adaptation protocol information according to the splitting rules to obtain protocol split segments; performing field splitting on the parameter adaptation protocol information according to the splitting rules can effectively split the fields in the parameter adaptation protocol information into protocol split segments corresponding to the protocol adaptation requirements;

[0062] Acquire the combination rule in the protocol adaptation information, and perform field combination on the protocol split segments according to the combination rule to obtain the protocol combination information; wherein, by performing field combination on the protocol split segments according to the combination rule, the protocol combination information that meets the protocol adaptation requirements can be effectively obtained;

[0063] The target data type in the protocol adaptation information is obtained, and the data type of the protocol combination information is adapted according to the target data type to obtain a target adaptation protocol; wherein, a dynamic function corresponding to the target data type is obtained, and data adaptation of the protocol combination information is performed based on the obtained dynamic function to obtain a target adaptation protocol.

[0064] Preferably, after performing protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain the target adaptation protocol, the method further includes:

[0065] Acquire the protocol requirement format of the protocol information to be adapted, and perform format detection on the target adaptation protocol according to the protocol requirement format to obtain a format detection result; wherein, performing format detection on the target adaptation protocol according to the protocol requirement format can effectively detect whether the format of the target adaptation protocol is the format required by the user;

[0066] Obtaining the number of splits corresponding to the splitting rule, and performing split detection on the protocol split segment according to the splitting number to obtain a split detection result; wherein, performing split detection on the protocol split segment by the splitting number can effectively detect whether there is an error in the field splitting process of the parameter adaptation protocol information;

[0067] The information call result of the target data source is obtained, a protocol detection result is generated according to the format detection result, the split detection result and the information call result, and a protocol adaptation exception prompt is generated according to the protocol detection result; wherein, by obtaining the information call result of the target data source to detect whether there is an error in the call of the target data source, and by generating a protocol adaptation exception prompt, it is effectively facilitated to check the abnormal errors in the protocol adaptation process.

[0068] Furthermore, generating a protocol adaptation abnormality prompt according to the protocol detection result includes:

[0069] If the format detection result in the protocol detection result is unqualified, a format abnormality log is generated;

[0070] If the split detection result in the protocol detection result is unqualified, a split exception log is generated;

[0071] If the information call result in the protocol detection result is unqualified, a call exception log is generated;

[0072] Generate protocol adaptation exception prompts based on the log information of format exception logs, split exception logs and call exception logs; among them, exception handling in the protocol adaptation process includes target adaptation protocol format errors, target data source call exception errors, protocol adaptation exceptions and other situations for exception capture and processing. When an exception occurs, the exception code can be output as required, and the type of exception can be quickly determined through log monitoring to provide developers with rapid problem location.

[0073] In this embodiment, by inputting the logical expression in the protocol information to be adapted into the rule engine for template matching, it can be effectively adapted to the protocol adaptation template corresponding to the protocol information to be adapted, and the target data source can be effectively determined based on the protocol adaptation template. Through the parameter adaptation information corresponding to the target data source, the parameter adaptation of the protocol information to be adapted can be effectively performed to obtain parameter adaptation protocol information. Based on the protocol adaptation information corresponding to the target data source, the parameter adaptation protocol information can be effectively adapted to obtain the target adaptation protocol. In this embodiment of the present invention, the protocol adaptation of the protocol information to be adapted can be automatically performed based on the rule engine, and there is no need to perform protocol adaptation in the form of manual coding and mapping, thereby improving the efficiency of protocol adaptation.

[0074] Embodiment 2

[0075] See also Figure 2 , is a schematic diagram of the structure of a protocol adaptation system 100 based on a rule engine provided in a second embodiment of the present invention, including:

[0076] The template matching module 10 is used to obtain the protocol information to be adapted, and input the logic expression in the protocol information to be adapted into the rule engine for template matching to obtain the protocol adaptation template.

[0077] Optionally, the module matching module 10 is further used to: obtain the data type and expression parameter of each logical expression according to the rule engine, and determine the logical parameter table according to the data type;

[0078] For each logical expression, matching the expression parameter with the corresponding logical parameter table to obtain an expression identifier;

[0079] Acquire a logical operator in the protocol information to be adapted, and combine each expression identifier according to the logical operator to obtain a combined identifier;

[0080] The combination identifier is matched with the template query table to obtain the protocol adaptation template.

[0081] The data source calling module 11 is used to determine the target data source according to the protocol adaptation template, and call the parameter adaptation information and protocol adaptation information corresponding to the target data source.

[0082] Optionally, the data source calling module 11 is further used to: obtain a template identifier of the protocol adaptation template, and match the template identifier with an address query table to obtain the target data source.

[0083] The protocol adaptation module 12 is used to perform parameter adaptation on the protocol information to be adapted according to the parameter adaptation information to obtain parameter adaptation protocol information, and perform protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain a target adaptation protocol.

[0084] Optionally, the protocol adaptation module 12 is further used to: obtain a splitting rule in the protocol adaptation information, and perform field splitting on the parameter adaptation protocol information according to the splitting rule to obtain a protocol split segment;

[0085] Acquire the combination rule in the protocol adaptation information, and perform field combination on the protocol split segment according to the combination rule to obtain protocol combination information;

[0086] The target data type in the protocol adaptation information is acquired, and the data type is adapted for the protocol combination information according to the target data type to obtain a target adaptation protocol.

[0087] Furthermore, the protocol adaptation module 12 is also used to: obtain the protocol requirement format of the protocol information to be adapted, and perform format detection on the target adaptation protocol according to the protocol requirement format to obtain a format detection result;

[0088] Obtaining the number of splits corresponding to the split rule, and performing split detection on the protocol split segment according to the number of splits to obtain a split detection result;

[0089] Obtaining the information call result of the target data source, and generating a protocol detection result according to the format detection result, the split detection result and the information call result;

[0090] A protocol adaptation exception prompt is generated according to the protocol detection result.

[0091] Furthermore, the protocol adaptation module 12 is further used to: generate a format abnormality log if the format detection result in the protocol detection result is unqualified;

[0092] If the split detection result in the protocol detection result is unqualified, generating a split exception log;

[0093] If the information call result in the protocol detection result is unqualified, a call exception log is generated;

[0094] The protocol adaptation exception prompt is generated according to the log information of the format exception log, the split exception log and the call exception log.

[0095] Preferably, the protocol adaptation module 12 is further used to: obtain a parameter adaptation function in the parameter adaptation information, and perform parameter adaptation on the protocol information to be adapted according to the parameter adaptation function to obtain the parameter adaptation protocol information.

[0096] In this embodiment, by inputting the logical expression in the protocol information to be adapted into the rule engine for template matching, it can be effectively adapted to the protocol adaptation template corresponding to the protocol information to be adapted, and the target data source can be effectively determined based on the protocol adaptation template. Through the parameter adaptation information corresponding to the target data source, the parameter adaptation of the protocol information to be adapted can be effectively performed to obtain parameter adaptation protocol information. Based on the protocol adaptation information corresponding to the target data source, the parameter adaptation protocol information can be effectively adapted to obtain the target adaptation protocol. In this embodiment of the present invention, the protocol adaptation of the protocol information to be adapted can be automatically performed based on the rule engine, and there is no need to perform protocol adaptation in the form of manual coding and mapping, thereby improving the efficiency of protocol adaptation.

[0097] Embodiment 3

[0098] See also Figure 3 , is a structural diagram of a protocol adaptation system 101 based on a rule engine provided in the third embodiment of the present invention, including: an access layer 13, a rule engine 14 and a basic protocol module 15. The access layer 13 is used for client access, and the client can be an Internet of Things device or a cloud service. The rule engine 14 is the core module of the system, responsible for parsing and executing predefined rule templates. The rule engine 14 not only handles conditional judgment and rule execution, but also can match the input protocol (protocol information to be adapted) with the standard protocol field through conditional parsing and mapping parsing. The flexibility of the rule engine 14 is reflected in allowing users to configure and modify rules to meet the needs of different scenarios. Flexible and efficient protocol adaptation is achieved through the rule engine 14 to adapt to the changing protocol adaptation processing requirements. The basic protocol module 15 is used to store information such as protocol templates.

[0099] The main processing flow of the rule engine 14 includes: loading rule templates, engine template matching, execution of the rule engine 14 and abnormal log processing;

[0100] Step 1: Load the rule template, which mainly loads the template data stored in the DB into the cache, which can improve the speed of reading the template.

[0101] Step 2: Engine template matching, template matching is performed according to the input protocol. In order to ensure accurate matching of the rules, the rule engine 14 supports various logical expression configurations, and can configure complex logical condition judgments, allowing multiple conditions to be combined through logical operators such as "and (AND)", "or (OR)" and "not (NOT)". The parameter value in each condition can be subjected to various comparison operations, such as judging whether a field is empty (IS NULL / IS NOT NULL), whether it is equal to a specific value (EQUALS), whether it is greater than or less than a threshold value (GREATER THAN / LESS THAN), or whether a string contains specific content (CONTAINS). The data type support is also diverse, including but not limited to Boolean values, strings, and numbers.

[0102] Step 3: The execution of the rule engine 14 converts the input protocol into the output protocol (target adaptation protocol) required by the target according to the matched template content. The conversion process mainly includes pre-data preparation and post-data processing. The pre-data preparation mainly includes: when calling the third-party data source defined in the template, the engine will automatically call and convert according to the configured API address, input parameters, and output parameters. Post-data processing mainly includes processing functions such as field splitting, field merging, data type conversion, dynamic function calling, etc., to meet the needs of the target protocol, and finally complete the automated protocol output.

[0103] Step 4: Exception log processing. Exception processing mainly involves capturing and processing various situations such as output parameter format errors, API call exception errors, and post-data processing exceptions. When an exception occurs, the exception code can be output as required. In addition, the type of exception can be quickly determined through log monitoring and provided to developers to quickly locate the problem.

[0104] This embodiment can effectively solve the problem of changing customer needs. When a customer requires a specific protocol output, the output format can be quickly adjusted to meet the needs of different customers. The workload of manually writing conversion logic for each customer is reduced, and the integration cost and time are reduced. The protocol compatibility problem between different platforms or services is solved. This embodiment can be quickly tested and iterated. The rule engine 14 can quickly change and test the rules so that new business logic can be quickly launched. Automated conversion rules reduce manual conversion errors, increase the accuracy of data conversion, and simplify the maintenance process.

[0105] Embodiment 4

[0106] Figure 4 2 is a block diagram of a terminal device 2 provided in the fourth embodiment of the present application. Figure 4As shown, the terminal device 2 of this embodiment includes: a processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the processor 20, such as a program of a protocol adaptation method based on a rule engine. When the processor 20 executes the computer program 22, the steps in each embodiment of the protocol adaptation method based on a rule engine are implemented.

[0107] Exemplarily, the computer program 22 may be divided into one or more modules, which are stored in the memory 21 and executed by the processor 20 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 22 in the terminal device 2. The terminal device may include, but is not limited to, a processor 20 and a memory 21.

[0108] The processor 20 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0109] The memory 21 may be an internal storage unit of the terminal device 2, such as a hard disk or memory of the terminal device 2. The memory 21 may also be an external storage device of the terminal device 2, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 2. Further, the memory 21 may also include both an internal storage unit and an external storage device of the terminal device 2. The memory 21 is used to store the computer program and other programs and data required by the terminal device. The memory 21 may also be used to temporarily store data that has been output or is to be output.

[0110] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional unit.

[0111] If the integrated module is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium can be non-volatile or volatile. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in computer-readable storage media can be appropriately increased or decreased according to the requirements of legislation and patent practices in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practices, computer-readable storage media do not include electrical carrier signals and telecommunication signals.

[0112] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A protocol adaptation method based on a rule engine, characterized in that: The method comprises: Acquire the protocol information to be adapted, and input the logical expression in the protocol information to be adapted into the rule engine for template matching to obtain a protocol adaptation template; Determine the target data source according to the protocol adaptation template, and call the parameter adaptation information and protocol adaptation information corresponding to the target data source; The protocol information to be adapted is parameter-adapted according to the parameter adaptation information to obtain parameter adaptation protocol information, and the parameter adaptation protocol information is protocol-adapted according to the protocol adaptation information to obtain a target adaptation protocol.

2. The protocol adaptation method based on rule engine according to claim 1, characterized in that: Inputting the logical expression in the protocol information to be adapted into the rule engine for template matching to obtain a protocol adaptation template, including: According to the rule engine, the data type and expression parameter of each logical expression are respectively obtained, and a logical parameter table is determined according to the data type; For each logical expression, matching the expression parameter with the corresponding logical parameter table to obtain an expression identifier; Acquire a logical operator in the protocol information to be adapted, and combine each expression identifier according to the logical operator to obtain a combined identifier; The combination identifier is matched with the template query table to obtain the protocol adaptation template.

3. The protocol adaptation method based on rule engine according to claim 1, characterized in that: Performing protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain a target adaptation protocol includes: Acquire the splitting rule in the protocol adaptation information, and perform field splitting on the parameter adaptation protocol information according to the splitting rule to obtain protocol split segments; Acquire the combination rule in the protocol adaptation information, and perform field combination on the protocol split segment according to the combination rule to obtain protocol combination information; The target data type in the protocol adaptation information is acquired, and the data type is adapted for the protocol combination information according to the target data type to obtain a target adaptation protocol.

4. The protocol adaptation method based on rule engine as claimed in claim 3, characterized in that: After performing protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain a target adaptation protocol, the method further includes: Acquire the protocol requirement format of the protocol information to be adapted, and perform format detection on the target adaptation protocol according to the protocol requirement format to obtain a format detection result; Obtaining the number of splits corresponding to the split rule, and performing split detection on the protocol split segment according to the number of splits to obtain a split detection result; Obtaining the information call result of the target data source, and generating a protocol detection result according to the format detection result, the split detection result and the information call result; A protocol adaptation exception prompt is generated according to the protocol detection result.

5. The protocol adaptation method based on rule engine as claimed in claim 4, characterized in that: Generate a protocol adaptation exception prompt according to the protocol detection result, including: If the format detection result in the protocol detection result is unqualified, a format exception log is generated; If the split detection result in the protocol detection result is unqualified, generating a split exception log; If the information call result in the protocol detection result is unqualified, a call exception log is generated; The protocol adaptation exception prompt is generated according to the log information of the format exception log, the split exception log and the call exception log.

6. The protocol adaptation method based on rule engine according to claim 1, characterized in that: Performing parameter adaptation on the protocol information to be adapted according to the parameter adaptation information to obtain parameter adaptation protocol information includes: A parameter adaptation function in the parameter adaptation information is obtained, and parameter adaptation is performed on the protocol information to be adapted according to the parameter adaptation function to obtain the parameter adaptation protocol information.

7. The protocol adaptation method based on rule engine according to claim 1, characterized in that: Determining a target data source according to the protocol adaptation template includes: The template identifier of the protocol adaptation template is obtained, and the template identifier is matched with an address query table to obtain the target data source.

8. A protocol adaptation system based on a rule engine, characterized in that: The system comprises: The template matching module is used to obtain the protocol information to be adapted, and input the logical expression in the protocol information to be adapted into the rule engine for template matching to obtain the protocol adaptation template; A data source calling module, used to determine a target data source according to the protocol adaptation template, and call parameter adaptation information and protocol adaptation information corresponding to the target data source; The protocol adaptation module is used to perform parameter adaptation on the protocol information to be adapted according to the parameter adaptation information to obtain parameter adaptation protocol information, and perform protocol adaptation on the parameter adaptation protocol information according to the protocol adaptation information to obtain a target adaptation protocol.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Protocol conversion method of distributed power supply access unit and power grid access system

    CN120455559A