Dag-based hierarchical data storage and loading method

By building a DAG hierarchical data storage model and using a depth-first recursive algorithm to load data, the problems of high system resource usage and heavy database access pressure are solved, and efficient data storage and loading are achieved.

CN119760029BActive Publication Date: 2025-10-17BEIJING KONGJIAN SCI&TECH INFORMATION RES LABOR
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411736287.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-10-17
Estimated Expiration
2044-11-29

AI Technical Summary

Technical Problem

Existing data storage and loading methods result in high system resource usage, heavy database access pressure, and low efficiency due to nested loops when processing large amounts of data.

Method used

A DAG-based hierarchical data storage method is adopted. By building a DAG layered data storage model, a depth-first recursive algorithm is used to load data, and information indexing is extracted through the relationship links between hierarchical data.

Benefits of technology

It improves data storage efficiency and loading speed, reduces system resource usage and database access pressure, and adapts to the needs of big data processing and complex web page data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760029B_ABST
    Figure CN119760029B_ABST
Patent Text Reader

Abstract

The application relates to a DAG-based hierarchical data storage and loading method, which comprises the following steps: step S1, constructing a DAG hierarchical data storage model and storing hierarchical data; step S2, traversing the data in the DAG hierarchical data storage model, loading the hierarchical data by using a depth-first recursive algorithm; and step S3, performing index extraction of information through a relationship link between hierarchical data. The application effectively solves the problem of hierarchical data storage and loading and has the advantages of high data storage efficiency and fast loading speed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data storage and loading, and particularly relates to a DAG-based hierarchical data storage and loading method. BACKGROUND

[0002] At present, most data storage and loading methods rely on traditional flat structures. Meanwhile, some methods also use tree structures or linked list structures to realize data storage and loading. However, when these methods are used in the scene of loading a large amount of data, they usually adopt a loop-nested means, which greatly leads to high occupation of system resources and increase of database access pressure. Under this background, in order to ensure the efficiency and stability of data processing, it is urgent to propose a data storage and loading method which is more efficient and can solve the current problems. SUMMARY

[0003] To solve the above technical problems in the prior art, the purpose of the present application is to provide a DAG-based hierarchical data storage and loading method, which solves the problems of high system resource occupation rate and large database access pressure in hierarchical data structure loading.

[0004] To achieve the above application purpose, the present application provides a DAG-based hierarchical data storage and loading method, comprising the following steps:

[0005] Step S1, constructing a DAG hierarchical data storage model and storing hierarchical data;

[0006] Step S2, traversing the data in the DAG hierarchical data storage model, using a depth-first recursive algorithm to load the hierarchical data;

[0007] Step S3, extracting information by a relationship link between hierarchical data.

[0008] According to one technical solution of the present application, in the step S1, specifically comprising:

[0009] Step S11, constructing a node for representing data hierarchy;

[0010] Step S12, constructing an edge connecting each node according to the hierarchical relationship between the hierarchical data, to form the DAG hierarchical data storage model;

[0011] Step S13, storing data attribute information of each node of the DAG hierarchical data storage model;

[0012] Step S14, according to the DAG hierarchical data storage model, maintaining the relationship between each node and its corresponding parent node, establishing a hierarchical data table, the hierarchical data table contains the corresponding relationship between all parent nodes and child nodes in the DAG hierarchical data storage model;

[0013] Step S15, adding, deleting, modifying and inquiring the data attribute information of the DAG hierarchical data storage model and storing.

[0014] According to one technical solution of the application, the data attribute information includes data name, data number, data type and description.

[0015] According to one technical solution of the application, in the step S2, specifically comprising:

[0016] Step S21, constructing a temporary T table, and storing the hierarchical data table in the temporary T table; the temporary T table includes a parent node column and a child node column, and the child node column is the child node corresponding to the node in the parent node column;

[0017] Step S22, counting the number of nodes in the temporary T table to obtain a data record t1;

[0018] Step S23, judging whether the data record exists t1=0; if yes, ending, otherwise, executing step S24;

[0019] Step S24, traversing the temporary T table, obtaining the hierarchical data corresponding to the node in the parent node column of the temporary T table and not in the child node column, and inserting the hierarchical data into a result set;

[0020] Step S25, deleting the node in the parent node column and its corresponding child node column in the result set;

[0021] Step S26, executing step S22.

[0022] According to one technical solution of the application, in the step S24, further comprising:

[0023] According to the hierarchical data of the node, adding an index to the hierarchical data inserted into the result set.

[0024] According to one aspect of the application, an electronic device is provided, comprising one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected with the memory, and the one or more computer programs are stored in the memory, when the electronic device is running, the processor executes the one or more computer programs stored in the memory, so that the electronic device executes a DAG-based hierarchical data storage and loading method as described in any of the above technical solutions.

[0025] According to an aspect of the present application, there is provided a computer readable storage medium for storing computer instructions, which when executed by a processor, implement a DAG-based hierarchical data storage and loading method as described in any of the above technical solutions.

[0026] Compared with the prior art, the present application has the following beneficial effects:

[0027] The present application provides a DAG-based hierarchical data storage and loading method, electronic equipment and storage medium, which realizes hierarchical data storage by constructing a DAG model, then loads data in a depth-first traversal manner, and finally extracts information index through the relationship link between hierarchical data, effectively solving the problem of hierarchical data storage and loading, and having the advantages of high data storage efficiency and fast loading speed.

[0028] The present application can adapt to the needs of big data processing and has important practical value for efficient storage and loading of data. It can process massive cloud data and complex web data, and has excellent practicability and universality. BRIEF DESCRIPTION OF DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0030] Figure 1 Schematically represents a directed acyclic graph;

[0031] Figure 2 Schematically represents a structure diagram of hierarchical data according to an embodiment of the present application;

[0032] Figure 3 Schematically represents a directed acyclic graph of hierarchical data according to an embodiment of the present application;

[0033] Figure 4 Schematically represents a flowchart of the DAG-based hierarchical data storage and loading method provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0034] The description of the embodiments of the present specification should be combined with the corresponding drawings, which should be considered as a part of the complete specification. In the drawings, the shape or thickness of the embodiments can be exaggerated and simplified or facilitated for illustration. Furthermore, parts of the structures in the drawings will be described separately, and it should be noted that the elements not shown or not described in the drawings are in the form known to those skilled in the art.

[0035] The description of the embodiments herein, any reference to direction and position, is only for the convenience of description, and cannot be understood as any limitation on the scope of protection of the present application. The following description of the preferred embodiments will involve a combination of features, which can exist independently or in combination, and the present application is not particularly limited to the preferred embodiments. The scope of the present application is defined by the claims.

[0036] As shown in Figure 1 The present application provides a DAG-based hierarchical data storage and loading method, comprising the following steps:

[0037] Step S1, constructing a DAG hierarchical data storage model and storing hierarchical data;

[0038] In step S1, specifically comprising:

[0039] Step S11, constructing a node for representing data hierarchy;

[0040] Step S12, constructing edge connections between nodes according to the hierarchical relationship between hierarchical data, forming a DAG hierarchical data storage model;

[0041] Step S13, storing data attribute information of each node of the DAG hierarchical data storage model;

[0042] Step S14, maintaining the relationship between each node and its corresponding parent node according to the DAG hierarchical data storage model, establishing a hierarchical data table, which contains the corresponding relationship between all parent nodes and child nodes in the DAG hierarchical data storage model;

[0043] Step S15, adding, deleting, modifying and inquiring the data attribute information of the DAG hierarchical data storage model and storing it.

[0044] The data attribute information further includes data name, data number, data type and description.

[0045] Step S2, traversing the data in the DAG hierarchical data storage model, using a depth-first recursive algorithm to load hierarchical data;

[0046] In step S2, specifically comprising:

[0047] Step S21: Build a temporary T-table and transfer the hierarchical data table to the temporary T-table; the temporary T-table includes a parent node column and a child node column, and the child node column contains the child nodes corresponding to the nodes in the parent node column;

[0048] Step S22: Count the number of node names in the temporary T table to obtain data record t1;

[0049] Step S23, determine whether the data record exists t1=0; if so, end; otherwise, execute step S24;

[0050] Step S24: traverse the temporary T table, obtain the hierarchical data corresponding to the nodes in the temporary T table that are in the parent node column but not in the child node column, and insert them into the result set;

[0051] Step S24 further includes: inserting the hierarchical data of the node into the result set, and adding an index to the hierarchical data inserted into the result set.

[0052] Step S25: Delete the node in the parent node column whose hierarchical data is inserted into the result set and its corresponding child node column;

[0053] Step S26, execute step S22.

[0054] Step S3: extract information indexes through relationship links between hierarchical data.

[0055] According to the index of the hierarchical data in the result set, information index extraction can be performed according to the relationship links between the hierarchical data, thereby facilitating the acquisition of the corresponding hierarchical data and improving the efficiency of obtaining the hierarchical data.

[0056] like Figure 1 As shown in the figure, in a directed acyclic graph (DAG), numbered nodes represent data, and the direction of arrows represents the relationship and connection between data. By constructing such a directed acyclic graph (DAG), data storage is achieved. When loading, data with fewer or no dependencies is loaded first according to the direction of the arrows, thereby improving the efficiency of data loading.

[0057] The present invention realizes the storage of hierarchical data by constructing a DAG model and adopts a priority traversal method to load data. It has the advantages of high data storage efficiency and fast loading speed, and can accurately process hierarchical data. It has broad application prospects and can be widely used in big data processing, web page rendering, 3D modeling and other fields.

[0058] The present application can be seen from the topological sorting idea of graph theory and the improved algorithm of DAG in hierarchical data loading to prevent nesting errors, which avoids the shortcomings of the commonly used algorithm of multiple traversals and comparisons of the same node. Further, in each loop process, the recorded node is necessarily a top node, because in each loop, the deleted node is a node without a predecessor, and the number of loops is reduced by one each time, effectively reducing the complexity of code execution, saving calculation time and computer resources.

[0059] According to an aspect of the present application, an electronic device is provided, comprising one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected with the memory, and the one or more computer programs are stored in the memory, and when the electronic device is running, the processor executes the one or more computer programs stored in the memory, so that the electronic device executes a DAG-based hierarchical data storage and loading method according to any of the above technical solutions.

[0060] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0061] According to an aspect of the present application, a computer readable storage medium is provided for storing computer instructions, which are executed by a processor to implement a DAG-based hierarchical data storage and loading method according to any of the above technical solutions.

[0062] The computer readable storage medium can include any medium capable of storing or transmitting information. Examples of the computer readable storage medium include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0063] Moreover, it should be noted that the present application can be provided as a method, an apparatus, or a computer program product. Therefore, the present application embodiments can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application embodiments can take the form of a computer program product on one or more computer-usable storage media (including disks, diskettes, tapes, optical, silicon, solid substrate, etc.) embodying computer-readable instructions.

[0064] The present application embodiments are described with reference to the flowchart illustrations and / or block diagrams of the methods, terminal devices (systems) and computer program products according to the present application embodiments. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing terminal devices to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal devices, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0065] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal devices to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means that implement the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.

[0066] It should also be noted that the terms "comprising", "including", or any other variant thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article or terminal device that comprises a list of elements does not include only those elements in the list, but can also include other elements not expressly listed or inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising a means" does not exclude the presence of additional identical elements in the process, method, article or terminal device including the stated element.

[0067] Finally, it should be noted that the above description is of preferred embodiments of the application, and that although preferred embodiments of the application have been described, numerous changes and modifications can be made to the preferred embodiments without departing from the principles of the application, and that such changes and modifications are contemplated as falling within the scope of the application. Accordingly, the appended claims are intended to embrace all such changes and modifications.

Claims

1. A DAG-based hierarchical data storage and loading method, characterized in that: The following steps are involved: Step S1: Build a DAG hierarchical data storage model and store hierarchical data; Step S2: traverse the data in the DAG hierarchical data storage model and load the hierarchical data using a depth-first recursive algorithm; Step S3: extracting information indexes through the relationship links between the hierarchical data; In the step S1, it specifically includes: Step S11: constructing nodes to represent data levels; Step S12: constructing edges to connect the nodes based on the hierarchical relationship between the hierarchical data to form the DAG hierarchical data storage model; Step S13: storing data attribute information of each node in the DAG hierarchical data storage model; Step S14: Maintain the relationship between each node and its corresponding parent node according to the DAG hierarchical data storage model, and establish a hierarchical data table, wherein the hierarchical data table contains the corresponding relationship between all parent nodes and child nodes in the DAG hierarchical data storage model; Step S15: Add, delete, modify, query, and store the data attribute information of the DAG hierarchical data storage model; In the step S2, it specifically includes: Step S21: construct a temporary T-table and transfer the hierarchical data table to the temporary T-table; the temporary T-table includes a parent node column and a child node column, and the child node column contains child nodes corresponding to the nodes in the parent node column; Step S22: Count the number of nodes in the temporary T table to obtain data record t1; Step S23, determine whether the data record exists t1=0; if so, end; otherwise, execute step S24; Step S24: traverse the temporary T table, obtain the hierarchical data corresponding to the nodes in the temporary T table that are in the parent node column but not in the child node column, and insert the hierarchical data into the result set; Step S25: Delete the node in the parent node column whose hierarchical data is inserted into the result set and its corresponding child node column; Step S26, execute step S22.

2. The DAG-based hierarchical data storage and loading method according to claim 1, characterized in that: The data attribute information includes data name, data number, data type and description.

3. The DAG-based hierarchical data storage and loading method according to claim 1, characterized in that: In the step S24, it further includes: The hierarchical data of the node is inserted into the result set, and an index is added to the hierarchical data inserted into the result set.

4. An electronic device, characterized in that: include: One or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, and the one or more computer programs are stored in the memory. When the electronic device is running, the processor executes the one or more computer programs stored in the memory to enable the electronic device to perform the DAG-based hierarchical data storage and loading method as described in any one of claims 1 to 3.

5. A computer-readable storage medium, characterized in that Used to store computer instructions, which, when executed by a processor, implement the DAG-based hierarchical data storage and loading method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Service deployment method and device, equipment and storage medium

    CN117041053A

  • Techniques for determining ancestry in directed acyclic graphs

    US20210182273A1