CN112948479A - Data structure interconversion method based on aviator - Google Patents
Data structure interconversion method based on aviator Download PDFInfo
- Publication number
- CN112948479A CN112948479A CN202110413870.1A CN202110413870A CN112948479A CN 112948479 A CN112948479 A CN 112948479A CN 202110413870 A CN202110413870 A CN 202110413870A CN 112948479 A CN112948479 A CN 112948479A
- Authority
- CN
- China
- Prior art keywords
- data
- attribute
- source
- mapping
- field
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 13
- IWEDIXLBFLAXBO-UHFFFAOYSA-N dicamba Chemical compound COC1=C(Cl)C=CC(Cl)=C1C(O)=O IWEDIXLBFLAXBO-UHFFFAOYSA-N 0.000 title claims abstract description 4
- 238000006243 chemical reaction Methods 0.000 claims abstract description 23
- 238000011161 development Methods 0.000 claims abstract description 4
- 238000013507 mapping Methods 0.000 claims description 27
- 210000001503 joint Anatomy 0.000 claims description 5
- 238000012545 processing Methods 0.000 claims description 5
- 230000006854 communication Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 238000001914 filtration Methods 0.000 description 3
- 238000012827 research and development Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000007620 mathematical function Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/258—Data format conversion from or to a database
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
Abstract
The invention relates to the technical field of computers, and discloses a mutual conversion method between data structures based on an aviator, which aims to solve the problem that when data interfaces are butted, the data formats and the data structures between the interfaces are not matched, so that manual customization and development are needed.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a mutual conversion method based on an ariator data structure.
Background
With the continuous development of information technology, more and more complex applications and the popularization of micro-service thinking, and the quantity is continuously increased, the calling between services becomes very frequent, and parameters between interfaces and data structures and data formats of returned information need to be determined during the communication process of each service; however, the update cycle of each service is inconsistent, some services are updated frequently, some services are relatively stable, and few services are updated, which causes two problems:
firstly, technology stacks adopted by some services are old, technology stacks of some services are new, and technology stacks of different services are different, so that the services use different data formats to organize respective service data, for example, an interface provided by an early webservice can use xml as a communication data format, some current services can perform communication between services in a mode of combining http and json, if one service needs to be in butt joint with a plurality of services, the same set of data is in butt joint with different services, some services are in communication in the xml format, some services are in communication in the json format, and research and development personnel need to perform corresponding format conversion coding, so that the cost is high;
secondly, when some services are in data butt joint, the situation may exist, the same data is called id in the system A, called no in the system B, weight field unit of the system A uses KG, weight field unit of the system B uses G, if the services are in butt joint with the system C, weight unit of the system B uses ton, research and development personnel need to perform different conversion on respective interfaces, and cost is very high;
based on the two problems, the method disclosed by the patent can realize convenient and effective treatment, and greatly reduces the investment of research and development cost.
Based on the patent, only the butted application and the interface of the application are needed to be used as a dimension, the data structure and the mapping relation are configured, and one piece of data is converted and output after the corresponding mapping relation is found through different applications and interfaces.
Disclosure of Invention
The invention aims to provide a mutual conversion method between data structures based on an ariator, which aims to solve the problem that the conversion of different data formats and data structures in the background art needs manual code writing for conversion, and realizes quick conversion and follow-up use through mapping and processing logic of fields of source data and target data.
In order to achieve the above technical purpose and achieve the above technical effects, the present invention discloses a method for mutual conversion between arbitrary data structures, including but not limited to (json, xml, yml) and other data format conversion, and simultaneously, the structure of the data can be adjusted, which specifically comprises the following steps:
s1: determining a data format and a data structure of source data, wherein the data format is common data formats such as json, xml, yml and the like;
s2: determining the data format and the data structure of the target data, wherein the data format is one of the data formats mentioned in the step S1;
s3: generating a reverse rule for the target data, and analyzing the data structure of the target data;
s4: listing the analyzed target data fields in an interface, and waiting for a user to configure the corresponding relation between each field and the field in the source data structure;
s5: wherein, the $ source is used for representing the target data, and the field in the source data can be referred by the $ source field name for mapping;
s6: after mapping is completed, in data conversion, firstly, taking $ source and target data as key value pairs and putting the key value pairs into an environment variable;
s7: traversing each attribute in the data layer by layer from the root of the target data, wherein the types of each attribute are two, one is an array, and the other is an object;
s8: if the attribute is an array, circulating, traversing each object in the array, assigning the current object in the traversal to a $ this environment variable in the environment variable, judging whether the condition is met, skipping the current object if the condition is not met, beginning to traverse the current object or the array if the condition is met, and repeating the steps of S8-S10;
s9: if the attributes are the objects, traversing each attribute in the objects, judging whether the conditions are met, if not, skipping the current object, if so, starting to traverse the attributes in the objects, and repeating the steps of S8-S10;
s10: if the attribute is not data or object, namely the attribute of the final stored value, judging whether the condition is satisfied, if not, skipping the current attribute, and if so, analyzing through mapping configured by a user to obtain the final value;
s11: and organizing the values obtained by analyzing each step according to the hierarchy to obtain a final target data structure.
The invention has the following beneficial effects:
1. the present invention is used for conversion between any commonly used data formats, including but not limited to json, xml, yml.
2. The invention can carry out flexible mapping aiming at different data structures, including but not limited to field mapping, field filtering, field processing (numerical value conversion, character splicing, character substring taking, date format conversion and mathematical function expression).
Drawings
Fig. 1 is a block flow diagram of an embodiment of the present invention.
FIG. 2 is a diagram of an operation interface for data conversion according to the present invention.
FIG. 3 is a diagram of an operation interface for data analysis according to the present invention.
FIG. 4 is a diagram of an operation interface after mapping a user configuration source data structure and a target data structure according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail with reference to the following embodiments.
As shown in fig. 1, the present invention discloses a method for mutual conversion between data structures based on an ariator, so as to solve the problem of high cost of customized development in the background art when different services are docked, and help a user to dock quickly in different data formats and data structures by configuring a field mapping relationship and filtering processing logic before a source data format and a target data format by the user.
The operational interface of the data conversion is shown in FIG. 2; the upper left line frame of fig. 2 is an input frame of a source data structure, the data formats such as JSON, XML, YAML and the like are arranged above the input frame, the upper right line frame of fig. 2 is an input frame of a target data structure, the data formats such as JSON, XML, YAML and the like are arranged above the input frame, and the lower line frame of fig. 2 is a region where a field mapping rule is configured between the source data format and the target data format.
1. FIG. 2 is a table of example target data structures and source data structures populated into corresponding regions;
2. clicking a reverse generation rule, analyzing a target data structure, and filling a field obtained by analysis into a field mapping rule area of the figure 2;
3. as shown in fig. 3, if the items node of the target data structure is analyzed as an array, the target field below the item node will be in a tree structure, where $ source corresponds to Main, $ source represents the source data structure, and the user can use $ source. field to refer to the field in the source data structure for field mapping, and after the mapping configuration is completed;
4. as shown in fig. 4, in this example, $ source.material list is taken to correspond to the items field of the target, but since this field is an array, iteration processing is performed inside, each object entering the inside of the data uses $ this to represent a current element in the array, elements in the array are traversed one by one, and mapped into the target data structure, and if data in the source data structure needs to be filtered, if elements with a weight greater than 50 need to be filtered out, only $ this.weight >50 needs to be input in the condition column of the items row in fig. 4, then element filtering can be achieved in the iteration process; in the number input box on the right side of each field of items, if a condition expression is input, whether the field is output to a target format is judged according to the condition, compared with the condition input at the array node, the whole element is filtered differently, and the condition of the field is only used for controlling whether the field is output; when mapping the weight field, the numerical value can be converted, for example, by multiplying 1000, and the original kg is converted into the g unit;
5. after the user configures the mapping relationship, the secondary mapping relationship is stored by clicking to determine, the source data structure and the target data structure used in the previous configuration process are used for testing and checking the mapping result when the user configures the mapping relationship, no practical effect exists, and after the mapping relationship exists, the mapping relationship can be converted into the corresponding target data structure by using the same different data of the source data structure. The user can configure the conversion mapping on the corresponding interface according to the requirement, and call the data conversion into the corresponding target data structure when receiving the source data.
The above description is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are also within the scope of the present invention.
Claims (1)
1. A mutual conversion method based on data structures of an aviator aims at solving the problem that when data interfaces are in butt joint, data formats between the interfaces are not matched with the data structures, and manual customization development is needed, and the mutual conversion method is characterized in that any data structure can carry out field mapping and data processing through mapping in the supported data formats, and the mutual conversion method comprises the following steps:
s1: determining a data format and a data structure of source data, wherein the data format is common data formats such as json, xml, yml and the like;
s2: determining the data format and the data structure of the target data, wherein the data format is one of the data formats mentioned in the step S1;
s3: generating a reverse rule for the target data, and analyzing the data structure of the target data;
s4: listing the analyzed target data fields in an interface, and waiting for a user to configure the corresponding relation between each field and the field in the source data structure;
s5: wherein, the $ source is used for representing the target data, and the field in the source data can be referred by the $ source field name for mapping;
s6: after mapping is completed, in data conversion, firstly, taking $ source and target data as key value pairs and putting the key value pairs into an environment variable;
s7: traversing each attribute in the data layer by layer from the root of the target data, wherein the types of each attribute are two, one is an array, and the other is an object;
s8: if the attribute is an array, circulating, traversing each object in the array, assigning the current object in the traversal to a $ this environment variable in the environment variable, judging whether the condition is met, skipping the current object if the condition is not met, beginning to traverse the current object or the array if the condition is met, and repeating the steps of S8-S10;
s9: if the attributes are the objects, traversing each attribute in the objects, judging whether the conditions are met, if not, skipping the current object, if so, starting to traverse the attributes in the objects, and repeating the steps of S8-S10;
s10: if the attribute is not data or object, namely the attribute of the final stored value, judging whether the condition is satisfied, if not, skipping the current attribute, and if so, analyzing through mapping configured by a user to obtain the final value;
s11: and organizing the values obtained by analyzing each step according to the hierarchy to obtain a final target data structure.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110413870.1A CN112948479A (en) | 2021-04-16 | 2021-04-16 | Data structure interconversion method based on aviator |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110413870.1A CN112948479A (en) | 2021-04-16 | 2021-04-16 | Data structure interconversion method based on aviator |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112948479A true CN112948479A (en) | 2021-06-11 |
Family
ID=76232897
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110413870.1A Pending CN112948479A (en) | 2021-04-16 | 2021-04-16 | Data structure interconversion method based on aviator |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112948479A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9201558B1 (en) * | 2011-11-03 | 2015-12-01 | Pervasive Software Inc. | Data transformation system, graphical mapping tool, and method for creating a schema map |
CN107895018A (en) * | 2017-11-15 | 2018-04-10 | 广州视睿电子科技有限公司 | Database update SQL generation methods, system, storage medium and computer equipment |
CN110347879A (en) * | 2019-07-12 | 2019-10-18 | 上海熙菱信息技术有限公司 | A kind of rule-based data normalization method and system |
CN110780971A (en) * | 2019-11-06 | 2020-02-11 | 山东健康医疗大数据有限公司 | Method and system for realizing visual medical data mapping and converting tool |
CN110995846A (en) * | 2019-12-10 | 2020-04-10 | 北京数知科技股份有限公司 | Internet of things collected data processing device, method and system |
CN111061743A (en) * | 2019-12-25 | 2020-04-24 | 北京百度网讯科技有限公司 | Data processing method and device and electronic equipment |
CN112559613A (en) * | 2020-12-16 | 2021-03-26 | 深圳市中农网有限公司 | Voucher data extraction method and device, computer equipment and storage medium |
-
2021
- 2021-04-16 CN CN202110413870.1A patent/CN112948479A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9201558B1 (en) * | 2011-11-03 | 2015-12-01 | Pervasive Software Inc. | Data transformation system, graphical mapping tool, and method for creating a schema map |
CN107895018A (en) * | 2017-11-15 | 2018-04-10 | 广州视睿电子科技有限公司 | Database update SQL generation methods, system, storage medium and computer equipment |
CN110347879A (en) * | 2019-07-12 | 2019-10-18 | 上海熙菱信息技术有限公司 | A kind of rule-based data normalization method and system |
CN110780971A (en) * | 2019-11-06 | 2020-02-11 | 山东健康医疗大数据有限公司 | Method and system for realizing visual medical data mapping and converting tool |
CN110995846A (en) * | 2019-12-10 | 2020-04-10 | 北京数知科技股份有限公司 | Internet of things collected data processing device, method and system |
CN111061743A (en) * | 2019-12-25 | 2020-04-24 | 北京百度网讯科技有限公司 | Data processing method and device and electronic equipment |
CN112559613A (en) * | 2020-12-16 | 2021-03-26 | 深圳市中农网有限公司 | Voucher data extraction method and device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2017202599B2 (en) | System architecture with visual modeling tool for designing and deploying complex models to distributed computing clusters | |
EP3928168B1 (en) | Automatic extraction of assets data from engineering data sources | |
EP2186025B1 (en) | Configuring of intelligent electronic device | |
CN111538731B (en) | Automatic report generation system for industrial data | |
CN112650766B (en) | Database data operation method, system and server | |
US10657206B2 (en) | Graphical user interface system and method for natural language generation editing | |
CN103077022B (en) | A kind of work flow visual operation collocation method and device | |
CN112199086A (en) | Automatic programming control system, method, device, electronic device and storage medium | |
CN106130899A (en) | A kind of method and apparatus generating service path | |
CN115794106A (en) | Method and system for analyzing configuration of binary protocol data of rail transit | |
CN113806429A (en) | Canvas type log analysis method based on large data stream processing framework | |
Vanhove et al. | Tengu: An experimentation platform for big data applications | |
US10996835B1 (en) | Data preparation user interface with coordinated pivots | |
CN114926151A (en) | RPA flow automatic generation method and device based on reinforcement learning | |
CN116301735B (en) | Method, device and storage medium for organizing software elements into software data links | |
CN112948479A (en) | Data structure interconversion method based on aviator | |
US9244659B2 (en) | Extensible meta model for capturing solution patterns | |
CN116384295A (en) | Top file generation method and device, computer equipment and storage medium | |
CN114328452A (en) | Data auditing method, device, platform, electronic equipment and storage medium | |
CN114168438A (en) | Visual operation and maintenance control arrangement method and system realized in low-code mode | |
CN112947832A (en) | BIM data organization relationship construction method and device | |
CN114416052B (en) | Trigger variable assignment method, trigger configuration method, and computer storage medium | |
CN114327406B (en) | Trigger data filtering method, trigger configuration method and computer storage medium | |
CN112015398A (en) | Data fusion method and device | |
CN110377934A (en) | The design and calculation method and device of electronic product peculiar to vessel |
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: 20210611 |