CN113590348B - Parameter transmission method, device, equipment and medium based on tree structure - Google Patents

Parameter transmission method, device, equipment and medium based on tree structure Download PDF

Info

Publication number
CN113590348B
CN113590348B CN202110844172.7A CN202110844172A CN113590348B CN 113590348 B CN113590348 B CN 113590348B CN 202110844172 A CN202110844172 A CN 202110844172A CN 113590348 B CN113590348 B CN 113590348B
Authority
CN
China
Prior art keywords
node
data
tree
leaf
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110844172.7A
Other languages
Chinese (zh)
Other versions
CN113590348A (en
Inventor
刘圣杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingdong Technology Holding Co Ltd
Original Assignee
Jingdong Technology Holding Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jingdong Technology Holding Co Ltd filed Critical Jingdong Technology Holding Co Ltd
Priority to CN202110844172.7A priority Critical patent/CN113590348B/en
Publication of CN113590348A publication Critical patent/CN113590348A/en
Application granted granted Critical
Publication of CN113590348B publication Critical patent/CN113590348B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9027Trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention relates to a parameter transmission method based on a tree structure, which comprises the following steps: respectively constructing tree-shaped data structures for the source terminal parameters and the target terminal parameters to obtain a source terminal data tree and a target terminal data tree; each leaf node of the tree-shaped data structure records a node path and node data; determining a node path and node data of each leaf node of the source data tree; and assigning the node data of the leaf nodes of the target end data tree by using the node data of the leaf nodes of the source end data tree according to the known mapping relation between the leaf nodes of the source end data tree and the leaf nodes of the target end data tree. The method is suitable for parameter transmission among a plurality of systems involving parameters of different structure types without changing the parameter structure types, effectively improves flexibility, reduces complexity, reduces time consumption, effectively improves efficiency and reduces cost.

Description

Parameter transmission method, device, equipment and medium based on tree structure
Technical Field
The present invention relates to the field of computers, and in particular, to a parameter transmission method and apparatus based on a tree structure, an electronic device, and a computer readable storage medium.
Background
As computer software systems develop, multisystem interaction becomes generalized, and in the process of implementing the inventive concept, the inventor finds that at least the following technical problems exist in the related art: when the multiple ends interact, parameters are required to be transmitted between the source end and the target end, the prior art only supports the transmission of some parameters of the same type, or the transmission of parameters of complex structure types cannot be supported by carrying out some simple conversion on the parameter structure types, the prior art usually adopts a manual coding mode to code mapping relations of the parameters of the two ends one by one, the problems of high configuration complexity, long time consumption and low efficiency exist, and the problems of low flexibility exist when customized requirements are met by independent development.
Disclosure of Invention
To solve or at least partially solve the above technical problems, embodiments of the present invention provide a parameter transferring method, apparatus, electronic device and computer readable storage medium based on a tree structure.
In a first aspect, an embodiment of the present invention provides a parameter delivery method based on a tree structure. The method comprises the following steps: respectively constructing tree-shaped data structures for the source terminal parameters and the target terminal parameters to obtain a source terminal data tree and a target terminal data tree; wherein, each leaf node of the tree-shaped data structure records a node path and node data; determining a node path and node data of each leaf node of the source data tree; and assigning the node data of the leaf nodes of the target end data tree by using the node data of the leaf nodes of the source end data tree according to the known mapping relation between the leaf nodes of the source end data tree and the leaf nodes of the target end data tree.
According to an embodiment of the present invention, the assigning the node data of the leaf node of the target data tree by using the node data of the leaf node of the source data tree according to the known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree includes: determining a node path of a leaf node of a source data tree corresponding to a leaf node of a target data tree according to a known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree, acquiring node data of the leaf node of the source data tree corresponding to the leaf node of the target data tree according to the node path, and assigning values to the node data of the leaf node of the target data tree according to the known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree by using the node data.
According to the embodiment of the invention, each leaf node of the tree-shaped data structure records the node path and the node data in the form of a key value structure.
According to an embodiment of the present invention, before assigning each leaf node of the target data tree, the method further includes: traversing from a root node of a target data tree, executing a stacking operation on each node and judging whether the node is a leaf node, wherein if the node is the leaf node, executing a step of assigning value to node data of the node, and then executing a stacking operation on the node.
According to an embodiment of the present invention, the above-mentioned mapping relation is dynamically configurable; and/or the mapping relationship comprises a one-to-one mapping relationship and/or a many-to-one mapping relationship; the one-to-one mapping relationship includes that node data of one leaf node of the source end data tree corresponds to node data of one leaf node of the target end data tree; the many-to-one mapping relationship includes that node data of a plurality of leaf nodes of the source data tree corresponds to node data of one leaf node of the target data tree.
According to an embodiment of the present invention, the above-mentioned mapping relation is dynamically configurable; and/or the mapping relationship comprises a one-to-one mapping and a many-to-one mapping, wherein the one-to-one mapping is that one source parameter leaf node corresponds to one target parameter leaf node, and the many-to-one mapping is that a plurality of source parameter leaf nodes correspond to one target parameter leaf node.
According to an embodiment of the present invention, when the mapping relationship is a one-to-one mapping, the assigning the node data of the leaf node of the target data tree includes: enabling node data of leaf nodes of the target end data tree to be equal to node data of corresponding leaf nodes of the source end data tree; when the mapping relationship is many-to-one mapping, the assigning the node data of the leaf node of the target data tree includes: and calculating the logical operation result of the node data of the corresponding plurality of leaf nodes of the source data tree, and enabling the node data of the leaf nodes of the target data tree to be equal to the logical operation result.
According to an embodiment of the present invention, the tree-like data structure includes one or more multi-way trees.
According to an embodiment of the present invention, the data structure types of the source side parameter and the destination side parameter are the same or different.
In a second aspect, an embodiment of the present invention provides a parameter delivery device based on a tree structure. The device comprises: the structure construction module is used for respectively constructing tree-shaped data structures for the source terminal parameters and the target terminal parameters so as to obtain a source terminal data tree and a target terminal data tree; wherein, each leaf node of the tree-shaped data structure records a node path and node data; the node determining module is used for determining a node path and node data of each leaf node of the source data tree; and the node assignment module is used for assigning the node data of the leaf nodes of the target end data tree by utilizing the node data of the leaf nodes of the source end data tree according to the known mapping relation between the leaf nodes of the source end data tree and the leaf nodes of the target end data tree.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
A memory for storing a computer program;
and a processor for implementing the method as described above when executing the program stored on the memory.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method as described above.
Compared with the prior art, the technical scheme provided by the embodiment of the invention has at least part or all of the following advantages:
the method comprises the steps of constructing a source end parameter and a target end parameter into a tree-shaped data structure, obtaining a source end data tree, a target end data tree and leaf nodes recorded with node paths and node data, determining the node paths of the leaf nodes of the source end data tree corresponding to the leaf nodes of the target end data tree according to the mapping relation between the leaf nodes of the source end data tree and the leaf nodes of the target end data tree for each leaf node of the target end data tree, obtaining the node data, assigning the node data of the leaf nodes of the target end data tree by using the node data, transmitting the node data of the source end parameter to the nodes of the target end parameter, and transmitting the source end parameter to the target end parameter after traversing all the leaf nodes of the target end data tree.
According to the technical scheme, when multi-terminal interaction is realized, even if the parameters with different data structure types and the parameters with complex data structure types are faced, the parameter transmission between the source terminal and the target terminal can be realized, the problem that the transmission of the parameters with complex structure types cannot be supported is solved, the parameters of the source terminal and the target terminal are definitely expressed by constructing a clear tree structure, and according to the mapping relation capable of being dynamically configured, the leaf nodes are traversed so as to assign the node data of the source terminal parameters to the nodes of the target terminal parameters.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 schematically illustrates a system architecture of a tree-based parameter delivery method and apparatus suitable for use in embodiments of the present invention;
FIG. 2 schematically illustrates a flow diagram of a tree-based parameter delivery method according to one embodiment of the invention;
fig. 3 schematically shows a detailed implementation flowchart of operation S203 according to an embodiment of the invention;
FIG. 4 schematically illustrates a tree structure of source parameters according to an embodiment of the present invention;
FIG. 5 schematically illustrates a tree structure diagram of target-side parameters according to an embodiment of the present invention;
FIG. 6 schematically illustrates a mapping relationship between leaf nodes of a source data tree and leaf nodes of a destination data tree, in accordance with a specific embodiment of the present invention;
fig. 7 schematically shows a block diagram of a tree-based parameter delivering apparatus according to an embodiment of the present invention; and
Fig. 8 schematically shows a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In the related art, when interaction is performed between multiple ends, parameter transmission is required to be performed between a source end and a target end, the prior art only supports transmission between parameters of the same type, or some simple structural changes are performed on parameter types, transmission of parameters of complex data types cannot be supported, the prior art usually adopts a manual coding mode to code mapping relations of parameters of two ends one by one, the problems of high configuration complexity, long time consumption and low efficiency exist, independent development is required when customized requirements are met, and the problem of poor flexibility exists. For parameter transmission among multiple systems, for example, multiple systems with different parameter types, the mapping relationship is encoded one by one in a manual encoding manner, so that the parameter transmission cannot be flexibly and efficiently realized.
In view of this, an embodiment of the present invention provides a tree structure-based parameter transfer method for performing value transfer between a source parameter and a target parameter, where the source parameter may also be referred to as an input parameter (referred to as an input parameter for short), and the target parameter may also be referred to as an output parameter (referred to as an output parameter for short), and the method includes: respectively constructing tree-shaped data structures for the source end parameter and the target end parameter to obtain a source end data tree (a ginseng-in structure) and a target end data tree (a ginseng-out structure); wherein, each leaf node of the tree-shaped data structure records a node path and node data; determining a node path and node data of each leaf node of the source data tree; for each leaf node of the target end data tree, assigning the node data by the following steps: determining a node path of a leaf node of a source data tree corresponding to a leaf node of a target data tree according to a known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree, acquiring node data of the leaf node of the source data tree corresponding to the leaf node of the target data tree according to the node path, and assigning values to the node data of the leaf node of the target data tree according to the known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree by using the node data.
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 schematically illustrates a system architecture of a tree-based parameter delivery method and apparatus suitable for use in an embodiment of the present invention.
Referring to fig. 1, a system architecture 100 of a tree-based parameter delivery method and apparatus according to an embodiment of the present invention includes: terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various types of communication client applications may be installed on the terminal devices 101, 102, 103, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices that display screens and support web browsing, such as electronic devices including, but not limited to, smartphones, tablets, notebooks, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing service support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, data, etc. acquired or generated according to the user request) to the terminal device.
It should be noted that, the parameter transferring method based on the tree structure provided by the embodiment of the present invention may be generally executed by the terminal devices 101, 102, 103, the server 105 or the terminal device with a certain computing capability. Accordingly, the parameter transferring device based on the tree structure provided by the embodiment of the present invention may be generally set in the terminal device 101, 102, 103, the server 105 or the cloud device. The parameter delivery method based on the tree structure provided by the embodiment of the present invention may also be performed by a server or a server cluster, which is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the parameter transferring apparatus based on the tree structure provided by the embodiment of the present invention may also be provided in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
A first exemplary embodiment of the present invention provides a parameter delivery method based on a tree structure.
Fig. 2 schematically shows a flow chart of a tree-structure based parameter delivery method according to one embodiment of the invention.
Referring to fig. 2, the parameter transferring method based on the tree structure according to the embodiment of the present invention includes the following operations: s201, S202, and S203. The above operations S201 to S203 may be performed by a terminal device or a server, for example.
In operation S201, tree-like data structures are respectively constructed for the source and destination parameters to obtain source and destination data trees. Wherein, each leaf node of the tree-shaped data structure records a node path and node data.
Specifically, each leaf node of the tree-like data structure may record a node path and node data in the form of a key structure. Based on a tree structure or a forest structure, leaf nodes may be expressed in the form of a key-value structure, and node paths (node_path) and node data (value) are recorded in each leaf node, so the leaf nodes may be expressed as a key-value structure { node_path: value }, where node_path may be a node full path, node data value may be null, and may be various data such as a character string. For example, if the node path of a leaf node of the tree structure is A.a.1 and the node data value (i.e., node value) is a "hello" string, the leaf node may be represented as a key structure of { "A.a.1": "hello" }.
In particular, the tree-like data structure may include one or more multi-tree structures, which may also be referred to as forest structures.
In operation S202, a node path and node data of each leaf node of the source data tree are determined.
In operation S203, for each leaf node of the target data tree, the node data of each leaf node of the target data tree is assigned by using the node data of the leaf node of the source data tree according to the known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree.
Fig. 3 schematically shows a detailed implementation flowchart of operation S203 according to an embodiment of the invention.
Referring to fig. 3, the operation S203 of assigning a value to the node data of each leaf node of the target data tree includes the following operations: s2031, S2032 and S2033.
In operation S2031, a node path of a leaf node of a source data tree corresponding to a leaf node of a target data tree is determined according to a known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree.
In operation S2032, node data of leaf nodes of the source end data tree corresponding to the leaf nodes of the destination end data tree is acquired according to the node path.
In operation S2033, node data of a leaf node of the target data tree is assigned by using the node data according to a known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree.
Based on the operations S201 to S203 and S2031 to S2033, the parameter transfer from the source end parameter to the target end parameter is realized, the source end parameter and the target end parameter are explicitly expressed by constructing a clear tree structure, and according to the mapping relation capable of being dynamically configured, the leaf node is traversed so as to assign the node data of the source end parameter to the node of the target end parameter, thereby automatically and configurationally realizing the parameter transfer from the source end to the target end, improving the efficiency, reducing the complexity, reducing the time consumption, effectively reducing the cost and improving the flexibility. The embodiment of the invention is also suitable for the source end and target end parameters expressed based on the forest structures of a plurality of multi-tree, further realizes the parameter transmission from the source end parameters to the target end parameters, effectively improves the transmission efficiency of a large number of parameters, namely, the parameters with huge node quantity, and has strong flexibility.
The operations S201 to S203 and S2031 to S2033 may be performed by a terminal device or a server of the source end, or may be performed by a terminal device or a server of the target end, or may be performed by a gateway, a cloud end, or other devices or servers that may be accessed by the source end and the target end.
Fig. 4 schematically shows a tree structure diagram of source parameters according to an embodiment of the invention.
Fig. 5 schematically illustrates a tree structure diagram of a target-side parameter according to an embodiment of the present invention.
Fig. 6 schematically illustrates a mapping relationship between leaf nodes of a source data tree and leaf nodes of a destination data tree according to a specific embodiment of the present invention.
In the following, referring to fig. 4 to fig. 6, an example of a procedure for transferring data in a source parameter to a destination parameter is performed in a specific embodiment, where the tree structures in fig. 4 and fig. 5 are a constructed source data tree and a destination data tree, respectively.
Illustratively, the construction of the source data tree in FIG. 4 may be accomplished in the following expression:
Illustratively, the source data tree in fig. 4 includes two multi-tree, i.e., A, B, two parameters, where a is a complex structure including three children nodes a, B, and c, and children nodes including descendant nodes, and B is a simple basic structure. The construction and expression of the source data tree in the form of key values can be understood as analysis and explicit expression of the source parameter structure. The source data tree in fig. 4 clearly expresses the parameter structure of the source parameter A, B, so that the node path and node data of each leaf node of the source data tree can be determined, and the node path and node data of each node can be recorded in the form of a key value structure, for example, each leaf node of the source data tree in fig. 4 can be respectively denoted by :{"A.a.1":"value"},{"A.a.2":"value"},{"A.a.3":"value"},{"A.b":"value"},{"A.c.1":"value"},{"A.c.2":"value"},{"B":"value"},value and represent the node data of each leaf node, and can be various types of data such as a character string "world", integer data "8" and the like stored in the node. The process of constructing a source data tree and expressing the node path and the node data of each leaf node in the form of a key value structure can be regarded as that all the leaf nodes are disassembled based on a tree structure, and the node path and the node data of each leaf node are assembled.
Similarly, the target data tree may be constructed and expressed by the above procedure, and for the case that there is no value in the leaf node of the target data tree, that is, the value is null, it may be represented by a key value structure, for example, one leaf node in fig. 5 may be represented as { "a.c.3": "value" }, where value is a null value, and "a.c.3" is the full path of the leaf node.
Illustratively, the assignment of node data for a leaf node { "A.c.3": "value" } in FIG. 5 is intended to be performed as follows,
Firstly, according to the mapping relation between the leaf nodes of the source data tree and the leaf nodes of the target data tree in fig. 6, determining the node path of the leaf nodes of the source data tree corresponding to the leaf nodes of the target data tree { "A.c.3": "value" }, namely, according to the one-to-one mapping relation between the leaf node path "A.c.3" of the source data tree and the leaf node path "A.a.3" of the target data tree queried in fig. 6, determining the node path of the leaf nodes of the source data tree corresponding to the leaf nodes { "A.c.3": "value" };
Secondly, acquiring node data of the leaf node { "A.a.3": "value1" } of the source end data tree corresponding to the leaf node { "A.c.3": "value" } of the target end data tree according to the node path "A.a.3", namely, data stored in the leaf node of which the path is "A.c.3" in the tree structure on the left side in FIG. 5, for example, the data is "value1";
Finally, according to the mapping relation between the leaf node of the source end data tree { "A.a.3": value1"} and the leaf node of the target end data tree {" A.c.3": value" }, the node data of the leaf node of the target end data tree is assigned by utilizing the node data "value1", so that the node data of the leaf node of the target end data tree is equal to the node data of the corresponding leaf node of the source end data tree, and the leaf node of the target end data tree after assignment is { "A.c.3": "value1" }, namely, the assembly of the node path of the leaf node and the node data is completed.
In the above operation, the mapping relationship shown in fig. 6 is dynamically configurable, that is, the mapping relationship may be changed by configuration, and the specific mapping relationship may be changed according to the actual requirement in the application scenario. For example, after parameter transfer is completed on the target data tree of a tree structure, the mapping relationship is changed, if one or more corresponding relationships are changed, no matter what kind of change occurs, when parameter transfer is performed on the target data tree of the next tree structure, corresponding operation is performed according to the current mapping relationship, namely, the mapping relationship after change.
As shown in the mapping relationship of fig. 6, it can be seen that the node data of one leaf node of the source data tree corresponds to the node data of one leaf node of the destination data tree, i.e., one-to-one mapping. For example, in fig. 6, the source data tree contains 7 leaf nodes, the target data tree contains 8 leaf nodes, and the leaf node "a.a.2" of the source data tree has no corresponding target leaf node, i.e., the node data in the leaf node "a.a.2" of the source data tree is discarded, and the value of the node "a.a.2" is not required to be used for assignment according to the mapping relationship. Therefore, in the practical application scene, the transmission of the parameters only takes each leaf node of the traversing target data tree as a reference, the mapping relation is queried to find the corresponding leaf node of the source data tree, and then the parameter value is transmitted, so that the technical scheme is also suitable for the situation that the number of the leaf nodes of the source data tree is more than that of the leaf child nodes of the target data tree.
Optionally, in addition to the one-to-one mapping relationship shown in fig. 6, the mapping relationship further includes a many-to-one mapping relationship, that is, node data of a plurality of leaf nodes of the source data tree corresponds to node data of one leaf node of the destination data tree. For example, when the leaf node M and the leaf node N of the source data tree are related in a certain logic relationship and correspond to one leaf node T of the target data tree, that is, two-to-one mapping, the logical operation result of the node data of the leaf nodes M and N of the source data tree may be calculated first, if the logic relationship is addition, the values in the M and N nodes are added to obtain the operation result, and then the node data of the leaf node P of the target data tree is made equal to the above logical operation result. It should be noted that, in the practical application scenario, the mapping relationship may further include a one-to-one mapping relationship, a many-to-one mapping relationship, a one-to-many mapping relationship, and various combinations of the foregoing mapping relationships.
For example, before assigning each leaf node of the target data tree, the above technical solution may further include the following operations, first, traversing from the root node of the target data tree, for example, traversing from the root node a in fig. 5 in a precedent manner, stacking a, determining whether the node a is a leaf node, finding that a is not a leaf node, continuing to stack the child node c of the node a, determining whether the node c is a leaf node, finding that c is not a leaf node, continuing to stack the child node 3 of the node c, determining whether the node 3 is a leaf node, finding that 3 is a leaf node, determining that the node data of the leaf node with the path of "a.c.3" is a leaf node of the target data tree, that is, determining a.a.3 "of the leaf node of the source data tree corresponding to the node with the path of" a.c.3 "of the target data tree according to the mapping relation of fig. 6, then obtaining the leaf node with the path of" a.c.3 "corresponding to the leaf node of the leaf node 1, and assigning the leaf data of the value1 to the leaf node 1 according to the mapping relation of the node 1. After the assignment operation is completed, a pop operation is performed on the node 3.
Then, the other nodes are continuously traversed, after 3 is popped off, other sub-nodes of the node c are continuously popped on, for example, the sub-node B, the sub-node 1 and the sub-node B of the node c in fig. 5, and the operations of stacking, assignment and popping as described above are sequentially executed on the three sub-nodes according to the sequence of traversing the first order, which is not repeated here. After completing the left tree structure in fig. 5 (i.e., the left subtree in the forest structure), the right tree structure (i.e., the right subtree) is continued to be traversed.
The forest structure of two subtrees in fig. 5 is only an example, and the tree structure of the embodiment of the present invention may include one or more multi-tree, i.e. a plurality of subtrees, and after traversing all the subtrees in sequence, in order to complete the traversing of the target data tree, it is realized that node data in all leaf nodes of the target data tree are replaced with node data of leaf nodes of the corresponding source data tree, i.e. the transfer of parameters from the source to the target ends. The above-mentioned process of replacing node data may be further understood as placing node data of leaf nodes of the corresponding source data tree into all leaf nodes of the target data tree, for the case that the node data of the target data tree is empty.
For example, the data structure types of the source side parameter and the destination side parameter may be the same or different. In a practical application scenario, for example, there are three different systems: the parameter structure types of the system X, the system Y and the system Z are different and are respectively as follows: shaping (belonging to basic data type), object data type (embedding object data type and character type belonging to basic data type), then when these three systems interact, for example when transferring system X parameter value to system Y parameter, system X is the source end, system Y is the target end, for example when transferring system Y parameter value to system X and system Z parameters respectively, system Y is the source end, system X and system Z are both target ends, it can transfer parameter value under the condition of not changing data structure type of each system parameter, that is, it can implement parameter transfer without making data structure type of parameter agree, so that it can implement parameter transfer with high efficiency and high speed.
Therefore, the parameter transfer method provided by the embodiment of the invention supports parameter transfer among a plurality of systems with different data structure types, has strong compatibility, overcomes the defects of high cost, low efficiency and the like caused by manual coding and customization of interaction among the plurality of systems with different parameter structure types in the prior art, has strong portability and wide application range, can automatically and configurably realize parameter transfer from a source end to a target end, improves efficiency, reduces complexity, reduces time consumption, effectively reduces cost and improves flexibility.
A second exemplary embodiment of the present invention provides a parameter transferring apparatus based on a tree structure.
Fig. 7 schematically shows a block diagram of a tree-based parameter delivery device according to an embodiment of the invention.
Referring to fig. 7, a tree structure-based parameter transferring apparatus 700 according to an embodiment of the present invention includes: a structure building module 701, a node determination module 702 and a node assignment module 703.
The above-mentioned structure building module 701 is configured to build tree-like data structures for the source-side parameter and the destination-side parameter, respectively, so as to obtain a source-side data tree and a destination-side data tree; wherein, each leaf node of the tree-shaped data structure records a node path and node data;
the node determining module 702 is configured to determine a node path and node data of each leaf node of the source data tree;
the node assignment module 703 is configured to assign, to each leaf node of the target data tree, node data thereof by: determining a node path of a leaf node of a source data tree corresponding to a leaf node of a target data tree according to a known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree, acquiring node data of the leaf node of the source data tree corresponding to the leaf node of the target data tree according to the node path, and assigning values to the node data of the leaf node of the target data tree according to the known mapping relationship between the leaf node of the source data tree and the leaf node of the target data tree by using the node data.
According to an embodiment of the present invention, the parameter transferring apparatus 700 may further include a node stacking module, configured to perform a stacking operation on each node and determine whether the node is a leaf node, before performing assignment on each leaf node of the target data tree, and then perform a stacking operation on the node after performing the assignment on the node data if the node is a leaf node.
Any of the above-described structure building module 701, node determination module 702, and node assignment module 703 may be incorporated in one module to be implemented, or any of the modules may be split into a plurality of modules. Or at least some of the functionality of one or more of the modules may be combined with, and implemented in, at least some of the functionality of other modules. At least one of the structure building module 701, the node determination module 702, and the node assignment module 703 may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware, such as any other reasonable way of integrating or packaging the circuit, or in any one of or a suitable combination of three of software, hardware, and firmware. Or at least one of the structure building module 701, the node determination module 702 and the node assignment module 703 may be at least partly implemented as computer program modules which, when run, may perform the respective functions.
It should be noted that, the parameter transferring apparatus 700 may be applied to multi-system interaction, and may be configured in a gateway system or any system in the multi-system, and does not limit which of the source system or the target system in the embodiment of the present invention is specifically any system in the multi-system, so that the system may be flexibly configured, and has the advantages of wide application range and high flexibility.
A third exemplary embodiment of the present invention provides an electronic device.
Fig. 8 schematically shows a block diagram of an electronic device according to an embodiment of the present invention.
Referring to fig. 8, an electronic device 800 provided in an embodiment of the present invention includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete communication with each other through the communication bus 804; a memory 803 for storing a computer program; the processor 801 is configured to implement the parameter transfer method based on the tree structure as described above when executing the program stored in the memory.
The fourth exemplary embodiment of the present invention also provides a computer-readable storage medium. The computer readable storage medium stores a computer program which, when executed by a processor, implements the tree-structure-based parameter delivery method described above.
The computer-readable storage medium may be embodied in the apparatus/means described in the above embodiments; or may exist alone without being assembled into the apparatus/device. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present invention.
According to embodiments of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A tree-based parameter delivery method, comprising:
Respectively constructing tree-shaped data structures for the source terminal parameters and the target terminal parameters to obtain a source terminal data tree and a target terminal data tree; wherein, each leaf node of the tree-shaped data structure records a node path and node data;
determining a node path and node data of each leaf node of the source data tree;
For each leaf node of the target end data tree, assigning the node data by the following steps:
determining a node path of a leaf node of the source data tree corresponding to the leaf node of the target data tree according to the known mapping relation between the leaf node of the source data tree and the leaf node of the target data tree,
Acquiring node data of leaf nodes of the source data tree corresponding to the leaf nodes of the target data tree according to the node paths,
And assigning the node data of the leaf nodes of the target data tree by using the node data according to the known mapping relation between the leaf nodes of the source data tree and the leaf nodes of the target data tree.
2. The method of claim 1, wherein each leaf node of the tree-like data structure records node paths and node data in the form of a key structure.
3. The method of claim 1, wherein prior to assigning each leaf node of the target data tree, the method further comprises:
Traversing from a root node of a target data tree, executing a stacking operation on each node and judging whether the node is a leaf node, wherein if the node is the leaf node, executing a step of assigning value to node data of the node, and then executing a stacking operation on the node.
4. A method according to any one of claims 1-3, characterized in that the mapping relation is dynamically configurable; and/or
The mapping relationship comprises a one-to-one mapping relationship and/or a many-to-one mapping relationship;
The one-to-one mapping relation comprises that node data of one leaf node of the source end data tree corresponds to node data of one leaf node of the target end data tree;
the many-to-one mapping relationship includes that node data of a plurality of leaf nodes of the source data tree corresponds to node data of one leaf node of the target data tree.
5. The method of claim 4, wherein the step of determining the position of the first electrode is performed,
And when the mapping relationship is one-to-one mapping, assigning the node data of the leaf node of the target data tree, wherein the assigning comprises the following steps:
Enabling node data of leaf nodes of the target end data tree to be equal to node data of corresponding leaf nodes of the source end data tree;
When the mapping relationship is many-to-one mapping, the assigning the node data of the leaf node of the target data tree includes:
And calculating the logical operation result of the node data of the corresponding plurality of leaf nodes of the source data tree, and enabling the node data of the leaf nodes of the target data tree to be equal to the logical operation result.
6. A method according to any of claims 1-3, wherein the tree-like data structure comprises one or more multi-way trees.
7. A method according to any of claims 1-3, characterized in that the data structure types of the source side parameter and the destination side parameter are the same or different.
8. A tree-based parameter delivery device, comprising:
The structure construction module is used for respectively constructing tree-shaped data structures for the source terminal parameters and the target terminal parameters so as to obtain a source terminal data tree and a target terminal data tree; wherein, each leaf node of the tree-shaped data structure records a node path and node data;
the node determining module is used for determining a node path and node data of each leaf node of the source data tree;
the node assignment module is used for assigning values to the node data of each leaf node of the target end data tree through the following steps:
determining a node path of a leaf node of the source data tree corresponding to the leaf node of the target data tree according to the known mapping relation between the leaf node of the source data tree and the leaf node of the target data tree,
Acquiring node data of leaf nodes of the source data tree corresponding to the leaf nodes of the target data tree according to the node paths,
And assigning the node data of the leaf nodes of the target data tree by using the node data according to the known mapping relation between the leaf nodes of the source data tree and the leaf nodes of the target data tree.
9. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
A memory for storing a computer program;
a processor for implementing the method of any of claims 1-7 when executing a program stored on a memory.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method of any of claims 1-7.
CN202110844172.7A 2021-07-26 2021-07-26 Parameter transmission method, device, equipment and medium based on tree structure Active CN113590348B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110844172.7A CN113590348B (en) 2021-07-26 2021-07-26 Parameter transmission method, device, equipment and medium based on tree structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110844172.7A CN113590348B (en) 2021-07-26 2021-07-26 Parameter transmission method, device, equipment and medium based on tree structure

Publications (2)

Publication Number Publication Date
CN113590348A CN113590348A (en) 2021-11-02
CN113590348B true CN113590348B (en) 2024-05-17

Family

ID=78250012

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110844172.7A Active CN113590348B (en) 2021-07-26 2021-07-26 Parameter transmission method, device, equipment and medium based on tree structure

Country Status (1)

Country Link
CN (1) CN113590348B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5632031A (en) * 1991-03-28 1997-05-20 International Business Machines Corporation Method and means for encoding storing and retrieving hierarchical data processing information for a computer system
CN1892602A (en) * 2005-07-01 2007-01-10 中国科学院计算技术研究所 Method for processing library function call in binary translation
CN106844877A (en) * 2016-12-28 2017-06-13 中国人民解放军军械工程学院 The analysis method of multimode phased mission systems dependability parameter
CN108171283A (en) * 2017-12-31 2018-06-15 厦门大学 A kind of picture material automatic describing method based on structuring semantic embedding
CN111475511A (en) * 2020-04-03 2020-07-31 弦子科技(北京)有限公司 Data storage method, data access method, data storage device, data access device and data access equipment based on tree structure

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013048298A1 (en) * 2011-09-30 2013-04-04 Telefonaktiebolaget L M Ericsson (Publ) Method and apparatus for controlling data transmission in a communication system
CN105095237B (en) * 2014-04-30 2018-07-17 国际商业机器公司 Method and apparatus for the pattern for generating non-relational database
CN109600447B (en) * 2018-12-21 2021-08-10 北京百度网讯科技有限公司 Method, device and system for processing data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5632031A (en) * 1991-03-28 1997-05-20 International Business Machines Corporation Method and means for encoding storing and retrieving hierarchical data processing information for a computer system
CN1892602A (en) * 2005-07-01 2007-01-10 中国科学院计算技术研究所 Method for processing library function call in binary translation
CN106844877A (en) * 2016-12-28 2017-06-13 中国人民解放军军械工程学院 The analysis method of multimode phased mission systems dependability parameter
CN108171283A (en) * 2017-12-31 2018-06-15 厦门大学 A kind of picture material automatic describing method based on structuring semantic embedding
CN111475511A (en) * 2020-04-03 2020-07-31 弦子科技(北京)有限公司 Data storage method, data access method, data storage device, data access device and data access equipment based on tree structure

Also Published As

Publication number Publication date
CN113590348A (en) 2021-11-02

Similar Documents

Publication Publication Date Title
CN103548020B (en) The method and system of the longest prefix match of the variable hierarchical name of size for being carried out by little tree
US10445334B1 (en) Query transmission in type-limited interchange formats
US9104676B2 (en) Hash algorithm-based data storage method and system
US9110884B2 (en) Message publishing and subscribing method and apparatus
CN110019080B (en) Data access method and device
US9641598B1 (en) Contextually unique identifier generation service
WO2021023149A1 (en) Method and apparatus for dynamically returning message
WO2023131218A1 (en) Graph data storage
CN115016784B (en) Low code application multiplexing method, application analysis system, equipment and storage medium
CN107665237A (en) Data structure sorter, the distribution subscription system of unstructured data and method
CN114090388A (en) Information acquisition method, server cluster, server and equipment
CN113900810A (en) Distributed graph processing method, system and storage medium
CN113590348B (en) Parameter transmission method, device, equipment and medium based on tree structure
CN111078773A (en) Data processing method and device
CN107977381B (en) Data configuration method, index management method, related device and computing equipment
CN114936097A (en) Processing node determination method, processing node determination device, computer equipment and storage medium
US10366059B2 (en) Record schemas identification in non-relational database
CN108345699A (en) Obtain the method, apparatus and storage medium of multi-medium data
US10114864B1 (en) List element query support and processing
CN113934767A (en) Data processing method and device, computer equipment and storage medium
CN113760343A (en) Method and device for processing service request
CN112711588A (en) Multi-table connection method and device
US11301492B1 (en) Network address range storage and retrieval
US11314414B2 (en) Methods, devices, and computer program products for storage management
Li et al. A multidimensional index for range queries over Cayley‐based DHT

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant