CN109189728B - Intelligent hardware device, disk data processing method and storage medium - Google Patents
Intelligent hardware device, disk data processing method and storage medium Download PDFInfo
- Publication number
- CN109189728B CN109189728B CN201810791052.3A CN201810791052A CN109189728B CN 109189728 B CN109189728 B CN 109189728B CN 201810791052 A CN201810791052 A CN 201810791052A CN 109189728 B CN109189728 B CN 109189728B
- Authority
- CN
- China
- Prior art keywords
- directory
- node
- file
- directory node
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 16
- 238000000034 method Methods 0.000 claims description 32
- 238000000605 extraction Methods 0.000 claims description 31
- 238000013507 mapping Methods 0.000 claims description 21
- 238000012545 processing Methods 0.000 claims description 11
- 238000004891 communication Methods 0.000 claims description 5
- 238000012163 sequencing technique Methods 0.000 claims 2
- 239000000284 extract Substances 0.000 abstract description 9
- 238000010586 diagram Methods 0.000 description 9
- 238000012217 deletion Methods 0.000 description 5
- 230000037430 deletion Effects 0.000 description 5
- 230000000717 retained effect Effects 0.000 description 5
- 230000006870 function Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 238000004590 computer program Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000000844 transformation Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明公开一种智能硬件设备、磁盘数据处理方法和存储介质。本发明扫描数据文件的文件目录;从扫描的文件目录中提取一个或多个目录标签;分别将各个文件目录下的每一个数据文件与对应的目录标签关联映射,并建立对应关系;在收到一个用户终端发送来的带有目录标签的文件查询请求后,根据对应关系数据确定查询请求中的目录标签对应的各个数据文件的预设类型文件信息,生成并反馈该查询请求对应的文件查询结果至用户终端。相较于现有技术,本发明提高了文件查询的效率及准确率,且操作简单。
The invention discloses an intelligent hardware device, a disk data processing method and a storage medium. The present invention scans the file directory of the data file; extracts one or more directory labels from the scanned file directory; associates and maps each data file under each file directory with the corresponding directory label, and establishes a corresponding relationship; After a file query request with a directory tag sent by a user terminal, determine the preset type file information of each data file corresponding to the directory tag in the query request according to the corresponding relationship data, and generate and feed back the file query result corresponding to the query request. to the user terminal. Compared with the prior art, the present invention improves the efficiency and accuracy of file query, and has simple operation.
Description
技术领域technical field
本发明涉及智能硬件技术领域,特别涉及一种智能硬件设备、磁盘数据处理方法和存储介质。The present invention relates to the technical field of intelligent hardware, in particular to an intelligent hardware device, a disk data processing method and a storage medium.
背景技术Background technique
随着人们生活水平的提高,人们对智能硬件(智能硬件指的是通过软硬件结合的方式,对传统设备进行改造,进而让其拥有智能化的功能,智能化之后,硬件具备连接的能力,实现互联网服务的加载,具备了大数据等附加价值,例如,智能手机、智能手表、智能电视、智能手环等)的需求也越来越强大。智能硬件为用户提供的最便捷的功能之一是可以通过远程访问的方式实现远程控制智能硬件。例如,在由智能硬件设备、服务器、用户终端组成的通信系统架构中,用户终端往往需要与智能硬件设备进行数据交互(例如,文件的查询、存储、删除等)。With the improvement of people's living standards, people's intelligent hardware (intelligent hardware refers to the transformation of traditional equipment through the combination of software and hardware, so that it has intelligent functions, after intelligent, the hardware has the ability to connect, To realize the loading of Internet services, with added value such as big data, for example, the demand for smart phones, smart watches, smart TVs, smart bracelets, etc. is becoming stronger and stronger. One of the most convenient functions that smart hardware provides users is the ability to remotely control smart hardware through remote access. For example, in a communication system architecture consisting of intelligent hardware devices, servers, and user terminals, user terminals often need to perform data interaction with the intelligent hardware devices (eg, file query, storage, deletion, etc.).
然而,现有的智能硬件设备的磁盘中,数据文件通常以文件目录的形式进行管理(例如,文件的查询、存储、删除等),例如,用户想要在磁盘(所述磁盘指的是非易失性存储器,例如,硬盘)中进行文件查询。通常的查询方式包括:方式一、基于磁盘目录结构去找所需要的数据文件,缺陷在于这种方式需要用户非常熟悉自己磁盘的目录结构,并整理好自己的磁盘目录,自己归类,以便快速地找到自己想要的东西,操作繁琐,且容易出错;方式二、通过搜索关键字查找所需要的数据文件,这种方式需要用户知道自己想要的数据文件的文件名或关键字,否则没法搜索到,而且速度慢。However, in the disks of existing smart hardware devices, data files are usually managed in the form of file directories (for example, file query, storage, deletion, etc.). volatile storage, such as a hard disk) for file lookups. The usual query methods include: Method 1. Find the required data files based on the disk directory structure. The disadvantage is that this method requires users to be very familiar with the directory structure of their own disks, organize their own disk directories, and categorize them by themselves, so as to quickly It is tedious and error-prone to find what you want. Method 2: Find the required data file by searching keywords. This method requires the user to know the file name or keyword of the data file they want. method to search, and the speed is slow.
因此,如何将数据文件导入磁盘存储后,能够快捷、准确的查询想要的数据文件,已经成为一个亟待解决的技术问题。Therefore, how to quickly and accurately query the desired data file after importing the data file into the disk storage has become an urgent technical problem to be solved.
发明内容SUMMARY OF THE INVENTION
本发明的主要目的是提供一种智能硬件设备、磁盘数据处理方法和存储介质,旨在解决如何将数据文件导入磁盘存储后,能够快捷、准确的查询想要的数据文件的问题。The main purpose of the present invention is to provide an intelligent hardware device, a disk data processing method and a storage medium, aiming at solving the problem of how to quickly and accurately query the desired data file after importing the data file into the disk for storage.
为实现上述目的,本发明提出一种智能硬件设备,所述智能硬件设备包括第一存储器和处理器,所述第一存储器上存储有可在所述处理器上运行的磁盘数据处理程序,所述磁盘数据处理程序被所述处理器执行时实现如下步骤:In order to achieve the above object, the present invention proposes an intelligent hardware device, the intelligent hardware device includes a first memory and a processor, and the first memory stores a disk data processing program that can run on the processor, so When the disk data processing program is executed by the processor, the following steps are implemented:
扫描步骤:实时或定时,或在收到归类存储指令后,扫描数据文件的文件目录,所述数据文件存储于与所述智能硬件设备通信连接的电子设备中;Scanning step: real-time or timing, or after receiving the classification and storage instruction, scan the file directory of the data file, and the data file is stored in the electronic device communicatively connected to the intelligent hardware device;
提取步骤:根据预先确定的标签提取规则,从扫描的所述文件目录中提取一个或多个目录标签;Extraction step: extracting one or more directory labels from the scanned file directory according to a predetermined label extraction rule;
映射建立步骤:分别将各个所述文件目录下的每一个数据文件与对应的目录标签关联映射,建立每一个数据文件的预设类型文件信息与关联映射的目录标签之间的对应关系;The mapping establishment step: respectively associate and map each data file under each described file directory with the corresponding catalog label, and establish the corresponding relationship between the preset type file information of each data file and the catalog label associated with the mapping;
存储步骤:将所述对应关系数据进行存储;Storage step: storing the corresponding relationship data;
查询步骤:相应用户终端发送的带有目录标签的文件查询请求后,根据所述对应关系数据确定所述查询请求中的目录标签对应的各个数据文件的预设类型文件信息,基于确定的预设类型文件信息,生成所述查询请求对应的文件查询结果,并将生成的文件查询结果反馈给所述用户终端。Querying step: after the corresponding user terminal sends a file query request with a directory tag, determine the preset type file information of each data file corresponding to the directory tag in the query request according to the corresponding relationship data, and based on the determined preset file information type file information, generate a file query result corresponding to the query request, and feed back the generated file query result to the user terminal.
优选地,所述与智能硬件设备通信连接的电子设备包括第一存储区和第二存储区,所述数据文件及所述数据文件的文件目录存储于所述第一存储区中,所述对应关系数据存储于所述第二存储区中。Preferably, the electronic device communicatively connected to the intelligent hardware device includes a first storage area and a second storage area, the data file and the file directory of the data file are stored in the first storage area, and the corresponding data file is stored in the first storage area. Relational data is stored in the second storage area.
优选地,所述处理器执行所述磁盘数据处理程序,在所述提取步骤之后,还实现以下步骤:Preferably, the processor executes the disk data processing program, and after the extraction step, the following steps are also implemented:
在各个目录标签之间建立关联关系。Establish associations between individual catalog labels.
优选地,所述预先确定的标签提取规则为:Preferably, the predetermined label extraction rule is:
为所述文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支,每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点;A node tree is established for each directory node of the file directory, the node tree includes a plurality of directory node branches, each directory node branch includes a main directory node and a subdirectory node, and each upper-level directory node is a subordinate directory node. home directory node;
确定每一个目录节点分支中的最下级共有目录节点,一个目录节点分支的最下级共有目录节点指的是与其他目录节点分支共有的、且在所述目录节点分支中对应的所有下级子目录节点均不是共有目录节点的目录节点;Determine the lowest-level shared directory node in each directory node branch, and the lowest-level shared directory node of a directory node branch refers to all lower-level subdirectory nodes shared with other directory node branches and corresponding to the directory node branch Neither is a directory node that shares a directory node;
分别将确定的每一个目录节点分支的最下级共有目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称,所述组合名称即为对应的目录节点分支的目录标签。Respectively combine the node names of the lowest-level shared directory node and all corresponding upper-level directory nodes of each directory node branch, and combine them together in the order of the positions of the corresponding directory node branches to generate a combined name, and the combined name is The directory label of the corresponding directory node branch.
优选地,所述预先确定的标签提取规则为:Preferably, the predetermined label extraction rule is:
为文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支,每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点;Establish a node tree for each directory node of the file directory, the node tree includes a plurality of directory node branches, each directory node branch includes a main directory node and a subdirectory node, and each upper-level directory node is the main directory of its lower-level directory node. node;
分别确定每一个目录节点分支中的第i级目录节点,i为大于1的正整数;Determine the i-th level directory node in each directory node branch respectively, where i is a positive integer greater than 1;
分别将确定的每一个目录节点分支的第i级目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称,所述组合名称即为对应的目录节点分支的目录标签。Respectively combine the i-th level directory node of each directory node branch and the node names of all corresponding upper-level directory nodes, according to the position order of the corresponding directory node branch, to generate a combined name, and the combined name is The directory label of the corresponding directory node branch.
优选地,所述处理器执行所述磁盘数据处理程序,在所述存储步骤之前,还实现以下步骤:Preferably, the processor executes the disk data processing program, and before the storing step, further implements the following steps:
分别确定各个目录标签对应的数据文件的数量;Determine the number of data files corresponding to each directory label respectively;
将各个目录标签按照对应的数据文件的数量的大小顺序进行排序;Sort each directory label according to the size order of the number of corresponding data files;
当所述大小顺序是从大到小的顺序时,保留排序在前的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除,或者,当所述大小顺序是从小到大的顺序时,保留排序在后的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除。When the size order is from large to small, the preset number of directory labels sorted in the front are retained, and other directory labels other than the reserved directory labels are deleted, or, when the size order is from small to large When ordering, keep the preset number of catalog labels sorted after, and delete the catalog labels other than the reserved catalog labels.
优选地,所述处理器执行所述磁盘数据处理程序,在所述存储步骤之前,还实现以下步骤:Preferably, the processor executes the disk data processing program, and before the storing step, further implements the following steps:
分别确定各个目录标签对应的数据文件的数量;Determine the number of data files corresponding to each directory label respectively;
当有目录标签对应的数据文件的数量小于预设阈值时,删除所述目录标签。When the number of data files corresponding to the directory label is less than the preset threshold, the directory label is deleted.
此外,为实现上述目的,本发明还提出一种智能硬件设备,所述智能硬件设备包括第二存储器和处理器,所述第二存储器上存储有可在所述处理器上运行的磁盘数据处理程序,所述磁盘数据处理程序被所述处理器执行时实现如下步骤:In addition, in order to achieve the above object, the present invention also proposes an intelligent hardware device, the intelligent hardware device includes a second memory and a processor, and the second memory stores disk data processing that can run on the processor. The program, when the disk data processing program is executed by the processor, implements the following steps:
扫描步骤:实时或定时,或在收到归类存储指令后,扫描数据文件的文件目录,所述数据文件存储于所述第二存储器中;Scanning step: real-time or timing, or after receiving the classification and storage instruction, scan the file directory of the data file, and the data file is stored in the second memory;
提取步骤:根据预先确定的标签提取规则,从扫描的所述文件目录中提取一个或多个目录标签;Extraction step: extracting one or more directory labels from the scanned file directory according to a predetermined label extraction rule;
映射建立步骤:分别将各个所述文件目录下的每一个数据文件与对应的目录标签关联映射,建立每一个数据文件的预设类型文件信息与关联映射的目录标签之间的对应关系;The mapping establishment step: respectively associate and map each data file under each described file directory with the corresponding catalog label, and establish the corresponding relationship between the preset type file information of each data file and the catalog label associated with the mapping;
存储步骤:将所述对应关系数据进行存储至;Storage step: storing the corresponding relationship data to;
查询步骤:响应用户终端发送的带有目录标签的文件查询请求,根据所述对应关系数据确定所述查询请求中的目录标签对应的各个数据文件的预设类型文件信息,基于确定的预设类型文件信息,生成所述查询请求对应的文件查询结果,并将生成的文件查询结果反馈给所述用户终端。Querying step: responding to a file query request with a directory tag sent by a user terminal, determining the preset type file information of each data file corresponding to the directory tag in the query request according to the corresponding relationship data, and based on the determined preset type file information, generate a file query result corresponding to the query request, and feed back the generated file query result to the user terminal.
优选地,所述第二存储器还包括第一存储区和第二存储区,所述数据文件及所述数据文件的文件目录存储于所述第一存储区中,所述对应关系数据存储于所述第二存储区中。Preferably, the second memory further includes a first storage area and a second storage area, the data file and the file directory of the data file are stored in the first storage area, and the corresponding relationship data is stored in the first storage area. in the second storage area.
优选地,所述处理器执行所述磁盘数据处理程序,在所述提取步骤之后,还实现以下步骤:Preferably, the processor executes the disk data processing program, and after the extraction step, the following steps are also implemented:
在各个目录标签之间建立关联关系。Establish associations between individual catalog labels.
优选地,所述预先确定的标签提取规则为:Preferably, the predetermined label extraction rule is:
为所述文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支,每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点;A node tree is established for each directory node of the file directory, the node tree includes a plurality of directory node branches, each directory node branch includes a main directory node and a subdirectory node, and each upper-level directory node is a subordinate directory node. home directory node;
确定每一个目录节点分支中的最下级共有目录节点,一个目录节点分支的最下级共有目录节点指的是与其他目录节点分支共有的、且在所述目录节点分支中对应的所有下级子目录节点均不是共有目录节点的目录节点;Determine the lowest-level shared directory node in each directory node branch, and the lowest-level shared directory node of a directory node branch refers to all lower-level subdirectory nodes shared with other directory node branches and corresponding to the directory node branch Neither is a directory node that shares a directory node;
分别将确定的每一个目录节点分支的最下级共有目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称,所述组合名称即为对应的目录节点分支的目录标签。Respectively combine the node names of the lowest-level shared directory node and all corresponding upper-level directory nodes of each directory node branch, and combine them together in the order of the positions of the corresponding directory node branches to generate a combined name, and the combined name is The directory label of the corresponding directory node branch.
优选地,所述预先确定的标签提取规则为:Preferably, the predetermined label extraction rule is:
为文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支,每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点;Establish a node tree for each directory node of the file directory, the node tree includes a plurality of directory node branches, each directory node branch includes a main directory node and a subdirectory node, and each upper-level directory node is the main directory of its lower-level directory node. node;
分别确定每一个目录节点分支中的第i级目录节点,i为大于1的正整数;Determine the i-th level directory node in each directory node branch respectively, where i is a positive integer greater than 1;
分别将确定的每一个目录节点分支的第i级目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称,所述组合名称即为对应的目录节点分支的目录标签。Respectively combine the i-th level directory node of each directory node branch and the node names of all corresponding upper-level directory nodes, according to the position order of the corresponding directory node branch, to generate a combined name, and the combined name is The directory label of the corresponding directory node branch.
优选地,所述处理器执行所述磁盘数据处理程序,在所述存储步骤之前,还实现以下步骤:Preferably, the processor executes the disk data processing program, and before the storing step, further implements the following steps:
分别确定各个目录标签对应的数据文件的数量;Determine the number of data files corresponding to each directory label respectively;
将各个目录标签按照对应的数据文件的数量的大小顺序进行排序;Sort each directory label according to the size order of the number of corresponding data files;
当所述大小顺序是从大到小的顺序时,保留排序在前的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除,或者,当所述大小顺序是从小到大的顺序时,保留排序在后的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除。When the size order is from large to small, the preset number of directory labels sorted in the front are retained, and other directory labels other than the reserved directory labels are deleted, or, when the size order is from small to large When ordering, keep the preset number of catalog labels sorted after, and delete the catalog labels other than the reserved catalog labels.
优选地,所述处理器执行所述磁盘数据处理程序,在所述存储步骤之前,还实现以下步骤:Preferably, the processor executes the disk data processing program, and before the storing step, further implements the following steps:
分别确定各个目录标签对应的数据文件的数量;Determine the number of data files corresponding to each directory label respectively;
当有目录标签对应的数据文件的数量小于预设阈值时,删除所述目录标签。When the number of data files corresponding to the directory label is less than the preset threshold, the directory label is deleted.
此外,为实现上述目的,本发明还提出一种磁盘数据处理方法,该方法适用于存储有数据文件的智能硬件设备,或者,适用于与存储有所述数据文件的电子设备通信连接的智能硬件设备,其特征在于,该方法包括步骤:In addition, in order to achieve the above object, the present invention also proposes a disk data processing method, which is applicable to intelligent hardware devices that store data files, or to intelligent hardware devices that are communicatively connected to electronic devices that store the data files. equipment, characterized in that the method includes the steps:
扫描步骤:实时或定时,或在收到归类存储指令后,扫描所述数据文件的文件目录;Scanning step: scan the file directory of the data file in real time or timed, or after receiving the classification and storage instruction;
提取步骤:根据预先确定的标签提取规则,从扫描的所述文件目录中提取一个或多个目录标签;Extraction step: extracting one or more directory labels from the scanned file directory according to a predetermined label extraction rule;
映射建立步骤:分别将各个所述文件目录下的每一个数据文件与对应的目录标签关联映射,建立每一个数据文件的预设类型文件信息与关联映射的目录标签之间的对应关系;The mapping establishment step: respectively associate and map each data file under each described file directory with the corresponding catalog label, and establish the corresponding relationship between the preset type file information of each data file and the catalog label associated with the mapping;
存储步骤:将所述对应关系数据进行存储;Storage step: storing the corresponding relationship data;
查询步骤:响应用户终端发送的带有目录标签的文件查询请求,根据所述对应关系数据确定所述查询请求中的目录标签对应的各个数据文件的预设类型文件信息,基于确定的预设类型文件信息,生成所述查询请求对应的文件查询结果,并将生成的文件查询结果反馈给所述用户终端。Querying step: responding to a file query request with a directory tag sent by a user terminal, determining the preset type file information of each data file corresponding to the directory tag in the query request according to the corresponding relationship data, and based on the determined preset type file information, generate a file query result corresponding to the query request, and feed back the generated file query result to the user terminal.
优选地,在所述提取步骤之后,该方法还包括:Preferably, after the extracting step, the method further comprises:
在各个目录标签之间建立关联关系。Establish associations between individual catalog labels.
优选地,所述预先确定的标签提取规则为:Preferably, the predetermined label extraction rule is:
为所述文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支,每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点;A node tree is established for each directory node of the file directory, the node tree includes a plurality of directory node branches, each directory node branch includes a main directory node and a subdirectory node, and each upper-level directory node is a subordinate directory node. home directory node;
确定每一个目录节点分支中的最下级共有目录节点,一个目录节点分支的最下级共有目录节点指的是与其他目录节点分支共有的、且在所述目录节点分支中对应的所有下级子目录节点均不是共有目录节点的目录节点;Determine the lowest-level shared directory node in each directory node branch, and the lowest-level shared directory node of a directory node branch refers to all lower-level subdirectory nodes shared with other directory node branches and corresponding to the directory node branch Neither is a directory node that shares a directory node;
分别将确定的每一个目录节点分支的最下级共有目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称,所述组合名称即为对应的目录节点分支的目录标签。Respectively combine the node names of the lowest-level shared directory node and all corresponding upper-level directory nodes of each directory node branch, and combine them together in the order of the positions of the corresponding directory node branches to generate a combined name, and the combined name is The directory label of the corresponding directory node branch.
优选地,所述预先确定的标签提取规则为:Preferably, the predetermined label extraction rule is:
为文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支,每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点;Establish a node tree for each directory node of the file directory, the node tree includes a plurality of directory node branches, each directory node branch includes a main directory node and a subdirectory node, and each upper-level directory node is the main directory of its lower-level directory node. node;
分别确定每一个目录节点分支中的第i级目录节点,i为大于1的正整数;Determine the i-th level directory node in each directory node branch respectively, where i is a positive integer greater than 1;
分别将确定的每一个目录节点分支的第i级目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称,所述组合名称即为对应的目录节点分支的目录标签。Respectively combine the i-th level directory node of each directory node branch and the node names of all corresponding upper-level directory nodes, according to the position order of the corresponding directory node branch, to generate a combined name, and the combined name is The directory label of the corresponding directory node branch.
优选地,在所述存储步骤之前,该方法还包括:Preferably, before the storing step, the method further comprises:
分别确定各个目录标签对应的数据文件的数量;Determine the number of data files corresponding to each directory label respectively;
将各个目录标签按照对应的数据文件的数量的大小顺序进行排序;Sort each directory label according to the size order of the number of corresponding data files;
当所述大小顺序是从大到小的顺序时,保留排序在前的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除,或者,当所述大小顺序是从小到大的顺序时,保留排序在后的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除。When the size order is from large to small, the preset number of directory labels sorted in the front are retained, and other directory labels other than the reserved directory labels are deleted, or, when the size order is from small to large When ordering, keep the preset number of catalog labels sorted after, and delete the catalog labels other than the reserved catalog labels.
优选地,在所述存储步骤之前,该方法还包括:Preferably, before the storing step, the method further comprises:
分别确定各个目录标签对应的数据文件的数量;Determine the number of data files corresponding to each directory label respectively;
当有目录标签对应的数据文件的数量小于预设阈值时,删除所述目录标签。When the number of data files corresponding to the directory label is less than the preset threshold, the directory label is deleted.
此外,为实现上述目的,本发明还提出一种计算机可读存储介质,所述计算机可读存储介质存储有磁盘数据处理程序,所述磁盘数据处理程序可被至少一个处理器执行,以使所述至少一个处理器执行如上述任一项所述的磁盘数据处理方法的步骤。In addition, in order to achieve the above object, the present invention also provides a computer-readable storage medium, the computer-readable storage medium stores a disk data processing program, and the disk data processing program can be executed by at least one processor, so that all The at least one processor executes the steps of the disk data processing method according to any one of the above.
本发明扫描数据文件的文件目录;从扫描的文件目录中提取一个或多个目录标签;分别将各个文件目录下的每一个数据文件与对应的目录标签关联映射,并建立对应关系;在收到一个用户终端发送来的带有目录标签的文件查询请求后,根据对应关系数据确定查询请求中的目录标签对应的各个数据文件的预设类型文件信息,生成并反馈该查询请求对应的文件查询结果至用户终端。相较于现有技术,本发明将文件目录中提取的目录标签与数据文件之间建立映射关系,在进行文件查询时,只需用户终端提供目录标签,即可快速准确的查询出对应的数据文件,提高了文件查询的效率及准确率,且操作简单。The present invention scans the file directory of the data file; extracts one or more directory labels from the scanned file directory; associates and maps each data file under each file directory with the corresponding directory label, and establishes a corresponding relationship; After a file query request with a directory tag sent by a user terminal, determine the preset type file information of each data file corresponding to the directory tag in the query request according to the corresponding relationship data, and generate and feed back the file query result corresponding to the query request. to the user terminal. Compared with the prior art, the present invention establishes a mapping relationship between the directory label extracted from the file directory and the data file. When performing file query, only the user terminal needs to provide the directory label, and the corresponding data can be quickly and accurately queried. file, the efficiency and accuracy of file query are improved, and the operation is simple.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图示出的结构获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can also be obtained according to the structures shown in these drawings without creative efforts.
图1为本发明磁盘数据处理程序第一、第二、第三实施例一可选的运行环境示意图;1 is a schematic diagram of an optional operating environment of the first, second, and third embodiments of a disk data processing program according to the present invention;
图2为本发明磁盘数据处理程序第一、第二、第三实施例另一可选的运行环境示意图;2 is a schematic diagram of another optional operating environment of the first, second, and third embodiments of the disk data processing program of the present invention;
图3为本发明磁盘数据处理程序第一、第二实施例的程序模块图;3 is a program module diagram of the first and second embodiments of the disk data processing program of the present invention;
图4为文件目录的节点树示意图;4 is a schematic diagram of a node tree of a file directory;
图5为本发明磁盘数据处理程序第三实施例的程序模块图;Fig. 5 is the program module diagram of the third embodiment of the disk data processing program of the present invention;
图6为本发明磁盘数据处理方法第一实施例的流程示意图;FIG. 6 is a schematic flowchart of the first embodiment of the disk data processing method of the present invention;
图7为本发明磁盘数据处理方法第二实施例的流程示意图;7 is a schematic flowchart of a second embodiment of a disk data processing method according to the present invention;
图8为本发明磁盘数据处理方法第三实施例的流程示意图。FIG. 8 is a schematic flowchart of a third embodiment of a method for processing disk data according to the present invention.
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments.
具体实施方式Detailed ways
以下结合附图对本发明的原理和特征进行描述,所举实例只用于解释本发明,并非用于限定本发明的范围。The principles and features of the present invention will be described below with reference to the accompanying drawings. The examples are only used to explain the present invention, but not to limit the scope of the present invention.
本发明提出一种磁盘数据处理程序。The invention provides a disk data processing program.
请参阅图1,是本发明磁盘数据处理程序10第一、第二、第三实施例一可选的运行环境示意图。Please refer to FIG. 1 , which is a schematic diagram of an optional operating environment of the first, second, and third embodiments of the disk data processing program 10 of the present invention.
在本实施例中,本发明可应用于包括,但不仅限于,智能硬件设备1、用户终端2的应用环境中。所述智能硬件设备1与用户终端2之间通信连接。In this embodiment, the present invention can be applied to an application environment including, but not limited to, an intelligent hardware device 1 and a user terminal 2 . The intelligent hardware device 1 is in communication connection with the user terminal 2 .
其中,智能硬件设备1用于接收与响应用户终端2发送的服务请求(例如,文件查询请求等),并反馈服务请求处理结果至用户终端2。The intelligent hardware device 1 is configured to receive and respond to a service request (eg, a file query request, etc.) sent by the user terminal 2 , and feed back the processing result of the service request to the user terminal 2 .
用户终端2用于发送服务请求至智能硬件设备1,并接收智能硬件设备1反馈的服务请求处理结果。The user terminal 2 is configured to send a service request to the intelligent hardware device 1 and receive the service request processing result fed back by the intelligent hardware device 1 .
在本实施例中,磁盘数据处理程序10安装并运行于智能硬件设备1中。智能硬件设备1可以是桌上型计算机、笔记本、掌上电脑及服务器等计算设备。该智能硬件设备1可包括,但不仅限于,存储器11、处理器12及显示器13。图2仅示出了具有组件11-13的智能硬件设备1,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。In this embodiment, the disk data processing program 10 is installed and run in the intelligent hardware device 1 . The intelligent hardware device 1 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a server. The intelligent hardware device 1 may include, but is not limited to, a memory 11 , a processor 12 and a display 13 . Figure 2 only shows the intelligent hardware device 1 with components 11-13, but it should be understood that implementation of all shown components is not required, and more or fewer components may be implemented instead.
存储器11在一些实施例中可以是智能硬件设备1的内部存储单元,例如该智能硬件设备1的硬盘或内存。存储器11在另一些实施例中也可以是智能硬件设备1的外部存储设备,例如智能硬件设备1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括智能硬件设备1的内部存储单元也包括外部存储设备。存储器11用于存储安装于智能硬件设备1的应用软件及各类数据,例如磁盘数据处理程序10的程序代码等。存储器11还可以用于暂时地存储已经输出或者将要输出的数据。本实施例中,上述存储器11包括第一存储区111(例如,本地数据库)和第二存储区112,该第一存储区111用于存储数据文件。The memory 11 may be an internal storage unit of the intelligent hardware device 1 in some embodiments, such as a hard disk or a memory of the intelligent hardware device 1 . The memory 11 may also be an external storage device of the smart hardware device 1 in other embodiments, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), etc. Further, the memory 11 may also include both an internal storage unit of the intelligent hardware device 1 and an external storage device. The memory 11 is used for storing application software and various types of data installed in the intelligent hardware device 1 , such as program codes of the disk data processing program 10 , and the like. The memory 11 may also be used to temporarily store data that has been output or is to be output. In this embodiment, the above-mentioned memory 11 includes a first storage area 111 (eg, a local database) and a
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行磁盘数据处理程序10等。The processor 12 may be a central processing unit (Central Processing Unit, CPU), a microprocessor or other data processing chips in some embodiments, and is used to execute program codes or process data stored in the memory 11, for example, to perform disk data processing Procedure 10 et al.
显示器13在一些实施例中可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。显示器13用于显示在智能硬件设备1中处理的信息以及用于显示可视化的用户界面。智能硬件设备1的部件11-13通过程序总线相互通信。In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like. The display 13 is used for displaying information processed in the intelligent hardware device 1 and for displaying a visual user interface. The components 11-13 of the intelligent hardware device 1 communicate with each other via a program bus.
请参阅图2,是本发明磁盘数据处理程序10第一、第二、第三实施例另一可选的运行环境示意图。Please refer to FIG. 2 , which is a schematic diagram of another optional operating environment of the first, second, and third embodiments of the disk data processing program 10 of the present invention.
在本实施例中,本发明还可应用于包括,但不仅限于,智能硬件设备1、用户终端2、电子设备3的应用环境中。所述智能硬件设备1分别与用户终端2、电子设备3之间通信连接。In this embodiment, the present invention can also be applied to an application environment including, but not limited to, an intelligent hardware device 1 , a user terminal 2 , and an electronic device 3 . The intelligent hardware device 1 is in communication connection with the user terminal 2 and the electronic device 3 respectively.
图2与图1的区别在于,第一存储区111和第二存储区112设置于与智能硬件设备1通信连接的电子设备3(例如,个人计算机、插接式硬盘、智能存储卡等)中。The difference between FIG. 2 and FIG. 1 is that the
需要注意的是,上述第二存储区112还可设置于除智能硬件设备1及电子设备3以外的其他任何适用的装置或设备中。It should be noted that, the above-mentioned
请参阅图3,是本发明磁盘数据处理程序10第一、第二实施例的程序模块图。在本实施例中,磁盘数据处理程序10可以被分割成一个或多个模块,一个或者多个模块被存储于存储器11中,并由一个或多个处理器(本实施例为处理器12)所执行,以完成本发明。例如,在图3中,磁盘数据处理程序10可以被分割成扫描模块101、提取模块102、映射建立模块103、存储模块104及查询模块105。本发明所称的模块是指能够完成特定功能的一系列计算机程序指令段,比程序更适合于描述磁盘数据处理程序10在智能硬件设备1中的执行过程,其中:Please refer to FIG. 3 , which is a program module diagram of the first and second embodiments of the disk data processing program 10 of the present invention. In this embodiment, the disk data processing program 10 can be divided into one or more modules, and one or more modules are stored in the memory 11 and executed by one or more processors (the processor 12 in this embodiment) performed to complete the present invention. For example, in FIG. 3 , the disk data processing program 10 can be divided into a scanning module 101 , an extraction module 102 , a mapping establishment module 103 , a storage module 104 and a query module 105 . The modules referred to in the present invention refer to a series of computer program instruction segments capable of completing specific functions, and are more suitable for describing the execution process of the disk data processing program 10 in the intelligent hardware device 1 than programs, wherein:
扫描模块101,用于实时或定时,或在收到归类存储指令后,扫描数据文件的文件目录。The scanning module 101 is configured to scan the file directory of the data file in real time or timing, or after receiving the classification and storage instruction.
上述数据文件可存储于上述第一存储区111中,该数据文件的文件目录可存储于上述第二存储区112中。提取模块102,用于根据预先确定的标签提取规则,从扫描的所述文件目录中提取一个或多个目录标签。The above-mentioned data file can be stored in the above-mentioned
具体地,以文件目录D:\PDF\Setup Files为例,对该文件目录进行标签提取,生成目录标签“D”和“PDF”。Specifically, taking the file directory D:\PDF\Setup Files as an example, label extraction is performed on the file directory to generate directory labels "D" and "PDF".
优选地,本实施例中,上述预先确定的标签提取规则可参照下列两种方案:Preferably, in this embodiment, the above-mentioned predetermined label extraction rules may refer to the following two schemes:
方案一:Option One:
首先,为所述文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支(例如,图4中的目录节点分支“X1-X2-X3-X4”、“X1-X2-X5-X6”、“X1-X2-X5-X7”、“X1-Z1-Z2-Z3”、“X1-Y1-Y2”等)。每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点,例如,节点X1是节点X1、Z1、Y1的主目录节点、节点X2是节点X3、X5的主目录节点。First, a node tree is established for each directory node of the file directory, and the node tree includes a plurality of directory node branches (for example, the directory node branches "X1-X2-X3-X4", "X1-X2- X5-X6", "X1-X2-X5-X7", "X1-Z1-Z2-Z3", "X1-Y1-Y2", etc.). Each directory node branch includes a main directory node and a sub-directory node, and each upper-level directory node is the main directory node of its subordinate directory node. For example, node X1 is the main directory node of nodes X1, Z1, and Y1, and node X2 is a node. The home directory node of X3 and X5.
然后,确定每一个目录节点分支中的最下级共有目录节点,一个目录节点分支的最下级共有目录节点指的是与其他目录节点分支共有的、且在所述目录节点分支中对应的所有下级子目录节点均不是共有目录节点的目录节点。例如,目录节点分支“X1-X2-X3-X4”对应的最下级共有目录节点为节点X2,“X1-X2-X5-X6”和“X1-X2-X5-X7”对应的最下级共有目录节点均为节点X5。Then, the lowest-level shared directory node in each directory node branch is determined, and the lowest-level shared directory node of a directory node branch refers to all subordinate children shared with other directory node branches and corresponding to the directory node branch None of the directory nodes are directory nodes that share a directory node. For example, the lowest-level shared directory node corresponding to the directory node branch "X1-X2-X3-X4" is node X2, and the lowest-level shared directory corresponding to "X1-X2-X5-X6" and "X1-X2-X5-X7" The nodes are all node X5.
最后,分别将确定的每一个目录节点分支的最下级共有目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称。所述组合名称即为对应的目录节点分支的目录标签,例如,目录节点分支“X1-X2-X3-X4”对应的目录标签为“X1-X2”。Finally, the lowermost common directory node of each determined directory node branch and the node names of all corresponding upper-level directory nodes are combined together according to the position sequence of the corresponding directory node branch to generate a combined name. The combination name is the directory label of the corresponding directory node branch, for example, the directory label corresponding to the directory node branch "X1-X2-X3-X4" is "X1-X2".
方案二:Option II:
首先,为文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支(例如,图4中的目录节点分支“X1-X2-X3-X4”、“X1-X2-X5-X6”、“X1-X2-X5-X7”、“X1-Z1-Z2-Z3”、“X1-Y1-Y2”等)。每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点,例如,节点X1是节点X1、Z1、Y1的主目录节点、节点X2是节点X3、X5的主目录节点。First, a node tree is built for each directory node of the file directory, and the node tree includes a plurality of directory node branches (for example, the directory node branches "X1-X2-X3-X4", "X1-X2-X5- X6", "X1-X2-X5-X7", "X1-Z1-Z2-Z3", "X1-Y1-Y2", etc.). Each directory node branch includes a main directory node and a sub-directory node, and each upper-level directory node is the main directory node of its subordinate directory node. For example, node X1 is the main directory node of nodes X1, Z1, and Y1, and node X2 is a node. The home directory node of X3 and X5.
然后,分别确定每一个目录节点分支中的第i级目录节点,i为大于1的正整数,例如,i可以为2,目录节点分支“X1-X2-X3-X4”的第2级目录节点是“X2”。Then, determine the i-th level directory node in each directory node branch respectively, i is a positive integer greater than 1, for example, i can be 2, and the directory node branch "X1-X2-X3-X4" level 2 directory node is "X2".
最后,分别将确定的每一个目录节点分支的第i级目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称。所述组合名称即为对应的目录节点分支的目录标签,例如,目录节点分支“X1-X2-X3-X4”对应的目录标签为“X1-X2”。Finally, the determined i-th level directory node of each directory node branch and the node names of all corresponding upper-level directory nodes are combined together according to the position sequence of the corresponding directory node branch to generate a combined name. The combination name is the directory label of the corresponding directory node branch, for example, the directory label corresponding to the directory node branch "X1-X2-X3-X4" is "X1-X2".
映射建立模块103,用于分别将各个所述文件目录下的每一个数据文件与对应的目录标签关联映射,建立每一个数据文件的预设类型文件信息与关联映射的目录标签之间的对应关系。The mapping establishment module 103 is used to associate and map each data file under each described file directory with the corresponding catalog label, and establish the corresponding relationship between the preset type file information of each data file and the catalog label associated with the mapping .
具体地,分别为各个所述文件目录下的每一个数据文件标记对应的目录标签,例如,若文件目录A1对应的目录标签为a1,文件目录A2对应的目录标签为a2。文件目录A1下的每一个数据文件均与目录标签a1关联映射,文件目录A2下的每一个数据文件均与目录标签a2关联映射。并将每一个数据文件的预设类型文件信息与关联映射的目录标签建立对应关系。Specifically, each data file under each of the file directories is marked with a corresponding directory label. For example, if the directory label corresponding to the file directory A1 is a1, and the directory label corresponding to the file directory A2 is a2. Each data file under the file directory A1 is associated and mapped with the directory label a1, and each data file under the file directory A2 is associated and mapped with the directory label a2. A corresponding relationship is established between the preset type file information of each data file and the directory label associated with the mapping.
上述预设类型文件信息包括存储路径信息、文件名称等。The above-mentioned preset type file information includes storage path information, file name, and the like.
存储模块104,用于将所述对应关系数据进行存储。例如,存储模块104将该对应关系数据存储至所述第二存储区112中。The storage module 104 is configured to store the corresponding relationship data. For example, the storage module 104 stores the corresponding relationship data in the
查询模块105,用于响应用户终端发送的带有目录标签的文件查询请求,根据所述对应关系数据确定所述查询请求中的目录标签对应的各个数据文件的预设类型文件信息,基于确定的预设类型文件信息,生成所述查询请求对应的文件查询结果(例如,文件查询列表),并将生成的文件查询结果反馈给所述用户终端。The query module 105 is configured to respond to the file query request with the directory label sent by the user terminal, determine the preset type file information of each data file corresponding to the directory label in the query request according to the corresponding relationship data, and based on the determined Preset type file information, generate a file query result (eg, a file query list) corresponding to the query request, and feed back the generated file query result to the user terminal.
本实施例扫描数据文件的文件目录;从扫描的文件目录中提取一个或多个目录标签;分别将各个文件目录下的每一个数据文件与对应的目录标签关联映射,并建立对应关系;在收到一个用户终端发送来的带有目录标签的文件查询请求后,根据对应关系数据确定查询请求中的目录标签对应的各个数据文件的预设类型文件信息,生成并反馈该查询请求对应的文件查询结果至用户终端。相较于现有技术,本实施例将文件目录中提取的目录标签与数据文件之间建立映射关系,在进行文件查询时,只需用户终端提供目录标签,即可快速准确的查询出对应的数据文件,提高了文件查询的效率及准确率,且操作简单。This embodiment scans the file directory of the data file; extracts one or more directory labels from the scanned file directory; associates and maps each data file under each file directory with the corresponding directory label, and establishes a corresponding relationship; After a file query request with a directory tag sent by a user terminal, determine the preset file information of each data file corresponding to the directory tag in the query request according to the corresponding relationship data, and generate and feed back the file query corresponding to the query request. result to the user terminal. Compared with the prior art, in this embodiment, a mapping relationship is established between the directory labels extracted from the file directory and the data files. When performing file query, only the user terminal needs to provide the directory label to quickly and accurately query the corresponding data files. The data file improves the efficiency and accuracy of file query, and the operation is simple.
请再次参照图3,本发明磁盘数据处理程序10第二实施例中,本实施例在第一实施例的基础上,映射建立模块103还用于在各个目录标签之间建立关联关系。Referring to FIG. 3 again, in the second embodiment of the disk data processing program 10 of the present invention, on the basis of the first embodiment, the mapping establishment module 103 is further configured to establish an association relationship between each directory label.
例如,目录层级:/photo/shenzheng/nanshan/dsc_001.jpg,根据这个dsc_001.jpg文件的上二层目录名称就可以提出两个目录标签:shenzheng,nanshan,而当打开shenzheng这个目录标签的时候,还关联显示一个关联目录标签:nanshan。For example, the directory level: /photo/shenzheng/nanshan/dsc_001.jpg, two directory labels can be proposed according to the upper two-level directory name of this dsc_001.jpg file: shenzheng, nanshan, and when opening the directory label of shenzheng, Also shows an associated directory label associated with it: nanshan.
关联标签的场景可以有几种方式:There are several ways to associate a tag scene:
方式一、两个标签处于上下层的关系,如上个例子,shenzheng,Nanshan两个标签属于上下层关系,两个标签下都有同一个文件dsc_001.jpg,因此属于关联标签。Method 1. The two tags are in the relationship between the upper and lower layers. As in the previous example, the two tags of shenzheng and Nanshan belong to the upper and lower relationship, and there is the same file dsc_001.jpg under the two tags, so they are associated tags.
方式二、两个标签都关联了A文件。如用户手动对/photo/shenzheng/nanshan/dsc_001.jpg文件又打了一个“风景”的标签,那标签“shenzheng”,“nanshan”,“风景”都是关联标签,打开任何一个标签时,旁边的关联标签列都显示其它两个关联标签。Method 2. Both tags are associated with the A file. If the user manually adds a "landscape" label to the /photo/shenzheng/nanshan/dsc_001.jpg file, the labels "shenzheng", "nanshan", and "landscape" are all associated labels. The Associated Labels column of both displays the other two associated labels.
方式三、标签同名:根据/photo/shenzheng/nanshan/dsc_001.jpg文件可以提取:两个标签:shenzheng,nanshan,根据/video/shenzheng/DJI_002.MOV,也可提取:video,shenzheng两个标签,其中shenzheng标签已存在,所以shenzheng标签关联了dsc_001.jpg和DJI_002.MOV文件,而nanshan,video也有关联了这两个文件,因此:shenzheng,Nanshan,video都属于关联标签。Method 3. Labels with the same name: According to the /photo/shenzheng/nanshan/dsc_001.jpg file, you can extract: two labels: shenzheng, nanshan, according to /video/shenzheng/DJI_002.MOV, you can also extract: video, shenzheng two labels, The shenzheng tag already exists, so the shenzheng tag is associated with the dsc_001.jpg and DJI_002.MOV files, and nanshan and video are also associated with these two files, so: shenzheng, Nanshan, and video are all associated tags.
本实施例通过在各个目录标签之间建立关联关系,可进一步提高用户文件查询请求的响应准确性,有效提升查询的效率。This embodiment can further improve the response accuracy of the user's file query request and effectively improve the query efficiency by establishing an association relationship between each directory label.
如图5所示,图5为本发明磁盘数据处理程序10第三实施例的程序模块图。As shown in FIG. 5, FIG. 5 is a program module diagram of the third embodiment of the disk data processing program 10 of the present invention.
本实施例在第一、第二实施例的基础上,该程序还包括删除模块106,删除模块106用于:On the basis of the first and second embodiments, this embodiment further includes a deletion module 106, and the deletion module 106 is used for:
首先,分别确定各个目录标签对应的数据文件的数量。First, the number of data files corresponding to each directory label is determined respectively.
然后,当有目录标签对应的数据文件的数量小于预设阈值时,删除所述目录标签。Then, when the number of data files corresponding to the directory label is less than the preset threshold, the directory label is deleted.
本实施例中,上述删除模块106还用于:In this embodiment, the above-mentioned deletion module 106 is also used for:
首先,分别确定各个目录标签对应的数据文件的数量。First, the number of data files corresponding to each directory label is determined respectively.
然后,将各个目录标签按照对应的数据文件的数量的大小顺序进行排序。例如,从大到小的顺序或者从小到大的顺序进行排序。Then, sort each directory label according to the size order of the number of corresponding data files. For example, sort from largest to smallest or smallest to largest.
最后,当所述大小顺序是从大到小的顺序时,保留排序在前的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除。或者,若所述大小顺序是从小到大的顺序,则保留排序在后的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除。Finally, when the size order is from the largest to the smallest, the preset number of catalog labels in the first order are retained, and other catalog labels other than the reserved catalog labels are deleted. Or, if the size order is from small to large, the preset number of catalog labels that are sorted later are reserved, and other catalog labels other than the reserved catalog labels are deleted.
本实施例删除部分目标标签有利于降低存储空间的占用率。Deleting part of the target tags in this embodiment is beneficial to reduce the occupancy rate of the storage space.
此外,本发明提出一种磁盘数据处理方法。In addition, the present invention provides a disk data processing method.
如图6所示,图6为本发明磁盘数据处理方法第一实施例的流程示意图。As shown in FIG. 6 , FIG. 6 is a schematic flowchart of the first embodiment of the disk data processing method according to the present invention.
本实施例中,该方法适用于存储有数据文件的智能硬件设备(例如,配置有第一存储区和第二存储区的智能硬件设备),或者,适用于与存储有所述数据文件的电子设备(例如,配置有第一存储区和第二存储区的电子设备)通信连接的智能硬件设备,该方法包括:In this embodiment, the method is applicable to an intelligent hardware device that stores a data file (for example, an intelligent hardware device configured with a first storage area and a second storage area), or to an electronic device that stores the data file. A device (eg, an electronic device configured with a first storage area and a second storage area) is an intelligent hardware device communicatively connected, the method comprising:
步骤S10,实时或定时,或在收到归类存储指令后,扫描所述数据文件的文件目录。In step S10, the file directory of the data file is scanned in real time or timing, or after receiving the classification and storage instruction.
上述数据文件可存储于上述第一存储区中,该数据文件的文件目录可存储于第二存储区中。在本实施例以外的其他实施例中,该数据文件的文件目录还可存储于除智能硬件设备及电子设备以外的其他任何适用的装置或设备中。The data file may be stored in the first storage area, and the file directory of the data file may be stored in the second storage area. In other embodiments than this embodiment, the file directory of the data file may also be stored in any other applicable device or device except the intelligent hardware device and the electronic device.
步骤S20,根据预先确定的标签提取规则,从扫描的所述文件目录中提取一个或多个目录标签。Step S20: Extract one or more directory labels from the scanned file directory according to a predetermined label extraction rule.
具体地,以文件目录D:\PDF\Setup Files为例,对该文件目录进行标签提取,生成目录标签“D”和“PDF”。Specifically, taking the file directory D:\PDF\Setup Files as an example, label extraction is performed on the file directory to generate directory labels "D" and "PDF".
优选地,本实施例中,上述预先确定的标签提取规则可参照下列两种方案:Preferably, in this embodiment, the above-mentioned predetermined label extraction rules may refer to the following two schemes:
方案一:Option One:
首先,为所述文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支(例如,图4中的目录节点分支“X1-X2-X3-X4”、“X1-X2-X5-X6”、“X1-X2-X5-X7”、“X1-Z1-Z2-Z3”、“X1-Y1-Y2”等)。每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点,例如,节点X1是节点X1、Z1、Y1的主目录节点、节点X2是节点X3、X5的主目录节点。First, a node tree is established for each directory node of the file directory, and the node tree includes a plurality of directory node branches (for example, the directory node branches "X1-X2-X3-X4", "X1-X2- X5-X6", "X1-X2-X5-X7", "X1-Z1-Z2-Z3", "X1-Y1-Y2", etc.). Each directory node branch includes a main directory node and a sub-directory node, and each upper-level directory node is the main directory node of its subordinate directory node. For example, node X1 is the main directory node of nodes X1, Z1, and Y1, and node X2 is a node. The home directory node of X3 and X5.
然后,确定每一个目录节点分支中的最下级共有目录节点,一个目录节点分支的最下级共有目录节点指的是与其他目录节点分支共有的、且在所述目录节点分支中对应的所有下级子目录节点均不是共有目录节点的目录节点。例如,目录节点分支“X1-X2-X3-X4”对应的最下级共有目录节点为节点X2,“X1-X2-X5-X6”和“X1-X2-X5-X7”对应的最下级共有目录节点均为节点X5。Then, the lowest-level shared directory node in each directory node branch is determined, and the lowest-level shared directory node of a directory node branch refers to all subordinate children shared with other directory node branches and corresponding to the directory node branch None of the directory nodes are directory nodes that share a directory node. For example, the lowest-level shared directory node corresponding to the directory node branch "X1-X2-X3-X4" is node X2, and the lowest-level shared directory corresponding to "X1-X2-X5-X6" and "X1-X2-X5-X7" The nodes are all node X5.
最后,分别将确定的每一个目录节点分支的最下级共有目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称。所述组合名称即为对应的目录节点分支的目录标签,例如,目录节点分支“X1-X2-X3-X4”对应的目录标签为“X1-X2”。Finally, the lowermost common directory node of each determined directory node branch and the node names of all corresponding upper-level directory nodes are combined together according to the position sequence of the corresponding directory node branch to generate a combined name. The combination name is the directory label of the corresponding directory node branch, for example, the directory label corresponding to the directory node branch "X1-X2-X3-X4" is "X1-X2".
方案二:Option II:
首先,为文件目录的各个目录节点建立节点树,所述节点树包括多个目录节点分支(例如,图4中的目录节点分支“X1-X2-X3-X4”、“X1-X2-X5-X6”、“X1-X2-X5-X7”、“X1-Z1-Z2-Z3”、“X1-Y1-Y2”等)。每一个目录节点分支中包括主目录节点和子目录节点,每一个上级目录节点均是其下级目录节点的主目录节点,例如,节点X1是节点X1、Z1、Y1的主目录节点、节点X2是节点X3、X5的主目录节点。First, a node tree is built for each directory node of the file directory, and the node tree includes a plurality of directory node branches (for example, the directory node branches "X1-X2-X3-X4", "X1-X2-X5- X6", "X1-X2-X5-X7", "X1-Z1-Z2-Z3", "X1-Y1-Y2", etc.). Each directory node branch includes a main directory node and a sub-directory node, and each upper-level directory node is the main directory node of its subordinate directory node. For example, node X1 is the main directory node of nodes X1, Z1, and Y1, and node X2 is a node. The home directory node of X3 and X5.
然后,分别确定每一个目录节点分支中的第i级目录节点,i为大于1的正整数,例如,i可以为2,目录节点分支“X1-X2-X3-X4”的第2级目录节点是“X2”。Then, determine the i-th level directory node in each directory node branch respectively, i is a positive integer greater than 1, for example, i can be 2, and the directory node branch "X1-X2-X3-X4" level 2 directory node is "X2".
最后,分别将确定的每一个目录节点分支的第i级目录节点及其对应的所有上级目录节点的节点名称,按照对应的目录节点分支的位置顺序组合在一起,生成组合名称。所述组合名称即为对应的目录节点分支的目录标签,例如,目录节点分支“X1-X2-X3-X4”对应的目录标签为“X1-X2”。Finally, the determined i-th level directory node of each directory node branch and the node names of all corresponding upper-level directory nodes are combined together according to the position sequence of the corresponding directory node branch to generate a combined name. The combination name is the directory label of the corresponding directory node branch, for example, the directory label corresponding to the directory node branch "X1-X2-X3-X4" is "X1-X2".
步骤S30,分别将各个所述文件目录下的每一个数据文件与对应的目录标签关联映射,建立每一个数据文件的预设类型文件信息与关联映射的目录标签之间的对应关系。Step S30 , associate and map each data file under each of the file directories with the corresponding directory label, and establish a corresponding relationship between the preset type file information of each data file and the associated mapped directory label.
具体地,分别为各个所述文件目录下的每一个数据文件标记对应的目录标签,例如,若文件目录A1对应的目录标签为a1,文件目录A2对应的目录标签为a2。文件目录A1下的每一个数据文件均与目录标签a1关联映射,文件目录A2下的每一个数据文件均与目录标签a2关联映射。并将每一个数据文件的预设类型文件信息与关联映射的目录标签建立对应关系。Specifically, each data file under each of the file directories is marked with a corresponding directory label. For example, if the directory label corresponding to the file directory A1 is a1, and the directory label corresponding to the file directory A2 is a2. Each data file under the file directory A1 is associated and mapped with the directory label a1, and each data file under the file directory A2 is associated and mapped with the directory label a2. A corresponding relationship is established between the preset type file information of each data file and the directory label associated with the mapping.
上述预设类型文件信息包括存储路径信息、文件名称等。The above-mentioned preset type file information includes storage path information, file name, and the like.
步骤S40,将所述对应关系数据进行存储。例如,将所述对应关系数据存储至第二存储区中。Step S40, storing the corresponding relationship data. For example, the corresponding relationship data is stored in the second storage area.
步骤S50,响应用户终端发送的带有目录标签的文件查询请求后,根据所述对应关系数据确定所述查询请求中的目录标签对应的各个数据文件的预设类型文件信息,基于确定的预设类型文件信息,生成所述查询请求对应的文件查询结果(例如,文件查询列表),并将生成的文件查询结果反馈给所述用户终端。Step S50, after responding to the file query request with the directory tag sent by the user terminal, determine the preset type file information of each data file corresponding to the directory tag in the query request according to the corresponding relationship data, based on the determined preset file information. type file information, generate a file query result (eg, a file query list) corresponding to the query request, and feed back the generated file query result to the user terminal.
本实施例扫描数据文件的文件目录;从扫描的文件目录中提取一个或多个目录标签;分别将各个文件目录下的每一个数据文件与对应的目录标签关联映射,并建立对应关系;在收到一个用户终端发送来的带有目录标签的文件查询请求后,根据对应关系数据确定查询请求中的目录标签对应的各个数据文件的预设类型文件信息,生成并反馈该查询请求对应的文件查询结果至用户终端。相较于现有技术,本实施例将文件目录中提取的目录标签与数据文件之间建立映射关系,在进行文件查询时,只需用户终端提供目录标签,即可快速准确的查询出对应的数据文件,提高了文件查询的效率及准确率,且操作简单。This embodiment scans the file directory of the data file; extracts one or more directory labels from the scanned file directory; associates and maps each data file under each file directory with the corresponding directory label, and establishes a corresponding relationship; After a file query request with a directory tag sent by a user terminal, determine the preset file information of each data file corresponding to the directory tag in the query request according to the corresponding relationship data, and generate and feed back the file query corresponding to the query request. result to the user terminal. Compared with the prior art, in this embodiment, a mapping relationship is established between the directory labels extracted from the file directory and the data files. When performing file query, only the user terminal needs to provide the directory label to quickly and accurately query the corresponding data files. The data file improves the efficiency and accuracy of file query, and the operation is simple.
如图7所示,图7为本发明磁盘数据处理方法第二实施例的流程示意图。As shown in FIG. 7 , FIG. 7 is a schematic flowchart of a second embodiment of a disk data processing method according to the present invention.
本实施例在第一实施例的基础上,在步骤S20之后,该方法还包括:This embodiment is based on the first embodiment, after step S20, the method further includes:
步骤S60,在各个目录标签之间建立关联关系。Step S60, establishing an association relationship between each directory label.
例如,目录层级:/photo/shenzhen/nanshan/dsc_001.jpg,根据这个dsc_001.jpg文件的上二层目录名称就可以提出两个目录标签:shenzhen,nanshan,而当打开shenzhen这个目录标签的时候,还关联显示一个关联目录标签:nanshan。For example, the directory level: /photo/shenzhen/nanshan/dsc_001.jpg, two directory labels can be proposed according to the upper two-level directory name of the dsc_001.jpg file: shenzhen, nanshan, and when opening the directory label of shenzhen, Also shows an associated directory label associated with it: nanshan.
关联标签的场景可以有几种方式:There are several ways to associate a tag scene:
方式一、两个标签处于上下层的关系,如上个例子,shenzhen,nanshan两个标签属于上下层关系,两个标签下都有同一个文件dsc_001.jpg,因此属于关联标签。Method 1. The two tags are in the relationship between the upper and lower layers. For example, in the previous example, the two tags shenzhen and nanshan belong to the upper and lower relationship. There is the same file dsc_001.jpg under both tags, so they are associated tags.
方式二、两个标签都关联了A文件。如用户手动对/photo/shenzhen/nanshan/dsc_001.jpg文件又打了一个“风景”的标签,那标签“shenzhen”,“nanshan”,“风景”都是关联标签,打开任何一个标签时,旁边的关联标签列都显示其它两个关联标签。Method 2. Both tags are associated with the A file. If the user manually adds a "landscape" label to the /photo/shenzhen/nanshan/dsc_001.jpg file, the labels "shenzhen", "nanshan", and "landscape" are all associated labels. The Associated Labels column of both displays the other two associated labels.
方式三、标签同名:根据/photo/shenzhen/nanshan/dsc_001.jpg文件可以提取:两个标签:shenzhen,nanshan,根据/video/shenzhen/DJI_002.MOV,也可提取:video,shenzhen两个标签,其中shenzhen标签已存在,所以shenzhen标签关联了dsc_001.jpg和DJI_002.MOV文件,而nanshan,video也有关联了这两个文件,因此:shenzhen,nanshan,video都属于关联标签。Method 3. Labels with the same name: According to the /photo/shenzhen/nanshan/dsc_001.jpg file, you can extract: two labels: shenzhen, nanshan, according to /video/shenzhen/DJI_002.MOV, you can also extract: video, shenzhen two labels, The shenzhen tag already exists, so the shenzhen tag is associated with the dsc_001.jpg and DJI_002.MOV files, and nanshan and video are also associated with these two files, so: shenzhen, nanshan, and video are all associated tags.
本实施例通过在各个目录标签之间建立关联关系,可进一步提高用户文件查询请求的响应准确性,有效提升查询的效率。This embodiment can further improve the response accuracy of the user's file query request and effectively improve the query efficiency by establishing an association relationship between each directory label.
如图8所示,图8为本发明磁盘数据处理方法第三实施例的流程示意图。As shown in FIG. 8 , FIG. 8 is a schematic flowchart of a third embodiment of a method for processing disk data according to the present invention.
本实施例在第一、第二实施例的基础上,于步骤S40之前,该方法还包括:In this embodiment, on the basis of the first and second embodiments, before step S40, the method further includes:
步骤S70,分别确定各个目录标签对应的数据文件的数量。Step S70, respectively determining the number of data files corresponding to each directory label.
步骤S80,当有目录标签对应的数据文件的数量小于预设阈值时,删除所述目录标签。Step S80, when the number of data files corresponding to the directory label is less than a preset threshold, delete the directory label.
本实施例中,上述步骤S70、S80可由如下步骤替换:In this embodiment, the above steps S70 and S80 can be replaced by the following steps:
首先,分别确定各个目录标签对应的数据文件的数量。First, the number of data files corresponding to each directory label is determined respectively.
然后,将各个目录标签按照对应的数据文件的数量的大小顺序进行排序。例如,从大到小的顺序或者从小到大的顺序进行排序。Then, sort each directory label according to the size order of the number of corresponding data files. For example, sort from largest to smallest or smallest to largest.
最后,当所述大小顺序是从大到小的顺序时,保留排序在前的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除。或者,若所述大小顺序是从小到大的顺序,则保留排序在后的预设数量的目录标签,并将保留的目录标签以外的其他目录标签删除。Finally, when the size order is from the largest to the smallest, the preset number of catalog labels in the first order are retained, and other catalog labels other than the reserved catalog labels are deleted. Or, if the size order is from small to large, the preset number of catalog labels that are sorted later are reserved, and other catalog labels other than the reserved catalog labels are deleted.
本实施例删除部分目标标签有利于降低存储空间的占用率。Deleting part of the target tags in this embodiment is beneficial to reduce the occupancy rate of the storage space.
进一步地,本发明还提出一种计算机可读存储介质,所述计算机可读存储介质存储有磁盘数据处理程序,所述磁盘数据处理程序可被至少一个处理器执行,以使所述至少一个处理器执行上述任一实施例中的磁盘数据处理方法。Further, the present invention also provides a computer-readable storage medium, the computer-readable storage medium stores a disk data processing program, and the disk data processing program can be executed by at least one processor, so that the at least one process The processor executes the disk data processing method in any of the above embodiments.
以上所述仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是在本发明的发明构思下,利用本发明说明书及附图内容所作的等效结构变换,或直接/间接运用在其他相关的技术领域均包括在本发明的专利保护范围内。The above descriptions are only the preferred embodiments of the present invention, and are not intended to limit the scope of the present invention. Under the inventive concept of the present invention, the equivalent structural transformations made by the contents of the description and drawings of the present invention, or the direct/indirect application Other related technical fields are included in the scope of patent protection of the present invention.
Claims (14)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810791052.3A CN109189728B (en) | 2018-07-18 | 2018-07-18 | Intelligent hardware device, disk data processing method and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810791052.3A CN109189728B (en) | 2018-07-18 | 2018-07-18 | Intelligent hardware device, disk data processing method and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN109189728A CN109189728A (en) | 2019-01-11 |
| CN109189728B true CN109189728B (en) | 2022-08-12 |
Family
ID=64936191
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201810791052.3A Active CN109189728B (en) | 2018-07-18 | 2018-07-18 | Intelligent hardware device, disk data processing method and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN109189728B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110532231B (en) * | 2019-09-02 | 2021-12-17 | Oppo(重庆)智能科技有限公司 | File query method, file query device and terminal equipment |
| CN111966633B (en) * | 2020-08-14 | 2024-04-09 | 北京百度网讯科技有限公司 | Method, device, electronic device and medium for querying subnodes in a directory |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103942205A (en) * | 2013-01-18 | 2014-07-23 | 深圳市腾讯计算机系统有限公司 | Method, device and system for storing and reading catalogue index |
| CN105550252A (en) * | 2015-12-09 | 2016-05-04 | 北京金山安全软件有限公司 | File positioning method and device and electronic equipment |
Family Cites Families (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101183367B (en) * | 2007-01-23 | 2010-06-09 | 腾讯科技(深圳)有限公司 | Method for managing document by label, instantaneous communications customer terminal and system |
| CN102722487B (en) * | 2011-03-30 | 2016-08-24 | 腾讯科技(深圳)有限公司 | File management method and device |
| CN102609532B (en) * | 2012-02-15 | 2014-07-23 | 大唐移动通信设备有限公司 | Method and device for monitoring file directory |
| CN105721527B (en) * | 2014-12-04 | 2019-03-01 | 金蝶软件(中国)有限公司 | A kind of data processing method and server |
| CN104469518B (en) * | 2014-12-16 | 2017-09-22 | 广东欧珀移动通信有限公司 | The access method and electronic equipment of audio-video document |
| CN105243081B (en) * | 2015-09-07 | 2017-06-16 | 河南大学 | A kind of file system directory structures method for organizing based on formal notion |
| CN106331075B (en) * | 2016-08-18 | 2020-01-17 | 华为技术有限公司 | Method, metadata server and manager for storing files |
| CN106886610A (en) * | 2017-04-11 | 2017-06-23 | 广东浪潮大数据研究有限公司 | The file management method and device of a kind of distributed file system |
| CN107562786A (en) * | 2017-07-27 | 2018-01-09 | 平安科技(深圳)有限公司 | File memory method, terminal and computer-readable recording medium |
-
2018
- 2018-07-18 CN CN201810791052.3A patent/CN109189728B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103942205A (en) * | 2013-01-18 | 2014-07-23 | 深圳市腾讯计算机系统有限公司 | Method, device and system for storing and reading catalogue index |
| CN105550252A (en) * | 2015-12-09 | 2016-05-04 | 北京金山安全软件有限公司 | File positioning method and device and electronic equipment |
Also Published As
| Publication number | Publication date |
|---|---|
| CN109189728A (en) | 2019-01-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11017018B2 (en) | Systems and methods of building and using an image catalog | |
| US8874596B2 (en) | Image processing system and method | |
| US10055509B2 (en) | Constructing an in-memory representation of a graph | |
| US10078781B2 (en) | Automatically organizing images | |
| US20240013456A1 (en) | Computerized systems and methods for graph data modeling | |
| US9996549B2 (en) | Method to construct a file system based on aggregated metadata from disparate sources | |
| CN102932523B (en) | Media content management system and method implemented in communication device | |
| US12259874B2 (en) | Custom metadata tag inheritance based on a filesystem directory tree or object storage bucket | |
| US11573961B2 (en) | Delta graph traversing system | |
| CN111522927A (en) | Entity query method and device based on knowledge graph | |
| WO2021043088A1 (en) | File query method and device, and computer device and storage medium | |
| CN109189728B (en) | Intelligent hardware device, disk data processing method and storage medium | |
| CN116340991B (en) | Big data management method and device for IP gallery material resources and electronic equipment | |
| EP3616092A1 (en) | Media sharing based on identified physical objects | |
| CN108763440A (en) | A kind of image searching method, device, terminal and storage medium | |
| WO2019085591A1 (en) | Intelligent hardware device, intelligent disk data processing method, and storage medium | |
| CN106503120A (en) | Picture classification methods of exhibiting, device and server | |
| US20210165772A1 (en) | Discovering and merging entity record fragments of a same entity across multiple entity stores for improved named entity disambiguation | |
| US11615133B2 (en) | Sharing user generated content for media searches | |
| CN116341491A (en) | Data processing method and related device | |
| CN114528321A (en) | Data retrieval method and device, electronic equipment and readable storage medium | |
| US12326870B2 (en) | Deep connectivity between disparate database systems | |
| CN108197321A (en) | File memory method and system | |
| CN112835857B (en) | Method for managing file main name of work group | |
| CN116226182A (en) | Information processing method, device, equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |