A data message compression method and system based on VMF

By adding a numeric index and an indicator index to the VMF format, using a binary tree to build an index tree and dynamically pruning it, the problem of low data packet compression efficiency in the existing technology is solved, and fast compression and efficient transmission are achieved.

CN118394725BActive Publication Date: 2024-10-01WEAPON EQUIP RES INST OF CHINA NAT WEAPON EQUIP GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410850799.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-01
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

Existing data packet compression methods based on variable message format (VMF) have problems such as high time complexity, large number of early structures, heavy manual writing workload, and high maintenance costs, especially when processing JSON data packets. When, it is difficult to achieve efficient compression and transmission.

Method used

By obtaining the encoding standard of the data packet type, adding numeric index and indicator index, a compression template is quickly generated, and an index tree is constructed using a binary tree to dynamically prune redundant nodes to achieve fast matching and compression.

Benefits of technology

It greatly improves the storage efficiency of compression rules, optimizes compression efficiency, can handle message data of different lengths and types, achieves fast compression, and reduces the amount of calculation and time complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394725B_ABST
    Figure CN118394725B_ABST
Patent Text Reader

Abstract

The present invention proposes a data message compression method and system based on VMF, which belongs to the field of data compression technology. The method includes: using a custom index to quickly build a compression template; mapping the field name, indicator index and compression rule in the compression template to the node of a binary tree through a digital index to build an index tree; reading the data of the data message, traversing the index tree in order, matching the nodes of the index tree with the field information in the data message, and pruning the redundant nodes in the index tree; traversing the pruned index tree in order, reading the field information and compressing according to the compression rules. The present invention greatly improves the storage efficiency of compression rules by quickly building a compression template. By dynamically adjusting the binary index tree structure, it can not only process message data of different lengths and types, but also optimize the compression efficiency and achieve rapid compression. The method has broad application prospects in the field of data storage and transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data compression, and in particular relates to a VMF-based data message compression method and system. Background Art

[0002] In the process of network communication transmission, data messages such as JSON are widely used lightweight data exchange formats. They use curly brackets to represent objects and key-value pairs to describe object properties. However, data messages use text compression, which has low compression efficiency and occupies a large amount of memory. In order to reduce communication bandwidth occupancy and improve transmission efficiency, message data is usually converted into binary data. Furthermore, according to the dynamic changes of key-value pairs, it is converted into binary data in variable message format. Variable message format (VMF) is one of the important data link standards currently used in digital battlefields. It provides a standard reference for converting data messages into binary data. VMF messages are composed of mandatory fields and optional fields. In the message description, whether a field or field group appears is determined by the field occurrence indicator, field repetition indicator, group occurrence indicator, and group repetition indicator, thereby achieving on-demand transmission and saving bandwidth.

[0003] To achieve fast compression based on variable message format (VMF), the commonly used methods are: 1. Write the compression rule template into the code through the structure, traverse the JSON key (message field) during compression, compare it with the template, set the indicator of the message field or field group, and take the value (the value of the message field) before compression. The time complexity of this method is O(n 2 log(m)), the amount of calculation is large, and there are a large number of structures in the early stage, the workload of manual writing is large, and since the template is stored in the code, it is not easy to modify and maintain later. 2. Use XML to build a compression template, correspond each node to the template field one by one, generate an XML index tree, traverse the index tree and message fields, and compress the message according to the elements in each node. Although this method can be maintained by modifying the configuration file, due to the XML format, the workload of building the template in the early stage is large, and the maintenance cost is high. Summary of the invention

[0004] Specifically include:

[0005] According to the data message type, the encoding standard of the VMF format is obtained; the data message type indicates the service type of the corresponding message content; the encoding standard of the VMF format includes field names and compression rules;

[0006] A digital index and an indicator index are added to the encoding standard of the VMF format so as to quickly generate a compression template; wherein the indicator index stores an identifier corresponding to the field name.

[0007] Optionally, the digital index increases from top to bottom according to the compression rule. The number of digits of the indexes of fields or field groups at the same level is the same. After the field indexes in the field group remain consistent, the number of digits increases by 1.

[0008] Optionally, in step S2, the binary tree is composed of a left node and a right node, the left node always stores a numerical index of the same level, and the right node always stores a numerical index of a lower level.

[0009] Optionally, step S3 specifically includes:

[0010] Traverse the index tree to determine whether the indicator index on a node of the index tree matches any field name in the data message; if so, store the field information corresponding to the field name in the data message in the corresponding binary tree node; if not, prune the binary tree node.

[0011] The second aspect of the present invention discloses a data message compression system based on VMF; the system comprises:

[0012] The first processing module is configured to use a custom index to quickly build a compression template; the compression template is composed of a digital index, a field name, an indicator index, and a compression rule;

[0013] The second processing module is configured to map the field name, indicator index and compression rule in the compression template to the nodes of the binary tree through the digital index to construct an index tree;

[0014] The third processing module is configured to read the data of the data message, traverse the index tree in order, match the nodes of the index tree with the field information in the data message, and prune the redundant nodes in the index tree;

[0015] The fourth processing module is configured to traverse the pruned index tree in order, read the field information and compress it according to the compression rule.

[0016] The third aspect of the present invention discloses an electronic device. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in any one of the VMF-based data message compression methods in the first aspect of the present disclosure are implemented.

[0017] The fourth aspect of the present invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any one of the VMF-based data message compression methods in the first aspect of the present disclosure are implemented.

[0018] In summary, the present invention greatly improves the storage efficiency of compression rules by quickly constructing compression templates. By dynamically adjusting the binary index tree structure, it can not only process message data of different lengths and types, but also optimize the compression efficiency and achieve rapid compression. The method has broad application prospects in the field of data storage and transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 A schematic diagram of a process of a VMF-based data message compression method according to an embodiment of the present invention;

[0021] Figure 2 A schematic diagram of a binary index tree quickly constructed according to an embodiment of the present invention;

[0022] Figure 3 Schematic diagram of a binary index tree after dynamic pruning according to an embodiment of the present invention;

[0023] Figure 4 The figure is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] See also Figure 1 The first aspect of the present invention discloses a data message compression method based on VMF; the method comprises:

[0026] Step S1, using a custom index to quickly build a compression template; in the present invention, the compression template is a simple template, consisting of a digital index, a field name, an indicator index, and a compression rule, and is not limited to a storage format and is easy to edit and maintain. The compression template is shown in Table 1.

[0027] Table 1 Compression template generated based on custom index

[0028]

[0029] Optionally, step S1 specifically includes:

[0030] According to the data message type, the encoding standard of the VMF format is obtained; the data message type indicates the service type of the corresponding message content; the encoding standard of the VMF format includes field names and compression rules;

[0031] A digital index and an indicator index are added to the encoding standard of the VMF format so as to quickly generate a compression template; wherein the indicator index stores an identifier corresponding to the field name.

[0032] In the present invention, the custom index is composed of a digital index and an indicator index. The digital index increases from top to bottom according to the compression rule. The index bits of fields or field groups at the same level are the same. After the field indexes in the field group remain consistent, the bit number increases by 1. The indicator index is related to the data message field name and is used to make a judgment during the first traversal to determine the value of the field indicator in Table 1.

[0033] Step S2, mapping the field name, indicator index and compression rule in the compression template to the nodes of the binary tree through digital indexes to construct an index tree;

[0034] Optionally, in step S2, the binary tree is composed of a left node and a right node, the left node always stores a numerical index of the same level, and the right node always stores a numerical index of a lower level.

[0035] In the present invention, the index tree is recursively constructed based on the binary tree, and the digital index is mapped to the nodes of the binary tree, so as to quickly generate the corresponding index tree, and traverse it using the hierarchical traversal characteristics of the binary tree.

[0036] Step S3, read the data of the data message, traverse the index tree in order, match the nodes of the index tree with the field information in the data message, and prune the redundant nodes in the index tree;

[0037] Optionally, step S3 specifically includes:

[0038] Traverse the index tree to determine whether the indicator index on a node of the index tree matches any field name in the data message; if so, store the field information corresponding to the field name in the data message in the corresponding binary tree node; if not, prune the binary tree node. Obtain the pruned index tree for compression, and the computational time complexity of the first traversal is O(nlog(m)), where O(.) is the time complexity function, n is the number of all fields in the template, and m is the field name in the data message.

[0039] Step S4, traverse the pruned index tree in order, read the field information and compress it according to the compression rules.

[0040] In the present invention, the corresponding message field index is the index of the message field (key), and the message field value can be directly obtained through the index. The time complexity of this process is O (1). By traversing the pruned index tree, the value of the corresponding field is obtained, and compression is performed according to the compression rule. The time complexity of the second traversal is O (h), where h is the height of the pruned index tree. Through two binary tree traversals and corresponding message field indexes, the time complexity of compression of the present invention is O (nlog (m)), which greatly reduces the amount of calculation and time complexity.

[0041] Exemplarily, the present invention is described by the following process:

[0042] (1) Obtaining a VMF format compression standard according to the message type. The message type indicates the service type of the corresponding message content, and the VMF format compression standard refers to: field names, compression rules, and other information defined in the VMF format standard;

[0043] (2) Rapidly generate a compression template, wherein the compression template refers to the VMF standard format of the corresponding data message class prefabricated as a compilation template before compression. On the basis of the VMF standard format, the present invention adds a custom index, which is composed of a digital index and an indicator index.

[0044] (3) Constructing an index tree, wherein the index tree is recursively constructed based on a binary tree, and the compression template is mapped to the nodes of the binary tree through digital indexes. The binary tree is composed of a left node and a right node. During mapping, the left node always stores the digital index of the same level, and the right node always stores the digital index of the lower level.

[0045] See also Figure 2 , Figure 2 This is a schematic diagram of a rapidly constructed binary index tree according to an embodiment of the present invention. The index tree is generated based on digital indexes, which greatly improves the generation efficiency and can be traversed using the hierarchical traversal characteristics of the binary tree.

[0046] (4) Traversing the index tree for the first time and dynamically pruning the index tree. Traversing the index tree means traversing from the root node downward, comparing the indicator index with the data message field or field group, determining whether the field or field group exists, and then determining the value of the indicator and dynamically pruning the binary index tree to obtain the pruned index tree for compression. The computational time complexity of the first traversal is O(nlog(m)), where n is the number of all fields in the template and m is the field name in the data message.

[0047] See also Figure 3 , Figure 3 Schematic diagram of a binary index tree after dynamic pruning according to an embodiment of the present invention; when a field or field group does not exist, only the numerical index of the indicator is retained.

[0048] (5) Record the message path index with the compressed field. The message path index is the index of the message field (key). The message field value can be directly obtained through the index. The time complexity of this process is O (1). Compared with the two methods described in the technical background, the message field value can be obtained more quickly and the compression efficiency can be improved. The structure of the message path index is shown in Table 2.

[0049] Table 2 Message field index

[0050]

[0051] (6) Secondary traversal, compression according to rules. The secondary traversal refers to traversing the pruned index tree, obtaining the value of the corresponding field, and compressing according to the compression rules. The time complexity of the second traversal is O(h), where h is the height of the pruned index tree. Through two binary tree traversals and corresponding message field indexes, the time complexity of compression in the present invention is O(nlog(m)), which greatly reduces the amount of calculation and time complexity.

[0052] The second aspect of the present invention discloses a data message compression system based on VMF; the system implements any one of the data message compression methods based on VMF in the above embodiments. The system comprises:

[0053] The first processing module is configured to use a custom index to quickly build a compression template; the compression template is composed of a digital index, a field name, an indicator index, and a compression rule;

[0054] The second processing module is configured to map the field name, indicator index and compression rule in the compression template to the nodes of the binary tree through the digital index to construct an index tree;

[0055] The third processing module is configured to read the data of the data message, traverse the index tree in order, match the nodes of the index tree with the field information in the data message, and prune the redundant nodes in the index tree;

[0056] The fourth processing module is configured to traverse the pruned index tree in order, read the field information and compress it according to the compression rule.

[0057] The third aspect of the present invention discloses an electronic device. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in any one of the VMF-based data message compression methods in the first aspect of the present disclosure are implemented.

[0058] Figure 4 is a structural diagram of an electronic device according to an embodiment of the present invention, see Figure 4 , the electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0059] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a structural diagram of the part related to the technical solution of the present disclosure, and does not constitute a limitation on the electronic device to which the technical solution of the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0060] The fourth aspect of the present invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any one of the steps in the VMF-based data message compression method in the first aspect of the present disclosure are implemented.

[0061] In summary, the present invention adopts custom indexes to quickly build compression templates; automatically builds an index tree to record compression rules; reads data from data messages, traverses the index tree in sequence, compares message field names, records compressed field indexes and prunes the index tree; traverses the pruned index tree in sequence, reads field values ​​for compression.

[0062] The present invention greatly improves the storage efficiency of compression rules by quickly constructing compression templates. By dynamically adjusting the binary index tree structure, it can not only process message data of different lengths and types, but also optimize the compression efficiency and achieve rapid compression. The method has broad application prospects in the field of data storage and transmission.

[0063] Please note that the technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not 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. The above embodiments only express several implementation methods of the present application, and their descriptions are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, without departing from the concept of the present application, several variations and improvements can be made, which all belong to the scope of protection of the present application. Therefore, the scope of protection of the patent in this application shall be based on the attached claims.

Claims

1. A data message compression method based on VMF, It is characterized in that The method comprises: Step S1, using a custom index to quickly build a compression template; the compression template consists of a digital index, a field name, an indicator index, and a compression rule; Step S1 specifically includes: According to the data message type, the encoding standard of the VMF format is obtained; the data message type indicates the service type of the corresponding message content; the encoding standard of the VMF format includes field names and compression rules; A digital index and an indicator index are added to the encoding standard of the VMF format, so as to quickly generate a compression template; wherein the indicator index stores the identifier corresponding to the field name; Digital indexes increase from top to bottom according to the compression rules. The number of index digits of fields or field groups at the same level is the same. When the field indexes in a field group remain consistent, the number of digits increases by 1. Step S2, mapping the field name, indicator index and compression rule in the compression template to the nodes of the binary tree through the digital index to construct the index tree; in step S2, the binary tree is composed of a left node and a right node, the left node always stores the digital index of the same level, and the right node always stores the digital index of the lower level; Step S3, read the data of the data message, traverse the index tree in order, match the nodes of the index tree with the field information in the data message, and prune the redundant nodes in the index tree; Step S3 specifically includes: Traverse the index tree to determine whether the indicator index on a node of the index tree matches any field name in the data message; if so, store the field information corresponding to the field name in the data message in the corresponding node of the binary tree; if not, prune the node of the binary tree; Step S4, traverse the pruned index tree in order, read the field information and compress it according to the compression rules.

2. A data message compression system based on VMF, It is characterized in that The system comprises: The first processing module is configured to use a custom index to quickly build a compression template; the compression template is composed of a digital index, a field name, an indicator index, and a compression rule; specifically configured to obtain a coding standard of a VMF format according to a data message type; the data message type indicates a service type of a corresponding message content; the coding standard of the VMF format includes a field name and a compression rule; Add digital index and indicator index to the encoding standard of VMF format, so as to quickly generate compression template; the indicator index stores the identifier corresponding to the field name; the digital index increases from top to bottom according to the compression rule, the index digits of fields or field groups at the same level are the same, and the field indexes in the field group are consistent, and the digits are increased by 1; The second processing module is configured to map the field name, indicator index and compression rule in the compression template to the nodes of the binary tree through the digital index to construct the index tree; the binary tree is composed of a left node and a right node, the left node always stores the digital index of the same level, and the right node always stores the digital index of a lower level; The third processing module is configured to read the data of the data message, traverse the index tree in order, match the nodes of the index tree with the field information in the data message, and prune the redundant nodes in the index tree; specifically, it is configured to traverse the index tree to determine whether the indicator index on a node of the index tree matches any field name in the data message; if so, store the field information corresponding to the field name in the data message in the corresponding node of the binary tree; if not, prune the node of the binary tree; The fourth processing module is configured to traverse the pruned index tree in order, read the field information and compress it according to the compression rule.

3. An electronic device, It is characterized in that The electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps in the VMF-based data message compression method described in claim 1 are implemented.

4. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps in the VMF-based data message compression method described in claim 1 are implemented.