Structured model data processing method and device, computer equipment and storage medium

By obtaining the user's target data list, processing the leaf nodes in the YANG model, generating the target processing model and converting data, the problem of inefficient data processing in traditional technology is solved and more efficient data processing is achieved.

CN119740552APending Publication Date: 2025-04-01CHINA TELECOM CLOUD TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411790598.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

When using the YANG model in traditional technology, the processing efficiency is low, and all data needs to be loaded and processed, resulting in waste of resources and inefficient efficiency.

Method used

Provides a data processing method of a structured model. By obtaining the user's target data list, processing the leaf nodes in the to-process model, generating the target processing model, and reading and converting the data of all leaf nodes in the target processing model into data instances in the target format.

Benefits of technology

Improve data processing efficiency, avoid reading of all leaf node data, and directly convert the read data into data instance output in the target format, further improving processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740552A_ABST
    Figure CN119740552A_ABST
Patent Text Reader

Abstract

The invention relates to a data processing method and device of a structured model, computer equipment and a storage medium. The method comprises the steps of obtaining a target data list of a user; leaf nodes in the to-be-processed model are processed according to the target data list, and a target processing model is generated; the to-be-processed model is a tree structure model; and reading data of all leaf nodes in the target processing model, and converting the read data into a data instance in a target format to be output. The leaf nodes in the to-be-processed model are processed according to the target data list, so that the server does not need to read the data of all the leaf nodes of the to-be-processed model, the reading efficiency of the to-be-processed model is improved, the read data are directly converted into the data instance in the target format to be output, and the data processing efficiency is improved. And the data processing efficiency is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network technology, and in particular to a data processing method, device, computer equipment and storage medium for a structured model. Background Art

[0002] YANG file is a language that describes "network configuration data mode". The model described by YANG file satisfies the tree structure. The location where data is finally stored is the leaf node. When the data in the tree structure needs to be processed, the YANG model needs to be extracted and parsed.

[0003] In traditional technology, when using the YANG model, all data will be loaded and multiple file imports will be processed recursively. The final parsed YANG model contains all leaf node contents, and all leaf nodes will also be processed in subsequent uses, such as code generation, model viewing, etc.

[0004] However, the data processing method in the traditional technology has the problem of low processing efficiency. Summary of the invention

[0005] Based on this, it is necessary to provide a data processing method, device, computer equipment and storage medium of a structured model that can improve data processing efficiency in response to the above technical problems.

[0006] In a first aspect, the present application provides a data processing method for a structured model, the method comprising:

[0007] Get the user's target data list;

[0008] Processing leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model;

[0009] The data of all leaf nodes in the target processing model are read, and the read data are converted into data instances in the target format for output.

[0010] In one embodiment, the processing of leaf nodes in the to-be-processed model according to the target data list to generate a target processing model includes:

[0011] Traversing the model to be processed, and determining the path information of each leaf node in the model to be processed;

[0012] Marking the model to be processed according to the target data list and the path information of each leaf node, and determining marked nodes and unmarked nodes in the model to be processed;

[0013] The model to be processed is processed according to the marked nodes and the unmarked nodes to generate the target processing model.

[0014] In one embodiment, the processing of the to-be-processed model according to the marked nodes and the unmarked nodes to generate the target processing model includes:

[0015] The marked nodes in the model to be processed are retained, and the unmarked nodes are deleted from the model to be processed to generate the target processing model.

[0016] In one embodiment, marking the model to be processed according to the target data list and the path information of each leaf node and the path information of the node, and determining the marked nodes and unmarked nodes in the model to be processed includes:

[0017] Determine the target node indicated in the target data list, and determine the path information of the target node from the path information of each leaf node;

[0018] Determine the parent node of the target node according to the path information of the target node;

[0019] The target node and the parent node of the target node are marked to obtain the marked nodes, and other nodes in the model to be processed are used as the unmarked nodes.

[0020] In one embodiment, the step of reading data of all leaf nodes in the target processing model and converting the read data into data instance output in a target format includes:

[0021] Generate a model file corresponding to the target processing model according to the target processing model and the preset grammar specification; the model file includes at least one sub-model file;

[0022] According to the data type of each sub-model file, each sub-model file is converted into a data instance in a target format and outputted.

[0023] In one embodiment, converting each sub-model file into a data instance output in a target format according to the data type of each sub-model file comprises:

[0024] If the data type of the sub-model file is a first data type, generating a data structure and a first constructor corresponding to the first data type according to the attribute field in the sub-model file;

[0025] If the data type of the sub-model file is the second data type, the list is initialized and created and a second constructor is generated; the second constructor includes list elements;

[0026] If the data type of the sub-model file is the third data type, a third constructor is constructed according to the non-primary key type in the sub-model file.

[0027] In a second aspect, the present application also provides a data processing device for a structured model, comprising:

[0028] The acquisition module is used to obtain the user's target data list;

[0029] A generating module, used for processing the leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model;

[0030] The conversion module is used to read the data of all leaf nodes in the target processing model and convert the read data into data instances in the target format for output.

[0031] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0032] Get the user's target data list;

[0033] Processing leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model;

[0034] The data of all leaf nodes in the target processing model are read, and the read data are converted into data instances in the target format for output.

[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0036] Get the user's target data list;

[0037] Processing leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model;

[0038] The data of all leaf nodes in the target processing model are read, and the read data are converted into data instances in the target format for output.

[0039] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0040] Get the user's target data list;

[0041] Processing leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model;

[0042] The data of all leaf nodes in the target processing model are read, and the read data are converted into data instances in the target format for output.

[0043] The data processing method, device, computer equipment and storage medium of the structured model described above obtain the user's target data list; process the leaf nodes in the model to be processed according to the target data list to generate a target processing model; the model to be processed is a tree structure model; read the data of all leaf nodes in the target processing model, and convert the read data into a data instance output in the target format. Processing the leaf nodes in the model to be processed according to the target data list makes it unnecessary for the server to read the data of all leaf nodes of the model to be processed, thereby improving the reading efficiency of the model to be processed, and directly converting the read data into a data instance output in the target format, further improving the data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0045] Figure 1 An application environment diagram of a data processing method of a structured model in an embodiment;

[0046] Figure 2 A schematic diagram of a flow chart of a data processing method of a structured model in one embodiment;

[0047] Figure 3 is a flow chart of a data processing method of a structured model in another embodiment;

[0048] Figure 4 is a flow chart of a data processing method of a structured model in another embodiment;

[0049] Figure 5 is a flow chart of a data processing method of a structured model in another embodiment;

[0050] Figure 6 is a flow chart of a data processing method of a structured model in another embodiment;

[0051] Figure 7 is a flow chart of a data processing method of a structured model in another embodiment;

[0052] Figure 8 is a structural block diagram of a data processing device of a structured model in one embodiment;

[0053] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0055] The data processing method of the structured model provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 obtains the target data list from the terminal 102, and reads the data of all leaf nodes in the target processing model according to the target data list. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0056] In one embodiment, Figure 2 As shown, a data processing method for a structured model is provided, which is applied to Figure 1 The following is an example of a server in the example, including:

[0057] S201, obtaining a user's target data list.

[0058] The target data list may be a leaf node list, and the target data list may include multiple leaf node identifiers or leaf node names.

[0059] In an embodiment of the present application, the server may receive a target data list sent by a terminal, or the server may obtain a user's target data list based on input data.

[0060] Optionally, the server may first obtain an encrypted target data list, and further perform decryption processing, data parsing processing, etc. on the encrypted target data list to obtain the target data list.

[0061] S202, processing the leaf nodes in the model to be processed according to the target data list to generate a target processing model; the model to be processed is a tree structure model.

[0062] The model to be processed is a tree structure model, for example, a YANG model.

[0063] In an embodiment of the present application, leaf nodes in the model to be processed are deleted according to the target data list, the leaf nodes included in the target data list are retained, and the deleted model to be processed is used as the target processing model.

[0064] Optionally, all leaf nodes in the model to be processed can be traversed to determine the identification data of all leaf nodes, thereby determining the leaf nodes that need to be retained and the leaf nodes that need to be deleted in the model to be processed based on the leaf node identification in the target data list, thereby processing the leaf nodes in the model to be processed and generating a target processing model.

[0065] S203, reading the data of all leaf nodes in the target processing model, and converting the read data into data instances in the target format for output.

[0066] In an embodiment of the present application, data of all leaf nodes in the target processing model are read to generate a model file of the target processing model. Further, according to preset conversion rules, the model file of the target processing model is converted into a data instance output in a target format.

[0067] In the data processing method of the structured model, the user's target data list is obtained; the leaf nodes in the model to be processed are processed according to the target data list to generate the target processing model; the model to be processed is a tree structure model; the data of all leaf nodes in the target processing model are read, and the read data is converted into a data instance output in the target format. The leaf nodes in the model to be processed are processed according to the target data list, so that the server does not need to read the data of all leaf nodes of the model to be processed, which improves the reading efficiency of the model to be processed, and directly converts the read data into a data instance output in the target format, further improving the data processing efficiency.

[0068] In one embodiment, an implementation of the above S203 is provided, such as Figure 3As shown, the above “processing the leaf nodes in the to-be-processed model according to the target data list to generate the target processing model” includes:

[0069] S301, traverse the model to be processed, and determine the path information of each leaf node in the model to be processed.

[0070] As an optional implementation, the model to be processed is read to determine the node identifier of each leaf node in the model to be processed, and then the path information corresponding to each leaf node is determined from a preset path information library according to the node identifier.

[0071] As another optional implementation, nodes at each level in the model to be processed are read step by step to determine the parent nodes passed through when reading the leaf nodes, and the path information of each leaf node in the model to be processed is generated according to the reading order of each parent node and the parent node and leaf node.

[0072] S302, marking the model to be processed according to the target data list and the path information of each leaf node, and determining the marked nodes and unmarked nodes in the model to be processed.

[0073] In an embodiment of the present application, the target leaf node is determined based on the target list data, and the position of the target node is located in the model to be processed based on the path information of each leaf node, so that the target node is marked in the model to be processed to obtain a marked node, and the leaf nodes in the model to be processed except the marked node are treated as unmarked nodes.

[0074] S303: Process the model to be processed according to the marked nodes and the unmarked nodes to generate a target processing model.

[0075] Optionally, the marked nodes in the model to be processed may be retained, and the unmarked nodes may be deleted from the model to be processed to generate a target processing model.

[0076] As another optional implementation, the marked nodes in the model to be processed may be included, and necessary nodes may be determined from unmarked nodes according to a preset node list, and a target processing model may be generated according to the marked nodes and necessary nodes.

[0077] In the above application embodiment, the marked nodes and unmarked nodes are determined according to the target data list, so as to screen the model to be processed and obtain the target processing model, so that the leaf nodes in the target processing model are more in line with the user's needs.

[0078] In one embodiment, an implementation of the above S302 is provided, such as Figure 4 As shown, the above “marking the model to be processed according to the target data list and the path information of each leaf node, and determining the marked nodes and unmarked nodes in the model to be processed” includes:

[0079] S401, determine the target node indicated in the target data list, and determine the path information of the target node from the path information of each leaf node.

[0080] In an embodiment of the present application, the target data list is parsed to obtain the target node indicated in the target data list, and further, the corresponding target node is determined from the leaf node, thereby reading the path information of the target node.

[0081] S402: Determine the parent node of the target node according to the path information of the target node.

[0082] In an embodiment of the present application, the path information of each leaf node includes the parent node passed through when reading the leaf node, so that all parent nodes of the target node can be determined in sequence according to the path information of the target node.

[0083] S403, marking the target node and the parent node of the target node to obtain marked nodes, and treating other nodes in the model to be processed as unmarked nodes.

[0084] In an embodiment of the present application, the target node and the parent node of the target node are marked as marked nodes, and the nodes other than the target node and the parent node of the target node are determined as unmarked nodes. Optionally, the node information of each node may include a flag bit, and the flag bit is used to indicate whether the node is marked, for example, when the flag bit is 1, it indicates that the node is marked, and when the flag bit is 0, it indicates that the node is not marked.

[0085] In an embodiment of the present application, both the target node and the parent node of the target node are marked, so that the determined marked nodes are more comprehensive and accurate, thereby improving the accuracy of the target processing model.

[0086] In one embodiment, an implementation of the above S203 is provided, such as Figure 5 As shown, the above “reading the data of all leaf nodes in the target processing model and converting the read data into data instance output in the target format” includes:

[0087] S501, generating a model file corresponding to the target processing model according to the target processing model and a preset grammar specification; the model file includes at least one sub-model file.

[0088] The preset grammar specification may be a grammar specification of a YANG model.

[0089] In an embodiment of the present application, the data in the target processing model is read and organized into the format of a model file according to a preset syntax specification. The model file may include multiple data blocks, and each data block is used as a sub-model file. The data types of the sub-model files may be the same or different.

[0090] S502: Convert each sub-model file into a data instance in a target format according to the data type of each sub-model file and output it.

[0091] In an embodiment of the present application, the data type of the submodel may include container, list, and leaf. Different data types correspond to different conversion methods. Optionally, when the data type is container, the submodel file can be converted to the data instance output corresponding to the Go struct code according to the first conversion rule; when the data type is list, the submodel file can be converted to the data instance output corresponding to the Go struct code according to the second conversion rule; when the data type is leaf, the submodel file can be converted to the data instance output corresponding to the Go struct code according to the third conversion rule.

[0092] In the above application embodiment, the target processing model is first converted into a model file, and then each sub-model file in the model file is converted into a data instance output in the target format. Through the step-by-step conversion, the accuracy of the data instance output is improved.

[0093] In one embodiment, an implementation of the above S502 is provided, such as Figure 6 As shown, the above “converting each sub-model file into a data instance output in a target format according to the data type of each sub-model file” includes:

[0094] S601: If the data type of the sub-model file is the first data type, a data structure and a first constructor corresponding to the first data type are generated according to the attribute field in the sub-model file.

[0095] In the embodiment of the present application, the attribute fields contained in the container are parsed to generate the data structure corresponding to the container, and a basic constructor for creating and searching the container is provided. Further, its child elements are iteratively processed until all leaf nodes are processed.

[0096] S602: If the data type of the sub-model file is the second data type, a list is initialized and created and a second constructor is generated; the second constructor includes list elements.

[0097] In the embodiment of the present application, a data structure of a list type is generated, the list is initialized and created, and a basic constructor for adding list elements is provided. Further, its child elements are iteratively processed until all leaf nodes are processed.

[0098] S603: If the data type of the sub-model file is the third data type, construct a third constructor according to the non-primary key type in the sub-model file.

[0099] In an embodiment of the present application, a specific leaf element data type is generated, and a basic constructor for adding attribute identifiers is provided for non-primary key type Key.

[0100] Optionally, the generated data structure model and constructor are programmed to implement custom processing of the data model, and the serialization method provided by the system is used to generate an XML document that can be run on the network device, thereby completing the network programmable operation.

[0101] In the above application embodiment, the sub-model file is directly converted into an instance output corresponding to the target programming language using the conversion logic corresponding to each data type, without the need to switch between multiple programming languages, thereby improving the efficiency of data processing.

[0102] In one embodiment, a complete data processing method of a structured model is provided, such as Figure 7 As shown, the above method includes:

[0103] S1, obtain the user's target data list.

[0104] S2, traverse the model to be processed and determine the path information of each leaf node in the model to be processed.

[0105] S3, determining the target node indicated in the target data list, and determining the path information of the target node from the path information of each leaf node.

[0106] S4, determining the parent node of the target node according to the path information of the target node.

[0107] S5, marking the target node and the parent node of the target node to obtain marked nodes, and treating other nodes in the model to be processed as unmarked nodes.

[0108] S6, retaining the marked nodes in the model to be processed and deleting the unmarked nodes from the model to be processed, to generate a target processing model.

[0109] S7, generating a model file corresponding to the target processing model according to the target processing model and the preset grammar specification; the model file includes at least one sub-model file.

[0110] S8. If the data type of the sub-model file is the first data type, a data structure and a first constructor corresponding to the first data type are generated according to the attribute field in the sub-model file.

[0111] S9, if the data type of the sub-model file is the second data type, initialize and create a list and generate a second constructor; the second constructor includes list elements.

[0112] S10: If the data type of the sub-model file is the third data type, construct a third constructor according to the non-primary key type in the sub-model file.

[0113] In the data processing method of the structured model, the user's target data list is obtained; the leaf nodes in the model to be processed are processed according to the target data list to generate the target processing model; the model to be processed is a tree structure model; the data of all leaf nodes in the target processing model are read, and the read data is converted into a data instance output in the target format. The leaf nodes in the model to be processed are processed according to the target data list, so that the server does not need to read the data of all leaf nodes of the model to be processed, which improves the reading efficiency of the model to be processed, and directly converts the read data into a data instance output in the target format, further improving the data processing efficiency.

[0114] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0115] Based on the same inventive concept, the embodiment of the present application also provides a data processing device for a structured model for implementing the data processing method for a structured model involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations of the data processing device embodiments of one or more structured models provided below can refer to the limitations of the data processing method for the structured model above, and will not be repeated here.

[0116] In one embodiment, Figure 8As shown, a data processing device of a structured model is provided, comprising: an acquisition module 10, a generation module 11 and a conversion module 12, wherein:

[0117] The acquisition module 10 is used to acquire the user's target data list.

[0118] The generating module 11 is used to process the leaf nodes in the model to be processed according to the target data list to generate a target processing model; the model to be processed is a tree structure model.

[0119] The conversion module 12 is used to read the data of all leaf nodes in the target processing model and convert the read data into data instances in the target format for output.

[0120] In one embodiment, the generation module 11 includes: a determination unit, a marking unit and a first generation unit, wherein:

[0121] The determination unit is used to traverse the model to be processed and determine the path information of each leaf node in the model to be processed.

[0122] The marking unit is used to mark the model to be processed according to the target data list and the path information of each leaf node, and determine the marked nodes and unmarked nodes in the model to be processed.

[0123] The first generating unit is used to process the model to be processed according to the marked nodes and the unmarked nodes to generate a target processing model.

[0124] In one embodiment, the first generating unit is specifically used to retain the marked nodes in the model to be processed, and delete the unmarked nodes from the model to be processed, so as to generate the target processing model.

[0125] In one embodiment, the above-mentioned marking unit is specifically used to determine the target node indicated in the target data list, and determine the path information of the target node from the path information of each leaf node; determine the parent node of the target node according to the path information of the target node; mark the target node and the parent node of the target node to obtain marked nodes, and treat other nodes in the model to be processed as unmarked nodes.

[0126] In one embodiment, the conversion module includes: a second generation unit and a conversion unit, wherein:

[0127] The second generating unit is used to generate a model file corresponding to the target processing model according to the target processing model and a preset grammar specification; the model file includes at least one sub-model file.

[0128] The conversion unit is used to convert each sub-model file into a data instance output in a target format according to the data type of each sub-model file.

[0129] In one embodiment, the above-mentioned conversion unit is specifically used to generate a data structure and a first constructor corresponding to the first data type according to the attribute field in the sub-model file if the data type of the sub-model file is the first data type; if the data type of the sub-model file is the second data type, initialize and create a list and generate a second constructor; the second constructor includes list elements; if the data type of the sub-model file is the third data type, construct a third constructor according to the non-primary key type in the sub-model file.

[0130] Each module in the data processing device of the structured model can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0131] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data processing data of a structured model. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data processing method of a structured model is implemented.

[0132] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0133] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0134] Get the user's target data list;

[0135] Process the leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model;

[0136] Read the data of all leaf nodes in the target processing model and convert the read data into data instance output in the target format.

[0137] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0138] Traverse the model to be processed and determine the path information of each leaf node in the model to be processed;

[0139] According to the target data list and the path information of each leaf node, the model to be processed is marked, and the marked nodes and unmarked nodes in the model to be processed are determined;

[0140] According to the marked nodes and the unmarked nodes, the model to be processed is processed to generate a target processing model.

[0141] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0142] The marked nodes in the model to be processed are retained, and the unmarked nodes are deleted from the model to be processed to generate a target processing model.

[0143] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0144] Determine the target node indicated in the target data list, and determine the path information of the target node from the path information of each leaf node;

[0145] Determine the parent node of the target node according to the path information of the target node;

[0146] The target node and the parent node of the target node are marked to obtain marked nodes, and other nodes in the model to be processed are regarded as unmarked nodes.

[0147] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0148] Generate a model file corresponding to the target processing model according to the target processing model and the preset grammar specification; the model file includes at least one sub-model file;

[0149] According to the data type of each sub-model file, each sub-model file is converted into a data instance output in a target format.

[0150] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0151] If the data type of the sub-model file is the first data type, generating a data structure and a first constructor corresponding to the first data type according to the attribute field in the sub-model file;

[0152] If the data type of the sub-model file is the second data type, the list is initialized and created and a second constructor is generated; the second constructor includes list elements;

[0153] If the data type of the sub-model file is the third data type, a third constructor is constructed according to the non-primary key type in the sub-model file.

[0154] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0155] Get the user's target data list;

[0156] Process the leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model;

[0157] Read the data of all leaf nodes in the target processing model and convert the read data into data instance output in the target format.

[0158] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0159] Traverse the model to be processed and determine the path information of each leaf node in the model to be processed;

[0160] According to the target data list and the path information of each leaf node, the model to be processed is marked, and the marked nodes and unmarked nodes in the model to be processed are determined;

[0161] According to the marked nodes and the unmarked nodes, the model to be processed is processed to generate a target processing model.

[0162] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0163] The marked nodes in the model to be processed are retained, and the unmarked nodes are deleted from the model to be processed to generate a target processing model.

[0164] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0165] Determine the target node indicated in the target data list, and determine the path information of the target node from the path information of each leaf node;

[0166] Determine the parent node of the target node according to the path information of the target node;

[0167] The target node and the parent node of the target node are marked to obtain marked nodes, and other nodes in the model to be processed are regarded as unmarked nodes.

[0168] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0169] Generate a model file corresponding to the target processing model according to the target processing model and the preset grammar specification; the model file includes at least one sub-model file;

[0170] According to the data type of each sub-model file, each sub-model file is converted into a data instance output in a target format.

[0171] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0172] If the data type of the sub-model file is the first data type, generating a data structure and a first constructor corresponding to the first data type according to the attribute field in the sub-model file;

[0173] If the data type of the sub-model file is the second data type, the list is initialized and created and a second constructor is generated; the second constructor includes list elements;

[0174] If the data type of the sub-model file is the third data type, a third constructor is constructed according to the non-primary key type in the sub-model file.

[0175] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0176] Get the user's target data list;

[0177] Process the leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model;

[0178] Read the data of all leaf nodes in the target processing model and convert the read data into data instance output in the target format.

[0179] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0180] Traverse the model to be processed and determine the path information of each leaf node in the model to be processed;

[0181] According to the target data list and the path information of each leaf node, the model to be processed is marked, and the marked nodes and unmarked nodes in the model to be processed are determined;

[0182] According to the marked nodes and the unmarked nodes, the model to be processed is processed to generate a target processing model.

[0183] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0184] The marked nodes in the model to be processed are retained, and the unmarked nodes are deleted from the model to be processed to generate a target processing model.

[0185] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0186] Determine the target node indicated in the target data list, and determine the path information of the target node from the path information of each leaf node;

[0187] Determine the parent node of the target node according to the path information of the target node;

[0188] The target node and the parent node of the target node are marked to obtain marked nodes, and other nodes in the model to be processed are regarded as unmarked nodes.

[0189] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0190] Generate a model file corresponding to the target processing model according to the target processing model and the preset grammar specification; the model file includes at least one sub-model file;

[0191] According to the data type of each sub-model file, each sub-model file is converted into a data instance output in a target format.

[0192] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0193] If the data type of the sub-model file is the first data type, generating a data structure and a first constructor corresponding to the first data type according to the attribute field in the sub-model file;

[0194] If the data type of the sub-model file is the second data type, the list is initialized and created and a second constructor is generated; the second constructor includes list elements;

[0195] If the data type of the sub-model file is the third data type, a third constructor is constructed according to the non-primary key type in the sub-model file.

[0196] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0197] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0198] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A data processing method for a structured model, characterized in that: The method comprises: Get the user's target data list; Processing leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model; The data of all leaf nodes in the target processing model are read, and the read data are converted into data instances in the target format for output.

2. The method according to claim 1, characterized in that The step of processing the leaf nodes in the to-be-processed model according to the target data list to generate a target processing model includes: Traversing the model to be processed, and determining the path information of each leaf node in the model to be processed; Marking the model to be processed according to the target data list and the path information of each leaf node, and determining marked nodes and unmarked nodes in the model to be processed; The model to be processed is processed according to the marked nodes and the unmarked nodes to generate the target processing model.

3. The method according to claim 2, characterized in that The step of processing the model to be processed according to the marked nodes and the unmarked nodes to generate the target processing model includes: The marked nodes in the model to be processed are retained, and the unmarked nodes are deleted from the model to be processed to generate the target processing model.

4. The method according to claim 2, characterized in that: The step of marking the model to be processed according to the target data list and the path information of each leaf node, and determining the marked nodes and unmarked nodes in the model to be processed includes: Determine the target node indicated in the target data list, and determine the path information of the target node from the path information of each leaf node; Determine the parent node of the target node according to the path information of the target node; The target node and the parent node of the target node are marked to obtain the marked nodes, and other nodes in the model to be processed are used as the unmarked nodes.

5. The method according to any one of claims 1 to 4, characterized in that: The step of reading data of all leaf nodes in the target processing model and converting the read data into data instance output in a target format includes: Generate a model file corresponding to the target processing model according to the target processing model and the preset grammar specification; the model file includes at least one sub-model file; According to the data type of each sub-model file, each sub-model file is converted into a data instance in a target format and outputted.

6. The method according to claim 5, characterized in that The step of converting each sub-model file into a data instance of a target format and outputting the data instance according to the data type of each sub-model file comprises: If the data type of the sub-model file is a first data type, generating a data structure and a first constructor corresponding to the first data type according to the attribute field in the sub-model file; If the data type of the sub-model file is the second data type, the list is initialized and created and a second constructor is generated; the second constructor includes list elements; If the data type of the sub-model file is the third data type, a third constructor is constructed according to the non-primary key type in the sub-model file.

7. A data processing device for a structured model, characterized in that: The device comprises: The acquisition module is used to obtain the user's target data list; A generating module, used for processing the leaf nodes in the to-be-processed model according to the target data list to generate a target processing model; the to-be-processed model is a tree structure model; The conversion module is used to read the data of all leaf nodes in the target processing model and convert the read data into data instances in the target format for output.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Webpage information extraction method, apparatus and device, and storage medium

    CN112732994A

  • YANG model data transmission method and device

    CN118133780A

  • Webpage data extraction method and apparatus, computer device, and storage medium

    WO2023155303A1