Correlation data exporting and importing method, device, equipment and storage medium
By constructing a directed graph and using topological sorting, the problem of cumbersome and complex data migration operations in existing technologies is solved, enabling automated data export and import, and improving data migration efficiency and ease of operation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- KINGDEE SOFTWARE(CHINA) CO LTD
- Filing Date
- 2022-11-08
- Publication Date
- 2026-06-12
AI Technical Summary
Existing data migration methods are cumbersome, have strong limitations, are difficult to implement, and are inefficient. In particular, when migrating multiple relational tables, traditional methods cannot achieve automated data export and import, resulting in a complex implementation process.
A directed graph is constructed based on dynamic objects. Nodes are traversed using topological sorting to generate a resource list with temporal relationships. The list is stored and exported in JSON format, supporting one-click export and import of related data. Topological sorting is used to achieve automated data export and import.
It enables one-click export and import of documents and all their dependent basic data, supports asynchronous export with real-time progress monitoring, stores files in JSON format for easy reading, writing and transmission, is easy to operate, and ensures data integrity and accuracy.
Smart Images

Figure CN115905353B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of integrated service technology, and in particular to a method, apparatus, device and storage medium for exporting and importing associated data. Background Technology
[0002] In data management, data migration is one of the most common scenarios. When migrating large amounts of scheme or configuration information, a method for exporting and importing data is needed that can automatically trace the origin of the main resource and achieve a one-time export and import, thereby improving the efficiency of the data migration process.
[0003] Currently, there are generally two ways to switch an integrated solution that links multiple basic data sets from a development environment to a test or production environment: one is through configuration by implementation personnel or import / export via Excel; the other is through pre-configured SQL import / export. However, standard Excel import / export functions often only support data import / export for certain types of business documents. When multiple documents exist, manual import is required sequentially, and multiple Excel files need to be exported, which is not only cumbersome but also has significant limitations. Pre-configured SQL import / export does not automatically export data for basic data containing reference relationships, or scenarios where journal entries or sub-entries reference basic data. It also cannot support the export of complex hierarchical structures. Because data migration in this method involves multiple relational tables with sequential dependencies, the implementation process is extremely complex, resulting in poor implementability and hindering widespread application. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, device and storage medium for exporting and importing related data, which at least solves one of the technical problems of existing data migration methods, such as cumbersome operation, strong limitations, high implementation difficulty and low efficiency.
[0005] To achieve the above objectives, in a first aspect, this application provides a method for exporting associated data, comprising:
[0006] Based on the associated data, a directed graph of the associated data is constructed with dynamic objects as vertices and the dependencies between dynamic objects as edges;
[0007] Exporting the associated data includes traversing each node in the directed graph using a topological sorting method, generating a resource list with temporal relationships, and then exporting it.
[0008] In some implementations of the first aspect, the method of traversing each node in the directed graph using topological sorting includes:
[0009] Traverse the dynamic objects and add them to the vertex positions of the directed graph, then determine whether the addition was successful;
[0010] If the addition is successful, the properties of the dynamic object are traversed in a loop, the reference relationships are collected, and the edges and vertices of the directed graph are constructed.
[0011] If the addition fails, return to the step of traversing the dynamic object and adding it to the vertex position of the directed graph;
[0012] After adding all dynamic objects, perform a topological sort on the directed graph and output the nodes in the order they are depended on.
[0013] In some implementations of the first aspect, the iterative traversal of the properties of the dynamic object, collection of reference relationships, and construction of the edges and vertices of the directed graph include:
[0014] If the properties of a dynamic object are basic data and the graph contains references, then ignore it; otherwise, add it to a vertex of the directed graph and add a dependency edge.
[0015] If the attribute of the dynamic object is an entry, then obtain all field attributes of the entry and recursively call the step of looping through the attributes of the dynamic object;
[0016] If the properties of a dynamic object are restricted to basic data that cannot be exported, then ignore them.
[0017] In some implementations of the first aspect, generating and exporting a resource list with temporal relationships includes:
[0018] The resources are serialized into Map objects one by one, and if there are any post-plugins, they are executed to achieve data preprocessing.
[0019] The Map object is converted into a JSON string, the resources are split, and downloaded as text, Excel, or other custom format files via the output stream;
[0020] Output a list containing the main resource and referenced resources, arranged in order.
[0021] In some implementations of the first aspect, when performing the step of generating and exporting a resource list with temporal relationships, indirect reference fields can be exported together by custom extended fields.
[0022] Secondly, this application also provides a method for importing related data, which, in accordance with the method for exporting related data as described in any of the preceding claims, further includes:
[0023] The exported resource list is parsed and imported sequentially according to preset rules.
[0024] In some implementations of the second aspect, the parsing of the exported resource list and its sequential import according to preset rules includes:
[0025] The file data in the resource list is parsed, the JSON data is converted into a Map object, and then serialized into a dynamic object; the data in the dynamic object includes the main resource and the referenced resources;
[0026] Determine if there is any plugin intervention. If so, execute the plugin processing; otherwise, perform the import operation, retrieve the data from the dynamic object, and save it.
[0027] In some implementations of the second aspect, the import operation includes:
[0028] When the dynamic object is the primary resource, the import mode is set to overwrite mode;
[0029] When a dynamic object is a referenced resource, the import mode is set to add mode, or both add mode and overwrite mode are supported simultaneously; where,
[0030] The overwrite mode means that if new data is added during import, the new data will be added; otherwise, the existing data will be updated directly.
[0031] The new addition mode involves adding data without updating it, based on existing data.
[0032] Thirdly, this application also provides a data export device, comprising:
[0033] The directed graph construction module is used to construct a directed graph of associated data, with dynamic objects as vertices and the dependencies between dynamic objects as edges.
[0034] The export module is used to export the associated data, including traversing each node in the directed graph using a topological sorting method, generating a resource list with temporal relationships, and exporting it.
[0035] Fourthly, this application also provides a data import apparatus, referring to the data export apparatus described above, further comprising:
[0036] The import module is used to parse the exported resource list and import it sequentially according to preset rules.
[0037] Fifthly, this application also provides a computer device, including a processor and a memory, the memory being used to store a computer program, which, when executed by the processor, implements the associated data export method as described in the first aspect, or the associated data import method as described in the second aspect.
[0038] Sixthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the associated data export method as described in the first aspect, or the associated data import method as described in the second aspect.
[0039] In a seventh aspect, this application also provides a computer program product that, when run on a terminal device, causes the computer device to implement the associated data export method as described in the first aspect, or the associated data import method as described in the second aspect.
[0040] Compared to existing technologies, the advantages of this application are as follows:
[0041] 1) This application supports one-click export of documents and all dependent basic data;
[0042] 2) This application supports asynchronous export, allowing you to view the export progress in real time;
[0043] 3) The files in this application are stored in JSON format for easy reading, writing, and transmission;
[0044] 4) This application can import documents and all their dependent basic data with one click, and all related document data will be automatically added without any other operations, making the operation very simple. Attached Figure Description
[0045] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0046] Figure 1 This is a schematic diagram illustrating the principle of resource dependencies in a service process provided in a certain embodiment of this application;
[0047] Figure 2 This is a schematic diagram of the document composition structure provided in a certain embodiment of this application;
[0048] Figure 3 This is a flowchart illustrating a method for exporting associated data according to a certain embodiment of this application;
[0049] Figure 4 This is a schematic diagram of the directed graph export and import principle provided in a certain embodiment of this application;
[0050] Figure 5 This is a flowchart of the document export process provided in a certain embodiment of this application;
[0051] Figure 6 This is a flowchart illustrating a method for importing associated data according to a certain embodiment of this application;
[0052] Figure 7 This is a flowchart of the document import process provided in a certain embodiment of this application;
[0053] Figure 8 This is a schematic diagram of the structure of an associated data export device provided in a certain embodiment of this application;
[0054] Figure 9 This is a schematic diagram of the structure of a data import device provided in a certain embodiment of this application;
[0055] Figure 10 This is a schematic diagram of the structure of a computer device provided in a certain embodiment of this application. Detailed Implementation
[0056] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0057] It should be understood that the step numbers used in the text are for ease of description only and are not intended to limit the order in which the steps are performed.
[0058] It should be understood that the terminology used in this application specification is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this application specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0059] The terms “comprising” and “including” indicate the presence of the described feature, whole, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0060] The term “and / or” refers to any combination of one or more of the associated listed items, as well as all possible combinations, and includes these combinations.
[0061] To aid understanding, the relevant terms used in this application will first be explained:
[0062] JSON: A lightweight data exchange or storage format.
[0063] Basic data: This refers to fundamental information that can be represented by a code for a specific business object, preparing for subsequent processes and operations. Materials, currencies, and accounts are typical examples of basic data and can be referenced in documents.
[0064] Documents: Data models or business objects that implement business scenarios and are used to store transaction data. Examples include expense reimbursement forms and travel expense reimbursement forms.
[0065] Journal entries: Hierarchical data models upon which documents or basic data depend, generally used to describe detailed list data.
[0066] Sub-entries: Sub-entries refer to a subset of entries. An entry line can contain multiple sub-entries and are used to describe a list data structure at a deeper level.
[0067] Main resources: Resources that are of primary concern in business operations, including field attributes, types, operations, and events.
[0068] Referenced resources: Referenced resources are relative to the main resource. The main resource depends on the referenced resource to ensure data integrity. Referenced resources can also have referenced resources.
[0069] Directed graph: A graph is a data structure consisting of vertices and the relationships between them. Graph = (V, E), where V are vertices and E are called edges, which describe the relationships between vertices. An ordered set of vertex pairs connected by edges is a directed graph.
[0070] It should be noted that a complete integration solution / service process (main resource) depends on numerous resources, including the startup solution, data integration solution, integration objects, value transformation rules, data sources, and reference data solutions. Among these, Figure 1 It provides the resource dependencies for a certain service process. For example... Figure 1 As shown, the dependencies in this service process are relatively complex, with various resources potentially having dependencies on each other, ultimately forming a dependency network. Based on Figure 1 For the service process provided, if you want to switch an integrated solution or service that involves multiple basic data sets from the development environment to the testing or production environment, there are generally two ways: one is to configure it by the implementation personnel or to export and import it from Excel; the other is to import and export it through a pre-configured SQL.
[0071] This section uses a document as an example to explain how to export and import data from Excel. Please refer to [link / reference]. Figure 2 , Figure 2 This provides a document structure. (The structure consists of...) Figure 2 As can be seen, a document is typically divided into a document header and a primary entry; the document header usually contains "general fields" and "basic information"; and under the primary entry, there can be secondary, tertiary, and so on up to multi-level entries, each of which can contain corresponding fields and information. Based on Figure 2The document structure and standard Excel import / export functions allow for the import and export of data from document headers, entries, and sub-entries, making it suitable for importing and exporting data from a single business document. However, if multiple documents require data import, multiple Excel files need to be exported, and then imported sequentially as needed. This involves multiple steps and is a very cumbersome process.
[0072] Pre-built SQL scripts are one way to migrate data. This method involves manually organizing the reference relationships, generating scripts in sequence, and importing them sequentially during the import process. However, it does not automatically extract data from basic information or other data containing reference relationships, or from journal entries or sub-entries referencing basic information. Furthermore, this method using pre-built SQL is extremely complex and difficult to implement.
[0073] In the methods described above, the migration of data involves multiple relational tables with sequential dependencies, making the implementation process extremely complex and conservatively estimated to require 1-2 person-days, or even more. Therefore, addressing the problems inherent in the aforementioned data migration methods, this application aims to provide a method for exporting and importing relational data. This method can automatically trace the source of relational data from the top-level data and export its related dependencies in one go, importing them sequentially as needed, simplifying the operation. Simultaneously, it ensures data integrity and accuracy during the import and export process. The embodiments of this application are applicable to various Enterprise Resource Planning (ERP) systems, including but not limited to manufacturing management systems, supply chain systems, human resources systems, financial systems, tax systems, and auditing systems.
[0074] First aspect:
[0075] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating a method for exporting associated data according to an embodiment of this application. The method for exporting associated data according to this application can be applied to terminal devices, including but not limited to smartphones, laptops, tablets, and desktop computers. Figure 3 As shown, the data calculation logic demonstration method of this embodiment includes steps S10 and S20, which are described in detail below:
[0076] Step S10: Based on the associated data, construct a directed graph of the associated data, with dynamic objects as vertices and the dependencies between dynamic objects as edges.
[0077] For documents or basic data, there are situations where entries depend on basic data, or entries depend on sub-entries, making the referencing relationships very complex. During import or export, ensuring data integrity is paramount. Exporting requires traversing all attributes and sub-attributes, exporting them sequentially, while importing them sequentially. To ensure data integrity, this step utilizes a directed graph to represent the relationships between data.
[0078] It should be noted that directed graphs are very suitable algorithmic models for describing complex reference relationships. Therefore, step S10 constructs a graph of dynamic objects, such as... Figure 4 As shown. Specifically, a dynamic object refers to the data model of a document / basic data. During construction, dynamic objects are regarded as vertices of a graph, and the dependency relationship between any two dynamic objects is regarded as an edge (edge, e1, e2, etc.), pointing from the dependent to the dependent. By iterating through the metadata model of dynamic objects in a loop and recursively, a directed graph can be quickly constructed.
[0079] Step S20: Export the associated data, including traversing each node in the directed graph using a topological sorting method, generating a resource list with temporal relationships, and exporting it.
[0080] In the steps above, a directed graph of the associated data has been established. This step primarily involves exporting this associated data. Specifically, based on the constructed directed graph, each resource is analyzed. A topological sorting method is used to traverse each node in the graph, checking if the resource's preceding dependencies have already been visited. If so, the dependencies are output; otherwise, the next node is visited. After all nodes have been traversed, a sequential list of resources is obtained and finally output to a file.
[0081] In summary, the associated data export method provided in this embodiment, based on a directed graph, can clearly represent the dependencies between dynamic objects. By sorting resources and using topological sorting, it can ensure the integrity and orderliness of data during export, greatly simplifying the operation process of traditional data migration methods and improving data export efficiency.
[0082] In one exemplary embodiment, in Figure 3 Based on the illustrated embodiment, step S20 above, which involves traversing each node in the directed graph using a topological sorting method, specifically includes:
[0083] 2.1) Traverse the dynamic objects and add them to the vertex positions of the directed graph, and determine whether the addition was successful;
[0084] 2.2) If the addition is successful, iterate through the properties of the dynamic object, collect reference relationships, and construct the edges and vertices of the directed graph;
[0085] 2.3) If the addition fails, return to the step of traversing the dynamic object and adding it to the vertex position of the directed graph;
[0086] 2.4) After adding all dynamic objects, perform a topological sort on the directed graph and output the nodes in the order they are dependent on.
[0087] In a specific embodiment, step 2.2) involves iterating through the attributes of the dynamic object, collecting reference relationships, and constructing the edges and vertices of a directed graph, specifically including:
[0088] 2.2.1) If the attributes of a dynamic object are basic data and the graph contains reference relationships, then ignore it; otherwise, add it to the vertex of the directed graph and add dependent edges.
[0089] 2.2.2) If the attribute of the dynamic object is an entry, then obtain all field attributes of the entry and recursively call the step of looping through the attributes of the dynamic object;
[0090] 2.2.3) If the properties of a dynamic object are restricted to basic data that cannot be exported, then ignore it.
[0091] In one specific embodiment, step S20 involves generating and exporting a resource list with temporal relationships, including the following:
[0092] 2.5) Serialize the resources into Map objects sequentially, and execute any post-plugins to perform data preprocessing;
[0093] 2.6) Convert the Map object to a JSON string, split the resources, and download them as text, Excel, or other custom format files via the output stream; the output contains a List of main resources and referenced resources, arranged in order.
[0094] Preferably, when performing the step of generating and exporting a resource list with temporal relationships, custom extended fields are supported to export indirect reference fields together.
[0095] See Figure 5 To aid understanding, in one specific implementation, a dynamic object pair document is used as an example, combined with... Figure 5 The provided export flowchart details the document export process, specifically including the following steps:
[0096] 1) Create a graph.
[0097] 2) Iterate through the list of document objects to be exported and add the objects to the vertices of the graph.
[0098] 3) If the addition is successful, continue adding its reference relationship and jump to step 4); otherwise ignore it and jump to step 2).
[0099] 4) Loop through the attributes of the document object, collect reference relationships, and construct the edges and vertices of a directed graph:
[0100] a) If the attribute is basic data and the graph contains references, it means it has already been added and needs to be ignored; otherwise, add it to a vertex of the graph and add a dependency edge.
[0101] b) If the attribute is an entry, then retrieve all field attributes of the entry and recursively call step 4);
[0102] c) If the attribute is restricted from exporting basic data, then ignore it;
[0103] d) Supports custom extended fields, allowing indirectly referenced fields to be exported as well.
[0104] 5) Perform a topological sort (breadth-first traversal) on the graph: Output nodes in the order of dependencies. If a path a→b exists, it means b depends on a. The topological sort first outputs nodes that do not depend on other nodes; after excluding these nodes from the graph, it outputs nodes that do not depend on other nodes, until all nodes have been output. If not all nodes in the graph can be output after sorting, it means a cycle exists in the graph, and the extraction fails.
[0105] 6) Output a list containing the main resource and referenced resources, arranged in order.
[0106] 7) Serialize the resources into Map objects one by one, and execute them if there are post-plugins to achieve data preprocessing.
[0107] 8) Convert the Map to a JSON string, with resources separated by \n, and download it as a text, Excel, or other custom format file via the output stream.
[0108] In summary, the above steps can achieve the complete export of all document data, ensuring data integrity while completing the entire process relatively quickly.
[0109] In some possible implementations, the above-mentioned associated data export method can also be extended with plugins according to business needs. For example, related field information can be desensitized during export. This extension method can avoid interference from irrelevant information and further accelerate the efficiency of data migration.
[0110] The second aspect:
[0111] See Figure 6In one embodiment of this application, a method for importing associated data is also provided, which, based on the method for exporting associated data as described in the first aspect, further includes:
[0112] Step S30: Parse the exported resource list and import it sequentially according to preset rules.
[0113] In this step, during the import process, the resource list is parsed sequentially based on the generated files and imported in order, ultimately ensuring the integrity and orderliness of the data.
[0114] In an exemplary embodiment, step S30 involves parsing the exported resource list and importing it sequentially according to preset rules, specifically including:
[0115] 3.1) Parse the file data in the resource list, convert the JSON data into a Map object, and then serialize it into a dynamic object; the data in the dynamic object includes the main resource and referenced resources;
[0116] 3.2) Determine if there is any plugin intervention. If so, execute the plugin processing; otherwise, execute the import operation and save the data in the dynamic object.
[0117] Further, the import operation includes:
[0118] A) When the dynamic object is the primary resource, the import mode is set to overwrite mode;
[0119] B) When the dynamic object is a referenced resource, the import mode is set to add mode, or both add mode and overwrite mode are supported simultaneously; where,
[0120] The overwrite mode means that if new data is added during import, the new data will be added; otherwise, the existing data will be updated directly.
[0121] The new addition mode involves adding data without updating it, based on existing data.
[0122] See Figure 7 To aid understanding, in one specific implementation, a dynamic object pair document is used as an example, combined with... Figure 7 The provided import flowchart details the document import process, specifically including the following steps:
[0123] 1) During import, parse the file data.
[0124] 2) Convert JSON data into a Map and then serialize it into a dynamic object model.
[0125] 3) Two import modes are provided: Add (only adds without updating) and Overwrite (updates if the resource exists, adds if it doesn't). For main resources, the default is always Overwrite mode; for referenced resources, both Add and Overwrite modes are supported, with Add mode as the default. This is because referenced resources are shared by multiple main resources, preventing accidental overwriting.
[0126] 4) Check if there are any plugins interfering; if so, execute the plugin processing.
[0127] 5) Perform the final import operation and call the business object to save.
[0128] 6) For resources within the same database, the save operations of the referenced resource and the main resource are performed within the same transaction to ensure consistency whether successful or not.
[0129] In summary, the associated data import method provided in this embodiment exports the solution and its dependencies based on a directed acyclic graph, and uses topological sorting (TOP-SORT) to import the solutions sequentially according to their reference order. Furthermore, this method supports reference filtering, desensitization, and reference replacement operations, and the export tool is universal, supporting the import and export of various metadata types. Extended associated information can also be automatically traced without additional configuration.
[0130] In some possible implementations, the above-mentioned associated data import method can also be extended with plugins according to business needs. For example, the state of related data can be disabled during import. This extension method can avoid interference from irrelevant information and further accelerate the efficiency of data migration.
[0131] Third aspect:
[0132] To execute the associated data export method corresponding to the above method embodiments, in order to achieve the corresponding functions and technical effects, see [link to documentation]. Figure 8 , Figure 8 This diagram illustrates a structural block diagram of an associated data export device according to an embodiment of this application. For ease of explanation, only the parts relevant to this embodiment are shown. The associated data export device provided in this embodiment includes:
[0133] Directed graph construction module 01 is used to construct a directed graph of associated data based on associated data, with dynamic objects as vertices and the dependencies between dynamic objects as edges;
[0134] The export module 02 is used to export the associated data, including traversing each node in the directed graph using a topological sorting method, generating a resource list with temporal relationships, and exporting it.
[0135] The aforementioned associated data export device can implement the associated data export method of the above method embodiments. The options in the above method embodiments are also applicable to this embodiment, and will not be detailed here. The remaining content of this application embodiment can be referred to the content of the above method embodiments, and will not be repeated in this embodiment.
[0136] Fourth aspect:
[0137] To execute the associated data import method corresponding to the above method embodiments, in order to achieve the corresponding functions and technical effects, see [link to documentation]. Figure 9 , Figure 9 This diagram illustrates a structural block diagram of an associated data import device according to an embodiment of this application. For ease of explanation, only the parts relevant to this embodiment are shown. The associated data import device provided in this application, based on the associated data export device described in the third aspect, further includes:
[0138] Import module 03 is used to parse the exported resource list and import it sequentially according to preset rules.
[0139] The aforementioned associated data import device can implement the associated data import method of the above method embodiments. The options in the above method embodiments are also applicable to this embodiment, and will not be detailed here. The remaining content of this application embodiment can be referred to the content of the above method embodiments, and will not be repeated in this embodiment.
[0140] Fifth aspect:
[0141] Please see Figure 10 , Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 10 As shown, the computer device 10 of this embodiment includes: at least one processor 100 ( Figure 10 (Only one is shown) a processor, a memory 110, and a computer program 120 stored in the memory 110 and executable on the at least one processor 100, wherein the processor 100 executes the computer program 120 to implement the steps in any of the above method embodiments.
[0142] The computer device 10 may be a computing device such as a smartphone, tablet, desktop computer, or cloud server. This computer device may include, but is not limited to, a processor 100 and a memory 110. Those skilled in the art will understand that... Figure 10 The computer device 10 is merely an example and does not constitute a limitation on the computer device 10. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.
[0143] The processor 100 may be a Central Processing Unit (CPU), or it may 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 gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0144] In some embodiments, the memory 110 may be an internal storage unit of the computer device 10, such as a hard disk or memory of the computer device 10. In other embodiments, the memory 110 may be an external storage device of the computer device 10, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device 10. Furthermore, the memory 110 may include both internal and external storage units of the computer device 10. The memory 110 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory 110 can also be used to temporarily store data that has been output or will be output.
[0145] In addition, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above method embodiments.
[0146] This application provides a computer program product that, when run on a computer device, enables the computer device to execute the steps described in the various method embodiments above.
[0147] In the several embodiments provided in this application, it will be understood that each block in the flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the figures. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved.
[0148] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion 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 to execute all or part of the steps of the methods described in the various embodiments of this application. 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.
[0149] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this application. It should be understood that the above descriptions are merely specific embodiments of this application and are not intended to limit the scope of protection of this application. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application for those skilled in the art.
Claims
1. A method for exporting related data, characterized in that, include: Based on the associated data, a directed graph of the associated data is constructed with dynamic objects as vertices and the dependencies between dynamic objects as edges; Exporting the associated data includes traversing each node in the directed graph using a topological sorting method, generating a resource list with temporal relationships, and then exporting it. The method of traversing each node in the directed graph using topological sorting includes: Traverse the dynamic objects and add them to the vertex positions of the directed graph, then determine whether the addition was successful; If the addition is successful, the properties of the dynamic object are traversed in a loop, the reference relationships are collected, and the edges and vertices of the directed graph are constructed. If the addition fails, return to the step of traversing the dynamic object and adding it to the vertex position of the directed graph; After adding all dynamic objects, perform a topological sort on the directed graph and output the nodes in the order they are depended on.
2. The method for exporting associated data according to claim 1, characterized in that, The process of iterating through the properties of dynamic objects, collecting reference relationships, and constructing the edges and vertices of a directed graph includes: If the properties of a dynamic object are basic data and the graph contains references, then ignore it; otherwise, add it to a vertex of the directed graph and add a dependency edge. If the attribute of the dynamic object is an entry, then obtain all field attributes of the entry and recursively call the step of looping through the attributes of the dynamic object; If the properties of a dynamic object are restricted to basic data that cannot be exported, then ignore them.
3. The method for exporting associated data according to claim 1, characterized in that, The process of generating and exporting a resource list with temporal relationships includes: The resources are serialized into Map objects one by one, and if there are any post-plugins, they are executed to achieve data preprocessing. The Map object is converted into a JSON string, the resources are split, and downloaded as text, Excel, or other custom format files via the output stream; Output a list containing the main resource and referenced resources, arranged in order.
4. The method for exporting associated data according to any one of claims 1 or 3, characterized in that, When performing the step of generating and exporting a resource list with temporal relationships, indirect reference fields can be exported together by customizing extended fields.
5. A method for importing related data, referring to the method for exporting related data as described in any one of claims 1-4, characterized in that, Also includes: The exported resource list is parsed and imported sequentially according to preset rules.
6. The method for importing associated data according to claim 5, characterized in that, The process of parsing the exported resource list and importing it sequentially according to preset rules includes: The file data in the resource list is parsed, the JSON data is converted into a Map object, and then serialized into a dynamic object; the data in the dynamic object includes the main resource and the referenced resources; Determine if there is any plugin intervention. If so, execute the plugin processing; otherwise, perform the import operation, retrieve the data from the dynamic object, and save it.
7. The method for importing associated data according to claim 6, characterized in that, The import operation includes: When the dynamic object is the primary resource, the import mode is set to overwrite mode; When a dynamic object is a referenced resource, the import mode is set to add mode, or both add mode and overwrite mode are supported simultaneously; where, The overwrite mode means that if new data is added during import, the new data will be added; otherwise, the existing data will be updated directly. The new addition mode involves adding data without updating it, based on existing data.
8. A data export device, characterized in that, include: The directed graph construction module is used to construct a directed graph of associated data, with dynamic objects as vertices and the dependencies between dynamic objects as edges. The export module is used to export the associated data, including traversing each node in the directed graph using a topological sorting method, generating a resource list with temporal relationships, and exporting it. The export module traverses each node in the directed graph using a topological sorting method, including: The export module traverses the dynamic objects and adds them to the vertex positions of the directed graph, and determines whether the addition is successful. If the addition is successful, the properties of the dynamic object are traversed in a loop, the reference relationships are collected, and the edges and vertices of the directed graph are constructed. If the addition fails, return to the step of traversing the dynamic object and adding it to the vertex position of the directed graph; After adding all dynamic objects, perform a topological sort on the directed graph and output the nodes in the order they are depended on.
9. A data import device, referring to the data export device as described in claim 8, characterized in that, Also includes: The import module is used to parse the exported resource list and import it sequentially according to preset rules.
10. A computer device, characterized in that, It includes a processor and a memory, the memory being used to store a computer program, which, when executed by the processor, implements the associated data export method as described in any one of claims 1 to 4, or implements the associated data import method as described in any one of claims 5 to 7.
11. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the associated data export method as described in any one of claims 1 to 4, or the associated data import method as described in any one of claims 5 to 7.
12. A computer program product, characterized in that, When the computer program product is run on a terminal device, it causes the computer device to implement the associated data export method as described in any one of claims 1 to 4, or the associated data import method as described in any one of claims 5 to 7.