A data conversion method and system based on event-driven
Through an event-driven data conversion method, hash algorithms and partitioning strategies are used to convert data securely and efficiently, solving the problem of incompatible data formats between different industrial systems and achieving efficient and secure data conversion.
Patent Information
- Application Number
- CN202411896343.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-12-23
AI Technical Summary
The incompatibility of data formats between different industrial systems leads to low data conversion efficiency and poor security. Especially in large-scale data conversion, it may affect system response time and overall efficiency, and even cause system crashes. The data is also prone to leakage and tampering.
An event-driven data conversion method is adopted. The hash value of the data is calculated through a hash algorithm and stored in the blockchain. Keys and key values are assigned according to the preset partitioning strategy. The data is partitioned and converted, and the identity resolution module and conversion unit are used to identify and process the conversion results.
It improves the efficiency of data conversion, ensures the security of data conversion, ensures the confidentiality, integrity and availability of data, and avoids data leakage and tampering.
Smart Images

Figure CN119759909B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer file processing, and in particular to an event-driven data conversion method and system. Background Art
[0002] In today's industrial landscape, data conversion between different industrial systems is crucial. With the continuous advancement of technology, the independent operation of each industrial system can no longer meet the needs of efficient production and management. Different industrial systems are like independent islands, and data conversion is the bridge connecting them. Through effective data conversion, information can be smoothly transferred and shared, breaking down barriers between systems.
[0003] However, because different systems may use different data formats, such as XML, JSON, and CSV, incompatibility between data formats can arise. Currently, a common technique is to develop specialized data conversion tools or interfaces to convert and unify data in different formats. Another approach is to employ advanced data conversion technologies and tools, such as data integration platforms and ETL (Extract, Transform, Load) tools, to improve the efficiency and accuracy of data conversion. However, large-scale data conversion requires significant computing resources and time, especially when the data volume is large and the conversion logic is complex. This can affect system response time and overall efficiency, and may even cause system lag or crashes. Furthermore, data confidentiality, integrity, and availability cannot be guaranteed, making data susceptible to leakage and tampering. Summary of the Invention
[0004] In order to solve the above technical problems, an embodiment of the present invention provides an event-driven data conversion method and system, which improves data conversion efficiency and ensures data conversion security by partitioning data according to a partitioning strategy and then converting it.
[0005] A first aspect of an embodiment of the present invention provides an event-driven data conversion method, the method comprising:
[0006] Receive data uploaded from input interfaces of multiple pre-set clients and obtain the data to be converted corresponding to each client;
[0007] Using the hash algorithm, each data to be converted is calculated to obtain the hash value of the data to be converted, and the hash value and the data to be converted are stored in the blockchain;
[0008] According to a preset partitioning strategy, keys and key values are assigned to each data to be converted, and based on the key, the key values of each data to be converted are stored in the corresponding partition to obtain multiple groups of data, wherein each group of converted data includes multiple key values of the data to be converted;
[0009] The key value of the data to be converted in each group is sent to the corresponding identification resolution module, so that the identification resolution module uses the identification unit to identify the port address of the data to be converted to obtain a first identification result, and sends the key value of the data to be converted to the corresponding conversion unit according to the first identification result, so that the conversion unit converts the key value of the data to be converted according to the set conversion strategy to obtain a conversion result, and sends the conversion result to the corresponding consumer end so that the user can view the conversion result at the consumer end.
[0010] In a possible implementation of the first aspect, using a hash algorithm to calculate each data to be converted to obtain a hash value of the data to be converted includes:
[0011] Convert the data to be converted into binary code to obtain the binary code of the data to be converted;
[0012] Information is extracted from the binary code to obtain a fixed identifier of the data to be converted, and the fixed identifier is calculated using a hash algorithm to obtain a hash value of the data to be converted, where the fixed identifier consists of the 1st to 10th bytes and the Nth to N-10th bytes in the binary code, where N is an integer greater than or equal to 1.
[0013] In a possible implementation of the first aspect, allocating a key and a key value to each of the to-be-converted data according to a preset partitioning strategy includes:
[0014] When the data type of the data to be converted is text data, the string key is used as the key of the data to be converted, and the feature vector of the text data is extracted and used as the key value;
[0015] When the data type of the data to be converted is numerical data, the numerical key is used as the key of the data to be converted, and the actual numerical value is used as the key value, wherein the numerical key includes integer key and floating-point key;
[0016] When the data type of the data to be converted is image data or video data, the timestamp of the image data or video data is used as the key, and the improved extraction algorithm is used to extract the image distribution features of the image data or video data, and the image distribution features are used as the key value of the data to be converted.
[0017] In a possible implementation of the first aspect, using the improved extraction algorithm to calculate image distribution features of picture data or video data includes:
[0018] Perform Gaussian blurring on image or video data at multiple scales to obtain images at multiple scales.
[0019] The images of each scale are arranged in order from small to large according to the scale, from the upper layer to the lower layer to form a Gaussian pyramid, wherein the Gaussian pyramid includes multiple groups, and each group includes images of the corresponding scale;
[0020] Compare the values of each pixel in the image of each group with the adjacent pixels on the previous and next layers of the Gaussian pyramid. If the pixel is a maximum point or a minimum point, the pixel is determined to be a feature point, and multiple feature points are obtained.
[0021] Calculate the gradient magnitude and direction of the image according to each feature point to obtain multiple gradient magnitudes and directions, obtain a gradient direction histogram according to each gradient magnitude and direction, and determine the key point according to the gradient direction histogram;
[0022] Taking the key point as the center, a neighborhood of a preset area is obtained, the neighborhood is evenly divided into multiple sub-neighborhoods, and the gradient direction histogram of each sub-neighborhood is calculated to obtain multiple sub-gradient direction histograms;
[0023] According to each sub-gradient direction histogram, the image distribution characteristics of the picture data or video data are obtained.
[0024] In a possible implementation of the first aspect, converting the data to be converted according to a set conversion strategy to obtain a conversion result includes:
[0025] Convert the data to be converted into a string type, and use the string function to convert the data to be converted whose key is not a string value to obtain the conversion result;
[0026] Convert the data to be converted into a numeric type, then use the parseInt function to extract the numeric value in the data to be converted whose key is a string value, obtain an extraction result, and determine the extraction result as the conversion result;
[0027] If the key of the data to be converted is not a string value or a numeric value, use the string function to convert the data to a string type to obtain string data, and use the parseInt function to extract the numeric value in the string data to obtain the conversion result.
[0028] In a possible implementation of the first aspect, converting the data to be converted according to the set conversion strategy to obtain a conversion result further includes:
[0029] When converting the data to be converted whose key value is a floating-point key to an integer key, the preset conversion formula is used for conversion. The preset conversion formula is:
[0030]
[0031] In the formula, b represents the converted data, and a represents the data to be converted whose key value is a floating-point type.
[0032] In a possible implementation of the first aspect, when enabling a user to view the conversion result on a consumer end, the method further includes:
[0033] Obtain the binary code of the conversion result, and calculate the hash value to be checked based on the binary code;
[0034] It is determined whether the hash value to be checked is the same as the hash value of the conversion result. If they are the same, the conversion result is determined to be a correct conversion result.
[0035] A second aspect of an embodiment of the present invention provides an event-driven data conversion system, including:
[0036] A receiving module, configured to receive data uploaded from input interfaces of a plurality of pre-set clients and obtain data to be converted corresponding to each of the clients;
[0037] A calculation module is used to calculate each data to be converted using a hash algorithm to obtain a hash value of the data to be converted, and store the hash value and the data to be converted in the blockchain;
[0038] A partitioning module is used to assign keys and key values to each data to be converted according to a preset partitioning strategy, and based on the keys, store the key values of each data to be converted into corresponding partitions to obtain multiple groups of data, wherein each group of converted data includes multiple key values of the data to be converted;
[0039] The conversion module is used to send the key value of the data to be converted in each group to the corresponding identification resolution module, so that the identification resolution module uses the identification unit to identify the port address of the data to be converted to obtain a first identification result, and sends the key value of the data to be converted to the corresponding conversion unit according to the first identification result, so that the conversion unit converts the key value of the data to be converted according to the set conversion strategy to obtain a conversion result, and sends the conversion result to the corresponding consumer end so that the user can view the conversion result at the consumer end.
[0040] In a possible implementation of the second aspect, the calculation module includes a binary code conversion unit and an extraction unit.
[0041] The binary code conversion unit is used to convert the data to be converted into binary code to obtain the binary code of the data to be converted;
[0042] The extraction unit is used to extract information from the binary code to obtain a fixed identifier of the data to be converted, and calculate the fixed identifier using a hash algorithm to obtain a hash value of the data to be converted, wherein the fixed identifier is composed of the 1st to 10th bytes and the Nth to N-10th bytes in the binary code, and N is an integer greater than or equal to 1.
[0043] In a possible implementation of the second aspect, the partitioning module includes a first partitioning unit, a second partitioning unit, and a third partitioning unit.
[0044] The first partitioning unit is configured to use a string key as a key of the data to be converted when the data type of the data to be converted is text data, and extract a feature vector of the text data and use the feature vector as the key;
[0045] The second partitioning unit is configured to use a numerical key as a key of the data to be converted and an actual numerical value as a key value when the data type of the data to be converted is numerical data, wherein the numerical key includes an integer key and a floating-point key;
[0046] The third partitioning unit is used to use the timestamp of the picture or video data as the key when the data type of the data to be converted is picture data or video data, and use the improved extraction algorithm to extract the image distribution characteristics of the picture data or video data, and use the image distribution characteristics as the key value of the data to be converted.
[0047] The event-driven data conversion method proposed in the present invention receives data uploaded from the input interfaces of multiple pre-set clients, obtains the data to be converted corresponding to each client, calculates each data to be converted using a hash algorithm, obtains a hash value of the data to be converted, and stores the hash value and the data to be converted in a blockchain; assigns a key and a key value to each data to be converted according to a preset partitioning strategy, stores the key value of each data to be converted in a corresponding partition based on the key, and obtains multiple groups of data, wherein each group of converted data includes multiple key values of the data to be converted; sends the key value of the data to be converted in each group to a corresponding identification resolution module, so that the identification resolution module uses an identification unit to identify the port address of the data to be converted, obtains a first identification result, and sends the key value of the data to be converted to a corresponding conversion unit based on the first identification result, so that the conversion unit converts the key value of the data to be converted according to the set conversion strategy to obtain a conversion result, and sends the conversion result to the corresponding consumer end so that the user can view the conversion result at the consumer end. The above method improves data conversion efficiency and ensures data conversion security by partitioning the data according to the partitioning strategy and then converting it. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1: A flow chart of a conversion method according to an embodiment of the event-driven data conversion method provided by the present invention;
[0049] Figure 2 : A system block diagram of an embodiment of the event-driven data conversion method provided by the present invention. DETAILED DESCRIPTION
[0050] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0051] It will be understood that, although the terms first, second, third, etc. may be used herein to describe various elements, components and / or sections, these elements, components and / or sections should not be limited by these terms.
[0052] Please refer to Figure 1 , which is a flow chart of an embodiment of the event-driven data conversion method provided by an embodiment of the present invention, including steps S101 to S104, each of which is specifically as follows:
[0053] S101: receiving data uploaded from input interfaces of a plurality of pre-set clients, and obtaining data to be converted corresponding to each client.
[0054] In this embodiment, the user inputs freight data on the input interface of different freight system clients and uploads the freight data to the control system. The system receives data uploaded from the input interfaces of multiple pre-set clients. The freight data includes various types of data such as text data, digital data, image data, audio data, video data, etc. The format of the freight data includes but is not limited to text format, image format, audio format, video format, database format, spreadsheet format, 3D graphics format and map format.
[0055] It is worth noting that the data to be converted refers to the freight data uploaded to the control system.
[0056] S102: Calculate each data to be converted using a hash algorithm to obtain a hash value of the data to be converted, and store the hash value and the data to be converted in the blockchain.
[0057] In this embodiment, different systems may use different data formats, such as XML, JSON, and CSV. When developing specialized data conversion tools or interfaces to convert and unify data in different formats, data security is also a key consideration. During the data conversion process, data confidentiality, integrity, and availability must be ensured to prevent data leakage and tampering.
[0058] After receiving data uploaded by different clients, the hash algorithm is used to calculate each data to be converted to obtain the hash value of the data to be converted. The obtained hash value and the data to be converted are then stored in the blockchain, so that the converted data to be converted can be verified later to determine whether the converted data to be converted has been tampered with.
[0059] In some embodiments, the step S102 of "using a hash algorithm to calculate each of the data to be converted to obtain a hash value of the data to be converted" includes but is not limited to the following steps:
[0060] Convert the data to be converted into binary code to obtain the binary code of the data to be converted;
[0061] Information is extracted from the binary code to obtain a fixed identifier of the data to be converted, and the fixed identifier is calculated using a hash algorithm to obtain a hash value of the data to be converted, where the fixed identifier consists of the 1st to 10th bytes and the Nth to N-10th bytes in the binary code, where N is an integer greater than or equal to 1.
[0062] In this embodiment, the hash algorithm can map a binary string of arbitrary length to a fixed-length binary string. The resulting binary string is the hash value. However, since the hash value cannot be reversed to the original data, the input data must remain unchanged.
[0063] Therefore, the data to be converted is first converted into binary code to obtain the binary code of the data to be converted, and then the first 10 bytes and the last 10 bytes of the binary code are extracted. The first 10 bytes and the last 10 bytes are combined as a fixed identifier of the data to be converted, and then the fixed identifier is mapped into a hash value of a fixed length using a hash algorithm to obtain the hash value of the data to be converted.
[0064] S103. According to a preset partitioning strategy, keys and key values are assigned to each data to be converted. Based on the key, the key values of each data to be converted are stored in the corresponding partition to obtain multiple groups of data, wherein each group of converted data includes multiple key values of the data to be converted.
[0065] In this embodiment, according to a pre-set partitioning strategy, keys and key values are assigned to each data to be converted, and based on the key, each data to be converted is stored in a corresponding partition. Each partition includes multiple key values of the same type of conversion data, wherein the same type of conversion data included in each partition comes from different clients.
[0066] It's worth noting that a key is an identifier that uniquely identifies a data item or element. It's like a label that points to a specific piece of data, while a value is the data content associated with the key. It's the actual information associated with the key.
[0067] In some embodiments, the step S103 of “assigning keys and key values to the data to be converted according to a preset partitioning strategy” includes, but is not limited to, the following steps:
[0068] When the data type of the data to be converted is text data, the string key is used as the key of the data to be converted, and the feature vector of the text data is extracted and used as the key value;
[0069] When the data type of the data to be converted is numerical data, the numerical key is used as the key of the data to be converted, and the actual numerical value is used as the key value, wherein the numerical key includes integer key and floating-point key;
[0070] When the data type of the data to be converted is image data or video data, the timestamp of the image data or video data is used as the key, and the improved extraction algorithm is used to extract the image distribution features of the image data or video data, and the image distribution features are used as the key value of the data to be converted.
[0071] In this embodiment, when converting different data formats from different data sources, such as XML, JSON, CSV, database-specific formats, etc., a lot of time and effort is required to deal with format differences during the conversion process. For example, when converting data in a CSV file to JSON format for a specific application, it may be necessary to write complex scripts or use specialized conversion tools. Moreover, some formats may have specific structural requirements or restrictions, which further increases the difficulty of conversion. Therefore, by classifying the data according to the type of each data, dividing it into different areas, and then converting the data of the same format, the conversion time can be effectively reduced, and because the data types include text data, digital data, image data, audio data, video data and other types of data,
[0072] Key-value pairs are typically used to represent a mapping relationship. Keys can come in a variety of types, including integers such as int and long. For example, when writing a program to store data in a database, integers can be used as HashMap keys to store and retrieve corresponding values. Floating-point numbers such as float and double can also be used. Character types such as char can also be used. Single characters can be used as keys to store related information. Strings are also popular because they clearly express the meaning of the key and are easy to compare and manipulate.
[0073] Therefore, if the data to be converted, that is, the freight data, is digital data, then its key is a numerical key, wherein the numerical key includes an integer key and a floating-point key. When the freight data is text data, then its key value is a string value key. For image and video data, the key value can be determined according to the specific application scenario. When the type of freight data is image data or video data, the image distribution features of the image or video data are calculated and used as the key value. After obtaining the key value of each data to be converted, it is determined whether the data to be converted has a partition corresponding to the key. If so, the key value of the data to be converted is stored in the corresponding partition. If not, the key value of the data to be converted is stored in the spare partition to obtain multiple groups of data.
[0074] In some embodiments, step S103 of "using the improved extraction algorithm to calculate the image distribution characteristics of the picture data or video data" includes but is not limited to the following steps:
[0075] Performing Gaussian blurring of multiple scales on frame images in image data or video data to obtain images of multiple scales;
[0076] The images of each scale are arranged in order from small to large according to the scale, from the upper layer to the lower layer to form a Gaussian pyramid, wherein the Gaussian pyramid includes multiple groups, and each group includes images of the corresponding scale;
[0077] Compare the values of each pixel in the image of each group with the adjacent pixels on the previous and next layers of the Gaussian pyramid. If the pixel is a maximum point or a minimum point, the pixel is determined to be a feature point, and multiple feature points are obtained.
[0078] Calculate the gradient magnitude and direction of the image according to each feature point to obtain multiple gradient magnitudes and directions, obtain a gradient direction histogram according to each gradient magnitude and direction, and determine the key point according to the gradient direction histogram;
[0079] Taking the key point as the center, a neighborhood of a preset area is obtained, the neighborhood is evenly divided into multiple sub-neighborhoods, and the gradient direction histogram of each sub-neighborhood is calculated to obtain multiple sub-gradient direction histograms;
[0080] According to each sub-gradient direction histogram, the image distribution characteristics of the picture data or video data are obtained.
[0081] In this embodiment, a multi-scale space is constructed by performing Gaussian blurring of different scales on image or video data. Different standard deviations σ are used for Gaussian blurring. The larger σ is, the blurrier the image and the larger the scale. Images of different scales are then organized into Gaussian pyramids, divided into different groups, with each group containing image layers of different scales. In each group of the Gaussian pyramid, the values of each pixel and its adjacent pixels at different scales are compared. Adjacent pixels include adjacent pixels at the same scale and pixels at corresponding positions at upper and lower adjacent scales. If the value of the pixel is a local maximum or minimum, it is marked as a potential feature point.
[0082] More accurately locate detected potential feature points. A three-dimensional quadratic function is fitted to determine the precise location and scale of key points within the feature set. Low-contrast key points and edge response points are then removed to improve the stability of the feature points. Initial key points are obtained. For each initial key point, the image gradient magnitude and direction are calculated within its neighborhood to generate a gradient direction histogram. Based on this gradient direction histogram, the dominant direction of the key point is determined. The direction corresponding to the peak in the histogram is typically considered the dominant direction of the key point.
[0083] Centered on the keypoint, a neighborhood of a specific size is taken and evenly divided into several subregions. Within each subregion, a gradient direction histogram is calculated. These histograms are combined to form a high-dimensional feature descriptor that describes the local characteristics of the keypoint, i.e., the image distribution characteristics. The image distribution characteristics are used as the key value for the data to be converted.
[0084] S104. Send the key value of the data to be converted in each group to the corresponding identification resolution module, so that the identification resolution module uses the identification unit to identify the port address of the data to be converted to obtain a first identification result, and sends the key value of the data to be converted to the corresponding conversion unit according to the first identification result, so that the conversion unit converts the key value of the data to be converted according to the set conversion strategy to obtain a conversion result, and sends the conversion result to the corresponding consumer end, so that the user can view the conversion result at the consumer end.
[0085] In this embodiment, after partitioning each data to be converted, the key value of the data to be converted in each zone is sent to the corresponding identification resolution module. The identification resolution module uses the identification unit to identify the port address of the data to be converted, and obtains the port address identification result of each data to be converted. Then, based on the port address identification result, the key value of the data to be converted is sent to the corresponding conversion queue. The conversion unit in the conversion queue converts the key value of the data to be converted according to the set conversion strategy, obtains the conversion result, and sends the conversion result to the corresponding consumer end so that the user can view the conversion result at the consumer end.
[0086] Before sending the key of each group of converted data to the corresponding identity resolution module, the key value in each group stops storing after reaching a preset capacity and starts sending to the corresponding identity resolution module.
[0087] In some embodiments, step S104 of "converting the data to be converted according to the set conversion strategy to obtain a conversion result" includes but is not limited to the following steps:
[0088] Convert the data to be converted into a string type, and use the string function to convert the data to be converted whose key is not a string value to obtain the conversion result;
[0089] Convert the data to be converted into a numeric type, then use the parseInt function to extract the numeric value in the data to be converted whose key is a string value, obtain the extraction result, and determine the extraction result as the conversion result;
[0090] If the key of the data to be converted is not a string value or a numeric value, use the string function to convert the data to a string type to obtain string data, and use the parseInt function to extract the numeric value in the string data to obtain the conversion result.
[0091] In this embodiment, the data to be converted is converted into a string type, and the string function is used to convert the data to be converted whose key value is not a string value to obtain a conversion result, for example, String s = "" + i, where i represents a variable of type int.
[0092] Convert the data to a numeric type. Use the parseInt function to extract the numeric value from the data to be converted if the key value is a string value, obtain the extraction result, and determine the extraction result as the conversion result. If the key value of the data to be converted is not a string value or a numeric value, use the string function to convert the data to a string type to obtain string data. Use the parseInt function to extract the numeric value from the string data to obtain the conversion result.
[0093] It should be noted that when the parseInt function parses a string, it will return a number when it encounters a number.
[0094] In some embodiments, step S104 of "converting the data to be converted according to the set conversion strategy to obtain a conversion result" includes but is not limited to the following steps:
[0095] When converting the data to be converted whose key value is a floating-point key to an integer key, the conversion is performed using a preset conversion formula, where the preset conversion formula is:
[0096]
[0097] In the formula, b represents the converted data, and a represents the data to be converted whose key value is a floating-point type.
[0098] In this embodiment, when converting an integer whose key value is a floating-point type to an integer, the number to be converted can be explicitly converted using a forced type conversion operator. However, since this may result in data loss or reduced precision, the conversion formula is written as follows during the conversion:
[0099]
[0100] In the formula, b represents the converted data, and a represents the data to be converted whose key value is a floating-point type.
[0101] The above conversion formula can further ensure the accuracy of the conversion result.
[0102] In some embodiments, the step S105 of "enabling the user to view the conversion result on the consumer end" includes but is not limited to the following steps:
[0103] Obtain the binary code of the conversion result, and calculate the hash value to be checked based on the binary code;
[0104] It is determined whether the hash value to be checked is the same as the hash value of the conversion result. If they are the same, the conversion result is determined to be a correct conversion result.
[0105] In this embodiment, the binary code of the conversion result is obtained, and then a hash algorithm is used to calculate a hash value to be checked based on the binary code. It is determined whether the hash value to be checked is the same as the hash value of the conversion result. If they are the same, the conversion result is determined to be a correct conversion result.
[0106] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The order of execution of these steps or stages is not necessarily one by one, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0107] In some embodiments, as Figure 2 , which shows a block diagram of an event-driven data conversion system 200 provided in an embodiment of the present application, including: a receiving module 201, a calculation module 202, a partitioning module 203 and a conversion module 204, wherein:
[0108] The receiving module 201 is used to receive data uploaded from the input interfaces of a plurality of pre-set clients and obtain the data to be converted corresponding to each client;
[0109] The calculation module 202 is used to calculate each data to be converted using a hash algorithm to obtain a hash value of the data to be converted, and store the hash value and the data to be converted in the blockchain;
[0110] Partitioning module 203 is used to assign keys and key values to each data to be converted according to a preset partitioning strategy, and store the key values of each data to be converted into corresponding partitions based on the keys, thereby obtaining multiple groups of data, wherein each group of converted data includes multiple key values of the data to be converted;
[0111] The conversion module 204 is used to send the key value of the data to be converted in each group to the corresponding identification resolution module, so that the identification resolution module uses the identification unit to identify the port address of the data to be converted to obtain a first identification result, and sends the key value of the data to be converted to the corresponding conversion unit based on the first identification result, so that the conversion unit converts the key value of the data to be converted according to the set conversion strategy, obtains the conversion result, and sends the conversion result to the corresponding consumer end, so that the user can view the conversion result at the consumer end.
[0112] In some embodiments, the computing module includes a binary code conversion unit and an extraction unit.
[0113] The binary code conversion unit is used to perform binary code conversion on the data to be converted to obtain the binary code of the data to be converted;
[0114] The extraction unit is used to extract information from the binary code to obtain a fixed identifier of the data to be converted, and calculate the fixed identifier using a hash algorithm to obtain a hash value of the data to be converted, wherein the fixed identifier is composed of the 1st to 10th bytes and the Nth to N-10th bytes in the binary code, where N is an integer greater than or equal to 1.
[0115] In some embodiments, the partition module includes a first partition unit, a second partition unit, and a third partition unit.
[0116] The first partitioning unit is configured to use a string key as a key of the data to be converted when the data type of the data to be converted is text data, extract a feature vector of the text data, and use the feature vector as a key value;
[0117] The second partitioning unit is configured to use a numerical key as a key of the data to be converted and an actual numerical value as a key value when the data type of the data to be converted is numerical data, wherein the numerical key includes an integer key and a floating-point key;
[0118] The third partitioning unit is used to use the timestamp of the picture or video data as the key when the data type of the data to be converted is picture data or video data, and use the improved extraction algorithm to extract the image distribution characteristics of the picture data or video data, and use the image distribution characteristics as the key value of the data to be converted.
[0119] In some embodiments, the improved extraction algorithm is used to calculate the image distribution characteristics of the picture data or video data, including:
[0120] Performing Gaussian blurring of multiple scales on frame images in image data or video data to obtain images of multiple scales;
[0121] The images of each scale are arranged in order from small to large according to the scale, from the upper layer to the lower layer to form a Gaussian pyramid, wherein the Gaussian pyramid includes multiple groups, and each group includes images of the corresponding scale;
[0122] Compare the values of each pixel in the image of each group with the adjacent pixels on the previous and next layers of the Gaussian pyramid. If the pixel is a maximum point or a minimum point, the pixel is determined to be a feature point, and multiple feature points are obtained.
[0123] Calculate the gradient magnitude and direction of the image according to each feature point to obtain multiple gradient magnitudes and directions, obtain a gradient direction histogram according to each gradient magnitude and direction, and determine the key point according to the gradient direction histogram;
[0124] Taking the key point as the center, a neighborhood of a preset area is obtained, the neighborhood is evenly divided into multiple sub-neighborhoods, and the gradient direction histogram of each sub-neighborhood is calculated to obtain multiple sub-gradient direction histograms;
[0125] According to each sub-gradient direction histogram, the image distribution characteristics of the picture data or video data are obtained.
[0126] In some embodiments, the data to be converted is converted according to a set conversion strategy to obtain a conversion result, including:
[0127] Convert the data to be converted into a string type, and use the string function to convert the data to be converted whose key is not a string value to obtain the conversion result;
[0128] Convert the data to be converted into a numeric type, then use the parseInt function to extract the numeric value in the data to be converted whose key is a string value, obtain the extraction result, and determine the extraction result as the conversion result;
[0129] If the key of the data to be converted is not a string value or a numeric value, use the string function to convert the data to a string type to obtain string data, and use the parseInt function to extract the numeric value in the string data to obtain the conversion result.
[0130] In some embodiments, converting the data to be converted according to the set conversion strategy to obtain a conversion result further includes:
[0131] When converting the data to be converted whose key value is a floating-point key to an integer key, the conversion is performed using a preset conversion formula, where the preset conversion formula is:
[0132]
[0133] In the formula, b represents the converted data, and a represents the data to be converted whose key value is a floating-point type.
[0134] In some embodiments, when enabling a user to view the conversion result on the consumer side, the method further includes:
[0135] Obtain the binary code of the conversion result, and calculate the hash value to be checked based on the binary code;
[0136] It is determined whether the hash value to be checked is the same as the hash value of the conversion result. If they are the same, the conversion result is determined to be a correct conversion result.
[0137] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0138] The specific embodiments described above further illustrate the objectives, technical solutions, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.
Claims
1. A data conversion method based on event-driven, characterized in that: include: Receiving data uploaded from input interfaces of a plurality of pre-set clients, and obtaining data to be converted corresponding to each of the clients; Utilizing a hash algorithm, calculating each of the data to be converted to obtain a hash value of the data to be converted, and storing the hash value and the data to be converted in a blockchain; According to a preset partitioning strategy, a key and a key value are assigned to each of the data to be converted, and based on the key, the key value of each of the data to be converted is stored in a corresponding partition to obtain multiple groups of data, wherein each group of conversion data includes multiple key values of the data to be converted; Sending the key value of the data to be converted in each group to a corresponding identification resolution module, so that the identification resolution module uses an identification unit to identify the port address of the data to be converted to obtain a first identification result, and sending the key value of the data to be converted to a corresponding conversion unit according to the first identification result, so that the conversion unit converts the key value of the data to be converted according to a set conversion strategy to obtain a conversion result, and sending the conversion result to a corresponding consumer end, so that a user on the consumer end can view the conversion result; The allocating keys and key values to the data to be converted according to the preset partitioning strategy includes: When the data type of the data to be converted is text data, a string key is used as the key of the data to be converted, and a feature vector of the text data is extracted, and the feature vector is used as the key value; When the data type of the data to be converted is numerical data, a numerical key is used as the key of the data to be converted, and an actual numerical value is used as the key value, wherein the numerical key includes an integer key and a floating-point key; When the data type of the data to be converted is picture data or video data, the timestamp of the picture data or video data is used as the key, and the improved extraction algorithm is used to extract the image distribution characteristics of the picture data or video data, and the image distribution characteristics are used as the key value of the data to be converted.
2. The event-driven data conversion method according to claim 1, wherein: The method of calculating each of the data to be converted by using a hash algorithm to obtain a hash value of the data to be converted includes: Converting the data to be converted into binary code to obtain a binary code of the data to be converted; Information is extracted from the binary code to obtain a fixed identifier of the data to be converted, and a hash algorithm is used to calculate the fixed identifier to obtain a hash value of the data to be converted, wherein the fixed identifier is composed of the 1st to 10th bytes and the Nth to N-10th bytes in the binary code, where N is an integer greater than or equal to 1.
3. The event-driven data conversion method according to claim 1, wherein: The improved extraction algorithm is used to calculate the image distribution characteristics of the picture data or video data, including: Performing Gaussian blurring of multiple scales on the frame images in the picture data or video data to obtain images of multiple scales; Arrange the images of each scale in ascending order according to the scale size, from upper layer to lower layer, to form a Gaussian pyramid, wherein the Gaussian pyramid includes a plurality of groups, and each group includes the images of the corresponding scale; Comparing the values of each pixel in the image in each group with the values of adjacent pixels in the previous layer and the next layer of the Gaussian pyramid, and determining that the pixel is a feature point if the pixel is a maximum point or a minimum point, thereby obtaining a plurality of feature points; Calculating the gradient magnitude and direction of the image according to each of the feature points to obtain a plurality of the gradient magnitudes and directions, obtaining a gradient direction histogram according to each of the gradient magnitudes and directions, and determining the key point according to the gradient direction histogram; Taking the key point as the center, a neighborhood of a preset area is obtained, the neighborhood is evenly divided into a plurality of sub-neighborhoods, and a gradient direction histogram of each sub-neighborhood is calculated to obtain a plurality of sub-gradient direction histograms; The image distribution characteristics of the picture data or video data are obtained according to each of the sub-gradient direction histograms.
4. The event-driven data conversion method according to claim 1, wherein: The step of converting the data to be converted according to the set conversion strategy to obtain a conversion result includes: Convert the data to be converted into a string type, and use the string function to convert the data to be converted if the key is not a string value to obtain a conversion result; Convert the data to be converted into a numeric type, and then use the parseInt function to extract the numeric value in the data to be converted whose key is a string value to obtain an extraction result, and determine the extraction result as the conversion result; If the key of the data to be converted is not a string value or a numerical value, the string function is used to convert the data to be converted into a string type to obtain string data, and the parseInt function is used to extract the numerical value in the string data to obtain a conversion result.
5. The event-driven data conversion method according to claim 1, wherein: The step of converting the data to be converted according to the set conversion strategy to obtain a conversion result further includes: When the data to be converted whose key is a floating-point key is converted into the integer key, a preset conversion formula is used for conversion, wherein the preset conversion formula is: ; In the formula, b represents the converted data, and a represents the data to be converted whose key value is a floating-point type.
6. The event-driven data conversion method according to claim 1, wherein: When enabling the user to view the conversion result at the consumer end, the method further includes: Obtaining a binary code of the conversion result, and calculating a hash value to be checked based on the binary code; It is determined whether the hash value to be checked is the same as the hash value of the conversion result; if they are the same, the conversion result is determined to be a correct conversion result.
7. An event-driven data conversion system, characterized in that: include: A receiving module, configured to receive data uploaded from input interfaces of a plurality of pre-set clients and obtain data to be converted corresponding to each of the clients; A calculation module, configured to calculate each of the data to be converted using a hash algorithm to obtain a hash value of the data to be converted, and store the hash value and the data to be converted in a blockchain; A partitioning module is used to assign keys and key values to each data to be converted according to a preset partitioning strategy, and based on the keys, store the key values of each data to be converted into corresponding partitions to obtain multiple groups of data, wherein each group of converted data includes multiple key values of the data to be converted; a conversion module configured to send the key value of the data to be converted in each group to the corresponding identification resolution module, so that the identification resolution module uses the identification unit to identify the port address of the data to be converted to obtain a first identification result, and sends the key value of the data to be converted to the corresponding conversion unit based on the first identification result, so that the conversion unit converts the key value of the data to be converted according to a set conversion strategy to obtain a conversion result, and sends the conversion result to the corresponding consumer end so that the user can view the conversion result at the consumer end; The partition module includes a first partition unit, a second partition unit and a third partition unit, Wherein, the first partitioning unit is used for, when the data type of the data to be converted is text data, using a string key as a key of the data to be converted, extracting a feature vector of the text data, and using the feature vector as a key value; The second partitioning unit is configured to use a numerical key as a key of the data to be converted and an actual numerical value as a key value when the data type of the data to be converted is numerical data, wherein the numerical key includes an integer key and a floating-point key; The third partitioning unit is used to use the timestamp of the picture or video data as a key when the data type of the data to be converted is picture data or video data, and use the improved extraction algorithm to extract the image distribution characteristics of the picture data or video data, and use the image distribution characteristics as the key value of the data to be converted.
8. The event-driven data conversion system according to claim 7, wherein: The calculation module includes a binary code conversion unit and an extraction unit, The binary code conversion unit is used to perform binary code conversion on the data to be converted to obtain the binary code of the data to be converted; The extraction unit is used to extract information from the binary code to obtain a fixed identifier of the data to be converted, and calculate the fixed identifier using a hash algorithm to obtain a hash value of the data to be converted, wherein the fixed identifier is composed of the 1st to 10th bytes and the Nth to N-10th bytes in the binary code, where N is an integer greater than or equal to 1.
Citation Information
Patent Citations
Key value database-based data storage method and retrieval method and corresponding devices
CN114090575A
System, method, and computer program product for key-value commitments from accumulators and vector commitments
WO2024249467A2