A label-based file management method, device, electronic device, and storage medium
By using the verification code and label file management method of data files in locomotive signal equipment, the data files are converted to JSON format, which solves the problem of messy data files and improves the management efficiency and readability of data files.
Patent Information
- Application Number
- CN202110932559.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-13
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2041-08-13
AI Technical Summary
The data files in the locomotive signal vehicle-mounted equipment have problems such as large amount of data, poor readability, messy and difficult to divide and organize.
By receiving the verification code of the data file, we can determine whether the same file exists in the folder, store it in the structure using the tag, and convert the structure into a JSON format information file, and use the efficient transmission of the JSON format for file management.
It realizes rapid deduplication, improves data transmission efficiency and call speed, and facilitates data file retrieval and management.
Smart Images

Figure CN113704194B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of on-vehicle equipment for locomotive signals, and particularly to a tag-based file management method, device, electronic device, and storage medium. Background Art
[0002] In the field of on-vehicle equipment for locomotive signals, the input signal waveforms of track circuits during the operation of on-vehicle equipment for locomotive signals are stored in data files. As a result, the data files have problems such as large data volume, poor data readability, being messy, difficult to divide, and organize. Summary of the Invention
[0003] The present invention provides a tag-based file management method, device, electronic device, and storage medium to solve the problems of messiness, difficulty in division, and organization existing in the data files in the existing field of on-vehicle equipment for locomotive signals.
[0004] To solve the above problems, the present invention adopts the following technical solutions:
[0005] In a first aspect, the present invention provides a tag-based file management method, including: if a data file to be stored is received, obtaining the checksum of the data file;
[0006] judging whether a target file with the name of the checksum exists in a preset folder;
[0007] if the target file with the name of the checksum does not exist in the folder, receiving a tag set by a user for the data file and storing the tag in a structure;
[0008] converting the structure into an information file, and the format of the information file is JSON format;
[0009] storing the data file and the information file in the folder, and the names of the data file and the information file are the checksum;
[0010] if a data extraction request is received, the data extraction request includes a target tag;
[0011] retrieving a target information file from the folder according to the target tag;
[0012] retrieving a target data file from the folder according to the name of the target information file.
[0013] A further technical solution thereof is that obtaining the checksum of the data file includes: calculating the checksum of the data file by using the checksum function Simulink.getFileChecksum.
[0014] A further technical solution thereof is that storing the tag into the structure body includes:
[0015] Setting the tag using the WenJG_jsonGen function to obtain a tag value;
[0016] Storing the tag value of the tag into the structure body.
[0017] A further technical solution thereof is that converting the structure body into an information file includes: converting the structure body into an information file using the Jsonencode function.
[0018] A further technical solution thereof is that after storing the tag into the structure body, it includes:
[0019] Using the w_strTypeIsSame function to determine whether the structure body is legal, where "legal" means that any sub-domain in the structure body and any sub-domain in the standard structure body are subsets of each other;
[0020] If the structure body is legal, execute the step of converting the structure body into an information file.
[0021] A further technical solution thereof is that retrieving the target information file from the folder according to the target tag includes: according to the target tag, using the WenJG_jsonToExcel_objs function to find the target information file in the folder and return the storage path of the target information file.
[0022] A further technical solution of the method is that it further includes:
[0023] Receiving an information file tag modification request, where the information file tag modification request includes the tag to be modified;
[0024] According to the tag to be modified, using the WenJG_jsonToExcel_objs function to retrieve the information file to be modified from the folder;
[0025] Using the Jsondecode function to convert the information file to be modified into a structure body to be modified;
[0026] Using the WenJG_jsonFieldSetOld.m function to modify the tag to be modified in the structure body to be modified;
[0027] Using the Jsonencode function to convert the modified structure body into an information file in JSON format.
[0028] In a second aspect, the present invention further provides a tag-based file management device, including a unit for executing the method described in the first aspect.
[0029] In a third aspect, the present invention further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus;
[0030] The memory is used to store a computer program;
[0031] The processor, when executing the program stored in the memory, implements the steps of the method described in the first aspect.
[0032] In a fourth aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0033] The beneficial effects of the present invention compared with the prior art are:
[0034] By using the checksum of the data file to determine whether there are duplicate data files, the effect of quickly removing duplicates is achieved. By converting the structure into an information file in JSON format, the data transmission efficiency and conversion speed are improved, which is convenient for calling. By storing the tag in the structure, the information file required can be retrieved according to the tag, and the data file required can be retrieved according to the information file. Due to the high transmission efficiency of the JSON format, the required information file and data file can be quickly retrieved according to the tag, improving the efficiency of data extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present invention, and are used together with the specification to explain the principles of the present invention.
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0037] Figure 1 It is a schematic flow chart of a tag-based file management method provided in Embodiment 1 of the present invention;
[0038] Figure 2 It is a schematic flow chart of a tag-based file management method provided in Embodiment 2 of the present invention;
[0039] Figure 3A schematic flowchart of a method for determining the legality of a structure provided in Embodiment 2 of the present invention;
[0040] Figure 4 A structural block diagram of a tag-based file management device provided in Embodiment 3 of the present invention;
[0041] Figure 5 A structural block diagram of a tag-based file management device provided in Embodiment 4 of the present invention;
[0042] Figure 6 A schematic structural diagram of an electronic device proposed in Embodiment 5 of the present invention. Detailed implementation manners
[0043] To more fully understand the technical content of the present invention, the technical solutions of the present invention will be further introduced and described below in conjunction with specific embodiments, but not limited thereto.
[0044] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0045] It should be understood that when used in this specification and the appended claims, the terms "comprises" and "comprising" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their groups.
[0046] It should also be understood that the term " / and" as used in the specification and appended claims of the present invention refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0047] Embodiment 1
[0048] Refer to Figure 1 , Figure 1 which is a schematic flowchart of a tag-based file management method provided in Embodiment 1 of the present invention. This method can be applied to an electronic device, which includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory communicate with each other through the communication bus, and the present invention does not make specific limitations thereto. Specifically, refer to Figure 1 , and this method includes the following steps S101-S108.
[0049] S101, If a data file to be stored is received, obtain the check code of the data file.
[0050] The data file to be stored contains the input signal waveform of the on-board equipment of locomotive signals during operation in the track circuit. All data files can be stored in one or more folders of the computer system. The checksum is used to check whether there are data files with the same content in the folder. For any data files with different contents, their checksums are different.
[0051] In one embodiment, obtaining the checksum of the data file includes: using the checksum function Simulink.getFileChecksum to calculate the MD5 checksum of the data file.
[0052] S102, determine whether there is a target file named after the checksum in the preset folder.
[0053] The target file is a data file obtained according to user needs. The calculated checksum is used to name the data file. According to the fact that for any data files with different contents, their checksums are different, it is possible to check whether there are duplicate data files in the folder through the MD5 checksum.
[0054] In one embodiment, when a data file to be stored is newly added to the folder, the effect of deduplication is achieved by determining whether there is a target file named after the checksum in the folder.
[0055] If there is a target file named after the checksum, it means that there are data files with the same content in the folder, and there is no need to newly add the data file to be stored to this folder.
[0056] S103, if there is no target file named after the checksum in the folder, receive the label set by the user for the data file and store the label in the structure.
[0057] The label set by the user for the data file can be a binary label, and the value of the label is true or false. It can also be an enumerated label, and the value of the label is a few limited values, such as Monday to Sunday. It can also be a numerical label, and the value of the label is a large set or continuous numerical values, such as duration, date, string, etc. A structure is a new data type composed of a batch of data. It can define a data type or contain multiple data types.
[0058] In one embodiment, the above step S103 includes the following steps: S301 - S302.
[0059] S301, use the WenJG_jsonGen function to set the label to obtain the label value.
[0060] The WenJG_jsonGen function can obtain the tag value by setting according to the tags set by the user, and the tag value can be of multiple data types.
[0061] S302, store the tag value of the said tag into the MATLAB structure.
[0062] Define a MATLAB structure according to the data type of the tag value of the said tag for storing the tag value of this data type. The structure can be a data type or composed of multiple data types. At the same time, the structure can also be a set of some elements. The structure can be declared as a variable, pointer or array, etc. to implement a more complex data structure.
[0063] S104, convert the said structure into an information file, and the format of the information file is JSON format.
[0064] JSON is a lightweight data exchange format, easy to read and write, and can effectively improve data efficiency. Converting the structure into an information file in JSON format is to utilize the high-efficiency transmission of the JSON format file during conversion and reading to improve operation efficiency.
[0065] In one embodiment, according to the structure obtained in step S103, use the Jsonencode function to convert the said structure into an information file in JSON format, and convert the MATLAB structure into an information file in JSON format to complete the format conversion.
[0066] S105, store the said data file and information file into the said folder, and the names of the data file and the information file are the said check code.
[0067] The information file contains the tags set by the user, and the check code calculated by the data file is used as the file name of the corresponding information file. The difference between the data file and the information file is that the extension of the information file is.JSON.
[0068] In one embodiment, use the MD5 check code obtained in step S101 as the file names of the said data file and the information file. According to the uniqueness of the MD5 code, make the data file and the information file correspond one by one to improve the accuracy rate during data storage.
[0069] S106, if a data extraction request is received, the data extraction request includes the target tag.
[0070] The target tag can be a tag selected by the user according to needs. After the format conversion between the structure and the information file, the target tag is stored in the information file. The data extraction request also includes a target information file and a target data file. The target tag corresponds to the target information file and the target data file. The user can retrieve the corresponding information file and data file only through the target tag, which is convenient, fast, and easy to operate.
[0071] In one embodiment, a data extraction request is generated according to the information file required by the user. The data request contains a target tag, which is used to match the corresponding information file.
[0072] S107, Retrieve the target information file from the folder according to the target tag.
[0073] The target information file is uniformly in JSON format. When the structure is converted into an information file, the tags existing in the structure also exist in the information file. Therefore, the target information file contains the target tag. The target tag corresponds to the target information file, and the target information file can be obtained through the matching of the target tag.
[0074] In one embodiment, according to the target tag, use the WenJG_jsonToExcel_objs function to find the target information file and return the storage path of the target information file. The WenJG_jsonToExcel_objs function has an analysis and modeling function, which can sort out the characteristics of each tag and the relationship between the tag and the information file. The user can use this function to obtain an image and hierarchical data summary when browsing the data file and quickly find the required data file type.
[0075] S108, Retrieve the target data file from the folder according to the name of the target information file.
[0076] Due to the efficient transmission characteristics of the JSON format information file, the user can quickly retrieve the required information file according to the target tag. Each information file corresponds to a data file (this connection is generated by the MD5 checksum).
[0077] In one embodiment, it can be obtained from step S105 that the MD5 checksum is used as the file name of the data file and the information file. Through the file name of the target information file, the corresponding target data file is found.
[0078] Specifically, by using the MD5 checksum of the data file to determine whether there are duplicate data files, the effect of quickly removing duplicates is achieved. By converting the MATLAB structure into an information file in JSON format, the data transmission efficiency and conversion speed are improved, facilitating calls. By storing the tags in the MATLAB structure, the required information files can be retrieved according to the tags, and the required data files can be retrieved according to the information files. Due to the high transmission efficiency of the JSON format, the required information files and data files can be quickly retrieved according to the tags, improving the efficiency of data extraction.
[0079] Embodiment 2
[0080] See Figure 2 , Figure 2 which is a schematic flowchart of a tag-based file management method provided in Embodiment 2 of the present invention. The tag-based file management method of Embodiment 2 includes steps S201-S208, where steps S201-S208 are similar to steps S101-S108 in the above Embodiment 1 and will not be elaborated here. The additional steps S209-S214 in this embodiment will be described in detail below.
[0081] S209, receiving an information file tag modification request, where the information file tag modification request includes the tag to be modified.
[0082] The tag to be modified may be a tag set incorrectly by the user when storing the data file, and this incorrectly set tag has been converted to the information file through formatting; the tag to be modified may also be a tag reset by the user according to needs.
[0083] In one embodiment, receiving an information file tag modification request, where the information file tag modification request includes the tag to be modified selected by the user, and a modification request for any tag in the information file can be received.
[0084] S210, according to the tag to be modified, using the WenJG_jsonToExcel_objs function to retrieve the information file to be modified from the folder.
[0085] The WenJG_jsonToExcel_objs function outputs the obtained JSON to an Excel cell, that is, exports the output of the JSON to an Excel cell, so that the information file corresponding to the tag can be seen more intuitively, and then the storage location of the JSON file can be obtained.
[0086] In one embodiment, according to the tag to be modified, using the WenJG_jsonToExcel_objs function to find the information file to be modified and return the storage path of the information file to be modified.
[0087] S211. Use the Jsondecode function to convert the information file to be modified into a structure to be modified.
[0088] The structure to be modified stores the tags to be modified. When the information file to be modified is stored in the folder, the Jsonencode function has already converted the structure into a JSON-format information file. Due to the good readability of the structure, the information file to be modified is thus converted into a structure with good readability, facilitating reading and modification.
[0089] In one embodiment, the Jsondecode function is used to complete the format conversion between the MATLAB structure and the JSON-format information file. The JSON-format information file is converted into a MATLAB structure through the Jsondecode function, where the MATLAB structure has good readability and is convenient for reading.
[0090] S212. Use the WenJG_jsonFieldSetOld.m function to modify the tags to be modified in the structure to be modified.
[0091] The WenJG_jsonFieldSetOld.m function can read the data in the structure and has the function of resetting the bit fields in the structure. The bit fields of the structure are essentially a data type. By resetting the bit fields of the structure, that is, redefining the data type in the structure. The tags to be modified are also a data type. Resetting the bit fields thus modifies the tags in the structure, and the range of modification of the tags can be adding, deleting, renaming, and modifying values.
[0092] In one embodiment, the tags in the MATLAB structure are read through the WenJG_jsonFieldSetOld.m function and the tags in the MATLAB structure are modified.
[0093] S213. Use the Jsonencode function to convert the modified structure into a JSON-format information file.
[0094] The modified structure needs to be converted into a JSON-format information file and stored back in the folder before it can be called and read. By converting it back into a JSON-format information file, the file format is unified, the modification difficulty is reduced, and the file management efficiency is improved.
[0095] In one embodiment, after the labels in the MATLAB structure are modified, the modified MATLAB structure needs to be formatted again. Use the Jsonencode function to convert the modified MATLAB structure into a JSON format information file and store it back in the folder to complete the label modification process.
[0096] S214. Use the w_strTypeIsSame function to determine whether the structure is legal. The legality means that any sub-domain in the structure and any sub-domain in the standard structure are subsets of each other.
[0097] If it is legal, execute step S204 to convert the structure into an information file, and the format of the information file is JSON format.
[0098] See Figure 3 In one embodiment, step S214 includes:
[0099] S2141. Input parameters str1 and str2.
[0100] Use the w_strTypeIsSame function to input parameters str1 and parameter str2. The parameter str1 and parameter str2 correspond to the structure to be verified and the standard structure respectively. The w_strTypeIsSame function is applicable to the type comparison of MATLAB structures and is used to convert numeric variables or constants into character variables or constants. In this embodiment, through the structure to be verified corresponding to parameter str1 and the standard structure corresponding to parameter str2, a constant result is obtained through the w_strTypeIsSame function, and this constant is used to indicate whether the structure is legal. The legality means that the structure can be used for format conversion with the information file.
[0101] S2142. Determine whether both parameter str1 and parameter str2 are structures.
[0102] The main purpose of determining whether both parameter str1 and parameter str2 are structures is to determine whether parameter str1 is a structure. If parameter str1 is not a structure, then parameter str1 is not readable.
[0103] If parameter str1 is not a structure, determine that the structure is illegal.
[0104] S2143. If both parameter str1 and parameter str2 are structures, obtain the sub-domain field1 of parameter str1 and the sub-domain field2 of parameter str2.
[0105] The purpose of obtaining the subfield field1 of parameter str1 and the subfield field2 of parameter str2 is to pass the subfields as parameters so that the subfield field1 of str1 and the subfield field2 of parameter str2 can be used as parameters for the next step.
[0106] S2144, determine whether the subfield field1 and the subfield field2 are subsets of each other.
[0107] If the subfield field1 and the subfield field2 are subsets of each other, it proves that field1 is a necessary and sufficient condition for field2, that is, the subfield field1 is equal to field2, which can prove that a certain part of parameter str1 is the same as a certain part of parameter str2.
[0108] If the subfield field1 and the subfield field2 are not subsets of each other, determine that the structure is illegal.
[0109] S2145, if the subfield fields1 and the subfield fields2 are subsets of each other, traverse all subfields of parameter str1 and parameter str2.
[0110] By traversing all subfields of parameter str1 and parameter str2, it is possible to determine whether parameter str1 and parameter str2 are of the same type of structure.
[0111] S2146, determine whether the traversal is completed.
[0112] By determining whether the traversal is completed, the result of whether parameter str1 and str2 are of the same type of structure can be obtained.
[0113] S2147, if the traversal is completed, determine that the structure is legal.
[0114] The completion of the traversal means that all subfields in parameter str1 and parameter str2 are subsets of each other, which can prove that parameter str1 and str2 are of the same type of structure.
[0115] S2148, if the traversal is not completed, input the field values of all subfields of parameter str1 and the field values of all subfields of parameter str2 respectively through a recursive algorithm;
[0116] Through the recursive algorithm, input the subfield values fieldn in parameter str1 and parameter str2. The purpose is to make the field value of parameter str1 and the field value of parameter str2 be subsets of each other, and through recursion, make all field values of parameter str1 and all field values of parameter str2 be subsets of each other.
[0117] S2149, Determine whether the recursion is completed. If the recursion is completed, determine that the structure is legal.
[0118] S2150, If the recursion is not completed, then determine that the structure is illegal.
[0119] If the recursion is completed, it proves that all sub-domains in parameter str1 and parameter str2 are subsets of each other, that is, it can prove that parameter str1 and str2 are structures of the same type; if the recursion is not completed, it proves that parameter str1 and parameter str2 are not exactly the same in structure and are not of the same type as the standard structure, and the verification result is illegal.
[0120] Specifically, the structures in the folder need to be compared with the standard structure. By verifying the legality of the structure, the format conversion between the MATLAB structure and the information file can be performed only after the structure is verified to be legal, which ensures the integrity of the data during transmission and encryption, prevents data omission or loss, and reduces the error of data transmission.
[0121] The format conversion between the structure and the information file is completed by using the Jsonencode function and the Jsondecode function. According to the high efficiency of the information file in JSON format and the good readability of the MATLAB structure, the labels in the MATLAB structure can be modified, and then the modified MATLAB structure is converted into an information file in JSON format by using the Jsonencode function. The labels corresponding to the information file can be modified according to actual needs. By modifying the labels in the information file, due to the unity of the JSON format, the modification difficulty is reduced, and thus the efficiency of file management is improved. The required information file can be retrieved according to the label, and the data file corresponding to the information file can be retrieved through the naming method of the MD5 code (one data file corresponds to only one information file, and the file name is the MD5 code calculated according to the data file). Due to the high-efficiency transmission of the information file in JSON format, the required information file and data file can be quickly retrieved according to the label, improving the efficiency of data extraction.
[0122] Embodiment 3
[0123] See Figure 4 , The embodiment of the present invention also provides a tag-based file management device 400, and the tag-based file management device 400 includes an acquisition unit 401, a first judgment unit 402, a first storage unit 403, a first conversion unit 404, a second storage unit 405, a first receiving unit 406, a first retrieval unit 407, and a second retrieval unit 408.
[0124] The acquisition unit 401 is used to obtain the check code of the data file if a data file to be stored is received;
[0125] The first judgment unit 402 is configured to judge whether there is a target file named the check code in a preset folder;
[0126] The first storage unit 403 is configured to, if there is no target file named the check code in the folder, receive a label set by a user for the data file and store the label in a structure;
[0127] The first conversion unit 404 is configured to convert the structure into an information file, and the format of the information file is JSON format;
[0128] The second storage unit 405 is configured to store the data file and the information file in the folder, and the names of the data file and the information file are the check code;
[0129] The first receiving unit 406 is configured to, if a data extraction request is received, where the data extraction request includes a target label;
[0130] The first retrieval unit 407 is configured to retrieve a target information file from the folder according to the target label;
[0131] The second retrieval unit 408 is configured to retrieve a target data file from the folder according to the name of the target information file.
[0132] In one embodiment, obtaining the check code of the data file includes:
[0133] Using the check function Simulink.getFileChecksum to calculate the check code of the data file.
[0134] In one embodiment, storing the label in the structure includes:
[0135] Using the WenJG_jsonGen function to set the label to obtain a label value;
[0136] Storing the label value of the label in the structure.
[0137] In one embodiment, converting the structure into an information file includes:
[0138] Using the Jsonencode function to convert the structure into an information file.
[0139] In one embodiment, retrieving the target information file from the folder according to the target label includes:
[0140] According to the target tag, use the WenJG_jsonToExcel_objs function to find the target information file from the folder, and return the storage path of the target information file.
[0141] In the embodiment of the present invention, the MD5 checksum of the data file to be stored is calculated by using the checksum function Simulink.getFileChecksum, and it is judged whether there is a target file with the name of the checksum in the preset folder according to the MD5 checksum. When there is no target file with the name of the checksum in the folder, according to the received user-set tag, the tag is stored in the structure body, and the Jsonencode function is used to convert the structure body into a JSON-format information file. The data file and the information file containing the tag information are named by the MD5 code. Due to the high transmission efficiency of JSON, the target information file can be quickly retrieved according to the tag, and then the data file corresponding to the target information file can be retrieved, improving the efficiency of data extraction.
[0142] Embodiment 4
[0143] See Figure 5 In addition, the embodiment of the present invention also provides a tag-based file management device 400. The difference between the tag-based file management device 400 and the tag-based file management device 400 proposed in Embodiment 3 is that it further includes: a second receiving unit 409, a third retrieving unit 410, a second converting unit 411, a modifying unit 412, a third converting unit 413, and a second judging unit 414.
[0144] The second receiving unit 409 is configured to receive an information file tag modification request, where the information file tag modification request includes the tag to be modified;
[0145] The third retrieving unit 410 is configured to retrieve the information file to be modified from the folder by using the WenJG_jsonToExcel_objs function according to the tag to be modified;
[0146] The second converting unit 411 is configured to convert the information file to be modified into a structure body to be modified by using the Jsondecode function;
[0147] The modifying unit 412 is configured to modify the tag to be modified in the structure body to be modified by using the WenJG_jsonFieldSetOld.m function;
[0148] The third converting unit 413 is configured to convert the modified structure body into a JSON-format information file by using the Jsonencode function.
[0149] A second determination unit 414, configured to determine whether the structure is legal by using the w_strTypeIsSame function, where "legal" means that any sub-domain in the structure and any sub-domain in the standard structure are subsets of each other.
[0150] In the embodiments of the present invention, by receiving an information file label modification request including a label to be modified, retrieving the information file to be modified from a folder through the WenJG_jsonToExcel_objs function, and converting the information file to be modified into a structure to be modified by using the Jsondecode function. According to the good readability of the MATLAB structure, the WenJG_jsonFieldSetOld.m function is used to read the label in the structure to be modified, and then the label to be modified in the structure to be modified is modified. The Jsonencode function is used to convert the modified structure into an information file in JSON format.
[0151] Specifically, the required information file can be retrieved according to the label, and the data file corresponding to the information file can be retrieved through the naming method of the MD5 code (one data file corresponds to only one information file, and the file name is the MD5 code calculated according to the data file), and the label corresponding to the information file can be modified according to actual needs.
[0152] Embodiment 5
[0153] See Figure 6 , the embodiments of the present invention further provide an electronic device, including a processor 111, a communication interface 112, a memory 113, and a communication bus 114. Among them, the processor 111, the communication interface 112, and the memory 113 complete communication with each other through the communication bus 114.
[0154] The memory 113 is used to store a computer program;
[0155] The processor 111 is configured to execute the program stored on the memory 113 to implement the label-based file management method provided in Embodiment 1 or 2.
[0156] The embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by the processor 111, the steps of the label-based file management method provided in Embodiment 1 or 2 are implemented.
[0157] It should be noted that in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising said element.
[0158] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.
Claims
1. A label-based file management method, characterized in that, including: If a data file to be stored is received, obtain the checksum of the data file; Determine whether a target file with the name of the checksum exists in a preset folder; If the target file with the name of the checksum does not exist in the folder, receive the label set by the user for the data file, and store the label in a structure; Convert the structure into an information file, and the format of the information file is JSON format; Store the data file and the information file in the folder, and the names of the data file and the information file are the checksum; If a data extraction request is received, the data extraction request includes a target label; Retrieve a target information file from the folder according to the target label; Retrieve a target data file from the folder according to the name of the target information file; Receive an information file label modification request, and the information file label modification request includes a label to be modified; According to the label to be modified, use the WenJG_jsonToExcel_objs function to retrieve the information file to be modified from the folder; use the Jsondecode function to convert the information file to be modified into a structure to be modified; use the WenJG_jsonFieldSetOld.m function to modify the label to be modified in the structure to be modified; use the Jsonencode function to convert the modified structure into an information file in JSON format.
2. The tabular document management method according to claim 1, wherein The obtaining the checksum of the data file includes: Use the checksum function Simulink.getFileChecksum to calculate the checksum of the data file.
3. The tabular document management method according to claim 1, characterized in that The storing the label in the structure includes: Use the WenJG_jsonGen function to set the label to obtain a label value; Store the label value of the label in the structure.
4. The tabular document management method according to claim 1, wherein The converting the structure into an information file includes: Use the Jsonencode function to convert the structure into an information file.
5. The tabular document management method according to claim 1, characterized in that After the storing the label in the structure, it includes: Use the w_strTypeIsSame function to determine whether the structure is legal, and the legal means that any sub-domain in the structure and any sub-domain in the standard structure are subsets of each other; If the structure is legal, execute the step of converting the structure into an information file.
6. The tabular document management method according to claim 1, wherein The retrieving the target information file from the folder according to the target label includes: According to the target label, use the WenJG_jsonToExcel_objs function to find the target information file in the folder, and return the storage path of the target information file.
7. A label-type document management device, characterized in that, including a unit for executing the method according to any one of claims 1-6.
8. An electronic device, characterized in that, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus; The memory is used for storing a computer program; The processor is used for implementing the steps of the method according to any one of claims 1-6 when executing the program stored on the memory.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-6.
Citation Information
Patent Citations
Large data integration method, system and device for spatial planning
CN109446164A
Data access method, device, equipment and storage medium
CN111680061A