CN109657103A - Conversion method, device, computer equipment and the storage medium of data structure - Google Patents

Conversion method, device, computer equipment and the storage medium of data structure Download PDF

Info

Publication number
CN109657103A
CN109657103A CN201811558756.2A CN201811558756A CN109657103A CN 109657103 A CN109657103 A CN 109657103A CN 201811558756 A CN201811558756 A CN 201811558756A CN 109657103 A CN109657103 A CN 109657103A
Authority
CN
China
Prior art keywords
data
data structure
type
converted
syntax tree
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.)
Pending
Application number
CN201811558756.2A
Other languages
Chinese (zh)
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.)
Guangzhou Tian Peng Computer Science And Technology Co Ltd
Original Assignee
Guangzhou Tian Peng Computer Science And Technology 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 Guangzhou Tian Peng Computer Science And Technology Co Ltd filed Critical Guangzhou Tian Peng Computer Science And Technology Co Ltd
Priority to CN201811558756.2A priority Critical patent/CN109657103A/en
Publication of CN109657103A publication Critical patent/CN109657103A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • G06F40/154Tree transformation for tree-structured or markup documents, e.g. XSLT, XSL-FO or stylesheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/253Grammatical analysis; Style critique

Abstract

This application involves a kind of conversion method of data structure, device, computer equipment and storage mediums.The described method includes: obtaining the first data structure data and mapping script;Called application-specific programming interface parses the mapping script, obtains syntax tree object;The first data structure data are input to the syntax tree object;The syntax tree object is traversed, the first data structure data are converted, generates the second data structure data.It can be realized the conversion between the data structure internal instance of multiple format using this method;Conversion between the data structure of the directed acyclic graph of a variety of similar and different formats provides a set of comprehensive, flexible and easy-to-use solution;Not to the limitation of source format, object format and conversion direction, flexibility and wide usage are substantially increased.

Description

Conversion method, device, computer equipment and the storage medium of data structure
Technical field
This application involves field of computer technology, more particularly to a kind of conversion method of data structure, device, computer Equipment and storage medium.
Background technique
XML (Extensible Markup Language, extensible markup language) is one kind by SGML (Standard Generalized Markup Language, standard generalized markup language) simple, the flexible text formatting that is derived.
Due to the various superperformances of XML, it will there is more and more data to save and transmit with the format of XML.Very XML document is needed to be converted into the document of extended formatting in more applications, for example, XML is needed to be converted into often when building website The html document seen exchanges data by XML document between enterprise, but may first want after receiving the data in e-commerce XML file is converted into the data format of enterprises.
For same data structure, the data hierarchy relationship of the XML document designed between different user, different times And element name all can be different, and the problem of data structure is converted is equally existed between XML document;It is similar with XML document There are also the document of JSON format, the problem of conversion between the document of JSON format there is also data structure;Further, different numbers It can also mutually be converted according to the document of structure, XML document is such as converted to the document of JSON format;Data structure either of the same race Document or data structure not of the same race document between conversion, require to write certain specific application program, or use Certain specific tool can be converted, and step is comparatively laborious, spend the time long, reduce the ease of use of user.
Summary of the invention
Based on this, it is necessary to which in view of the above technical problems, providing one kind can be improved user in data structure conversion process Ease of use data structure conversion method, device, computer equipment and storage medium.
A kind of conversion method of data structure, which comprises
Obtain the first data structure data and mapping script;
Called application-specific programming interface parses the mapping script, obtains syntax tree object;
The first data structure data are input to the syntax tree object;
The syntax tree object is traversed, the first data structure data are converted, generates the second data structure number According to.
The mapping script includes the input variable and category for belonging to the first type of data structure in one of the embodiments, In the output variable of the second type of data structure, it is respectively used to the first data structure data of storage and the second data structure data; The type of data structure of the type of data structure of first data structure data and the second data structure data is identical or different.
In one of the embodiments, the type of data structure include directed acyclic graph structures or can equivalence be converted to To the type of data structure of acyclic graph structures;The directed acyclic graph structures or the number that of equal value can be converted to directed acyclic graph structures According to structure type include JavaScript object representation, extensible markup language, object diagram navigation language, Map, At least one of MultiValuedMap, quick health interoperability resource.
The traversal syntax tree object in one of the embodiments, the first data structure data are carried out Conversion generates the second data structure data, comprising:
The first data structure data are resolved into corresponding table data, and assignment is to the input variable;
The data in the input variable are mapped according to the mapping script corresponding mapping ruler, generate target Data;
By the target data assignment to the output variable;
Target data in output variable is converted into the second data structure data.
A kind of conversion equipment of data structure, described device include:
Module is obtained, for obtaining the first data structure data and mapping script;
Calling module parses the mapping script for called application-specific programming interface, obtains syntax tree object;
Input module, for the first data structure data to be input to the syntax tree object;
Conversion module converts the first data structure data for traversing the syntax tree object, generates the Two data structure data.
A kind of computer equipment, including memory and processor, the memory are stored with computer program, the processing Device performs the steps of when executing the computer program
Obtain the first data structure data and mapping script;
Called application-specific programming interface parses the mapping script, obtains syntax tree object;
The first data structure data are input to the syntax tree object;
The syntax tree object is traversed, the first data structure data are converted, generates the second data structure number According to.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor It is performed the steps of when row
Obtain the first data structure data and mapping script;
Called application-specific programming interface parses the mapping script, obtains syntax tree object;
The first data structure data are input to the syntax tree object;
The syntax tree object is traversed, the first data structure data are converted, generates the second data structure number According to.
Conversion method, device, computer equipment and the storage medium of above-mentioned data structure, by obtaining the first data structure Data and mapping script;It calls specific API to parse the mapping script, obtains syntax tree object;By first data structure Data are input to the syntax tree object;The syntax tree object is traversed, the first data structure data are converted, it is raw At the second data structure data;Realize the conversion between the data structure internal instance of multiple format;For a variety of similar and different lattice The directed acyclic graph of formula or the conversion between the data structure of directed acyclic graph equivalence provide a set of comprehensive, flexible and easy-to-use Solution;Not to the limitation of source format, object format and conversion direction, flexibility and wide usage are substantially increased.
Detailed description of the invention
Fig. 1 is a kind of application apparatus figure of the conversion method of data structure of one embodiment;
Fig. 2 is a kind of flow diagram of the conversion method of data structure of one embodiment;
Fig. 3 is a kind of flow diagram of generation the second data structure data of one embodiment;
Fig. 4 is the initial value of variable and data structure situation schematic diagram in a kind of mapping script of one embodiment;
Fig. 5 is variable and alias value in a kind of mapping script of one embodiment, element corresponding relationship, executes logic sum Data structure situation schematic diagram;
Fig. 6 is variable and alias value in a kind of mapping script of one embodiment, element corresponding relationship, executes logic sum Data structure situation schematic diagram;
Fig. 7 is variable and alias value in a kind of mapping script of one embodiment, element corresponding relationship, executes logic sum Data structure situation schematic diagram;
Fig. 8 is the final value of variable, element corresponding relationship and data structure feelings in a kind of mapping script of one embodiment Condition schematic diagram;
Fig. 9 is a kind of structural block diagram of the conversion equipment of data structure of one embodiment;
Figure 10 is a kind of internal structure chart of computer equipment of one embodiment.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not For limiting the application.
The conversion method of data structure provided by the present application can be applied in equipment as shown in Figure 1.Wherein, described Equipment may include terminal 102, and the terminal 102 can be, but not limited to be various personal computers, laptop, intelligent hand Machine, tablet computer and portable wearable device, the operating system of the terminal 102 may include Windows, Linux, Android (Android), IOS, Windows Phone etc., the present embodiment to this with no restriction.
In one embodiment, as shown in Fig. 2, providing a kind of conversion method of data structure, it is applied in this way It is illustrated for terminal 102, comprising the following steps:
Step S201 obtains the first data structure data and mapping script;
In the present embodiment, the terminal is available first to arrive the first data structure data and mapping script;It needs Bright, the first data structure data can exist in the form of document data, the data structure of the first data structure data Type can be some specific data structure.For example, which may include directed acyclic diagram data knot Structure or the data structure that of equal value can be converted to directed acyclic graph.
In data structure, figure (Graph) is that a kind of collection that the finite nonempty set by vertex closes the side between vertex is combined At data structure;Figure is divided into non-directed graph and digraph according to the presence or absence of side directionality;It, can not be from some vertex in digraph It sets out and returns to the point by several sides, then the digraph is known as directed acyclic graph;Directed acyclic graph (DAG, Directed Acyclic Graph) data structure is mainly used for topological sorting and critical path operates.
Further, the mapping script can be preset mapping script, which is using mapped specific language Say the program write, it should be noted that may include the input variable for belonging to the first type of data structure in the mapping script With the output variable for belonging to the second type of data structure, it is respectively used to the first data structure data of storage and the second data structure number According to;The type of data structure of the type of data structure of first data structure data and the second data structure data is identical or different.
Step S202 calls specific API to parse the mapping script, obtains syntax tree object;
It is specifically applied in the present embodiment, it, can after terminal gets the first data structure data and mapping script To call specific API (Application Programming Interface, application programming interface) to parse the mapping Script.
The specific API is some functions predetermined, and the function predetermined is called to parse the mapping script, Corresponding syntax tree object is obtained, which is made of a series of Java object nodes, these nodes are interrelated, forms tree Shape structure, each node indicate a syntactic element in mapping script.
The first data structure data are input to the syntax tree object by step S203;
It applies in the present embodiment, the first data structure data can be input to the syntax tree pair by terminal As in, it is input with the first data structure data, executes the syntax tree object;It should be noted that first data When type of data structure in structured data is some specific data structure;The number of input data defined in the mapping script It should be data structure identical with the first data structure data according to structure type, the two matching can execute the mapping script Corresponding program.
Step S204 traverses the syntax tree object, and the first data structure data are converted, and generates the second number According to structured data.
In the present embodiment, after which is input to the syntax tree object, the syntax tree is traversed Object executes the described corresponding program of mapping script, the first data structure data is converted to the second data structure Data generate the second document data comprising the second data structure data after the completion of conversion operation;The i.e. described second data knot Structure data can equally exist in the form of document data.
Second data structure equally may include directed acyclic graph data structure or can equivalence be converted to directed acyclic The data structure of figure.
It should be noted that because the type of data structure of output data defined in the mapping script can be the second number According to structure, terminal can be carried out the first data structure data in first document data according to the format of the second data structure Conversion, obtains the second data structure data.
According to the conversion method of data structure provided in this embodiment, the first data structure data and mapping script are obtained; It calls specific API to parse the mapping script, obtains syntax tree object;The first data structure data are input to institute's predicate Method tree object;The syntax tree object is traversed, the first data structure data are converted, generates the second data structure number According to;Realize the conversion between the data structure internal instance of multiple format;For the directed acyclic graph of a variety of similar and different formats Conversion between data structure provides a set of comprehensive, flexible and easy-to-use solution;Not to source format, object format and The limitation of conversion direction, substantially increases flexibility and wide usage.
In another embodiment, the mapping script includes belonging to the input variable of the first type of data structure and belonging to The output variable of second type of data structure is respectively used to the first data structure data of storage and the second data structure data;The The type of data structure of the type of data structure of one data structure data and the second data structure data is identical or different.
In a specific example, which may include the input variable and category for belonging to the first type of data structure In the output variable of the second type of data structure, it is respectively used to the first data structure data of storage and the second data structure data; The type of data structure of the first data structure data is the type of data structure of the input data;Second data structure The type of data structure of data is the type of data structure of the output data.
For example, the correlative for defining the affiliated type of data structure of the input data is " #Source=" urn: struct:Source"";And the correlative for defining the affiliated type of data structure of output data is " #Target=" urn: struct:Target"";The different data structure type of input data and output data can be defined respectively in mapping script.
In another embodiment, the type of data structure include JSON (JavaScript Object Notation, JavaScript object representation), XML, object diagram navigation language OGNL (Object Graphic Navigation Language, object diagram navigation language), Map, MultiValuedMap, FHIR (quick health interoperability resource, Fast At least one of Health Interoperable Resources).
Wherein, the type of data structure includes directed acyclic graph structures or of equal value can be converted to directed acyclic graph structures Type of data structure;The directed acyclic graph structures or the type of data structure that of equal value can be converted to directed acyclic graph structures include Any one in the formats such as JSON, XML, OGNL, Map, MultiValuedMap, FHIR.
For example, when the type of data structure of input data is JSON, and the type of data structure of output data is XML, then the correlative of the affiliated type of data structure of this definition input data is " #Source=" urn:json:Source " "; And the correlative for defining the affiliated type of data structure of the output data is " #Target=" urn:xml:Target " ";It is reflecting Input data and the different type of data structure of output data can be defined by penetrating in script, realize the data structure number of multiple format Conversion between, user can be added by way of increasing and realizing class to other data structures and self-defining data structure Support.
JSON is a kind of data interchange format of lightweight, and the text formatting for being totally independent of programming language is used to deposit Storage and expression data.XML is a kind of simple, flexible text formatting being derived by SGML.OGNL is a kind of expression formula Language, can be with any attribute of access object, the method for calling object, traverses the structure chart of entire object, realizes field class The functions such as type conversion.Map in Java provides a more general element storage method.Map collection class is used for storage element To (referred to as " key " and " value "), wherein each key is mapped to a value.FHIR is based on a series of modularizations for being referred to as " resource " Component constructs.These resources can easily be assembled into work system, for solving in the real world clinical and management Problem defines a simple standard card cage, for extending and adapting to already present resource.
In another embodiment, referring to Fig. 3, a kind of flow diagram for generating the second data structure data is provided, As shown in figure 3, the step S204 includes following sub-step:
The first data structure data are resolved to corresponding table data by sub-step S11, and assignment is to the input Variable;
Sub-step S12 reflects the data in the input variable according to the corresponding mapping ruler of the mapping script It penetrates, generates target data;
Sub-step S13, by the target data assignment to the output variable;
Target data in output variable is converted to the second data structure data by sub-step S14.
It applies in the present embodiment, input data (i.e. the first data structure data) can be traversed the grammer by terminal Object is set, firstly, the first data structure data are resolved to corresponding table data;For example, working as the data knot of input data Structure type is JSON, then the parsing of the first data structure data is converted into the list of JSON element;When the data structure of input data Type is XML, then the parsing of the first data structure data is converted into DOM (DOM Document Object Model, the Document Object of XML Model) the list of node;By the table data assignment to the input variable of the mapping script.
Further, the data in the input variable are mapped, generates target data, the target data can be with For the data of the second data structure, specifically, according to the corresponding mapping ruler of the mapping script to the data in input variable It is mapped, generates target data;It should be noted that the rule that the mapping ruler is reflected for the program of the mapping script Then, different because of different data structure or user demand, the present embodiment is not necessarily to make this excessive limitation.
In practical application, then the output variable by the target data assignment into the mapping script, by the output Data in variable are converted to the second required data structure data;Wherein, the data of the output variable are equally with list number According to form save.Can also the node data in available data be increased, deleted, changed and be moved, be replicated, be sorted etc. with behaviour Make.
In order to make those skilled in the art more fully understand the present embodiment, it is illustrated below with a specific example.
It both must be directed acyclic 1. determining the first data structure and the second data structure for needing to carry out data conversion Figure can turn to directed acyclic graph through equivalence conversion;
2. obtaining mapping script;
3. passing through Java API load mapping script;JavaCC realization can be used in the API, compiles to mapping script It translates, being converted into corresponding syntax tree object, (the syntax tree object is one group of Java object;In conjunction with input (the first data structure) and Output data (the second data structure), it is the program for running mapping script description that syntax tree object is executed to it);
4. to syntax tree object addition output and input data, i.e., to mapping script defined in output and input variable assign Value;
5. using above-mentioned call method as a module of system, or forming independent program;When operating system or program, Realize the data conversion between directed acyclic graph or directed acyclic graph equivalent construction.
The explanation of data structure conversion is carried out by taking following mapping script as an example:
1. according to mapping script definition, by structure name with its define URI (Uniform Resource Identifier, Uniform resource identifier) data type representated by value is associated;In processing constant, variable, expression formula, the parameter of function and return When returning the nodes such as value, the adapter of the corresponding type of data structure of the node will be used to handle;
2. receiving the input data that user gives from input variable src, and according to structure name Source (i.e. #Source Source in=" urn:struct:Source ") input data is construed to be worth accordingly by corresponding type of data structure Data list, such as: Source is defined as XML data type, then src is the list of the DOM node of XML;Source is defined as JSON data type, then src is the list of JSON element;
3. receive the output data that user gives from output variable tgt, the node of generally one or a set of sky is (i.e. pair The example of data type generated using default initialization mode is answered, specific semanteme is determined by the adapter of each data type, i.e., It is determined by mapping script);Referring to Fig. 4, the initial value of variable and data structure in a kind of mapping script of the present embodiment are shown Situation schematic diagram;As shown in figure 4, dash box corresponding to src indicate input variable table data and it includes element, it is real The owner of line connection attribute and attribute, the tag representation attribute-name on solid line.
4. executing iterative part, that is,@@() { } part;Firstly, to iteration head, that is,@@() bracket inner part evaluation;Evaluation Tgt.prop1 () part creates the attribute value of several entitled prop1 that is, for each value in tgt node value list, Its number is the part access point (Junction) the i.e. number of the bracket inner part result of evaluation list intermediate value of@();Wherein, " new Build the attribute value of entitled prop1 " semanteme is determined by the type of data structure adapter of Target, such as: XML be increase it is entitled The attribute of prop1, or create the child node of entitled prop1;JSON is every in JSON array to current JSON object, or currently A JSON object increases the attribute of entitled prop1;
5. being asked first access point section src.prop1:src_prop1.prop3:src_prop3 to carry out step 4 Value;First to the first segment src.prop1:src_prop1 evaluation in chain, i.e., for each value in src node value list, It takes the attribute value of its entitled prop1 and is arranged successively, forming result node and marking its alias is src_prop1;Then to chain Second segment prop3:src_prop3 evaluation in item, i.e., for each value in the result src_prop1 value list of previous step, It takes the attribute value of its entitled prop3 and is arranged successively, forming result node and marking its alias is src_prop3;Reference Fig. 5, It shows variable and alias value in a kind of mapping script of the present embodiment, element corresponding relationship, execute logic and data structure Situation schematic diagram;As shown in figure 5, dash box corresponding to dash box corresponding to newly-increased src_prop1 and src_prop3 point Not Biao Shi the corresponding table data of alias and it includes element.
6. as described in step 4, each of the node for being src_prop3 for access point section result of evaluation, that is, alias Value, creates the attribute value of entitled prop1 respectively and is arranged successively under tgt node, forms result node and marks it not Entitled tgt_prop1;Meanwhile determining following corresponding relationship: according to the owner of attribute, determining tgt_prop1 and tgt, src_ Corresponding relationship between the value of this several pairs of nodes of prop1 and src, src_prop3 and src_prop1;It is asked according to according to access point It is worth the one-one relationship of result New anyAttribute value, determining tgt_prop1 and src_prop3, this closes corresponding between nodal value System;So far, iteration head partial evaluation is completed;Referring to Fig. 6, shows variable and alias in a kind of mapping script of the present embodiment and take Value, executes logic and data structure situation schematic diagram at element corresponding relationship;As shown in fig. 6, corresponding to newly-increased tgt_prop1 Dash box indicate the corresponding table data of alias and it includes element;Dotted arrow indicates the calculating process of access point, i.e., New anyAttribute value is distinguished for each element of access point section result of evaluation, and thus established one-one relationship.
7. each value of result of evaluation tgt_prop1 is divided on gained iteration head in pair step 6, iteration body portion is executed;? In iteration body scope, tgt_prop1 variable indicates the single value (actually monodrome list) being currently iterated;Other and iteration The variable or alias occurred in head variable of the same name, respectively indicates and triggers from current iteration value, according to corresponding relationship described in step 6 Directly or indirectly corresponding single value;
8. execute-assignment-statement tgt_prop1.prop2=src_prop1.prop2;Right-hand component is calculated, for src_ Prop1 (the monodrome list that current iteration value corresponds to intermediate node of the same name in iteration head) takes the attribute of its entitled prop2 and successively Arrangement forms result node;Left-hand component is calculated again, for tgt_prop1 (current iteration value), by the category of its entitled prop2 Property value sets gradually as the value of the right result of evaluation;Wherein, attribute value " the semantic data by Target of entitled prop2 are set Structure type adapter determines, specific to be same as above;Referring to Fig. 7, variable and alias in a kind of mapping script of the present embodiment are shown Value, executes logic and data structure situation schematic diagram at element corresponding relationship;As shown in fig. 7, being directed toward the point of prop2 and prop3 Line arrow indicates assignment operation and direction;Dark rectangular node indicates the element being currently iterated;Thick frame and heavy line table Show the element with the element that is currently iterated according to the associated each variable and alias meaning of corresponding relationship described in step 6 (value of these variables and alias is monodrome list in iteration body).
9. same, execute-assignment-statement tgt_prop1.prop3=src_prop3;
10. after pair all values execute iteration body portion, mapping script is finished, by output variable tgt to user The second data structure data after data conversion are provided;Referring to Fig. 8, shows in a kind of mapping script of the present embodiment and become Measure final value, element corresponding relationship and data structure situation schematic diagram.
First example:
Input data (XML format):
<prop1>
<prop2>abc</prop2>
<prop3>?</prop3>
<prop3>1231</prop3>
<prop3>2.2</prop3>
<prop3>liu</prop3>
<prop3>it thanks</prop3>
</prop1>
Output data (XML format):
<prop1>
<prop2>abc</prop2>
<prop3>?</prop3>
</prop1>
<prop1>
<prop2>abc</prop2>
<prop3>1231</prop3>
</prop1>
<prop1>
<prop2>abc</prop2>
<prop3>2.2</prop3>
</prop1>
<prop1>
<prop2>abc</prop2>
<prop3>liu</prop3>
</prop1>
<prop1>
<prop2>abc</prop2>
<prop3>it thanks</prop3>
</prop1>
Second example:
Input data (JSON format):
Output data (JSON format):
Third example:
Input data (XML format):
<prop1>
<prop2>abc</prop2>
<prop3>?</prop3>
<prop3>1231</prop3>
<prop3>2.2</prop3>
<prop3>liu</prop3>
<prop3>it thanks</prop3>
</prop1>
Output data (JSON format):
4th example:
Input data (JSON format):
Output data (XML format):
<prop1>
<prop2>abc</prop2>
<prop3>?</prop3>
</prop1>
<prop1>
<prop2>abc</prop2>
<prop3>1231</prop3>
</prop1>
<prop1>
<prop2>abc</prop2>
<prop3>2.2</prop3>
</prop1>
<prop1>
<prop2>abc</prop2>
<prop3>liu</prop3>
</prop1>
<prop1>
<prop2>abc</prop2>
<prop3>it thanks</prop3>
</prop1>
It should be understood that although each step in the flow chart of Fig. 2-3 is successively shown according to the instruction of arrow, These steps are not that the inevitable sequence according to arrow instruction successively executes.Unless expressly stating otherwise herein, these steps Execution there is no stringent sequences to limit, these steps can execute in other order.Moreover, at least one in Fig. 2-3 Part steps may include that perhaps these sub-steps of multiple stages or stage are not necessarily in synchronization to multiple sub-steps Completion is executed, but can be executed at different times, the execution sequence in these sub-steps or stage is also not necessarily successively It carries out, but can be at least part of the sub-step or stage of other steps or other steps in turn or alternately It executes.
In one embodiment, as shown in figure 9, providing a kind of conversion equipment of data structure, comprising: obtain module 301, calling module 302, input module 303 and conversion module 304, in which:
Module 301 is obtained, for obtaining the first data structure data and mapping script;
Calling module 302 parses the mapping script for called application-specific programming interface API, obtains grammer Set object;
Input module 303, for the first data structure data to be input to the syntax tree object;
Conversion module 304 converts the first data structure data for traversing the syntax tree object, raw At the second data structure data.
In one embodiment, the mapping script includes belonging to the input variable of the first type of data structure and belonging to the The output variable of two type of data structure is respectively used to the first data structure data of storage and the second data structure data;First The type of data structure of the type of data structure of data structure data and the second data structure data is identical or different.
In one embodiment, the type of data structure include directed acyclic graph structures or can equivalence be converted to oriented nothing The type of data structure of ring graph structure;The directed acyclic graph structures or the data knot that of equal value can be converted to directed acyclic graph structures Structure type include JavaScript object representation JSON, expandable mark language XML, object diagram navigation language OGNL, Map, At least one of MultiValuedMap, quick health interoperability resource FHIR.
In one embodiment, the conversion module includes:
Analyzing sub-module, for the first data structure data to be resolved to corresponding table data, and assignment is to institute State input variable;
Mapping submodule, for according to the corresponding mapping ruler of the mapping script to the data in the input variable into Row mapping, generates target data;
Assignment submodule is used for the target data assignment to the output variable;
Transform subblock, for the target data in output variable to be converted to the second data structure data.About data The specific of the conversion equipment of structure limits the restriction that may refer to the conversion method above for data structure, no longer superfluous herein It states.Modules in the conversion equipment of above-mentioned data structure can be realized fully or partially through software, hardware and combinations thereof. Above-mentioned each module can be embedded in the form of hardware or independently of in the processor in computer equipment, can also deposit in a software form It is stored in the memory in computer equipment, executes the corresponding operation of the above modules in order to which processor calls.
The conversion equipment of the data structure of above-mentioned offer can be used for executing the data structure that above-mentioned any embodiment provides Conversion method has corresponding function and beneficial effect.
In one embodiment, a kind of computer equipment is provided, which can be terminal, internal structure Figure can be as shown in Figure 10.The computer equipment includes the processor connected by system bus, memory, network interface, shows Display screen and input unit.Wherein, the processor of the computer equipment is for providing calculating and control ability.The computer equipment Memory includes non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system and computer Program.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The meter The network interface for calculating machine equipment is used to communicate with external terminal by network connection.When the computer program is executed by processor To realize a kind of conversion method of data structure.The display screen of the computer equipment can be liquid crystal display or electric ink Display screen, the input unit of the computer equipment can be the touch layer covered on display screen, be also possible to outside computer equipment Key, trace ball or the Trackpad being arranged on shell can also be external keyboard, Trackpad or mouse etc..
It will be understood by those skilled in the art that structure shown in Figure 10, only part relevant to application scheme The block diagram of structure, does not constitute the restriction for the computer equipment being applied thereon to application scheme, and specific computer is set Standby may include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of computer equipment, including memory and processor are provided, is stored in memory Computer program, the processor perform the steps of when executing computer program
Obtain the first data structure data and mapping script;
Called application-specific programming interface API parses the mapping script, obtains syntax tree object;
The first data structure data are input to the syntax tree object;
The syntax tree object is traversed, the first data structure data are converted, generates the second data structure number According to.
In one embodiment, the mapping script includes belonging to the input variable of the first type of data structure and belonging to the The output variable of two type of data structure is respectively used to the first data structure data of storage and the second data structure data;First The type of data structure of the type of data structure of data structure data and the second data structure data is identical or different.
In one embodiment, the type of data structure include directed acyclic graph structures or can equivalence be converted to oriented nothing The type of data structure of ring graph structure;The directed acyclic graph structures or the data knot that of equal value can be converted to directed acyclic graph structures Structure type include JavaScript object representation JSON, expandable mark language XML, object diagram navigation language OGNL, Map, At least one of MultiValuedMap, quick health interoperability resource FHIR.
In one embodiment, it is also performed the steps of when processor executes computer program
The first data structure data are resolved into corresponding table data, and assignment is to the input variable;
The data in the input variable are mapped according to the mapping script corresponding mapping ruler, generate target Data;
By the target data assignment to the output variable;
Target data in output variable is converted into the second data structure data.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program performs the steps of when being executed by processor
Obtain the first data structure data and mapping script;
Called application-specific programming interface API parses the mapping script, obtains syntax tree object;
The first data structure data are input to the syntax tree object;
The syntax tree object is traversed, the first data structure data are converted, generates the second data structure number According to.
In one embodiment, the mapping script includes belonging to the input variable of the first type of data structure and belonging to the The output variable of two type of data structure is respectively used to the first data structure data of storage and the second data structure data;First The type of data structure of the type of data structure of data structure data and the second data structure data is identical or different.
In one embodiment, the type of data structure include directed acyclic graph structures or can equivalence be converted to oriented nothing The type of data structure of ring graph structure;The directed acyclic graph structures or the data knot that of equal value can be converted to directed acyclic graph structures Structure type include JavaScript object representation JSON, expandable mark language XML, object diagram navigation language OGNL, Map, At least one of MultiValuedMap, quick health interoperability resource FHIR.
In one embodiment, it is also performed the steps of when computer program is executed by processor
The first data structure data are resolved into corresponding table data, and assignment is to the input variable;
The data in the input variable are mapped according to the mapping script corresponding mapping ruler, generate target Data;
By the target data assignment to the output variable;
Target data in output variable is converted into the second data structure data.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, To any reference of memory, storage, database or other media used in each embodiment provided herein, Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously It cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art It says, without departing from the concept of this application, various modifications and improvements can be made, these belong to the protection of the application Range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.

Claims (10)

1. a kind of conversion method of data structure, which comprises
Obtain the first data structure data and mapping script;
Called application-specific programming interface parses the mapping script, obtains syntax tree object;
The first data structure data are input to the syntax tree object;
The syntax tree object is traversed, the first data structure data are converted, generates the second data structure data.
2. the method according to claim 1, wherein the mapping script includes belonging to the first type of data structure Input variable and belong to the output variable of the second type of data structure, be respectively used to storage the first data structure data and second Data structure data;The type of data structure phase of the type of data structure of first data structure data and the second data structure data It is same or different.
3. method according to claim 1 or 2, which is characterized in that the type of data structure includes directed acyclic graph knot Structure or the type of data structure that of equal value can be converted to directed acyclic graph structures;The directed acyclic graph structures or can equivalence be converted to The type of data structure of directed acyclic graph structures includes that JavaScript object representation, extensible markup language, object diagram are led It navigates language, Map, MultiValuedMap, any one in quick health interoperability resource.
4. according to the method described in claim 2, it is characterized in that, the traversal syntax tree object, described first is counted It is converted according to structured data, generates the second data structure data, comprising:
The first data structure data are resolved into corresponding table data, and assignment is to the input variable;
The data in the input variable are mapped according to the mapping script corresponding mapping ruler, generate number of targets According to;
By the target data assignment to the output variable;
Target data in output variable is converted into the second data structure data.
5. a kind of conversion equipment of data structure, described device include:
Module is obtained, for obtaining the first data structure data and mapping script;
Calling module parses the mapping script for called application-specific programming interface, obtains syntax tree object;
Input module, for the first data structure data to be input to the syntax tree object;
Conversion module converts the first data structure data for traversing the syntax tree object, generates the second number According to structured data.
6. the apparatus according to claim 1, which is characterized in that the mapping script includes belonging to the first type of data structure Input variable and belong to the output variable of the second type of data structure, be respectively used to storage the first data structure data and second Data structure data;The type of data structure phase of the type of data structure of first data structure data and the second data structure data It is same or different.
7. the apparatus according to claim 1, which is characterized in that the type of data structure include directed acyclic graph structures or It of equal value can be converted to the type of data structure of directed acyclic graph structures;The directed acyclic graph structures or can equivalence be converted to it is oriented The type of data structure of acyclic graph structures includes JavaScript object representation, extensible markup language, object diagram navigation language Speech, Map, MultiValuedMap, any one in quick health interoperability resource.
8. device according to claim 5, which is characterized in that the conversion module includes:
Analyzing sub-module, for the first data structure data to be resolved to corresponding table data, and assignment is to described defeated Enter variable;
Mapping submodule, for being reflected according to the corresponding mapping ruler of the mapping script to the data in the input variable It penetrates, generates target data;
Assignment submodule is used for the target data assignment to the output variable;
Transform subblock, for the target data in output variable to be converted to the second data structure data.
9. a kind of computer equipment, including memory and processor, the memory are stored with computer program, feature exists In the processor realizes the conversion of data structure described in any one of Claims 1-4 when executing the computer program The step of method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of conversion method of data structure described in any one of Claims 1-4 is realized when being executed by processor.
CN201811558756.2A 2018-12-19 2018-12-19 Conversion method, device, computer equipment and the storage medium of data structure Pending CN109657103A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811558756.2A CN109657103A (en) 2018-12-19 2018-12-19 Conversion method, device, computer equipment and the storage medium of data structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811558756.2A CN109657103A (en) 2018-12-19 2018-12-19 Conversion method, device, computer equipment and the storage medium of data structure

Publications (1)

Publication Number Publication Date
CN109657103A true CN109657103A (en) 2019-04-19

Family

ID=66115857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811558756.2A Pending CN109657103A (en) 2018-12-19 2018-12-19 Conversion method, device, computer equipment and the storage medium of data structure

Country Status (1)

Country Link
CN (1) CN109657103A (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287429A (en) * 2019-06-28 2019-09-27 百度在线网络技术(北京)有限公司 Data analysis method, device, equipment and storage medium
CN110308907A (en) * 2019-07-03 2019-10-08 携程旅游网络技术(上海)有限公司 Data transfer device, device, storage medium and electronic equipment
CN110347696A (en) * 2019-05-28 2019-10-18 平安科技(深圳)有限公司 Data transfer device, device, computer equipment and storage medium
CN111061481A (en) * 2019-12-17 2020-04-24 神州数码融信软件有限公司 Data format conversion method and device
CN111143446A (en) * 2019-11-26 2020-05-12 贝壳技术有限公司 Data structure conversion processing method and device of data object and electronic equipment
CN111159278A (en) * 2019-12-30 2020-05-15 新浪网技术(中国)有限公司 Data display method and device, electronic equipment and computer readable storage medium
CN111813846A (en) * 2020-06-29 2020-10-23 北京九章云极科技有限公司 Data analysis processing system and data processing method
CN111858472A (en) * 2020-08-03 2020-10-30 平安国际智慧城市科技股份有限公司 File format conversion method and device, computer equipment and storage medium
CN112270176A (en) * 2020-11-09 2021-01-26 北京百度网讯科技有限公司 Method, apparatus, and computer storage medium for mode conversion in a deep learning framework
CN112287013A (en) * 2020-12-24 2021-01-29 深圳市蓝凌软件股份有限公司 Data conversion method and adapter
CN113590085A (en) * 2020-04-30 2021-11-02 深圳中砼物联网科技有限公司 Processing method of multi-source heterogeneous data, computer equipment and storage medium
US20230034198A1 (en) * 2021-07-28 2023-02-02 Red Hat, Inc. Using dynamic data structures for storing data objects

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1940913A (en) * 2006-09-15 2007-04-04 北京北大方正电子有限公司 Variable table data type setting method
CN101208660A (en) * 2005-06-27 2008-06-25 奎朴兹有限公司 Code transformation
CN101763339A (en) * 2009-12-21 2010-06-30 金蝶软件(中国)有限公司 Business bill conversion method, device and system
CN105335412A (en) * 2014-07-31 2016-02-17 阿里巴巴集团控股有限公司 Method and device for data conversion and data migration
CN106165369A (en) * 2014-03-27 2016-11-23 甲骨文国际公司 For supporting the system and method for data type conversion in heterogeneous computing environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101208660A (en) * 2005-06-27 2008-06-25 奎朴兹有限公司 Code transformation
CN1940913A (en) * 2006-09-15 2007-04-04 北京北大方正电子有限公司 Variable table data type setting method
CN101763339A (en) * 2009-12-21 2010-06-30 金蝶软件(中国)有限公司 Business bill conversion method, device and system
CN106165369A (en) * 2014-03-27 2016-11-23 甲骨文国际公司 For supporting the system and method for data type conversion in heterogeneous computing environment
CN105335412A (en) * 2014-07-31 2016-02-17 阿里巴巴集团控股有限公司 Method and device for data conversion and data migration

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
韩来发主编: "《提高测绘科技水平 促进吉林振兴发展:吉林省测绘学会2008年学术年会论文集 上》", 31 July 2008, 哈尔滨地图出版社 *

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110347696A (en) * 2019-05-28 2019-10-18 平安科技(深圳)有限公司 Data transfer device, device, computer equipment and storage medium
CN110347696B (en) * 2019-05-28 2024-03-26 平安科技(深圳)有限公司 Data conversion method, device, computer equipment and storage medium
CN110287429A (en) * 2019-06-28 2019-09-27 百度在线网络技术(北京)有限公司 Data analysis method, device, equipment and storage medium
CN110308907A (en) * 2019-07-03 2019-10-08 携程旅游网络技术(上海)有限公司 Data transfer device, device, storage medium and electronic equipment
CN110308907B (en) * 2019-07-03 2023-06-27 携程旅游网络技术(上海)有限公司 Data conversion method and device, storage medium and electronic equipment
CN111143446A (en) * 2019-11-26 2020-05-12 贝壳技术有限公司 Data structure conversion processing method and device of data object and electronic equipment
CN111061481A (en) * 2019-12-17 2020-04-24 神州数码融信软件有限公司 Data format conversion method and device
CN111159278A (en) * 2019-12-30 2020-05-15 新浪网技术(中国)有限公司 Data display method and device, electronic equipment and computer readable storage medium
CN111159278B (en) * 2019-12-30 2023-07-14 新浪技术(中国)有限公司 Data display method and device, electronic equipment and computer readable storage medium
CN113590085B (en) * 2020-04-30 2023-06-16 广东中砼物联网科技有限公司 Processing method of multi-source heterogeneous data, computer equipment and storage medium
CN113590085A (en) * 2020-04-30 2021-11-02 深圳中砼物联网科技有限公司 Processing method of multi-source heterogeneous data, computer equipment and storage medium
CN111813846B (en) * 2020-06-29 2021-04-02 北京九章云极科技有限公司 Data analysis processing system and data processing method
CN111813846A (en) * 2020-06-29 2020-10-23 北京九章云极科技有限公司 Data analysis processing system and data processing method
CN111858472A (en) * 2020-08-03 2020-10-30 平安国际智慧城市科技股份有限公司 File format conversion method and device, computer equipment and storage medium
CN111858472B (en) * 2020-08-03 2023-09-05 深圳赛安特技术服务有限公司 File format conversion method, device, computer equipment and storage medium
US11604774B2 (en) 2020-11-09 2023-03-14 Beijing Baidu Netcom Science Technology Co., Ltd. Method and apparatus of converting schema in deep learning framework, and computer storage medium
CN112270176A (en) * 2020-11-09 2021-01-26 北京百度网讯科技有限公司 Method, apparatus, and computer storage medium for mode conversion in a deep learning framework
CN112287013B (en) * 2020-12-24 2021-05-07 深圳市蓝凌软件股份有限公司 Data conversion method and adapter
CN112287013A (en) * 2020-12-24 2021-01-29 深圳市蓝凌软件股份有限公司 Data conversion method and adapter
US20230034198A1 (en) * 2021-07-28 2023-02-02 Red Hat, Inc. Using dynamic data structures for storing data objects

Similar Documents

Publication Publication Date Title
CN109657103A (en) Conversion method, device, computer equipment and the storage medium of data structure
CN106708480B (en) Management platform implementation method and device
CN106293664A (en) Code generating method and device
US20170192877A1 (en) Mobile application development and deployment
JP7350923B2 (en) Deep learning framework operator registration method, equipment, device and storage medium
US11003835B2 (en) System and method to convert a webpage built on a legacy framework to a webpage compatible with a target framework
US20190052542A1 (en) System and method for providing visualizations of computing infrastructure using a domain-specific language for cloud services infrastructure
Sagebaum et al. Expression templates for primal value taping in the reverse mode of algorithmic differentiation
CN112148356B (en) Document generation method, interface development method, device, server and storage medium
CN109684607A (en) JSON data analysis method, device, computer equipment and storage medium
CN108920496A (en) A kind of rendering method and device
CN110377291A (en) Structural data conversion method, device, computer equipment and storage medium
CN115794213B (en) Configurable object management method, device and equipment based on embedded system
JP2012515972A (en) Web-based diagram visual extensibility
CN112287013A (en) Data conversion method and adapter
Mirandola et al. A reliability model for service component architectures
CN112187713B (en) Message conversion method, device, computer equipment and storage medium
Gómez-Martínez et al. ArgoSPE: Model-based software performance engineering
Muslim et al. A modular and extensible framework for open learning analytics
CN112926008B (en) Method, device, electronic equipment and storage medium for generating form page
Goldschmidt et al. Evaluating domain-specific languages for the development of OPC UA based applications
CN112947900A (en) Web application development method and device, server and development terminal
CN110058849A (en) Generation method, device, computer equipment and the storage medium of flow chart
Inayatullah et al. Model-based scaffolding code generation for cross-platform applications
RU2702508C1 (en) System of component-oriented software and method of development

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190419