Method, device and electronic equipment for converting file directory to data plane
Patent Information
- Application Number
- CN202610567885.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-27
- Publication Date
- 2026-08-18
AI Technical Summary
[0003]相关技术中,由于文件目录采用树形层级结构,不同文件的文件内容相互独立存储,导致跨文件的操作较为困难
[0017] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the file directory to data plane conversion method as described above.
Smart Images

Figure CN122594239A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, and electronic device for converting a file directory to a data plane. Background Technology
[0002] In current information storage systems, file systems and object storage are the two most common underlying data management methods. Object storage typically views "objects" as logical units with both metadata and payload, while file systems use hierarchical directories and file paths for organization. A typical many-to-one mapping relationship exists between the two—multiple objects often correspond to a single file in the file system, or a single file may be divided into multiple objects for distributed storage.
[0003] In related technologies, because file directories use a tree-like hierarchical structure, the contents of different files are stored independently, making cross-file operations quite difficult. Therefore, integrating the contents of different files has become an urgent technical problem to be solved. Summary of the Invention
[0004] To address the problems in the prior art, the present invention provides a method, apparatus, and electronic device for converting a file directory to a data plane.
[0005] This invention provides a method for converting a file directory to a data plane, comprising the following steps.
[0006] A two-dimensional rational number coordinate system is constructed, wherein the X-axis of the two-dimensional rational number coordinate system is used to represent the file path dimension, and the Y-axis of the two-dimensional rational number coordinate system is used to represent the file content dimension; For each file in the file directory, the file path of the file is converted to obtain the X-axis coordinate; The file content is converted to obtain the Y-axis coordinate; Based on the X-axis coordinates, the Y-axis coordinates, and the corresponding file sub-contents, a set of data point triples for the file is generated; Based on the set of triplet data points of all the files, determine the point set of the file directory on the data plane.
[0007] According to a method for converting a file directory to a data plane provided by the present invention, the step of converting the file path of the file to obtain the X-axis coordinate includes: Convert the path separator in the file path to the first symbol; Convert the period in the file path to the second symbol; Based on the hierarchical relationship of the file path, the first symbol, the second symbol, and each path component of the file path are combined to obtain the X-axis coordinate.
[0008] According to a method for converting a file directory to a data plane provided by the present invention, the step of combining the first symbol, the second symbol, and each path component of the file path based on the hierarchical relationship of the file path to obtain the X-axis coordinate includes: If the file is a parsed file, based on the hierarchical relationship of the file path, the first symbol, the second symbol, and each path component of the file path are combined to obtain the converted file path; Based on the file content of the file, determine the internal data path; The X-axis coordinates are obtained based on the converted file path and the internal data path.
[0009] According to a method for converting a file directory to a data plane provided by the present invention, the step of converting the file content of the file to obtain the Y-axis coordinate includes: If the file is an unparsed file, the file content is divided into blocks based on a preset size to obtain at least one block of content; For each of the aforementioned content blocks, the index of the content block is determined as the Y-axis coordinate of the content block.
[0010] According to a method for converting a file directory to a data plane provided by the present invention, the step of converting the file content of the file to obtain the Y-axis coordinate includes: If the file is a parsed file, for each piece of data in the file content, the Y-axis coordinate of the data is determined based on the position of the data in the data structure of the file content.
[0011] According to a method for converting a file directory to a data plane provided by the present invention, the method further includes: When new data is inserted into the file, the Y-axis coordinates of two adjacent targets are obtained based on the insertion position of the new data. Based on the two target Y-axis coordinates, a new Y-axis coordinate is determined, and the new Y-axis coordinate is located between the two target Y-axis coordinates; The new Y-axis coordinate is determined as the Y-axis coordinate of the new data.
[0012] According to a method for converting a file directory to a data plane provided by the present invention, the method further includes: The file paths of all files in the file directory are compared lexicographically level by level to obtain the sorting result of all file paths; Based on the sorting results of all file paths, the X-axis coordinates corresponding to each file path are added to the data plane.
[0013] According to a method for converting a file directory to a data plane provided by the present invention, the method further includes: Obtain a query instruction, which includes a query path and the content to be queried; In response to the query command, the X-axis coordinate range is determined in the data plane based on the query path; Among all file sub-contents corresponding to Y-axis coordinates within the X-axis coordinate range, at least one target file sub-content that matches the content to be queried is found. The content of each target file is determined as the query result.
[0014] The present invention also provides a file directory to data plane conversion device, comprising: A construction unit is used to construct a two-dimensional rational number coordinate system, wherein the X-axis of the two-dimensional rational number coordinate system is used to characterize the file path dimension, and the Y-axis of the two-dimensional rational number coordinate system is used to characterize the file content dimension; The first conversion unit is used to convert the file paths of each file in the file directory to obtain the X-axis coordinates; The second conversion unit is used to convert the file content of the file to obtain the Y-axis coordinate; The generation unit is used to generate a set of data point triples for the file based on the X-axis coordinate, the Y-axis coordinate, and the corresponding file sub-content; The determining unit is used to determine the set of points of the file directory on the data plane based on the set of triplet data points of all files.
[0015] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the file directory to data plane conversion method as described above.
[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the file directory to data plane conversion method as described above.
[0017] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the file directory to data plane conversion method as described above.
[0018] This invention provides a method, apparatus, and electronic device for converting file directories to a data plane. It constructs a two-dimensional rational number coordinate system. The X-axis of this system represents the file path dimension, and the Y-axis represents the file content dimension. For each file in the file directory, the file path is converted to obtain the X-axis coordinate, and the file content is converted to obtain the Y-axis coordinate. Based on the X-axis coordinate, Y-axis coordinate, and corresponding file sub-content, a set of data point triples for each file is generated. Finally, based on the set of data point triples for all files, the point set of the file directory on the data plane is determined. This invention abstracts the file content of different files into a two-dimensional tabular representation, converting the file content of different files to the same data plane, thus integrating the file content of different files and facilitating cross-file content operations based on the data plane. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 This is one of the flowcharts illustrating the method for converting a file directory to a data plane provided in this embodiment of the invention.
[0021] Figure 2 This is an example diagram of the file directory to data plane conversion provided in the embodiments of the present invention.
[0022] Figure 3 This is an example diagram of recursive conversion of a parsed file provided in an embodiment of the present invention.
[0023] Figure 4 This is an example diagram of lexicographical order comparison provided in an embodiment of the present invention.
[0024] Figure 5 This is the second flowchart illustrating the method for converting a file directory to a data plane provided in this embodiment of the invention.
[0025] Figure 6 This is an example diagram of a query process based on a data plane provided in an embodiment of the present invention.
[0026] Figure 7 This is a schematic diagram of the structure of the file directory to data plane conversion device provided in an embodiment of the present invention.
[0027] Figure 8 This is a schematic diagram of the physical structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0029] The following is combined Figures 1-6 This invention describes a method for converting a file directory to a data plane. The entity executing this method can be an electronic device such as a computer, tablet computer, terminal, or server, or a file directory-to-data plane conversion device installed in that electronic device. This conversion device can be implemented through software, hardware, or a combination of both.
[0030] Figure 1 This is one of the flowcharts illustrating the method for converting a file directory to a data plane according to an embodiment of the present invention, such as... Figure 1 As shown, the method for converting this file directory to the data plane includes the following steps: Step 101: Construct a two-dimensional rational number coordinate system. The X-axis of the two-dimensional rational number coordinate system is used to represent the file path dimension, and the Y-axis of the two-dimensional rational number coordinate system is used to represent the file content dimension.
[0031] For example, a two-dimensional rational number coordinate system is constructed, where the X-axis represents the file path dimension and the Y-axis represents the file content dimension. The two-dimensional rational number coordinate system is used as the data mapping space, that is, the set of all points with rational coordinates in the two-dimensional rational number coordinate system. .
[0032] Step 102: For each file in the file directory, convert the file path of the file to obtain the X-axis coordinate.
[0033] For example, for each file in the file directory, the file path is obtained, and the file path is converted into X-axis coordinates using preset rules. Different types of files can correspond to different preset rules; for example, unparsed files and parsed files correspond to different preset rules.
[0034] It should be noted that the files mentioned here can be files in the same directory or files in different directories; this invention does not limit this.
[0035] Step 103: Convert the file content to obtain the Y-axis coordinate.
[0036] For example, the file content is divided into blocks, resulting in multiple blocks, each corresponding to a Y-axis coordinate.
[0037] Step 104: Based on the X-axis coordinates, the Y-axis coordinates, and the corresponding file sub-contents, generate a set of data point triples for the file.
[0038] For example, when the X-axis coordinates and Y-axis coordinates of a file are obtained, the X-axis coordinates, Y-axis coordinates, and the file sub-contents corresponding to the X-axis coordinates and Y-axis coordinates are used as data point triples (X-axis coordinate, Y-axis coordinate, value), where the value is the file sub-content. The data point triples of different file sub-contents of the file constitute the set of data point triples of the file.
[0039] Step 105: Based on the set of triples of data points for all files, determine the point set of the file directory on the data plane.
[0040] For example, each file corresponds to multiple data point triples, that is, each file corresponds to a set of data point triples. The set of data point triples of all files forms a point set on the data plane, thereby realizing the transformation from file directory to data plane. Specifically, it realizes the transformation from file directory to two-dimensional rational number plane, breaking through the limitation of traditional integer grid points.
[0041] Compared to the traditional integer grid data plane ( The two-dimensional rational number plane possesses the following key characteristics: 1) Denseness: Rational numbers are densely distributed in the real number system. Between any two distinct rational points, there are always infinitely many other rational points, ensuring flexibility in data insertion. Regardless of the existing data distribution, a suitable position can always be found to insert new data. 2) No Outliers: Under standard real number topology, any neighborhood of any point in the two-dimensional rational number plane contains infinitely many other rational points. This contrasts sharply with the discrete structure of integer lattice points. 3) Countability: Despite its density, the set of rational numbers is still a countably infinite set, ensuring the enumerability of the data and the implementability of the algorithm. 4) Total Order: Rational numbers in each dimension possess a natural total order relation, supporting efficient comparison and sorting operations.
[0042] This invention provides a method for converting a file directory to a data plane. It constructs a two-dimensional rational number coordinate system. The X-axis of this system represents the file path dimension, and the Y-axis represents the file content dimension. For each file in the file directory, the file path is converted to obtain the X-axis coordinate, and the file content is converted to obtain the Y-axis coordinate. Based on the X-axis coordinate, Y-axis coordinate, and corresponding file sub-content, a set of data point triples for each file is generated. Finally, based on the set of data point triples for all files, the point set of the file directory on the data plane is determined. This invention abstracts the file content of different files into a two-dimensional tabular representation, converting the file content of different files to the same data plane, thus integrating the file content of different files and facilitating cross-file operations based on the data plane.
[0043] In one embodiment, step 102 above converts the file path of the file to obtain the X-axis coordinates, which can be achieved in the following way: The path separators in the file path are converted into a first symbol; the period in the file path is converted into a second symbol; based on the hierarchical relationship of the file path, the first symbol, the second symbol, and each path component of the file path are combined to obtain the X-axis coordinate.
[0044] For example, the file path is converted into an X-axis coordinate using a preset rule. This preset rule could be to convert path separators in the file path into the first symbol and periods into the second symbol. The first symbol can be a period (.) or other symbols, and the second symbol can be a combination of a backslash and a period (\.) or other symbols. Then, based on the hierarchical relationship of the file path, the first symbol, the second symbol, and each path component in the file path are combined to form a string, which is used as the X-axis coordinate. For example, in the file path / home / user / data.txt, the path separator / is converted to a period, and the period (.) is converted to \. The path components include home, user, data, and txt. They are combined according to the hierarchical relationship of / home / user / data.txt. For an unparsed file (e.g., an unparsed binary file), the final X-axis coordinate is: home.user.data\.txt.
[0045] In this embodiment, the path separator in the file path is converted into a first symbol, the dot in the file path is converted into a second symbol, and based on the hierarchical relationship of the file path, the first symbol, the second symbol, and each path component of the file path are combined to obtain the X-axis coordinate, ensuring that the hierarchical relationship of the file path can be maintained in the coordinate space of the data plane, that is, ensuring the topological invariance of the hierarchical relationship of the file path.
[0046] In one embodiment, the X-axis coordinate is obtained by combining the first symbol, the second symbol, and each path component of the file path based on the hierarchical relationship of the file path. This can be achieved in the following way: If the file is a parsed file, the first symbol, the second symbol, and each path component of the file path are combined based on the hierarchical relationship of the file path to obtain the converted file path; the internal data path is determined based on the file content; and the X-axis coordinate is obtained based on the converted file path and the internal data path.
[0047] The parsed files can be semi-structured files such as JSON and Parquet, or structured files such as CSV and TSV.
[0048] For example, when the file is a parsed file, the first symbol, the second symbol, and each path component of the file path are combined based on the hierarchical relationship of the file path to obtain the converted file path. It is also necessary to determine the internal data path based on the parsing of the file content. The converted file path and the internal data path are then combined to obtain the composite path coordinate (converted file path.internal data path), and this composite path coordinate is used as the X-axis coordinate of the file. For example, if the file path is / data / user.json and the file content is {'name': 'Alice', 'age': 30, 'address':{'city': 'NYC', 'zip':10001}, 'scores':[85,90]}, then the internal data path includes name, age, address, city, zip, and scores. The converted file path is data.user\.json, and the file's X-axis coordinates include: data.user\.json.name, data.user\.json.age, data.user\.json.address.city, data.user\.json.address.zip, data.user\.json.1.scores, and data.user\.json.2.scores.
[0049] In this embodiment, for parsed files, the X-axis coordinates can be determined based on the combination of the converted file path and the internal data path, thereby supporting the conversion of file paths for different types of files and supporting transparent processing of heterogeneous file formats.
[0050] In one embodiment, step 103 above converts the file content of the file to obtain the Y-axis coordinates, which can be implemented in the following way: If the file is an unparsed file, the file content is divided into blocks based on a preset size to obtain at least one block of content; for each block of content, the index of the block of content is determined as the Y-axis coordinate of the block of content.
[0051] For example, when the file is unparsed, the file content is divided into blocks based on a preset size K, resulting in multiple blocks. The index of each block is used as its Y-axis coordinate, and the Y-axis represents the physical order of the different blocks. For instance, if the file content is divided into four blocks based on the preset size K, with indices 1, 2, 3, and 4 respectively, then the Y-axis coordinate for the first block is 1, the second block is 2, the third block is 3, and the fourth block is 4.
[0052] In this embodiment, when the file is an unparsed file, the index of the file's block content is determined as the Y-axis coordinate of the block content, thus realizing the conversion of file content to Y-axis coordinate.
[0053] In one embodiment, step 103 above converts the file content of the file to obtain the Y-axis coordinates, which can be further implemented in the following ways: If the file is a parsed file, for each piece of data in the file content, the Y-axis coordinate of the data is determined based on the position of the data in the data structure of the file content.
[0054] For example, when the file is a parsed file, the Y-axis coordinates are determined recursively based on the data structure of the file content. That is, the Y-axis coordinates are determined by the position of the data within the file content's data structure. For instance, the file content is {'name': 'Alice', 'age': 30, 'address': {'city': 'NYC', 'zip': 10001}, 'scores': [85, 90]}. For the data 'name', the value is only 'Alice', so the Y-axis coordinate is Y=1; for the data 'age', the value is only '30', so the Y-axis coordinate is Y=1; for the data 'city', the value is only 'NYC', so the Y-axis coordinate is Y=1; for the data 'zip', the value is only '10001', so the Y-axis coordinate is Y=1; for the data 'scores', the values are '85' and '90', so there are two Y-axis coordinates, Y=1 and Y=2 respectively.
[0055] Figure 2 This is an example diagram of the file directory to data plane conversion provided in the embodiments of the present invention, such as... Figure 2As shown, taking a directory containing three files as an example, with file paths of / home / user / data.txt, / home / user / config.json, and / var / log / app.log respectively, the txt and log files are unparsed, while the json file is parsed. The txt and log files are then divided into chunks, for example, the txt file is chunked based on K=4096 bits, and the log file is chunked based on K=8192 bits. The json file is then parsed to obtain the X-axis coordinate of / home / user / data.txt as home.user.data\.txt. The Y-axis coordinates of the txt file are Y=1, Y=2, ..., Y=4096. Therefore, the data point triplets of the txt file converted to the data plane are (home.user.data\.txt, 1, block1), (home.user.data\.txt, 2, block2), etc. The X-axis coordinate of / home / user / config.json is home.user.config\.json.name, and the Y-axis coordinates are Y=1. Therefore, the data point triplets of the json file converted to the data plane can be (home.user.config\.json.name, 1, nameVal), etc. The X-axis coordinate of / var / log / app.Log is var.log.app\.log, and the Y-axis coordinates are Y=1, Y=2, ..., Y=8192. Therefore, the data point triplets of the log file converted to the data plane include (var.log.app\.log, 1, line1-1000), etc.
[0056] Figure 3 This is an example diagram of the recursive transformation of a parsed file provided in an embodiment of the present invention, such as... Figure 3As shown, taking a JSON file as an example, the file path is / data / user.json, and the file content is {'name': 'Alice', 'age': 30, 'address': {'city': 'NYC', 'zip': 10001}, 'scores': [85, 90]}. After converting the file path, the converted file path is data.user\.json. Combining the internal data path and the position of the data in the data structure of the file content, the coordinates of the file are: data.user\.json.name, Y=1, data.user\.json.age, Y=1, data.user\.json.address.city, Y=1, data.user\.json.address.zip, Y=1, data.user\.json.1.scores, Y=1, data.user\.json.2.scores, Y=2. Combining the corresponding file sub-contents, the final data point triplets in the data plane include: (data.user\.json.name, Y=1, Alice), (data.user\.json.age, Y=1, 30), (data.user\.json.address.city, Y=1, NYC), (data.user\.json.address.zip, Y=1, 10001), (data.user\.json.1.scores, Y=1, 85), (data.user\.json.1.scores, Y=2, 90).
[0057] It should be noted that the JSON file content contains two levels of nesting, connected by periods. For example, 'address' is the first level of nesting, and 'city' and 'zip' are the second level of nesting. Therefore, the X-axis coordinates would be represented as data.user\.json.address.city and data.user\.json.address.zip to reflect the hierarchical relationship. Multiple levels of nesting follow a similar pattern and will not be elaborated further here. Array elements are identified by their indices. For example, 'scores' includes two values, 85 and 90, which would be represented on the X-axis as data.user\.json.1.scores and data.user\.json.2.scores.
[0058] In one embodiment, the method for converting the file directory to the data plane further includes the following steps: When new data is inserted into the file, two adjacent target Y-axis coordinates are obtained based on the insertion position of the new data; a new Y-axis coordinate is determined based on the two target Y-axis coordinates, and the new Y-axis coordinate is located between the two target Y-axis coordinates; the new Y-axis coordinate is determined as the Y-axis coordinate of the new data.
[0059] For example, when inserting new data into a file, extract the insertion position of the new data, which can be a line number, etc., and then obtain the context adjacent to the insertion position. Mark the two target Y-axis coordinates corresponding to the context as y1 and y2. Then, the new Y-axis coordinate y can be determined based on the following formula (1): y = y1+ (y2-y1) / k (1) Where k is a positive integer greater than 1.
[0060] It should be noted that fractional form can be used to accurately determine the Y-axis coordinate, avoiding the precision loss caused by floating-point numbers.
[0061] It should be noted that because a two-dimensional rational number coordinate system is constructed, the density of rational numbers can ensure that new data can be dynamically inserted at any position in the data plane without rearranging the existing Y-axis coordinates. Furthermore, the logical order of the file content can be preserved through the coordinate size relationship, and the structure of the file can be completely reconstructed through the X-axis and Y-axis coordinates.
[0062] In this embodiment, new data can be inserted arbitrarily into the data plane, achieving conflict-free expansion of the data plane and improving its scalability.
[0063] In one embodiment, the method for converting the file directory to the data plane further includes the following steps: The file paths of all files in the file directory are compared lexicographically layer by layer to obtain a sorting result of all file paths; based on the sorting result of all file paths, the X-axis coordinates corresponding to each file path are added to the data plane.
[0064] For example, Figure 4 This is an example diagram of a lexicographical comparison provided in an embodiment of the present invention, such as... Figure 4As shown, taking the five file paths of home / admin / log, home / user / cache / temp, home / user / config.json, home / user / data.txt, and var / log / system as examples, first split each file path into multiple file sub-paths, and then compare the file sub-paths of different file paths layer by layer in lexicographical order. The converted dot (.) participates in the comparison as an ordinary character. The file sub-paths with the same prefix are sorted according to the file sub-paths at the next level, ensuring that the hierarchical relationship of the file directory is maintained in the coordinate space of the data plane. Specifically, first perform the first-level comparison. Among the last four file paths, home = home. When comparing with the first file path, home < var. Then perform the second-level comparison, admin < user = user, user = user. Then perform the third-level comparison, cache < config < data. The final sorting result is: home / admin.log < home / user / cache / temp < home / user / config.json < home / user / data.txt < var / log / system. Then the positions of the X-axis coordinates corresponding to home / admin / log, home / user / cache / temp, home / user / config.json, home / user / data.txt, and var / log / system on the X-axis of the data plane are from left to right.
[0065] In this embodiment, the file paths of all files in the file directory are compared layer by layer in lexicographical order, ensuring that the hierarchical relationship of each file in the file directory is maintained in the coordinate space of the data plane, improving the accuracy of the conversion from the file directory to the data plane.
[0066] In one embodiment, Figure 5 It is the second flowchart of the method for converting a file directory to a data plane provided by an embodiment of the present invention. After obtaining the data plane corresponding to the file directory, the method for converting the file directory to the data plane further includes the following steps: Step 501, obtain a query instruction, where the query instruction includes a query path and a content to be queried.
[0067] Exemplarily, provide a SQL-compatible query interface. When a user wants to query content across files or within the same file, they can enter the query path and the content to be queried in the corresponding input field and click the query button, thereby generating a query instruction.
[0068] Step 502: In response to the query instruction, determine the X-axis coordinate range in the data plane based on the query path.
[0069] For example, when a query instruction is obtained, the query instruction is parsed to obtain the query path and the content to be queried. Then, all X-axis coordinates related to the query path are searched in the data plane, and the range of X-axis coordinates is determined based on all X-axis coordinates related to the query path.
[0070] Step 503: Among all the file sub-contents corresponding to the Y-axis coordinates under the X-axis coordinate range, query at least one target file sub-content that matches the content to be queried.
[0071] For example, after determining the range of X-axis coordinates, all Y-axis coordinates within the range of X-axis coordinates are determined in the data plane, and all target file sub-contents that match the content to be queried are retrieved from the file sub-contents corresponding to all Y-axis coordinates.
[0072] Step 504: Determine the word content of each target file as the query result.
[0073] For example, when all target file sub-contents that match the query content are retrieved, all target file sub-contents are output as query results. Since the data plane can store various files of different types, it is possible to realize cross-file association queries and aggregation operations as well as content queries within the same file.
[0074] Figure 6 This is an example diagram of a query process based on the data plane provided in an embodiment of the present invention, such as... Figure 6 As shown, for example, the SQL query command is SELECT FROM files WHERE path LIKE 'home.user.%' AND contentCONTAINS 'error'. The query command is parsed for both path and content conditions, generating a query plan. The query plan is as follows: Search all files for content containing 'error' under the path 'home.user.%'; search the data plane for all X-axis coordinates related to 'home.user.%', resulting in an X-axis coordinate range of X∊[home.user, home.user]. Then, a full Y-axis scan is performed within the X-axis coordinate range. Then, among all the file sub-contents corresponding to the Y-axis coordinates within the X-axis coordinate range, all target file sub-contents that match the query content 'error' are filtered out using content.contains(error). This is called value filtering, which supports cross-file queries and aggregation operations, and realizes the relational query capability of file directories.
[0075] In this embodiment, cross-file query and aggregation operations can be performed based on the data plane, realizing relational query capabilities for file directories.
[0076] The method for converting file directories to a data plane provided by this invention can achieve the following significant technical effects: 1) Unification of file-level data representation This method unifies the data from files in different directories and of different types into a flat data structure, achieving a data view where "multiple files are treated as a single table." In practice, developers no longer need to write dedicated parsing programs for file paths and content; they can directly manipulate the content using a unified key-value / coordinate format.
[0077] 2) Supports direct querying using relational languages The transformed data plane is structurally equivalent to a standard relational database table, and can be directly accessed, filtered, joined, and aggregated by SQL or similar query languages, achieving a seamless transition from file directories to relational databases. For example, specific key-value segments (query content) across multiple files can be selected simultaneously for conditional filtering or aggregation calculations.
[0078] 3) Dynamic scalability and dense insertion capability Because it uses a dense coordinate system in a two-dimensional rational number plane, data can be added between any two points without renumbering, thus supporting dynamic insertion, version addition, and local modification of files without the need to reconstruct the coordinate or data plane of the entire file.
[0079] 4) Cross-format compatibility and structure preservation A single data plane can represent both the block order information of binary files and the logical hierarchy of hierarchical or semi-structured data. This unified framework makes it possible to compare and manipulate different types of files in the same space, while preserving the internal hierarchical relationships and order of the files.
[0080] 5) High-efficiency computing and recovery capabilities Because the coordinate system is countable, data can be quickly indexed and enumerated without the need for complex hashing; through inverse transformation operations, the structure and content of the original file can be restored from the set of data points in the data plane at any time, achieving bidirectional consistency between structuring and restoration.
[0081] The file directory to data plane conversion apparatus provided by the present invention will be described below. The file directory to data plane conversion apparatus described below and the file directory to data plane conversion method described above can be referred to in correspondence.
[0082] Figure 7 This is a schematic diagram of the structure of the file directory to data plane conversion device provided in an embodiment of the present invention, as shown below. Figure 7As shown, the file directory to data plane conversion device 700 includes a construction unit 701, a first conversion unit 702, a second conversion unit 703, a first generation unit 704, and a determination unit 705, wherein: Construction unit 701 is used to construct a two-dimensional rational number coordinate system, wherein the X-axis of the two-dimensional rational number coordinate system is used to characterize the file path dimension, and the Y-axis of the two-dimensional rational number coordinate system is used to characterize the file content dimension; The first conversion unit 702 is used to convert the file paths of each file in the file directory to obtain the X-axis coordinates; The second conversion unit 703 is used to convert the file content of the file to obtain the Y-axis coordinate; The first generation unit 704 is used to generate a set of data point triplets of a file based on the X-axis coordinate, the Y-axis coordinate and the corresponding file sub-content; The determining unit 705 is used to determine the point set of the file directory on the data plane based on the set of data point triples of all files.
[0083] The file directory to data plane conversion device provided by this invention constructs a two-dimensional rational number coordinate system. The X-axis of the two-dimensional rational number coordinate system is used to represent the file path dimension, and the Y-axis is used to represent the file content dimension. For each file in the file directory, the file path is converted to obtain the X-axis coordinate, and the file content is converted to obtain the Y-axis coordinate. Based on the X-axis coordinate, Y-axis coordinate, and corresponding file sub-content, a set of data point triples for each file is generated. Finally, based on the set of data point triples for all files, the point set of the file directory on the data plane is determined. It can be seen that this invention abstracts the file content of different files into a two-dimensional tabular representation, converts the file content of different files to the same data plane, realizes the integration of file content from different files, and facilitates cross-file operations based on the data plane.
[0084] Based on any of the above embodiments, the first conversion unit 702 is specifically used for: Convert the path separator in the file path to the first symbol; Convert the period in the file path to the second symbol; Based on the hierarchical relationship of the file path, the first symbol, the second symbol, and each path component of the file path are combined to obtain the X-axis coordinate.
[0085] Based on any of the above embodiments, the first conversion unit 702 is specifically used for: The method of combining the first symbol, the second symbol, and each path component of the file path based on the hierarchical relationship of the file path to obtain the X-axis coordinate includes: If the file is a parsed file, based on the hierarchical relationship of the file path, the first symbol, the second symbol, and each path component of the file path are combined to obtain the converted file path; Based on the file content of the file, determine the internal data path; The X-axis coordinates are obtained based on the converted file path and the internal data path.
[0086] Based on any of the above embodiments, the second conversion unit 703 is specifically used for: If the file is an unparsed file, the file content is divided into blocks based on a preset size to obtain at least one block of content; For each of the aforementioned content blocks, the index of the content block is determined as the Y-axis coordinate of the content block.
[0087] Based on any of the above embodiments, the second conversion unit 703 is specifically used for: If the file is a parsed file, for each piece of data in the file content, the Y-axis coordinate of the data is determined based on the position of the data in the data structure of the file content.
[0088] Based on any of the above embodiments, the file directory to data plane conversion device 700 is further used for: The first acquisition unit is used to acquire the Y-axis coordinates of two adjacent targets based on the insertion position of the new data when new data is inserted into the file. The second determining unit is used to determine a new Y-axis coordinate based on the two target Y-axis coordinates, wherein the new Y-axis coordinate is located between the two target Y-axis coordinates; The third determining unit is used to determine the new Y-axis coordinate as the Y-axis coordinate of the new data.
[0089] Based on any of the above embodiments, the file directory to data plane conversion device 700 is further used for: The comparison unit is used to perform lexicographical comparisons of the file paths of all files in the file directory to obtain the sorting results of all file paths; An adding unit is used to add the X-axis coordinates corresponding to each of the file paths to the data plane based on the sorting results of all file paths.
[0090] Based on any of the above embodiments, the file directory to data plane conversion device 700 is further used for: The second acquisition unit is used to acquire a query instruction, which includes a query path and the content to be queried. The fourth determining unit is used to determine the X-axis coordinate range in the data plane based on the query path in response to the query instruction. The query unit is used to query at least one target file sub-content that matches the content to be queried among all file sub-contents corresponding to all Y-axis coordinates under the X-axis coordinate range. The fifth determining unit is used to determine the word content of each of the target files as the query result.
[0091] Figure 8 This is a schematic diagram of the physical structure of the electronic device provided in the embodiments of the present invention, such as... Figure 8 As shown, the electronic device may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840. The processor 810, communications interface 820, and memory 830 communicate with each other via the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute a method for converting a file directory to a data plane. This method includes: constructing a two-dimensional rational number coordinate system, where the X-axis of the two-dimensional rational number coordinate system is used to represent the file path dimension, and the Y-axis of the two-dimensional rational number coordinate system is used to represent the file content dimension. For each file in the file directory, the file path of the file is converted to obtain the X-axis coordinate; The file content is converted to obtain the Y-axis coordinate; Based on the X-axis coordinates, the Y-axis coordinates, and the corresponding file sub-contents, a set of data point triples for the file is generated; Based on the set of triples of data points for all files, determine the set of points for the file directory on the data plane.
[0092] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0093] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being able to be stored on a non-transitory computer-readable storage medium, the computer program being executed by a processor, the computer being able to execute the file directory to data plane conversion method provided by the above methods, the method including: constructing a two-dimensional rational number coordinate system, the X-axis of the two-dimensional rational number coordinate system being used to characterize the file path dimension, the Y-axis of the two-dimensional rational number coordinate system being used to characterize the file content dimension; For each file in the file directory, the file path of the file is converted to obtain the X-axis coordinate; The file content is converted to obtain the Y-axis coordinate; Based on the X-axis coordinates, the Y-axis coordinates, and the corresponding file sub-contents, a set of data point triples for the file is generated; Based on the set of triples of data points for all files, determine the set of points for the file directory on the data plane.
[0094] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for converting a file directory to a data plane provided by the above methods, the method comprising: constructing a two-dimensional rational number coordinate system, wherein the X-axis of the two-dimensional rational number coordinate system is used to characterize the file path dimension, and the Y-axis of the two-dimensional rational number coordinate system is used to characterize the file content dimension; For each file in the file directory, the file path of the file is converted to obtain the X-axis coordinate; The file content is converted to obtain the Y-axis coordinate; Based on the X-axis coordinates, the Y-axis coordinates, and the corresponding file sub-contents, a set of data point triples for the file is generated; Based on the set of triples of data points for all files, determine the set of points for the file directory on the data plane.
[0095] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0096] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for converting a file directory to a data plane, characterized in that, include: A two-dimensional rational number coordinate system is constructed, wherein the X-axis of the two-dimensional rational number coordinate system is used to represent the file path dimension, and the Y-axis of the two-dimensional rational number coordinate system is used to represent the file content dimension; For each file in the file directory, the file path of the file is converted to obtain the X-axis coordinate; The file content is converted to obtain the Y-axis coordinate; Based on the X-axis coordinates, the Y-axis coordinates, and the corresponding file sub-contents, a set of data point triples for the file is generated; Based on the set of triplet data points of all the files, determine the point set of the file directory on the data plane.
2. The method for converting a file directory to a data plane according to claim 1, characterized in that, The process of converting the file path of the file to obtain the X-axis coordinate includes: Convert the path separator in the file path to the first symbol; Convert the period in the file path to the second symbol; Based on the hierarchical relationship of the file path, the first symbol, the second symbol, and each path component of the file path are combined to obtain the X-axis coordinate.
3. The method for converting a file directory to a data plane according to claim 2, characterized in that, The method of combining the first symbol, the second symbol, and each path component of the file path based on the hierarchical relationship of the file path to obtain the X-axis coordinate includes: If the file is a parsed file, based on the hierarchical relationship of the file path, the first symbol, the second symbol, and each path component of the file path are combined to obtain the converted file path; Based on the file content of the file, determine the internal data path; The X-axis coordinates are obtained based on the converted file path and the internal data path.
4. The method for converting a file directory to a data plane according to claim 1, characterized in that, The process of converting the file content to obtain the Y-axis coordinate includes: If the file is an unparsed file, the file content is divided into blocks based on a preset size to obtain at least one block of content; For each of the aforementioned content blocks, the index of the content block is determined as the Y-axis coordinate of the content block.
5. The method for converting a file directory to a data plane according to claim 1, characterized in that, The process of converting the file content to obtain the Y-axis coordinate includes: If the file is a parsed file, for each piece of data in the file content, the Y-axis coordinate of the data is determined based on the position of the data in the data structure of the file content.
6. The method for converting a file directory to a data plane according to any one of claims 1-5, characterized in that, The method further includes: When new data is inserted into the file, the Y-axis coordinates of two adjacent targets are obtained based on the insertion position of the new data. Based on the two target Y-axis coordinates, a new Y-axis coordinate is determined, and the new Y-axis coordinate is located between the two target Y-axis coordinates; The new Y-axis coordinate is determined as the Y-axis coordinate of the new data.
7. The method for converting a file directory to a data plane according to any one of claims 1-5, characterized in that, The method further includes: The file paths of all files in the file directory are compared lexicographically layer by layer to obtain a sorting result of all file paths; based on the sorting result of all file paths, the X-axis coordinates corresponding to each file path are added to the data plane.
8. The method for converting a file directory to a data plane according to any one of claims 1-5, characterized in that, The method further includes: Obtain a query instruction, which includes a query path and the content to be queried; In response to the query command, the X-axis coordinate range is determined in the data plane based on the query path; Among all file sub-contents corresponding to Y-axis coordinates within the X-axis coordinate range, at least one target file sub-content that matches the content to be queried is found. The content of each target file is determined as the query result.
9. A file directory to data plane conversion device, characterized in that, include: A construction unit is used to construct a two-dimensional rational number coordinate system, wherein the X-axis of the two-dimensional rational number coordinate system is used to characterize the file path dimension, and the Y-axis of the two-dimensional rational number coordinate system is used to characterize the file content dimension; The first conversion unit is used to convert the file paths of each file in the file directory to obtain the X-axis coordinates; The second conversion unit is used to convert the file content of the file to obtain the Y-axis coordinate; The generation unit is used to generate a set of data point triples for the file based on the X-axis coordinate, the Y-axis coordinate, and the corresponding file sub-content; The determining unit is used to determine the point set of the file directory on the data plane based on the set of data point triples of all the files.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the file directory to data plane conversion method as described in any one of claims 1 to 8.