Model Conversion Method, Device, Electronic Device, Storage Medium
By acquiring and utilizing the mapping relationship between models, flexible conversion between different models is achieved, which solves the problem of inflexible and time-consuming conversion methods in the existing technology, saves human resources and improves conversion efficiency.
Patent Information
- Application Number
- CN202011076807.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-10
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2040-10-10
AI Technical Summary
In the prior art, hard-coded methods write conversion logic in code and scripts, resulting in only fixed models being converted, the conversion method is inflexible, requiring multiple encodings, wasting human resources, and the conversion takes time.
By obtaining the source model and target model, as well as the mapping relationship between the source model fields and the target model fields, obtaining the source model data, and converting the source model data into target model data according to the mapping relationship, achieving flexible conversion between different models.
The conversion between different models can be achieved without multiple encodings. The conversion method is flexible, saving human resources and reducing conversion time.
Smart Images

Figure CN114327419B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of network orchestration, and in particular, to a model conversion method, apparatus, electronic device, and storage medium. Background Art
[0002] In network orchestration technology, different manufacturers have different models. When different manufacturers are connected, different models need to be converted to meet the manufacturers' requirements for models. Related technologies generally use hard coding. According to the models to be converted, code or scripts are written, and there are fixed conversion logics in the code or scripts.
[0003] However, the inventors found that the related technologies have the following problems: In the form of hard coding, the conversion logic is written in the code and scripts. This method can only convert fixed models, and the conversion method is not flexible. When other models need to be converted, re-coding is required, wasting human resources and taking a long time for conversion. Summary of the Invention
[0004] The main purpose of the embodiments of the present application is to propose a model conversion method, which enables the conversion between different models without multiple codings, has a flexible conversion method, saves human resources, and reduces the conversion time.
[0005] To achieve the above object, the embodiments of the present application provide a model conversion method, including: obtaining a source model and a target model, where the source model and the target model are used to describe data formats; obtaining the mapping relationship between the fields of the source model and the fields of the target model; obtaining source model data; and converting the source model data into target model data according to the mapping relationship.
[0006] To achieve the above object, the embodiments of the present application also provide a model conversion apparatus, including: a model obtaining module, configured to obtain a source model and a target model, where the source model and the target model are used to describe data formats; a mapping relationship obtaining module, configured to obtain the mapping relationship between the fields of the source model and the fields of the target model; a source model data obtaining module, configured to obtain source model data; and a conversion module, configured to convert the source model data into target model data according to the mapping relationship.
[0007] To achieve the above object, the embodiments of the present application also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; where the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above model conversion method.
[0008] To achieve the above object, an embodiment of the present application further provides a readable storage medium storing a computer program, and when the computer program is executed by a processor, the above-mentioned model conversion method is implemented.
[0009] The model conversion method, device, electronic device, and storage medium proposed by the present application obtain the source model and the target model, as well as the mapping relationship between the source model fields and the target model fields, so as to obtain the mapping relationship between different models. Then, the source model data is obtained, and according to the mapping relationship, the source model data is converted into the target model data. It is no longer limited to the conversion between fixed models, but can be applied to the conversion between different models, without the need to re-code different models, saving human resources and reducing the conversion time. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is a flowchart of the model conversion method according to the first embodiment of the present invention;
[0011] Figure 2 is a model instance diagram according to the first embodiment of the present invention;
[0012] Figure 3 is a schematic diagram of the visual configuration model mapping relationship interface according to the first embodiment of the present invention;
[0013] Figure 4 is a flowchart of the pre-translation model conversion method according to the second embodiment of the present invention;
[0014] Figure 5 is a schematic diagram of the pre-translation interface according to the second embodiment of the present invention;
[0015] Figure 6 is a flowchart of the post-transfer interface model conversion method according to the second embodiment of the present invention;
[0016] Figure 7 is a schematic diagram of the post-translation interface according to the second embodiment of the present invention;
[0017] Figure 8 is a schematic diagram of the architecture of the model conversion method according to the second embodiment of the present invention;
[0018] Figure 9 is a schematic diagram of the model conversion device according to the third embodiment of the present invention;
[0019] Figure 10 is a schematic diagram of the structure of the electronic device according to the fourth embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the following will elaborate on each embodiment of this application with reference to the accompanying drawings. However, those of ordinary skill in the art can understand that in each embodiment of this application, many technical details are provided to help readers better understand this application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in this application can still be implemented. The following division of each embodiment is for convenience of description and should not constitute any limitation on the specific implementation of this application. Each embodiment can be combined and cross-referenced with each other on the premise of no contradiction.
[0021] The first embodiment of the present invention relates to a model conversion method. The model conversion method of this embodiment can be applied to a computer, but is not limited thereto. The method includes: obtaining a source model and a target model, where the models are used to describe data formats; obtaining the mapping relationship between the fields of the source model and the fields of the target model; obtaining source model data; and converting the source model data into target model data according to the mapping relationship. This enables the conversion between different models to be achieved without multiple encodings, with a flexible conversion method, saving human resources, and reducing conversion time. The following specifically describes the implementation details of the model conversion method in the first embodiment of the present invention. The following content is only implementation details provided for convenience of understanding and is not necessary for implementing this solution.
[0022] The flowchart of the first embodiment of the present invention is as Figure 1 shown.
[0023] Step 101: Obtain a source model and a target model, where the source model and the target model are used to describe data formats.
[0024] In one example, the model is used to describe the data format. For example, the data format, that is, the model, can be obtained from the data represented in JSON (JavaScript Object Notation), or can be set manually. The data format may include: fields, and the data rules of each field, such as data types, etc. In this embodiment, the source model is Model A of manufacturer A, and the target model is Model B of manufacturer B. The computer provides a model import interface for the user. The user imports the source model and the target model in the model import interface provided by the computer. The computer obtains the imported Model A and Model B from the model import interface and displays them on the interface. Figure 2 These are the models of Model A and Model B. Model A is Model A, and Model B is Model B. It should be noted that Figure 2 This is only a schematic diagram and does not show the specific content of each field.
[0025] Step 102: Obtain the mapping relationship between the fields of the source model and the fields of the target model.
[0026] In one example, first obtain the matching relationship between the source model fields and the target model fields, and then obtain the mapping relationship between the fields of the source model and the fields of the target model according to the matching relationship and the hierarchical relationship, where the hierarchical relationship is the relationship between the hierarchy of the source model fields and the hierarchy of the target model fields.
[0027] Specifically, the user specifies the first target field of model A and the second target field of model B. The computer obtains the first target field and the second target field and establishes a matching relationship between the first target field and the second target field.
[0028] For example, if the user specifies that the field peUuid in the 23rd row of model A corresponds to the field meUuid in the 12th row of model B, the computer establishes a matching relationship between A.nodeMember[].peUuid and B.acPoints[].meUuid.
[0029] Optionally, the computer provides the user with a visual mapping relationship interface. The mapping relationship interface includes the fields of model A and the fields of model B. The user specifies the first target field of model A and the second target field of model B on the mapping relationship interface. The computer obtains the first target field and the second target field and establishes a matching relationship between the first target field and the second target field. Providing a visual interface facilitates the user to operate the conversion relationship between the two on the interface.
[0030] Optionally, the user can, on the visual interface provided by the computer, drag the field of model A to the field of model B in a dragging manner. The system will establish a matching relationship between the two. Using the dragging method to specify the first target field and the second target field to establish a matching relationship is more convenient, fast, and flexible.
[0031] Exemplarily, as Figure 3 shown, the arrow indicates the dragging direction, Figure 3 which is only a schematic diagram and does not show the specific content of each field. In actual applications, on the provided visual interface, the user drags peUuid in model A to meUuid in model B, and the computer will form a matching relationship between a.nodeMember[].peUuid and B.acPoints[].meUuid. And so on, the user can form all the matching relationships of the fields to be matched according to the dragging method.
[0032] It should be noted that the above method for obtaining the first target field of model A and the second target field of model B can be arbitrary. It can be dragged on the visualization interface or manually input by the user. The embodiments of the present application do not limit the method for obtaining the first target field of the source model and the second target field of the target model.
[0033] Exemplarily, the possible matching relationships between model A and model B are represented in the form of a table, as shown in Table 1 below.
[0034] Table 1
[0035] No. Model A Model B 1 a.nodeMember[].peUuid B.acPoints[].meUuid 2 a.nodeMember[].l3vpnAccessPoints[].ipv4Addr B.acPoints[].ipv4Addr 3 a.nodeMember[].l3vpnAccessPoints[].vlanEncap.dot1q.vlanId B.acPoints[].svlanId 4 a.nodeMember[].rdType B.rdType 5 a.nodeMember[].rd B.rd 6 a.nodeMember[].routeTargets.importRts[].importRt B.ipv4AF.rt[].rt
[0036] Then, obtain the mapping relationship between the source model field and the target model field according to the matching relationship and the hierarchical relationship.
[0037] Optionally, sort out all the entries of the matching relationships. Each row of the matching relationship in the table is an entry. Among all the entries where the level of model A is greater than that of model B, calculate the difference between the level of model A and the level of model B. The larger the difference, the higher the entry is ranked. For example, in the first row of Table 1 for model A, the level of a.nodeMember[].peUuid is 1, and the level of B.acPoints[].meUuid in model B is 1, and the difference between the two levels is 0; in the second row of Table 1, the level of a.nodeMember[].l3vpnAccessPoints[].ipv4Addr in model A is 2, and the level of B.acPoints[].ipv4Addr in model B is 1. In this entry, the level of model A is greater than that of model B, and the difference is 1; the matching relationship in the second row is ranked in front of the first row, and so on, to obtain the sorted entries of the matching relationships.
[0038] Next, process the entries where the level of model A is greater than that of model B.
[0039] In an example, if the field level of model A is greater than the level of the field of the matching model B, then complete the field of model B to obtain the completed field of model B, so that the level of the completed target model field is equal to the level of the matching source model field, and obtain the mapping relationship according to the source model field and the completed target model field.
[0040] Exemplarily, the level of the field A.nodeMember[].l3vpnAccessPoints[].ipv4Addr of Model A is 2, and the level of the field B.acPoints[].ipv4Addr of Model B is 1. Since the level of A.nodeMember[].l3vpnAccessPoints[].ipv4Addr is greater than that of B.acPoints[].ipv4Addr, B.acPoints[].ipv4Addr is completed, and the completed field becomes B[].acPoints[].ipv4Addr. After completion, the levels of A.nodeMember[].l3vpnAccessPoints[].ipv4Addr and B[].acPoints[].ipv4Addr are the same. In this way, the entries where the level of Model A is greater than that of Model B are processed.
[0041] After processing all the entries where the level of Model A is greater than that of Model B, update the entries of other matching relationships. Complete all Bs in other relationship entries to B[], and add a new matching relationship. In addition, match the field A.nodeMember[] of Model A with B[] of Model B, and obtain the mapping relationship according to the fields of Model A and the completed fields of Model B. The possible mapping relationships are shown in Table 2, and the 7th row in Table 2 is the newly added entry. After processing, the levels of the fields of Model A are all less than or equal to the levels of the fields of Model B.
[0042] Table 2
[0043] No. Model A Model B 1 a.nodeMember[].peUuid B[].acPoints[].meUuid 2 a.nodeMember[].l3vpnAccessPoints[].ipv4Addr B[].acPoints[].ipv4Addr 3 a.nodeMember[].l3vpnAccessPoints[].vlanEncap.dot1q.vlanId B[].acPoints[].svlanId 4 a.nodeMember[].rdType B[].rdType 5 a.nodeMember[].rd B[].rd 6 a.nodeMember[].routeTargets.importRts[].importRt B[].ipv4AF.rt[].rt 7 a.nodeMember B[]
[0044] Step 103: Obtain the source model data.
[0045] In an example, a visual data import interface is provided for the user to input the data of Model A. The computer obtains the source model data from the data import interface, that is, the data of Model A.
[0046] Step 104: Convert the source model data into target model data according to the mapping relationship.
[0047] As shown in Table 2, the model conversion relationship only remains the matching mapping relationships where the level of Model A is equal to that of Model B and the level of Model A is less than that of Model B. According to the mapping relationship between Model A and Model B, update the data structure of Model B of Manufacturer B. For example, B[] needs to add a List outside the B data structure.
[0048] In one example, if the level of the A model field is equal to the level of the mapped B model field, the value of the A model field is assigned to the B model field; if the level of the A model field is less than the level of the mapped B model field, the value of the A model field is assigned to multiple fields corresponding to the target model. After processing, the A model data is converted into B model data.
[0049] Exemplarily, as shown in Table 2, the level of the field a.nodeMember[].l3vpnAccessPoints[].ipv4Addr in the A model is 2, and the level of the B model field B[].acPoints[].ipv4Addr mapped by the B model is also 2. The levels of the two are the same. Find the value corresponding to a.nodeMember[].l3vpnAccessPoints[].ipv4Addr in the obtained A model data and assign it to B[].acPoints[].ipv4Addr; the level of the field a.nodeMember[].peUuid in the A model is 1, and the level of the B model field B[].acPoints[].meUuid mapped by the B model is 2. The level of a.nodeMember[].peUuid is less than the level of B[].acPoints[].meUuid. Find the value of a.nodeMember[].peUuid in the obtained A model data and assign it to the values of multiple corresponding fields in model B.
[0050] In this embodiment, the source model, the target model, and the mapping relationship between the source model fields and the target model fields are obtained, so that the mapping relationship between different models can be obtained. Then, the source model data is obtained, and according to the mapping relationship, the source model data is converted into the target model data. It is no longer limited to the conversion between fixed models, but can be applied to the conversion between different models. There is no need to re-code different models, which saves human resources, reduces the conversion time, and makes the conversion between models more flexible.
[0051] The second embodiment of this application relates to a model conversion method. The second embodiment is substantially the same as the first embodiment, except that it further includes: before converting the source model data into the target model data, translating the fields of the source model to convert the values of the source model data fields into values that conform to the data rules of the target model; or, after converting the source model data into the target model data, translating the fields of the target model to convert the values of the target model data fields into values that conform to the data rules of the target model.
[0052] Specifically, the flowchart of the model conversion method for pre-translating the source model fields in the second embodiment of the present invention is as Figure 4 shown.
[0053] Step 401: Obtain a source model and a target model, where the source model and the target model are used to describe data formats.
[0054] Step 402: Provide a pre-translation interface and obtain the field translation format of the source model.
[0055] In one example, after obtaining the source model and the target model, obtain the field translation format of the source model according to the source model and the target model. For example, provide a pre-translation interface to the user, and let the user configure the translation format of Model A in the pre-translation interface provided by the computer. Regarding the pre-translation interface of Model A, as Figure 5 shown.
[0056] Step 403: Obtain the mapping relationship between the fields of the source model and the fields of the target model.
[0057] Step 404: Obtain source model data.
[0058] Step 401 is substantially the same as step 101 of the first embodiment, and steps 403 and 404 are substantially the same as steps 102 and 103 of the first embodiment of the present invention, and will not be elaborated here.
[0059] Step 405: According to the field translation format of the source model, convert the values of the fields of the source model data into values that conform to the data rules of the target model.
[0060] Exemplarily, for example, if the source model is an enumerated value 1 and the data rule of the target model is that the value of this field is "true", obtain the field translation format of the source model transform(1 = true, 0 = false), and use this to convert the enumerated value 1 in the field of the source model data into the value "true" that conforms to the data rules of the target model; another example is that the source model is id1 and the data rule of the target model is that the value of this field is "{id1}", obtain the source model translation format format({%s}, and use this to convert id1 in the source data field into the value "{id1}" that conforms to the data rules of the target model. The source model translation format can be specified by means such as regular expressions, etc., and will not be limited here.
[0061] After obtaining the source model data, convert the value of Model A into a value that conforms to the data rules of Model B according to the source model translation format.
[0062] Step 406: According to the mapping relationship, convert the source model data into target model data.
[0063] Step 406 is substantially the same as step 104 of the first embodiment of the present invention, and will not be elaborated here.
[0064] The flowchart of the model conversion method for translating the target model's post - field in the second embodiment of the present invention is as follows Figure 6 as shown.
[0065] Step 601: Obtain the source model and the target model, where the source model and the target model are used to describe the data format.
[0066] Step 602: Obtain the mapping relationship between the fields of the source model and the fields of the target model.
[0067] Step 603: Provide a post - translation interface and obtain the field translation format of the target model.
[0068] Step 604: Obtain the source model data.
[0069] Step 605: Convert the source model data into target model data according to the mapping relationship.
[0070] Step 601 and Step 602 are substantially the same as Step 101 and Step 102 in the first embodiment of the present invention, and Step 604 and Step 605 are substantially the same as Step 103 and Step 104 in the first embodiment of the present invention. To avoid repetition in expression, they will not be elaborated here.
[0071] Step 606: Convert the value of the field of the target model data into a value that conforms to the data rules of the target model according to the field translation format of the target model.
[0072] In an example, after obtaining the mapping relationship between the source model and the target model, obtain the target model translation format according to the source model and the target model. For example, the user can configure the target model field translation format on the post - translation interface provided by the computer. Regarding the target model field translation interface for model B, as shown Figure 7 in the figure. After obtaining the target model data, convert the value of model B into a value that conforms to the data rules of model B according to the target model field translation format.
[0073] Exemplarily, for instance, if the obtained model data is an enumerated value 1, and the data rule of the target model is that the value of this field is "true", obtain the target model translation format transform(1 = true, 0 = false) to convert the enumerated value 1 in the field of the target model data into the value "true" that conforms to the data rules of the target model; also, for example, if the value of this field in the target model data is id1, and the data rule of the target model is that the value of this field is "{id1}", obtain the target model translation format format({%s} to convert id1 in the field of the target model data into the value "{id1}" that conforms to the data rules of the target model. The target model field translation format can be specified in forms such as regular expressions, which is not limited here.
[0074] It should be noted that whether to perform pre-field translation or post-field translation can be set according to actual business requirements. To achieve more flexible conversion between models, pre-field translation or post-field translation can be selectively performed to conform to the data rules of the target model and make the converted model more accurate.
[0075] In this embodiment, the computer can provide the user with a model import interface, a data import interface, a mapping relationship interface, and a field translation interface, as Figure 8 shown. Among them, the user can import the source model and the target model in the model import interface. The user can import the data of the source model in the data import interface. The user can configure the source model field translation interface in the mapping relationship interface, and the user can set the field translation format in the field translation interface. The field translation interface can be a pre-field translation interface or a post-field translation interface. The pre-field translation interface is used to configure the source model translation format to convert the values of the fields of the source model data into values that conform to the data rules of the target model. The post-field translation interface is used to configure the target model field translation format to convert the values of the fields of the target model data into values that conform to the data rules of the target model. Providing a visual interface reduces the complexity of the operation of model conversion. In the related art, programming is required to implement it. In the embodiment of the present invention, only the operations according to the visual interface are required, and the operations are simple and easy to master. After providing the interface, the computer also needs to process the data obtained from the front-end interface at the back-end. The back-end data processing can be divided into mapping relationship management, which is used to manage the obtained mapping relationship, source data management, which is used to manage the data of the source model obtained from the interface, business model management, which is used to manage the source model and the target model obtained from the interface, function management, which is used to manage the functions for setting model conversion, and script management, which is used to manage the scripts written to implement model conversion. In this way, the computer obtains data from the front-end interface and manages the data at the back-end to achieve the conversion between different models.
[0076] This embodiment obtains the mapping relationship between the source model and the target model and the mapping relationship between the source model fields and the target model fields, so as to obtain the mapping relationship between different models. Then, the source model data is obtained, and according to the mapping relationship, the source model data is converted into the target model data, which is no longer limited to the conversion between fixed models. Instead, it can be applied to the conversion between different models, without the need to recode different models, saving human resources and reducing conversion time. Moreover, converting the values of the fields of the target model data into values that conform to the data rules of the target model and / or converting the values of the fields of the source model data into values that conform to the data rules of the target model makes the data converted by the model more accurate and meets the requirements of the target model.
[0077] The step divisions of the above various methods are only for clear description. When implemented, they can be combined into one step or some steps can be split into multiple steps. As long as the same logical relationships are included, they are all within the protection scope of this patent. Making insignificant modifications to the algorithm or process or introducing insignificant designs, but without changing the core design of the algorithm and process, are all within the protection scope of this patent.
[0078] The third embodiment of the present invention relates to a model conversion device, as Figure 9 shown, including: a model acquisition module 901 for acquiring a source model and a target model, where the source model and the target model are used to describe data formats; a mapping relationship acquisition module 902 for acquiring the mapping relationship between the fields of the source model and the fields of the target model; a source model data acquisition module 903 for acquiring source model data; and a conversion module 904 for converting the source model data into target model data according to the mapping relationship.
[0079] In one example, the mapping relationship acquisition module 902 is further configured to acquire the matching relationship between the source model fields and the target model fields; and acquire the mapping relationship between the fields of the source model and the fields of the target model according to the matching relationship and the hierarchical relationship, where the hierarchical relationship is the relationship between the hierarchy of the source model fields and the hierarchy of the target model fields.
[0080] In one example, the mapping relationship acquisition module 902 is further configured to determine the relationship between the hierarchy of the source model fields and the hierarchy of the matching target model fields. If the hierarchy of the source model fields is greater than the hierarchy of the matching target model fields, then complete the target model fields to obtain the completed target model fields; where the hierarchy of the completed target model fields is equal to the hierarchy of the matching source model fields; and acquire the mapping relationship according to the source model fields and the completed target model fields.
[0081] In one example, the conversion module 904 is further configured to determine the relationship between the hierarchy of the source model fields and the hierarchy of the matching target model fields. If the hierarchy of the source model fields is equal to the hierarchy of the mapped target model fields, then assign the value of the source model fields to the target model fields; if the hierarchy of the source model fields is less than the hierarchy of the mapped target model fields, then assign the value of the source model fields to multiple corresponding fields of the target model.
[0082] In one example, the model acquisition module 901 is further configured to display a visualization interface, where the visualization interface includes the fields of the source model and the fields of the target model; acquire a first target field specified by a user in the fields of the source model, and a second target field specified by the user in the fields of the target model; and establish a matching relationship between the first target field and the second target field.
[0083] In one example, the conversion module 904 is further configured to convert the value of the field of the source model data into a value that conforms to the data rule of the target model according to the field translation format of the source model; where the field translation format of the source model is obtained through a pre-translation interface provided to the user.
[0084] In one example, the conversion module 904 is further configured to obtain the field translation format of the target model: convert the value of the field of the target model data into a value that conforms to the data rule of the target model according to the field translation format of the target model; where the field translation format of the target model is obtained through a post-translation interface provided to the user.
[0085] It is not difficult to find that this embodiment is a system embodiment corresponding to the first embodiment, and this embodiment can be implemented in cooperation with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment. To avoid repetition, they are not elaborated here. Correspondingly, the relevant technical details mentioned in this embodiment can also be applied to the first embodiment.
[0086] It is worth mentioning that each module involved in this embodiment is a logical module. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, to highlight the innovative part of the present invention, units that are not closely related to solving the technical problems proposed by the present invention are not introduced in this embodiment, but this does not mean that there are no other units in this embodiment.
[0087] The fourth embodiment of the present invention relates to an electronic device, such as Figure 10 shown, including at least one processor 1002; and a memory 1001 communicatively connected to the at least one processor; where the memory 1001 stores instructions executable by the at least one processor 1002, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above model conversion method.
[0088] Among them, the memory and the processor are connected in a bus manner. The bus can include any number of interconnected buses and bridges, which connect various circuits of one or more processors and the memory together. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, etc., which are well known in the art, so they will not be further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, and provides a unit for communicating with various other devices on the transmission medium. The data processed by the processor is transmitted on the wireless medium through the antenna. Further, the antenna also receives data and transmits the data to the processor.
[0089] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. The memory can be used to store the data used by the processor when executing operations.
[0090] The fifth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the above method embodiment is implemented.
[0091] That is, those skilled in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by instructing relevant hardware through a program. The program is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs, etc., which can store program codes.
[0092] Those of ordinary skill in the art can understand that the above embodiments are specific embodiments for implementing the present invention, and in practical applications, various changes can be made in form and details without departing from the spirit and scope of the present invention.
Claims
1. A model conversion method, characterized in that, Including: Obtain a source model and a target model, where the source model and the target model are used to describe data formats; Obtain the matching relationship between the source model fields and the target model fields; Obtain the mapping relationship between the fields of the source model and the fields of the target model according to the matching relationship and the hierarchical relationship, where the hierarchical relationship is the relationship between the hierarchy of the source model fields and the hierarchy of the target model fields; Obtain source model data; Convert the source model data into target model data according to the mapping relationship; Among them, obtaining the mapping relationship between the fields of the source model and the fields of the target model according to the matching relationship and the hierarchical relationship includes: If the hierarchy of the source model field is greater than the hierarchy of the matched target model field, then complete the target model field to obtain the completed target model field; where the hierarchy of the completed target model field is equal to the hierarchy of the matched source model field; Obtain the mapping relationship according to the source model field and the completed target model field.
2. The model conversion method according to claim 1, characterized in that, The converting the source model data into target model data according to the mapping relationship includes: If the hierarchy of the source model field is equal to the hierarchy of the mapped target model field, then assign the value of the source model field to the target model field; If the hierarchy of the source model field is less than the hierarchy of the mapped target model field, then assign the value of the source model field to multiple corresponding fields of the target model.
3. The model conversion method according to any one of claims 1 to 2, characterized in that, The obtaining the matching relationship between the source model fields and the target model fields includes: Display a visualization interface, where the visualization interface includes each field of the source model and each field of the target model; Obtain the first target field specified by the user in each field of the source model and the second target field specified by the user in each field of the target model; Establish the matching relationship between the first target field and the second target field.
4. The model conversion method according to any one of claims 1 to 2, characterized in that, Before converting the source model data into target model data according to the mapping relationship, it further includes: Convert the value of the field of the source model data into a value that conforms to the data rules of the target model according to the field translation format of the source model; where the field translation format of the source model is obtained through a pre-translation interface provided to the user.
5. The model conversion method according to any one of claims 1 to 2, characterized in that, After converting the source model data into target model data according to the mapping relationship, it includes: Convert the value of the field of the target model data into a value that conforms to the data rules of the target model according to the field translation format of the target model; where the field translation format of the target model is obtained through a post-translation interface provided to the user.
6. A model conversion device, characterized in that, Including: A model acquisition module, used to obtain a source model and a target model, where the source model and the target model are used to describe data formats; A mapping relationship acquisition module, used to obtain the matching relationship between the source model fields and the target model fields, and obtain the mapping relationship between the fields of the source model and the fields of the target model according to the matching relationship and the hierarchical relationship, where the hierarchical relationship is the relationship between the hierarchy of the source model fields and the hierarchy of the target model fields; A source model data acquisition module, configured to acquire source model data; A conversion module, configured to convert the source model data into target model data according to the mapping relationship; Wherein, the mapping relationship acquisition module is further configured to: If the level of the source model field is greater than the level of the matched target model field, complete the target model field to obtain the field of the completed target model; wherein, the level of the completed target model field is equal to the level of the matched source model field; Obtain the mapping relationship according to the source model field and the completed target model field.
7. An electronic device, characterized in that, Comprising: At least one processor; And, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the model conversion method according to any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, The computer program, when executed by a processor, implements the model conversion method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Field translation method and device based on key value, computer device and storage medium
CN110765782A
Service publishing method
CN110795487A
Data fusion method and device
CN111198910A