File format conversion method, device and storage medium

By obtaining and using dictionary files between file formats and generating keyword and parameter mapping tables, the problem of cumbersome and inflexible file format conversion in the existing technology is solved, and efficient and accurate file format conversion is achieved.

CN118760656BActive Publication Date: 2025-01-21深圳十沣科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411238125.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2025-01-21
Estimated Expiration
2044-09-05

AI Technical Summary

Technical Problem

Existing file format conversion methods are cumbersome and error-prone when dealing with complex or large-scale file formats, and lack flexibility and adaptability, making it difficult to quickly adapt to changes in new format specifications or user needs.

Method used

By obtaining the dictionary file between the input and output file formats, defining the keyword mapping relationship, parameter mapping relationship and data format description, generating the keyword mapping table and parameter mapping table, and then realizing the conversion of the file format.

Benefits of technology

It improves the flexibility and accuracy of file format conversion, reduces manual intervention, ensures data accuracy and consistency, and can more quickly adapt to data processing needs in different formats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760656B_ABST
    Figure CN118760656B_ABST
Patent Text Reader

Abstract

The present application discloses a file format conversion method, device and storage medium, and relates to the technical field of data conversion. The file format conversion method comprises: obtaining a dictionary file according to an input file format and an output file format, wherein the dictionary file defines a keyword mapping relationship, a parameter mapping relationship and a data format description between the input file format and the output file format; obtaining a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship; obtaining an output file according to the input file, the data format description, the keyword mapping table and the parameter mapping table. The present application not only ensures the accuracy and standardization of data conversion, but also improves the flexibility of file format conversion, making it more convenient and efficient to process data in different formats.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data conversion technology, and in particular to a file format conversion method, device and storage medium. Background Art

[0002] In the field of modern engineering and data processing, different software systems and applications often use different file formats to store and exchange data. For example, the input model file (IM, Input Model) generated by computer-aided engineering (CAE) software during simulation and analysis may need to be converted into an export model file (EX, ExportedModel) in another format for further processing and analysis by other software systems. In order to achieve data interoperability between these systems, it is necessary to solve the problem of data conversion between file formats. Data format conversion is not just a format conversion, but also involves the guarantee of data accuracy, consistency and integrity. Therefore, it is particularly important to develop an efficient and flexible file format conversion method to meet the needs of different formats.

[0003] Although existing file format conversion methods can meet basic needs in many cases, there are still some significant problems. First, the manual process of writing dictionary files is cumbersome and error-prone, especially when dealing with complex or large-scale file formats. Second, the mapping rules between different formats may be inconsistent, resulting in data loss or errors. Existing tools often lack flexibility and adaptability when dealing with diverse file formats and dynamically changing conversion requirements. In addition, these methods are usually not sensitive enough to changes in file formats and have difficulty quickly adapting to new format specifications or changes in user needs. Due to the existence of these problems, how to improve the flexibility of file format conversion has become an issue that needs to be urgently addressed.

[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The purpose of the present application is to provide a file format conversion method, device and storage medium, aiming to solve the technical problem of how to improve the flexibility of file format conversion.

[0006] To achieve the above object, the present application proposes a file format conversion method, the method comprising:

[0007] Acquire a dictionary file according to an input file format and an output file format, wherein the dictionary file defines a keyword mapping relationship, a parameter mapping relationship, and a data format description between the input file format and the output file format;

[0008] Obtain a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship;

[0009] An output file is obtained according to the input file, the data format description, the keyword mapping table and the parameter mapping table.

[0010] In one embodiment, the step of obtaining a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship, and the parameter mapping relationship comprises:

[0011] Read the dictionary file, and divide the read content into key-value pairs according to a preset identifier;

[0012] A keyword mapping table and a parameter mapping table between the input file and the output file are constructed according to the keyword mapping relationship, the parameter mapping relationship and the key-value pair.

[0013] In one embodiment, the step of obtaining the output file according to the input file, the data format description, the keyword mapping table and the parameter mapping table comprises:

[0014] Read an input file, identify a first keyword in the input file, and record a first parameter under the first keyword;

[0015] Obtaining, according to the first keyword, the first parameter, the data format description, the keyword mapping table, and the parameter mapping table, a second parameter and a second keyword corresponding to the first parameter corresponding to the first keyword;

[0016] An output file is obtained according to the second keyword and the second parameter.

[0017] In one embodiment, the step of obtaining the second parameter and the second keyword corresponding to the first parameter corresponding to the first keyword according to the first keyword, the first parameter, the data format description, the keyword mapping table, and the parameter mapping table includes:

[0018] Traversing the first keyword, searching the keyword mapping table for corresponding second keyword content according to the currently traversed first keyword;

[0019] Traversing the first parameter, and searching the parameter mapping table for a second parameter corresponding to the first parameter according to the currently traversed first parameter;

[0020] A second keyword is constructed according to the data format description, the second keyword content and the second parameter.

[0021] In one embodiment, after the step of traversing the first parameter and searching the parameter mapping table for a second parameter corresponding to the first parameter according to the currently traversed first parameter, the method further includes:

[0022] When the second keyword content cannot be found, skip the first keyword currently traversed and continue to traverse the next first keyword;

[0023] When the second parameter cannot be found, the traversal of the first parameter is stopped, the first keyword currently being traversed is skipped, and the traversal of the next first keyword is continued.

[0024] In one embodiment, the step of obtaining a dictionary file according to the input file format and the output file format includes:

[0025] When a dictionary file corresponding to the input file format and the output file format exists in the configuration file, obtaining the dictionary file from the configuration file;

[0026] When the dictionary file does not exist in the configuration file, the dictionary file is written according to the input file format, the output file format, the dictionary file structure, the comment character, the line identifier, the keyword separator, the sub-object separator and the operator.

[0027] In one embodiment, the step of writing the dictionary file according to the input file format, the output file format, the dictionary file structure, the comment symbol, the line identifier, the keyword separator, the sub-object separator and the operator comprises:

[0028] Obtaining keyword mapping rules and parameter mapping rules according to the input file format and the output file format;

[0029] Defining the key-value pair structure and organization form of the dictionary file;

[0030] Obtain a dictionary file structure according to the key-value pair structure and the organizational form;

[0031] Select comment characters, line identifiers, keyword delimiters, sub-object delimiters, and operators;

[0032] The dictionary file is written according to the keyword mapping rule, the parameter mapping rule, the dictionary file structure, the annotation symbol, the row identifier, the keyword separator, the sub-object separator, and the operator.

[0033] In one embodiment, before the step of identifying the first keyword in the input file, the method further includes:

[0034] Detecting a file header, a separator, an identifier or an end mark of the input file to obtain a detection result;

[0035] Obtaining a keyword format and a parameter format corresponding to the input file format;

[0036] Verify the input file according to the keyword format and the parameter format to obtain a verification result;

[0037] When there is no abnormality in the detection result or the verification result, continuing the step of identifying the first keyword in the input file;

[0038] When there is an abnormality in the detection result or the verification result, the detection result and the verification result are recorded in an error log.

[0039] In addition, to achieve the above purpose, the present application also proposes a file format conversion device, the device comprising:

[0040] A dictionary acquisition module, used to acquire a dictionary file according to an input file format and an output file format, wherein the dictionary file defines a keyword mapping relationship, a parameter mapping relationship and a data format description between the input file format and the output file format;

[0041] A mapping table construction module, used to obtain a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship;

[0042] The file output module is used to obtain an output file according to the input file, the data format description, the keyword mapping table and the parameter mapping table.

[0043] In addition, to achieve the above-mentioned purpose, the present application also proposes a file format conversion device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the file format conversion method described above.

[0044] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the file format conversion method described above are implemented.

[0045] One or more technical solutions proposed in this application have at least the following technical effects:

[0046] According to the input file format and the output file format, a dictionary file is obtained, and the dictionary file defines the keyword mapping relationship, parameter mapping relationship and data format description between the input file format and the output file format; a keyword mapping table and a parameter mapping table are obtained according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship; and an output file is obtained according to the input file, the data format description, the keyword mapping table and the parameter mapping table. First, a dictionary file is obtained according to the input file format and the output file format, and this file defines in detail the keyword mapping relationship, parameter mapping relationship and data format description between the input and output formats. Obtaining the dictionary file ensures the comprehensiveness and accuracy of the conversion rules, and provides the necessary rules and structures for the conversion process. By clarifying these mapping relationships, errors in data conversion can be effectively reduced, and the accuracy and consistency of data can be improved. Then, according to the definition in the dictionary file, a keyword mapping table and a parameter mapping table are generated. These tables clearly list the relationship between the keywords in the input file and the corresponding keywords in the output file, as well as the conversion rules between the input parameters and the output parameters. Such tables simplify complex conversion tasks, make data processing more intuitive and efficient, and reduce manual intervention. Finally, according to the data, data format description, keyword mapping table and parameter mapping table in the input file, the data is converted into an output file that conforms to the target format, ensuring that the structure and format of the output file meet expectations and improving the efficiency and accuracy of data processing. This application not only ensures the accuracy and standardization of data conversion, but also improves the flexibility of file format conversion, making it more convenient and efficient to process data in different formats. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0049] Figure 1 A flowchart of the first embodiment of the method for converting the file format of the present application is provided;

[0050] Figure 2 A flowchart of the second embodiment of the method for converting the file format of the present application is provided;

[0051] Figure 3 This is a schematic diagram of the module structure of the file format conversion device according to an embodiment of the present application;

[0052] Figure 4 Schematic diagram of the device structure of the hardware operating environment involved in the file format conversion method in the embodiment of the present application.

[0053] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0054] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0055] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0056] In modern engineering and data processing, data interoperability between different software systems requires solving file format conversion problems to ensure data accuracy, consistency, and integrity. Although existing conversion methods can meet basic needs, they have limitations in processing complex file formats, maintaining data mapping consistency, and adapting to format changes and user needs. Therefore, developing an efficient and flexible conversion method is essential to meet diverse format requirements.

[0057] The main solution of the embodiment of the present application is: first, ensure the accuracy of the conversion rules by obtaining a dictionary file containing the mapping relationship between input and output formats; then generate keyword and parameter mapping tables based on the dictionary file to simplify the conversion task; finally, use these mapping tables to convert the input file data into an output file in the target format, thereby improving the efficiency and accuracy of file format conversion.

[0058] It should be noted that the execution subject of the embodiment of the present application can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a file conversion system, etc. The following takes the file conversion system as an example to illustrate this embodiment and the following embodiments.

[0059] Based on this, the present application embodiment provides a file format conversion method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the file format conversion method of the present application.

[0060] In this embodiment, the file format conversion method includes steps S10 to S30:

[0061] Step S10, obtaining a dictionary file according to the input file format and the output file format, wherein the dictionary file defines a keyword mapping relationship, a parameter mapping relationship, and a data format description between the input file format and the output file format;

[0062] It should be noted that the input file format (IM file format) refers to the structure and specifications of the source file. These files are used to store and organize data for processing or analysis. The input file format includes information such as the overall structure of the file, keywords, parameters and their data types. In the context of file format conversion, the input file format is the format of the data file used as input in the file conversion process. This format defines how the data is organized and represented in the file. The conversion tool needs to parse this format to extract the data and prepare for conversion. The output file format (EX file format) refers to the structure and specifications of the target file. These files are used to store the converted data. The output file format defines how the data should be organized and represented in the target file. In the file format conversion process, the output file format is the format of the converted result file. The conversion tool needs to reorganize and format the data in the input file according to this format to generate an output file that meets the target requirements. The dictionary file is a configuration file that defines the mapping relationship between the input file format and the output file format. The dictionary file describes in detail how to convert the data items in the input file into the data items in the output file, including keyword mapping, parameter mapping and data format description. In file format conversion, the dictionary file acts as a bridge. It contains conversion rules and logic. The dictionary file is used to guide the conversion tool on how to parse the input file, how to map data items to the output file, and ensure the accuracy and consistency of the conversion process. Keyword mapping refers to the mapping rules between keywords in the input file format (such as field names or labels) and the corresponding keywords in the output file format. This mapping relationship defines how to convert keywords in the input file to keywords in the output file. In the dictionary file, the keyword mapping relationship helps the conversion tool identify and match keywords in the input file and keywords in the output file. For example, MAT_ELASTIC (a keyword used to identify the elastic properties of the material) in the input file may need to be mapped to MAT1 (an input format for representing one-dimensional elastic materials) in the output file. The dictionary file defines this mapping relationship. Parameter mapping refers to the mapping rules between parameters in the input file format (such as data values ​​or attributes) and corresponding parameters in the output file format. This mapping relationship defines how to convert parameter values ​​in the input file to parameter values ​​in the output file. In file format conversion, parameter mapping helps ensure that data values ​​in the input file are correctly mapped to the output file. For example, the value of PARAM1 in the input file may need to be converted to VALUE1 in the output file. The dictionary file defines this mapping, including any necessary data conversion or calculation. Data format description refers to a detailed description of the data structure, data type, and format specification of the input file format and the output file format. It includes how to parse and format the data to meet the requirements of the target file format.In the dictionary file, the data format description provides format specifications for input and output files, including the type of data items (such as integers, floating-point numbers, strings), the arrangement of data (such as row and column formats), and any specific format requirements (such as date formats, numerical precision, etc.). This description ensures that the conversion tool can correctly process and format the data to generate output files that meet the target specifications.

[0063] It is understandable that in the process of file format conversion, it is first necessary to obtain a dictionary file based on the input file format (IM file format) and the output file format (EX file format). The main function of this dictionary file is to clarify how to convert the data in the input file into a format that meets the requirements of the output file. Specifically, the dictionary file defines three core elements: keyword mapping, that is, how the keywords in the input file are mapped to the corresponding keywords in the output file; parameter mapping, that is, how the various parameters in the input file are converted to the corresponding parameters in the output file, and include any necessary conversion rules or calculation formulas; and data format description, that is, a detailed description of the data structure, data type and format specifications in the input file and output file. These definitions ensure the correctness and consistency of the data during the conversion process, so that the conversion from one file format to another can be completed accurately and without error.

[0064] As an example, the step of obtaining a dictionary file according to an input file format and an output file format includes: when a dictionary file corresponding to the input file format and the output file format exists in a configuration file, obtaining the dictionary file from the configuration file; when the dictionary file does not exist in the configuration file, writing the dictionary file according to the input file format, the output file format, a dictionary file structure, a comment character, a row identifier, a keyword delimiter, a sub-object delimiter, and an operator.

[0065] A configuration file is a file that contains system or application setting information, which is used to define the behavior and parameters of the program. In the context of file format conversion, the configuration file contains various settings, file paths, format specifications, and other information. The configuration file may list the path or name of the dictionary file used for file format conversion. If a dictionary file that matches the input file format and the output file format already exists in the configuration file, the dictionary file can be obtained directly from the configuration file; otherwise, the dictionary file needs to be written based on the relevant information. The dictionary file structure refers to the organization form and format specifications of the dictionary file, including how to define and store information such as keyword mapping, parameter mapping, and data format description. The dictionary file structure determines the arrangement and storage of data in the dictionary file. It includes how to identify and organize conversion rules, and how to represent the relationship between the input file format and the output file format in a structured form. For example, a dictionary file may be divided into different parts, such as mapping rules, format descriptions, etc., and defines how to parse and use this information for conversion. Comments are symbols used to add comments to files. These comments are not parsed or processed by the program and are only for human reading. In dictionary files, comments are used to insert explanations or descriptions of file contents to help understand mapping rules and data structures. For example, comment characters can be `#`, ` / / `, `$`, etc. These characters can be used to add explanatory text to the dictionary file without affecting the actual function of the file. Line identifiers are used to mark the start of each line in the file, usually used to separate different rules or data entries. In the dictionary file, line identifiers are used to identify the type or function of each line of data, such as `*` or `@`, to help the program or user distinguish different mapping rules or configuration items. Line identifiers can clearly indicate the content and function of each line, ensuring that the parsing process of the dictionary file is clearer. Keyword separators are symbols used to separate keywords and their corresponding values ​​in the dictionary file. In the dictionary file, keyword separators help distinguish and map keywords in the input file format with keywords in the output file format. For example, using `@` or `=` as a separator, the input keyword and the output keyword are separated, so as to clarify the mapping relationship. Subobject separators are symbols used to separate different parameters or subobjects under a keyword in the file. In the dictionary file, subobject separators are used to identify and separate individual parameters or subobjects under a keyword. For example, use `%` or `.` to separate different parameters or attributes to ensure that the data is organized and parsed according to the expected structure. Operators are symbols used to perform calculations or logical operations in dictionary files. In dictionary files, operators (such as `+`, `-`, `*`, ` / `) are used to define how to calculate or transform the data in the input file to adapt to the format requirements of the output file. For example, operators can be used for numerical calculations, data conversion, or logical judgment to ensure that the data meets specific rules and requirements during the conversion process.

[0066] First, check whether the configuration file already contains the dictionary file corresponding to the specified input file format and output file format. If such a dictionary file exists in the configuration file, directly extract the file from it for conversion. If there is no relevant dictionary file in the configuration file, you need to write a new dictionary file. In the writing process, it is necessary to define how to map the data in the input file to the output file according to the requirements of the input file format and the output file format, combined with the design of the dictionary file structure. This includes determining the annotation symbol (used to add file descriptions and comments), line identifiers (used to mark the rules or configuration items of each line), keyword separators (used to separate input and output keywords), sub-object separators (used to separate parameters or data items under keywords), and operators (used to define data calculation and conversion rules). Through these steps, ensure that the created dictionary file can accurately realize the conversion from the input file format to the output file format.

[0067] As an example, the steps of writing the dictionary file according to the input file format, the output file format, the dictionary file structure, annotation symbols, row identifiers, keyword separators, sub-object separators and operators include: obtaining keyword mapping rules and parameter mapping rules according to the input file format and the output file format; defining the key-value pair structure and the organizational form of the dictionary file; obtaining the dictionary file structure according to the key-value pair structure and the organizational form; selecting annotation symbols, row identifiers, keyword separators, sub-object separators and operators; and writing the dictionary file according to the keyword mapping rules, the parameter mapping rules, the dictionary file structure, the annotation symbols, the row identifiers, the keyword separators, the sub-object separators and the operators.

[0068] Keyword mapping rules refer to the rules for how to match and convert keywords (such as field names, labels) in the input file format with the corresponding keywords in the output file format. In file format conversion, keyword mapping rules specify the corresponding position of each keyword appearing in the input file in the output file. For example, if `Material_ID` is used in the input file to represent the material number, and `MAT_ID` is used in the output file, the keyword mapping rules will define how `Material_ID` is mapped to `MAT_ID`. These rules ensure the consistency and accuracy of data between different formats. Parameter mapping rules refer to the rules for how to map parameter values ​​(such as values, attributes) in the input file format to the corresponding parameter values ​​in the output file format. In file format conversion, parameter mapping rules define how to convert data values ​​in the input file to data values ​​in the output file. For example, the parameter `Density` in the input file may need to be converted to `Mass_Density` in the output file, and may involve the conversion or formatting of data units. Parameter mapping rules ensure the correct conversion of values ​​and attributes between different formats. The key-value pair structure refers to how data is organized and stored in the dictionary file, where each pair of "key" and value together defines the transformation rules. In the dictionary file, the key-value pair structure determines how to store keyword mapping and parameter mapping rules in a structured form, where the key represents the keyword or parameter in the input file format or output file format, and the value represents the corresponding mapping rule or data format description. For example, `"Material_ID" : "MAT_ID"` represents a key-value pair, where `"Material_ID"` is the keyword of the input format and `"MAT_ID"` is the keyword of the output format. The organization form refers to the layout and arrangement of data and rules in the dictionary file, including how to organize the key-value pair structure into a logically clear form. The organization form involves the overall structural design of the dictionary file, such as how the data is segmented, classified, and arranged. It determines the readability and ease of use of the file. The organization form can include grouping, sorting, and hierarchical structures to ensure that the dictionary file can intuitively represent and manage different mapping rules and transformation logic. The dictionary file structure refers to the overall layout and format of the dictionary file, including how to define and store mapping rules, data format descriptions, and other configuration information. The dictionary file structure covers all elements in the file, such as the definitions of comment symbols, line identifiers, keyword delimiters, sub-object delimiters, etc., and how to organize mapping rules and data format descriptions into valid files based on these definitions. The dictionary file structure ensures that the file can be correctly parsed and applied in the file format conversion process.

[0069] In the process of writing a dictionary file, first determine the keyword mapping rules and parameter mapping rules based on the input file format and the output file format. These rules specify how to convert the keywords and parameter values ​​in the input file into the corresponding items in the output file format. Next, define the key-value pair structure and organizational form of the dictionary file, decide how to store and arrange these rules in a structured manner, and build the overall structure of the dictionary file based on the determined key-value pair structure and organizational form. Then, select appropriate annotation symbols, line identifiers, keyword separators, sub-object separators, and operators. These symbols and tags will be used to define and distinguish different parts and rules in the dictionary file. Finally, write the dictionary file based on the defined mapping rules, dictionary file structure, and selected symbols to ensure that it can accurately guide the data conversion from the input file format to the output file format.

[0070] Step S20, obtaining a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship;

[0071] It should be noted that the keyword mapping table is a table or data structure used to display and manage the mapping relationship between keywords (field names, labels, etc.) in the input file format and the corresponding keywords in the output file format. The keyword mapping table lists in detail the keywords in each input file format and their corresponding keywords in the output file format. This table helps the conversion tool identify and match keywords to ensure that the input data is correctly mapped to the output format. For example, if the input file uses the keyword Material_ID and the output file uses MAT_ID, the keyword mapping table will record this correspondence for accurate replacement and processing during the conversion process. The parameter mapping table is a table or data structure used to display and manage the mapping relationship between parameter values ​​(such as values, attributes, etc.) in the input file format and the corresponding parameter values ​​in the output file format. The parameter mapping table lists in detail the parameters in each input file format and their corresponding parameters in the output file format, including any necessary conversion rules or calculation formulas. This table helps the conversion tool to follow the correct rules when converting the data values ​​in the input file to the output format. For example, if the parameter Density in the input file needs to be converted to Mass_Density in the output file, and unit conversion may be required, the parameter mapping table will define this correspondence and conversion details.

[0072] It can be understood that in the process of obtaining the keyword mapping table and the parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship, first, all the keyword mapping relationships and the parameter mapping relationships are extracted and sorted from the dictionary file, and these mapping relationships define how the keywords and parameters in the input file format correspond to the keywords and parameters in the output file format. Then, using these mapping relationships, a keyword mapping table is created, which lists each keyword in the input file format and its corresponding keyword in the output file format to ensure the consistency of the data structure. Next, a parameter mapping table is compiled, which shows each parameter in the input file format and its corresponding parameter in the output file format, including the necessary conversion rules and calculation formulas to ensure the correct conversion of data values. Through these two tables, the conversion tool can accurately map the input data to the output format, thereby achieving effective conversion of the file format.

[0073] As an example, the steps of obtaining a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship include: reading the dictionary file, dividing the read content into key-value pairs through a preset identifier; and constructing a keyword mapping table and a parameter mapping table between the input file and the output file according to the keyword mapping relationship, the parameter mapping relationship and the key-value pairs.

[0074] Preset identifiers are symbols or characters used in dictionary files to mark and separate different data items or data segments. These identifiers help the system identify and extract various parts of the file. Preset identifiers are used in dictionary files to indicate different types or levels of data, such as to separate key-value pairs or identify different mapping rules. For example, if a dictionary file uses ':' as a preset identifier, each pair of keywords and parameters in the file can be separated by ':', such as Material_ID:MAT_ID. When reading a dictionary file, the system will split the data into keys and values ​​based on this identifier, and then use it to build keyword mapping tables and parameter mapping tables. Key-value pairs are the basic units of data organization, where "key" is an identifier or label, and "value" is the data or information associated with the key. In the dictionary file, the key-value pair represents the basic structure of the mapping relationship. For example, a key-value pair may include a keyword in the input file format and its corresponding keyword in the output file format, or a parameter in the input file format and its corresponding parameter in the output file format. For example, the key-value pair Material_ID:MAT_ID means that Material_ID is used as the keyword in the input file, while MAT_ID is used in the output file to represent the same concept. Through these key-value pairs, keyword mapping tables and parameter mapping tables can be constructed to ensure the correct conversion of data between input files and output files.

[0075] First, read the contents of the dictionary file and use preset identifiers (such as colons `:` or equal signs `=`) to split the data in the file into pairs of key-value pairs. For example, in the dictionary file, `Material_ID: MAT_ID` and `Density: Mass_Density` represent the correspondence between input keywords and output keywords, respectively. Then, use these key-value pairs and the preset keyword mapping relationship and parameter mapping relationship to build a keyword mapping table and a parameter mapping table. The keyword mapping table will show how each keyword in the input file is mapped to the corresponding keyword in the output file, while the parameter mapping table will show how each parameter in the input file is converted to the corresponding parameter in the output file, including possible conversion rules or calculation methods. Through these tables, data conversion between input files and output files can be effectively achieved.

[0076] Step S30, obtaining an output file according to the input file, the data format description, the keyword mapping table and the parameter mapping table.

[0077] It should be noted that the input file refers to the original file that needs to be converted. It contains the data to be processed and organized in a specific format. This file is the starting point of the conversion process, and its data needs to be processed and converted according to the specified conversion rules. In the context of file format conversion, the input file is the file that actually stores the data. The data is organized and stored in a specific file format (such as IM format). The content of the input file will be read and the conversion rules will be applied through the keyword mapping table and parameter mapping table to convert the data to the required output format. For example, the input file may be a CAE file, CSV file, or XML file containing material data, which contains keywords and parameters to be converted. The output file refers to the target file after the format conversion, which organizes the data in the new format. The output file is the result file of the conversion process, and the data is presented in the new format after being processed by the conversion rules. In the process of file format conversion, the output file is the final generated file, and its data is reorganized and formatted according to the content of the input file and the conversion rules. The format of the output file (e.g., EX format) is different from that of the input file and may include different keywords, parameter formats, and data structures. The output file is the final result of the conversion and is designed to meet specific format requirements or be compatible with other systems. For example, the output file may be a converted Excel file, bdf file, JSON file, or other file that meets the target format requirements.

[0078] It can be understood that, first, the original data is read from the input file, and the data is organized in a specific format; then, according to the requirements in the data format description, the target format and data structure of the output file are determined; then, the keyword mapping table is used to convert the keywords in the input file into the keywords required in the output file to ensure the correct matching and conversion of the keywords; then, the parameter mapping table is applied to convert the data values ​​in the input file into the corresponding values ​​in the output file according to the specified conversion rules or calculation formulas; finally, all the converted data are organized and stored according to the format requirements in the data format description to generate an output file that meets the target format requirements. This process ensures that the data conversion from the input file to the output file is accurate and meets the expected format specifications.

[0079] This embodiment provides a file format conversion method, which obtains a dictionary file according to an input file format and an output file format, wherein the dictionary file defines a keyword mapping relationship, a parameter mapping relationship, and a data format description between the input file format and the output file format; obtains a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship, and the parameter mapping relationship; and obtains an output file according to the input file, the data format description, the keyword mapping table, and the parameter mapping table. First, a dictionary file is obtained according to the input file format and the output file format, and this file defines in detail the keyword mapping relationship, the parameter mapping relationship, and the data format description between the input and output formats. Obtaining the dictionary file ensures the comprehensiveness and accuracy of the conversion rules, and provides the necessary rules and structures for the conversion process. By clarifying these mapping relationships, errors in data conversion can be effectively reduced, and the accuracy and consistency of data can be improved. Then, according to the definition in the dictionary file, a keyword mapping table and a parameter mapping table are generated. These tables clearly list the relationship between the keywords in the input file and the corresponding keywords in the output file, as well as the conversion rules between the input parameters and the output parameters. Such tables simplify complex conversion tasks, make data processing more intuitive and efficient, and reduce manual intervention. Finally, according to the data, data format description, keyword mapping table and parameter mapping table in the input file, the data is converted into an output file that conforms to the target format, ensuring that the structure and format of the output file meet expectations and improving the efficiency and accuracy of data processing. This embodiment not only ensures the accuracy and standardization of file format conversion, but also improves the flexibility of file format conversion, making it more convenient and efficient to process data in different formats.

[0080] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 2 , Figure 2This is a flowchart of the second embodiment of the file format conversion method of the present application. Step S30 of the file format conversion method includes steps S31 to S33:

[0081] Step S31, reading an input file, identifying a first keyword in the input file, and recording a first parameter under the first keyword;

[0082] It should be noted that the first keyword refers to a specific identifier or label identified in the input file, which is used to mark or classify data items. When reading the input file, the system first identifies and extracts the first keyword in the input file. This keyword is used to mark the main field or attribute of the data, such as Material_ID or Density, which helps the system determine the category or type of the data. The first parameter refers to the data value or attribute value associated with the first keyword. After identifying the first keyword, the system will record the first parameter associated with it. This parameter is the data value under the first keyword. For example, for the keyword Material_ID, its first parameter may be a specific material identifier such as MAT123, etc. The first parameter is the specific value or data item of the keyword.

[0083] It can be understood that the data is first read from the input file; then, the system will identify the first keyword in the input file, which is a specific identifier used to mark or classify data, such as `Material_ID` or `Density`. After determining the first keyword, the system will look for the specific data item associated with the keyword, that is, the first parameter. For example, if the data value under the `Material_ID` keyword in the input file is `MAT123`, then `MAT123` is the first parameter. This process ensures that key information is extracted and recorded from the input file, providing basic data for subsequent data processing and conversion.

[0084] As an example, before the step of identifying the first keyword in the input file, it also includes: detecting the file header, delimiter, identifier or end mark of the input file to obtain a detection result; obtaining the keyword format and parameter format corresponding to the input file format; verifying the input file according to the keyword format and the parameter format to obtain a verification result; when there is no abnormality in the detection result or the verification result, continuing the step of identifying the first keyword in the input file; when there is an abnormality in the detection result or the verification result, recording the detection result and the verification result in an error log.

[0085] The file header refers to the beginning of a file, which usually contains information about the file structure or file type, such as file format, version number, creation date, etc. In the input file, the file header is used to provide metadata or identification information about the file content to help the system correctly understand and parse the structure of the file. For example, the file header of a comma-separated values ​​(CSV) file may contain column names to indicate the meaning of each column of data. A delimiter refers to a character or string used to separate different data items or fields in a file. In the input file, the delimiter helps the system distinguish data fields. For example, in a CSV file, a comma (,) is used as a field separator to separate different data columns. In other formats, tabs, spaces, or other symbols may be used as delimiters. An identifier is a specific symbol or string used to mark or identify data items in a file. Identifiers are used in input files to distinguish and mark data blocks or fields, such as tags or field names, etc. For example, in an XML file, an identifier can be a tag name such as <material> , used to mark related data parts. The end tag is a symbol or string used to identify the end of a data segment or file. The end tag is used to determine the end of a data segment or the end of a file. For example, in an XML file, the end tag is< / material> Logo <material>The end of a data block. In other file formats, a specific character sequence may be used as an end marker. The detection result refers to the status information or feedback obtained after detecting the file header, delimiter, identifier or end marker. The detection result provides verification information about the file format and structure, such as whether the expected delimiter, identifier is found or whether the file header is parsed correctly. The detection result can be a success or failure status, indicating whether the format requirements are met. The keyword format refers to the structure and representation of keywords in the file, including the type, length and allowed characters of the keywords. The keyword format defines the specifications of the keywords in the input file. For example, the keyword needs to be a combination of letters and numbers, and the length does not exceed 20 characters. This format ensures the correct parsing and processing of the keywords. The parameter format refers to the structure and representation of the parameters in the file, including the type, length and format requirements of the parameters. The parameter format defines the specifications of the parameters in the input file, such as the data type (string, integer, floating point number, etc.), length limit and format (such as the date format YYYY-MM-DD), to ensure the correct parsing and processing of the parameters. The verification result refers to the status information or feedback obtained after the input file is verified, indicating whether the file meets the expected format and structure requirements. The verification result provides feedback on whether the file content meets the keyword format and parameter format. If the file meets the specifications, the verification result is successful; otherwise, the result shows that there is an abnormality in the format or content. Error logs refer to files or data records that record abnormalities or errors found during the detection and verification process. Error logs are used to record problems that occur during file processing, such as format errors, unrecognizable delimiters or identifiers, etc. These records help developers or system administrators diagnose and fix problems and ensure the correctness and reliability of file processing.

[0086] Before identifying the first keyword in the input file, a series of preprocessing steps are required. First, the file header, delimiter, identifier or end tag of the input file is detected to obtain the corresponding test results. These steps confirm whether the file structure meets expectations, such as whether the file header exists, whether the delimiter is correct, and whether the identifier and end tag are complete. Next, the keyword format and parameter format corresponding to the input file format are obtained. These formats define the structural requirements of keywords and parameters in the file. Then, the input file is verified according to these formats to obtain the verification results. This step ensures that the data format and structure of the input file meet the specified requirements. If no abnormalities are found in the test results and verification results, the system will continue to identify the first keyword in the input file. However, if there are abnormalities in the test results or verification results, the system will record these abnormalities in the error log and provide detailed information for further analysis and correction. This process ensures that the structure and content of the input file meet expectations, which helps the smooth progress of subsequent data processing and conversion steps.

[0087] Step S32, obtaining a second parameter and a second keyword corresponding to the first parameter corresponding to the first keyword and a second parameter corresponding to the first keyword according to the first keyword, the first parameter, the data format description, the keyword mapping table and the parameter mapping table;

[0088] It should be noted that the second parameter refers to the target parameter value obtained after conversion according to the first keyword and the first parameter through the data format description, the keyword mapping table and the parameter mapping table. According to the first keyword, the first parameter and the relevant conversion rules (data format description, keyword mapping table and parameter mapping table), the system will convert the first parameter into the corresponding second parameter, and the second parameter is the target value to be used in the output file. For example, if the first parameter MAT123 in the input file needs to be mapped to a certain attribute value in the output file, then this value is the second parameter, such as Material_Code. The second keyword refers to an identifier or label associated with the second parameter in the output file format, which is used to mark or classify data items. Through the mapping rules, the system determines the second keyword, that is, the corresponding keyword in the output file, which is used to mark or store the value of the second parameter. For example, if the first parameter MAT123 of the first keyword Material_ID in the input file corresponds to the keyword MAT_ID in the output file, then MAT_ID is the second keyword. The second keyword is used to identify or classify data items in the output file.

[0089] It can be understood that data conversion is first performed using the identified first keyword and first parameter in combination with the data format description, keyword mapping table and parameter mapping table. Specifically, the system determines the second keyword to be used in the output file based on the first keyword, and finds the corresponding second parameter value through the parameter mapping table based on the value of the first parameter. The data format description provides the format requirements of the output file, while the keyword mapping table and the parameter mapping table define the conversion rules from input data to output data. By applying these rules, the system converts the first keyword and the first parameter into the second keyword and the second parameter, ensuring that the data is correctly mapped and organized according to the target format during the conversion process. This process realizes the accurate conversion of input data to output data, and meets the format specification and data consistency requirements.

[0090] As an example, the step of obtaining the second parameter and the second keyword corresponding to the first parameter corresponding to the first keyword according to the first keyword, the first parameter, the data format description, the keyword mapping table and the parameter mapping table includes: traversing the first keyword, and searching the corresponding second keyword content in the keyword mapping table according to the first keyword currently traversed; traversing the first parameter, and searching the second parameter corresponding to the first parameter in the parameter mapping table according to the first parameter currently traversed; and constructing the second keyword according to the data format description, the second keyword content and the second parameter.

[0091] The second keyword content refers to the specific information or value of the target keyword corresponding to the first keyword found in the keyword mapping table. It is used to determine the detailed content of the second keyword to be used in the output file. When traversing the first keyword and searching in the keyword mapping table, the content found is the second keyword content, which usually includes specific information such as the name, label or identifier of the second keyword, which is used to define the keyword to be used in the output file. For example, if the first keyword corresponds to Output_Key_1 in the mapping table, then Output_Key_1 is the second keyword content.

[0092] First, each identified first keyword is traversed and its corresponding second keyword content is searched in the keyword mapping table. The second keyword content is defined in the mapping table and is used to determine the actual keyword used in the output file. For example, the second keyword content corresponding to the first keyword `Material_ID` in the mapping table may be `Product_Code`. Next, each identified first parameter is traversed and the corresponding second parameter is searched in the parameter mapping table. The second parameter is the target value converted from the first parameter through the parameter mapping table. For example, the first parameter `MAT123` may correspond to the second parameter `Code_456`. After obtaining the second keyword content and the second parameter, these information are combined according to the data format description to construct the final second keyword. Specifically, this includes combining the second keyword content with the second parameter and forming a complete second keyword in accordance with the format and structure specified in the data format description. For example, if the data format description requires the second keyword and the second parameter to be combined into one field, `Product_Code` and `Code_456` can be combined into the form of `Product_Code: Code_456`. Through these steps, accurate conversion and formatting of data from input to output is ensured.

[0093] As an example, after traversing the first parameter and searching the parameter mapping table for the second parameter corresponding to the first parameter according to the currently traversed first parameter, the method further includes: when the second keyword content cannot be found, skipping the currently traversed first keyword and continuing to traverse the next first keyword; when the second parameter cannot be found, stopping traversing the first parameter, skipping the currently traversed first keyword, and continuing to traverse the next first keyword.

[0094] If the corresponding second keyword content cannot be found in the keyword mapping table, the system will skip the currently traversed first keyword and continue to process the next first keyword. After traversing the first parameter and searching for the corresponding second parameter in the parameter mapping table according to the current parameter, if the corresponding second parameter cannot be found, further processing of the current first parameter will be stopped, and the currently traversed first keyword will be skipped, and the traversal of the next first keyword will continue. Specifically, if there is no matching second parameter in the parameter mapping table, this means that the current first keyword and its related parameters cannot be effectively converted, and the system will no longer process the current keyword to avoid generating invalid or incomplete data. On the contrary, the system will continue to process the next first keyword to ensure that as much data as possible is correctly processed and converted. This processing method ensures the accuracy and effectiveness of data processing, reduces possible errors or omissions by skipping keywords and parameters that cannot be processed, and ensures the smoothness and consistency of data processing.

[0095] Step S33: obtaining an output file according to the second keyword and the second parameter.

[0096] It can be understood that, first, the system combines the second keyword and the second parameter to form the format and content required in the output file. For example, if the second keyword is Product_Code and the second parameter is Code_456, the system will organize these data items in the file according to the predefined output file format. Then, the system places these keywords and parameters in the appropriate file structure position according to the data format description, such as under the specified field or label. Finally, the system creates a file that meets the output file format requirements, which contains the data defined by the second keyword and the second parameter. This process ensures that the content of the output file obtained from the conversion of the input file is complete and accurate, and meets the expected format specifications, providing effective data output for subsequent data processing and analysis.

[0097] This embodiment reads the input file, identifies the first keyword in the input file, and records the first parameter under the first keyword; obtains the second parameter and the second keyword corresponding to the first parameter corresponding to the first keyword according to the first keyword, the first parameter, the data format description, the keyword mapping table and the parameter mapping table; obtains the output file according to the second keyword and the second parameter. First, the system reads data from the input file, identifies and records the first keyword and its corresponding first parameter. This step ensures accurate extraction of key information and lays the foundation for subsequent processing. Then, the system searches and determines the corresponding second keyword and the second parameter according to the first keyword and the first parameter, combined with the data format description, the keyword mapping table and the parameter mapping table. This step accurately maps the input data to the format required for the output data, ensuring the accuracy and consistency of the data conversion. Finally, the system generates an output file according to the obtained second keyword and the second parameter, and formats the processed data into a predetermined output format. This process ensures that the generated output file meets the requirements and ensures the accuracy and integrity of the data. Through this process, the efficiency and accuracy of data processing are improved, thereby effectively improving the flexibility and reliability of file format conversion.

[0098] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the file format conversion method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0099] This application also provides a file format conversion device, please refer to Figure 3 , the file format conversion device comprises:

[0100] A dictionary acquisition module 10, used to acquire a dictionary file according to an input file format and an output file format, wherein the dictionary file defines a keyword mapping relationship, a parameter mapping relationship and a data format description between the input file format and the output file format;

[0101] A mapping table construction module 20, configured to obtain a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship;

[0102] The file output module 30 is used to obtain an output file according to the input file, the data format description, the keyword mapping table and the parameter mapping table.

[0103] The file format conversion device provided by the present application adopts the file format conversion method in the above embodiment, which can solve the technical problem of how to improve the flexibility of file format conversion. Compared with the prior art, the beneficial effects of the file format conversion device provided by the present application are the same as the beneficial effects of the file format conversion method provided by the above embodiment, and other technical features in the file format conversion device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0104] The present application provides a file format conversion device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the file format conversion method in the above-mentioned embodiment 1.

[0105] Reference below Figure 4 , which shows a schematic diagram of the structure of a file format conversion device suitable for implementing an embodiment of the present application. The file format conversion device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The file format conversion device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0106] like Figure 4 As shown, the file format conversion device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the file format conversion device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the file format conversion device to communicate with other devices wirelessly or by wire to exchange data. Although the file format conversion device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided alternatively.

[0107] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0108] The file format conversion device provided by the present application adopts the file format conversion method in the above embodiment, which can solve the technical problem of how to improve the flexibility of file format conversion. Compared with the prior art, the beneficial effects of the file format conversion device provided by the present application are the same as the beneficial effects of the file format conversion method provided by the above embodiment, and other technical features in the file format conversion device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0109] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0110] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0111] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the file format conversion method in the above-mentioned embodiment.

[0112] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0113] The computer-readable storage medium may be included in the file format conversion device; or may exist independently without being assembled into the file format conversion device.

[0114] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by a file format conversion device, the file format conversion device: obtains a dictionary file according to an input file format and an output file format, wherein the dictionary file defines a keyword mapping relationship, a parameter mapping relationship and a data format description between the input file format and the output file format; obtains a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship; and obtains an output file according to the input file, the data format description, the keyword mapping table and the parameter mapping table.

[0115] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0116] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0117] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0118] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned file format conversion method, and can solve the technical problem of how to improve the flexibility of file format conversion. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the file format conversion method provided in the above-mentioned embodiment, and will not be elaborated here.

[0119] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned file format conversion method when executed by a processor.

[0120] The computer program product provided by the present application can solve the technical problem of how to improve the flexibility of file format conversion. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the file format conversion method provided by the above embodiment, which will not be repeated here.

[0121] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.< / material>

Claims

1. A file format conversion method, characterized in that: The method comprises: When a dictionary file corresponding to the input file format and the output file format exists in the configuration file, obtaining the dictionary file from the configuration file; When the dictionary file does not exist in the configuration file, a keyword mapping rule and a parameter mapping rule are obtained according to the input file format and the output file format, wherein the parameter mapping rule includes conversion of data values ​​and conversion or formatting of data units; Defining the key-value pair structure and organization form of the dictionary file; Obtain a dictionary file structure according to the key-value pair structure and the organizational form; Select comment characters, line identifiers, keyword delimiters, sub-object delimiters, and operators; The dictionary file is written according to the keyword mapping rule, the parameter mapping rule, the dictionary file structure, the annotation symbol, the row identifier, the keyword separator, the sub-object separator and the operator, wherein the dictionary file defines the keyword mapping relationship, the parameter mapping relationship and the data format description between the input file format and the output file format, and the data format description includes the data structure, data type and format specification of the input file and the output file; Obtain a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship; Detect the file header, delimiter, identifier or end mark of the input file and obtain the detection result; Obtaining a keyword format and a parameter format corresponding to the input file format; Verify the input file according to the keyword format and the parameter format to obtain a verification result; When there is an abnormality in the detection result or the verification result, the detection result and the verification result are recorded in an error log; When there is no abnormality in the detection result or the verification result, reading the input file, identifying the first keyword in the input file, and recording the first parameter under the first keyword; Traversing the first keyword, searching the keyword mapping table for corresponding second keyword content according to the currently traversed first keyword; Traversing the first parameter, and searching the parameter mapping table for a second parameter corresponding to the first parameter according to the currently traversed first parameter; When the second keyword content cannot be found, skip the first keyword currently traversed and continue to traverse the next first keyword; When the second parameter cannot be found, stop traversing the first parameter, skip the first keyword currently traversed, and continue traversing the next first keyword; Constructing a second keyword according to the data format description, the second keyword content and the second parameter; An output file is obtained according to the second keyword and the second parameter.

2. The method according to claim 1, characterized in that The step of obtaining a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship comprises: Read the dictionary file, and divide the read content into key-value pairs according to preset identifiers; A keyword mapping table and a parameter mapping table between the input file and the output file are constructed according to the keyword mapping relationship, the parameter mapping relationship and the key-value pair.

3. A file format conversion device, characterized in that: The device comprises: a dictionary acquisition module, for acquiring the dictionary file from the configuration file when a dictionary file corresponding to the input file format and the output file format exists in the configuration file; when the dictionary file does not exist in the configuration file, obtaining a keyword mapping rule and a parameter mapping rule according to the input file format and the output file format, wherein the parameter mapping rule includes the conversion of data values ​​and the conversion or formatting of data units; defining a key-value pair structure and an organizational form of the dictionary file; obtaining a dictionary file structure according to the key-value pair structure and the organizational form; selecting an annotation symbol, a row identifier, a keyword separator, a sub-object separator and an operator; and compiling the dictionary file according to the keyword mapping rule, the parameter mapping rule, the dictionary file structure, the annotation symbol, the row identifier, the keyword separator, the sub-object separator and the operator, wherein the dictionary file defines a keyword mapping relationship, a parameter mapping relationship and a data format description between the input file format and the output file format, wherein the data format description includes a data structure, a data type and a format specification in the input file and the output file; A mapping table construction module, used to obtain a keyword mapping table and a parameter mapping table according to the dictionary file, the keyword mapping relationship and the parameter mapping relationship; The file output module is used to detect the file header, delimiter, identifier or end mark of the input file to obtain the detection result; obtain the keyword format and parameter format corresponding to the input file format; verify the input file according to the keyword format and the parameter format to obtain the verification result; when there is an abnormality in the detection result or the verification result, record the detection result and the verification result in an error log; when there is no abnormality in the detection result or the verification result, read the input file, identify the first keyword in the input file, and record the first parameter under the first keyword; traverse the first keyword, and search the corresponding second keyword content in the keyword mapping table according to the first keyword currently traversed; traverse the first parameter, and search the second parameter corresponding to the first parameter in the parameter mapping table according to the first parameter currently traversed; when the second keyword content cannot be found, skip the first keyword currently traversed and continue to traverse the next first keyword; when the second parameter cannot be found, stop traversing the first parameter, skip the first keyword currently traversed, and continue to traverse the next first keyword; construct the second keyword according to the data format description, the second keyword content and the second parameter; obtain the output file according to the second keyword and the second parameter.

4. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the file format conversion method according to any one of claims 1 to 2 are implemented.

Citation Information

Patent Citations

  • Structured message self-adaptive conversion method and device

    CN109889553A