WO2022222577A1 - Data format conversion method and apparatus, device, and computer-readable storage medium - Google Patents

Data format conversion method and apparatus, device, and computer-readable storage medium Download PDF

Info

Publication number
WO2022222577A1
WO2022222577A1 PCT/CN2022/075563 CN2022075563W WO2022222577A1 WO 2022222577 A1 WO2022222577 A1 WO 2022222577A1 CN 2022075563 W CN2022075563 W CN 2022075563W WO 2022222577 A1 WO2022222577 A1 WO 2022222577A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
format
information
title
array
Prior art date
Application number
PCT/CN2022/075563
Other languages
French (fr)
Chinese (zh)
Inventor
张丽雅
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022222577A1 publication Critical patent/WO2022222577A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion

Definitions

  • the present application relates to the technical field of data processing, and in particular, to a data format conversion method, apparatus, device, and computer-readable storage medium.
  • a hard-coded conversion method is used to develop a product release version according to the requirements put forward by the customer. Since this data format conversion method needs to be released with the product version, it not only has a long development cycle, but also a long release cycle and high customization costs.
  • the present application proposes a data format conversion method, device, device and computer-readable storage medium, which are used to improve the conversion efficiency of the data format, realize the controllable structure of the converted target data, and are suitable for a wide range of source data structures. .
  • a first aspect provides a data format conversion method, including: a device obtains source data and mapping information, where the mapping information is obtained based on business requirements; the device obtains target data based on the mapping information and the source data,
  • the mapping information includes a mapping relationship, and the mapping relationship includes a corresponding relationship between the first position information and the second position information of at least one data object in the source data; wherein, the first position information is the at least one piece of data the position of the object in the data structure of the source data, the second position information is the position of the at least one data object in the data structure of the target data, the data in the position corresponding to the second position information
  • the object includes a data object in a location corresponding to the first location information.
  • the method obtains the mapping information according to the business requirements, and converts the data structure of the source data based on the mapping information to obtain the target data, so that the conversion efficiency of the data format is higher.
  • the mapping information since the data conversion is performed according to the mapping information, the mapping information includes the correspondence between the first position information and the second position information of at least one data object in the source data, so that the structure of the converted target data is controllable .
  • the target data converted according to the same mapping information has the same format, and this method is applicable to a wide range of source data structures.
  • the mapping information further includes an information identifier and conversion mode information; the information identifier is used to identify the mapping information; the conversion mode information is used to indicate the conversion mode, the source data The format and the format of the target data, the conversion mode is used to indicate the conversion from the format of the source data to the format of the target data.
  • the mapping information can be quickly acquired through the information identification.
  • the format of the source data is an object-oriented data format
  • the format of the target data is a two-dimensional data format
  • the mapping information is used to convert the source data in the object-oriented data format. into the target data in the two-dimensional data format.
  • the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the attribute path, and the second position information includes the title column ;
  • the device obtains target data based on the mapping information and the source data, including: the device generates target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
  • the device generates the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data, including: the device generates the target data from the mapping relationship Obtain a first title column, and generate a first title array according to the first title column, where the first title array includes the attribute path, the array count value, and the quantity value of the attribute path under the first title array ; Determine that the attribute path is not the last attribute path under the first title array based on the array count value and the quantity value, and change the attribute path corresponding to the first title array from the Obtain a data object from the source data and output it as a row of target data in the two-dimensional data format.
  • the format of the source data is a two-dimensional data format
  • the format of the target data is an object-oriented data format
  • the mapping information is used to convert the source data of the two-dimensional data format. into the target data in the object-oriented data format.
  • the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the title column, and the second position information includes the attribute path ;
  • the device obtains target data based on the mapping information and the source data, including: the device generates target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
  • the device generates the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data, including: the device generates the target data from the mapping relationship Obtain a second title column, and generate a second title array according to the second title column, where the second title array includes a property path and an array count value; in response to the current row of the source data being less than the total number of rows, the source data The data object indicated by the current row in the data is filled into the data structure of the target data according to the position specified by the attribute path and the array count value.
  • the business requirement includes associated information for acquiring the mapping information; the obtaining the mapping information, the mapping information is obtained based on the business requirement, includes: based on the business requirement to obtain the mapping information from the associated information.
  • the mapping information is obtained through the associated information, and the method for obtaining the mapping information in this method is more flexible.
  • the association information includes an information identifier of the mapping information.
  • the obtaining of the mapping information includes: obtaining user-specified mapping information or default mapping information based on the business requirements.
  • the acquired mapping information may also be specified mapping information or default mapping information acquired based on business requirements. This method acquires the mapping information in a more flexible way.
  • the format of the source data is JSON format
  • the format of the target data is CSV format
  • the format of the source data is CSV format
  • the format of the target data is JSON format
  • the type of the device includes at least one of a network management system, a software-defined network SDN controller network element device, a terminal, and a server.
  • the method realizes the conversion between the object-oriented data format and the two-dimensional data format, and the conversion between the two-dimensional data format and the object-oriented data format.
  • the transformation process of the data structure is reversible.
  • the object-oriented data format before and after the conversion is the same.
  • a data format conversion device including:
  • an acquisition module for acquiring source data and mapping information, where the mapping information is acquired based on business requirements
  • a conversion module configured to obtain target data based on the mapping information and the source data, where the mapping information includes a mapping relationship, and the mapping relationship includes first position information and second position information of at least one data object in the source data Corresponding relationship of location information; wherein, the first location information is the location of the at least one data object in the data structure of the source data, and the second location information is the at least one data object in the target
  • the position in the data structure of the data, the data object in the position corresponding to the second position information includes the data object in the position corresponding to the first position information.
  • the mapping information further includes an information identifier and conversion mode information; the information identifier is used to identify the mapping information; the conversion mode information is used to indicate the conversion mode, the source data The format and the format of the target data, the conversion mode is used to indicate the conversion from the format of the source data to the format of the target data.
  • the format of the source data is an object-oriented data format
  • the format of the target data is a two-dimensional data format
  • the mapping information is used to convert the source data in the object-oriented data format. into the target data in the two-dimensional data format.
  • the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the attribute path, and the second position information includes the title column ;
  • the conversion module is configured to generate target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
  • the conversion module is configured to obtain a first title column from the mapping relationship, and generate a first title array according to the first title column, where the first title array includes the property path, array count value, and quantity value of the property path under the first title array; determining that the property path is not the last one under the first title array based on the array count value and the quantity value an attribute path, obtaining a data object from the source data according to the attribute path corresponding to the first title array according to the array count value and outputting it as a row of the target data in the two-dimensional data format.
  • the format of the source data is a two-dimensional data format
  • the format of the target data is an object-oriented data format
  • the mapping information is used to convert the source data of the two-dimensional data format. into the target data in the object-oriented data format.
  • the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the title column, and the second position information includes the attribute path ;
  • the conversion module is configured to generate target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
  • the conversion module is configured to obtain a second title column from the mapping relationship, and generate a second title array according to the second title column, where the second title array includes an attribute path and an array count value; in response to the current row of the source data being less than the total number of rows, the data object indicated by the current row in the source data is filled into the target data according to the location specified by the attribute path and the array count value in the data structure.
  • the business requirement includes association information for obtaining the mapping information; the obtaining module is configured to obtain the mapping information based on the association information in the business requirement.
  • the association information includes an information identifier of the mapping information.
  • the obtaining module is configured to obtain user-specified mapping information or default mapping information based on the business requirement.
  • the format of the source data is JSON format
  • the format of the target data is CSV format
  • the format of the source data is CSV format
  • the format of the target data is JSON format
  • the type of the device includes at least one of a network management system, an SDN controller network element device, a terminal, and a server.
  • a data format conversion device including a processor and a computer program.
  • the processor executes the computer program, the data format conversion device implements the data format conversion method according to any one of the first aspect above.
  • a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the data format conversion method according to any one of the first aspect above is implemented.
  • a computer program product including a computer program.
  • the computer program When the computer program is executed by a computer, the data format conversion method according to any one of the above first aspect is implemented.
  • a communication apparatus comprising: a transceiver, a memory and a processor.
  • the transceiver, the memory and the processor communicate with each other through an internal connection path, the memory is used for storing instructions, and the processor is used for executing the instructions stored in the memory to control the transceiver to receive signals and control the transceiver to send signals , and when the processor executes the instructions stored in the memory, the processor is caused to execute the method in the first aspect or any possible implementation manner of the first aspect.
  • processors there are one or more processors and one or more memories.
  • the memory may be integrated with the processor, or the memory may be provided separately from the processor.
  • the memory can be a memory, for example, a read only memory (ROM), which can be integrated with the processor on the same chip, or can be respectively set on different chips.
  • ROM read only memory
  • a chip including a processor for invoking and executing instructions stored in the memory from a memory, so that a communication device on which the chip is installed executes the first aspect or any of the first aspects possible. method in an embodiment.
  • another chip comprising: an input interface, an output interface, a processor, and a memory, the input interface, the output interface, the processor, and the memory are connected through an internal connection path, and the processor is used to execute codes in the memory , when the code is executed, the processor is configured to execute the method in the first aspect or any possible implementation manner of the first aspect.
  • FIG. 1 is a schematic diagram of an implementation environment of a data format conversion method provided by an embodiment of the present application
  • FIG. 2 is a flowchart of a method for converting a data format provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of service planning information provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a conversion interaction process of a data format provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of an object-oriented data provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a two-dimensional data provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a mapping information provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of another mapping information provided by an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a target data provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of another target data provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a data format conversion device provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a data format conversion device provided by an embodiment of the present application.
  • FIG. 13 is a schematic structural diagram of another data format conversion device provided by an embodiment of the present application.
  • An embodiment of the present application provides a method for converting a data format, taking the method applied to the conversion between an object-oriented data format and a two-dimensional data format as an example, wherein the object-oriented data format includes but is not limited to javascript object notation (javascript object notation, JSON), extensible markup language (extensible markup language, xml), two-dimensional data formats including but not limited to comma separated values (comma separated values, CSV), EXCEL.
  • JSON javascript object notation
  • JSON extensible markup language
  • xml extensible markup language
  • two-dimensional data formats including but not limited to comma separated values (comma separated values, CSV), EXCEL.
  • the implementation environment of this method can be shown in the JSON and CSV conversion interface architecture diagram in FIG. 1 .
  • an operation support system is an operator's operation and maintenance support system, including a business planning system and a resource system.
  • the business planning system is used to plan business requirements, such as outputting data files such as business requirements in a two-dimensional data format
  • the resource system is used to collect resource information on the network, such as receiving data files such as business requirements in a two-dimensional data format.
  • the business application (application, APP) interacts with the OSS, receives the two-dimensional data format file of business requirements input by the OSS, and outputs the two-dimensional data format file to the OSS.
  • the business creation process is used to import files in two-dimensional data format.
  • a user inputs order requirements to the business planning system, and the business planning system inputs files in two-dimensional data format of business requirements to the business APP, so that the business APP imports the two-dimensional data. format file.
  • the user directly operates the business APP, and imports a file in a two-dimensional data format into the business APP.
  • the business creation process is also used to invoke a conversion model that converts the two-dimensional data format and the object-oriented data format, also called a converter. The converter reads the corresponding mapping information and parses the two-dimensional data format into object-oriented data.
  • Format for example, calling the converter of the two-dimensional data format and the object-oriented data format through the business interface to parse the two-dimensional data format file, and converting the two-dimensional data format file into JSON through the mapping information of the two-dimensional data format to the object-oriented data format format file.
  • the business export process is used to output data in object-oriented format, such as JSON data, call the converter, convert the data in object-oriented format into two-dimensional data format, and pass it to the resource system.
  • the converter of the two-dimensional data format and the object-oriented data format is used to receive the object-oriented data format file, and realize the controllable mutual conversion between the object-oriented data format file and the two-dimensional data format file according to the mapping information.
  • mapping information is used to control the content of conversion, wherein the mapping information is used to convert source data in object-oriented data format into target data in two-dimensional data format or for converting source data in two-dimensional data format target data in an object-oriented data format.
  • the method flow shown in FIG. 2 is taken as an example to explain the conversion process of the data format provided by the embodiment of the present application.
  • the methods provided in the embodiments of the present application may be applied to the implementation environment shown in FIG. 1 , including but not limited to step 201 and step 202 .
  • the method is performed by a data format conversion device, hereinafter referred to as a device, and the types of the device include but are not limited to network management systems, software defined networks (software defined network, SDN) controller network element devices, terminals and servers. at least one.
  • step 201 the device obtains source data and mapping information, and the mapping information is obtained based on business requirements.
  • the source data is the data that needs to be converted into a data format.
  • the source data and the service requirements may be input by the user, and the embodiment of the present application does not limit the acquisition method of the source data and the service requirements.
  • multiple mapping information may be pre-configured, and the multiple mapping information corresponds to different service requirements.
  • business requirements may include business planning information.
  • the service planning information is shown in Figure 3.
  • the service planning information includes service name, service type, source site, source network element, source port, sink site, sink network element, sink port, actual bandwidth, customer name and service remarks .
  • the service requirements include but are not limited to: service name, service type, source network element, source port, sink network element, and service remarks.
  • multiple pieces of mapping information may be pre-configured by a user, and then the device can perform the method provided in this embodiment of the present application based on the multiple pieces of mapping information.
  • the user configures multiple mapping information, specifies source data and business requirements, and inputs the multiple mapping information, source data and business requirements into the data format conversion system
  • the The data format conversion system includes the device; the device executes the method provided by the embodiment of the present application based on the mapping information, source data and business requirements.
  • a conversion model is stored in the device, and the conversion model is used to obtain the target data based on the mapping information and the source data.
  • the input of the conversion model includes source data and mapping information
  • the output of the conversion model includes target data after data format conversion.
  • mapping information, source data and business requirements when the user inputs the plurality of mapping information, source data and business requirements into the conversion system of the data format, he can directly input them into the device, or he can input the data that can communicate with the device in the conversion system of the data format. other devices. Therefore, the device can receive mapping information, source data, and service requirements sent by other devices, and then execute the methods provided by the embodiments of the present application based on the mapping information, source data, and service requirements.
  • the business requirements include, but are not limited to, association information for acquiring mapping information.
  • the mapping information is obtained based on the associated information in the business requirement. That is to say, to obtain the mapping information, the mapping information is obtained based on the business requirement, including: obtaining the mapping information based on the associated information in the business requirement.
  • the associated information includes an information identifier of the mapping information. According to different types of information identifiers, the acquisition of mapping information based on the associated information in business requirements includes but is not limited to the following two ways.
  • Manner 1 Obtain the mapping information based on the name of the mapping information in the business requirement.
  • the first method is used to obtain the mapping information. For example, if the name of the mapping information included in the associated information is ABC, based on the ABC, the mapping information with the name ABC is acquired from a plurality of pre-configured mapping information.
  • Manner 2 Obtain the mapping information based on the number of the mapping information in the business requirement.
  • the second method is used to obtain the mapping information.
  • the user is preconfigured with a mapping information list, where the mapping information list includes the multiple preconfigured mapping information and a number corresponding to each mapping information. For example, if the number of the mapping information included in the associated information is 1, the first mapping information in the mapping information list is acquired based on the number.
  • the mapping information is user-specified mapping information or default mapping information obtained based on business requirements. That is to say, the mapping information is obtained, and the mapping information is obtained based on business requirements, including: obtaining user-specified mapping information or default mapping information based on business requirements. For example, for any business requirement converted from data format 1 to data format 2, obtain mapping information 1; for any business requirement converted from data format 2 to data format 1, obtain mapping information 2.
  • the mapping information includes an information identifier, and the information identifier is used to identify the mapping information.
  • the mapping information also includes conversion mode information, where the conversion mode information is used to indicate the conversion mode (transMode), the format of the source data (objectType), and the format of the target data (fileType), and the conversion mode is used to indicate the conversion mode of the source data. format to convert to the format of the target data.
  • Step 202 the device obtains target data based on the mapping information and the source data.
  • the device performs data format conversion on the source data based on the mapping information to obtain the target data.
  • the mapping information includes a mapping relationship, and the mapping relationship includes a corresponding relationship between the first location information and the second location information of at least one data object in the source data.
  • the first location information is the location of at least one data object in the data structure of the source data
  • the second location information is the location of the at least one data object in the data structure of the target data
  • the object includes a data object in a location corresponding to the first location information.
  • the format of the source data is JSON format and the format of target data is CSV format, or the format of source data is CSV format and the format of target data is JSON format.
  • the data format of the source data and the data format of the target data may also be other data formats that need to be converted, which are not limited in this embodiment of the present application.
  • the representation of the first location information corresponds to the data format of the source data
  • the representation of the second location information corresponds to the data format of the target data. The embodiments of the present application are described by taking the representation of the location information corresponding to the object-oriented data as an attribute path, and the representation of the location information corresponding to the two-dimensional data as a title column as an example.
  • the source data is the object-oriented data shown in FIG. 5
  • the target data is the two-dimensional data shown in FIG. 6
  • the second position information of the data object is the root node of the title column.
  • the source data is the two-dimensional data shown in FIG. 6
  • the target data is the object-oriented data shown in FIG. 5 .
  • the first position information of the data object is the root node of the title column
  • the representation form of the location information corresponding to the data format can be determined, and the format conversion is performed by using the method provided in the embodiment of the present application, which is not repeated here. .
  • the target data is obtained based on the mapping information and the source data, including but not limited to the following two cases.
  • the format of the source data is the object-oriented data format
  • the format of the target data is the two-dimensional data format
  • the conversion mode is used to indicate the conversion from the object-oriented data format to the two-dimensional data format
  • the mapping information is used to convert the object-oriented data format into the two-dimensional data format.
  • the source data is converted into target data in a two-dimensional data format.
  • the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes an attribute path, and the second position information includes a title column; the device obtains the target data based on the mapping information and the source data, including: the device obtains the target data based on the mapping information and the source data.
  • the title column in the relationship, the attribute path corresponding to the title column, and the source data generate the target data.
  • the device generates the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data, including: the device obtains the first title column from the mapping relationship, and generates the first title array according to the first title column,
  • the first title array includes the attribute path, the array count value (index), and the number value (max) of the attribute path under the first title array; it is determined based on the array count value and the number value that the attribute path is not the last attribute under the first title array path, obtains the data object from the source data according to the attribute path corresponding to the first title array according to the array count value, and outputs it as a row of the target data in the two-dimensional data format.
  • the array count value (index) of the attribute path is 0, and the number value (max) of the attribute path under the first title array is 1. If the number of attribute paths in the first title array is 2, the array count value (index) of one attribute path is 0, and the array count value (index) of the other attribute path is 1. The number value (max) under a title array is 2.
  • mapping information 1 the information of the mapping information is identified as mapping information 1, and the mapping information is used to convert the source data in the object-oriented data format into the target data in the two-dimensional data format.
  • the conversion mode information included in the mapping information indicates that the conversion mode is from an object-oriented data format to a two-dimensional data format (JSON-to-CSV), the format of the source data is JSON, and the format of the target data is CSV.
  • the title column includes the root node, network branch, network sub-branch and other branch information; the attribute path (mappingScript) corresponding to the root node includes $Root[*].Branch, and the attribute path corresponding to the network branch includes $Root[*] .NstBranch[*].Branch, the attribute path corresponding to the network sub-branch includes $Root[*].NstBranch[*].Twig, and the attribute path corresponding to other branch information includes $Root[*].OthNstBranch[*].
  • the first title column obtained from the mapping relationship by calling the transformation model includes: root node, network branch, network sub-branch and other branch information.
  • the first title array generated according to the first title column includes: [$Root[index, max].Branch, $Root[index, max].NstBranch[index, max].Branch, $Root[index, max]. NstBranch[index, max].Twig, $Root[index, max].OthNstBranch[index, max]].
  • $Root[index, max].Branch, $Root[index, max].NstBranch[index, max].Branch, $Root[index, max].NstBranch[index, max].Twig and $Root[index , max].OthNstBranch[index, max] is the array node in the first title array.
  • the first title array may not include the quantity value. That is, if the number of property paths in the first header array is 1, the first header array includes property paths and an array count value.
  • the source data is the object-oriented data shown in FIG. 5
  • the value of the property path $Root[*].Branch under the first title array is 2, that is, max is equal to 2.
  • the array count value is initially 0, in response to the array count value being less than max-1, the property path is not the last property path under the first title array.
  • Branch that is, branch1 is the attribute path $Root[*].
  • Branch obtained from the source data according to index 0 Data object;
  • the output target data in a two-dimensional data format is shown in FIG. 6 .
  • the data object is outputted as a row of target data in two-dimensional data format, and the last attribute path in the array node that satisfies the If the array count value is less than max-1, add 1 to the array count value, reset the other array count value and the quantity value corresponding to the array count value.
  • the second line of the output target data includes: nbranch1.2, twig1.2.
  • the second row of the target data does not include other branch information corresponding to data object.
  • the third line of the output target data includes: branch2, nbranch2.1, twig2.1, 1.
  • the fourth line of the output target data includes: nbranch2.2, twig2.2, 2.
  • the property path in response to the array count value being not less than max-1, is the last property path under the first title array.
  • the attribute path corresponding to the first title array is obtained from the source data according to the array count value and outputs the data object.
  • the format of the source data is a two-dimensional data format
  • the format of the target data is an object-oriented data format
  • the conversion mode is used to indicate the conversion from a two-dimensional data format to an object-oriented data format
  • the mapping information is used to convert the two-dimensional data format
  • the source data is converted into target data in an object-oriented data format.
  • the mapping relationship includes a title column and an attribute path corresponding to the title column, the first location information includes a title column, and the second location information includes an attribute path; the device obtains the target data based on the mapping information and the source data, including: the device obtains the target data based on the mapping information and the source data.
  • the title column in the relationship, the attribute path corresponding to the title column, and the source data generate the target data.
  • generating the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data includes: the device obtains a second title column from the mapping relationship, generates a second title array according to the second title column, The second title array includes the attribute path and the array count value; in response to the current row of the source data being less than the total number of rows, the data object indicated by the current row in the source data is filled into the data structure of the target data according to the position specified by the attribute path and the array count value .
  • the initial value of the current row is 0.
  • mapping information 2 the information of the mapping information is identified as mapping information 2, and the mapping information is used to convert the source data in the two-dimensional data format into the target data in the object-oriented data format.
  • the conversion mode information included in the mapping information indicates that the conversion mode is to convert from a two-dimensional data format to an object-oriented data format (CSV-to-JSON), the format of the source data is CSV, and the format of the target data is JSON.
  • CSV-to-JSON object-oriented data format
  • the format of the source data is CSV
  • the format of the target data is JSON.
  • the title column includes root node, network branch, network sub-branch and other branch information; the attribute path corresponding to the root node includes $Root[*].Branch, and the attribute path corresponding to the network branch includes $ Root[*].NstBranch[*].Branch, the attribute path corresponding to the network sub-branch includes $Root[*].NstBranch[*].Twig, and the attribute path corresponding to other branch information includes $Root[*].OthNstBranch[* ]. Then, the second title column obtained from the mapping relationship by calling the transformation model includes: root node, network branch, network sub-branch and other branch information.
  • the second title array generated according to the second title column includes: [$Root[index].Branch, $Root[index].NstBranch[index].Branch, $Root[index].NstBranch[index].Twig, $ Root[index].OthNstBranch[index]].
  • $Root[index].Branch, $Root[index].NstBranch[index].Branch, $Root[index].NstBranch[index].Twig and $Root[index].OthNstBranch[index] are the second Array nodes in the header array.
  • the data structure of the target data determined according to the attribute path corresponding to the title column is shown in FIG. 9 .
  • the two-dimensional data includes five rows of data objects, and the total number of rows of the two-dimensional data is five. That is, for the first row data object of the two-dimensional data, the current row is 0; the array count value is initially 0. Therefore, the second header array includes:
  • the current row is 0.
  • the data object indicated by the current row in the source data is filled into the data structure of the target data according to the position specified by the attribute path and the array count value. That is, as shown in FIG. 9, the data objects branch1, nbranch1.1 and twig1.1 indicated by the current behavior 0 are filled into the data structure of the target data.
  • the indicated data objects do not include data objects with other branch information objects
  • the part corresponding to the array node in the data structure of the target data is deleted.
  • the current row is incremented by 1.
  • the second title array also includes the number value (max) of the attribute path under the second title array.
  • the last one in the array node satisfies the array count value less than The array count value of the condition of max-1 is incremented by 1, other array count values after resetting the array count value and the quantity value corresponding to the array count value; in response to the data object indicated by the current row in the source data being empty, the array The count value remains unchanged.
  • the second header array includes: [$Root[index,max].Branch,$Root[index,max].NstBranch[index,max].Branch,$Root[index,max].NstBranch[index,max] .Twig, $Root[index, max].OthNstBranch[index, max]].
  • Branch is filled in
  • the conversion process of the data format ends, and stops filling the data object indicated by the current row in the source data with the data of the target data according to the position specified by the attribute path and the array count value. in the structure.
  • the source data is converted into the data structure based on the mapping information obtained according to the business requirements to obtain the target data, and the conversion efficiency of the data format of this method is higher.
  • the structure of the converted target data is controllable.
  • the target data converted according to the same mapping information has the same format, and this method is applicable to a wide range of source data structures.
  • the method realizes the conversion between the object-oriented data format and the two-dimensional data format, and the conversion between the two-dimensional data format and the object-oriented data format.
  • the transformation process of the data structure is reversible.
  • the object-oriented data format before and after the conversion is the same.
  • FIG. 11 is a schematic structural diagram of a data format conversion apparatus provided by an embodiment of the present application. Based on the following multiple modules shown in FIG. 11 , the data format conversion apparatus shown in FIG. 11 can perform all or part of the operations performed by the data format conversion device. It should be understood that the apparatus may include more additional modules than the shown modules or omit a part of the modules shown therein, which is not limited in this embodiment of the present application. As shown in FIG. 11 , the apparatus includes: an acquisition module 1101 and a conversion module 1102 .
  • the obtaining module 1101 is used to obtain source data and mapping information, and the mapping information is obtained based on business requirements;
  • the conversion module 1102 is used to obtain target data based on the mapping information and the source data, and the mapping information includes A mapping relationship, the mapping relationship includes a correspondence between the first position information and the second position information of at least one data object in the source data; wherein, the first position information is the position of the at least one data object in the data structure of the source data, and the first position information is the position of the at least one data object in the data structure of the source data.
  • the second position information is the position of the at least one data object in the data structure of the target data, and the data object in the position corresponding to the second position information includes the data object in the position corresponding to the first position information.
  • the mapping information further includes an information identifier and conversion mode information; the information identifier is used to identify the mapping information; the conversion mode information is used to indicate the conversion mode, the format of the source data and the format of the target data, and the conversion mode uses Used to indicate the conversion from the format of the source data to the format of the target data.
  • the format of the source data is an object-oriented data format
  • the format of the target data is a two-dimensional data format
  • the mapping information is used to convert the source data of the object-oriented data format into the target data of the two-dimensional data format .
  • the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes an attribute path, and the second position information includes a title column; the conversion module 1102 is configured to, based on the mapping relationship, include the attribute path and the second position information.
  • the title column, the attribute path corresponding to the title column, and the source data generate the target data.
  • the conversion module 1102 is configured to obtain the first title column from the mapping relationship, and generate a first title array according to the first title column, where the first title array includes an attribute path, an array count value, and an attribute path The quantity value under the first title array; based on the array count value and the quantity value, it is determined that the attribute path is not the last attribute path under the first title array, and the attribute path corresponding to the first title array is obtained from the source data according to the array count value Data object and output as a row of target data in two-dimensional data format.
  • the format of the source data is a two-dimensional data format
  • the format of the target data is an object-oriented data format
  • the mapping information is used to convert the source data of the two-dimensional data format into the target data of the object-oriented data format .
  • the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes a title column, and the second position information includes an attribute path; the conversion module 1102 is configured to, based on the mapping relationship, The title column, the attribute path corresponding to the title column, and the source data generate the target data.
  • the conversion module 1102 is configured to obtain the second title column from the mapping relationship, and generate a second title array according to the second title column, where the second title array includes an attribute path and an array count value; in response to If the current row of the source data is less than the total number of rows, the data object indicated by the current row in the source data is filled into the data structure of the target data according to the position specified by the attribute path and the array count value.
  • the business requirement includes association information for obtaining the mapping information; the obtaining module 1101 is configured to obtain the mapping information based on the association information in the business requirement.
  • the association information includes an information identifier of the mapping information.
  • the obtaining module 1101 is configured to obtain user-specified mapping information or default mapping information based on business requirements.
  • the format of the source data is JSON format
  • the format of target data is CSV format
  • the format of source data is CSV format
  • the format of target data is JSON format
  • the type of the device includes at least one of a network management system, an SDN controller network element device, a terminal, and a server.
  • FIG. 11 realizes its functions, it is only illustrated by the division of the above-mentioned functional modules.
  • the internal structure is divided into different functional modules to complete all or part of the functions described above.
  • the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process thereof is detailed in the method embodiments, which will not be repeated here.
  • FIG. 12 shows a schematic structural diagram of a data format conversion device 2000 provided by an exemplary embodiment of the present application.
  • the data format conversion apparatus 2000 shown in FIG. 12 is used to perform the operations involved in the above-described data format conversion method shown in FIG. 2 .
  • the data format conversion device 2000 is, for example, a switch, a router, etc.
  • the data format conversion device 2000 can be implemented by a general bus architecture.
  • the data format conversion device 2000 includes at least one processor 2001 , memory 2003 and at least one communication interface 2004 .
  • the processor 2001 is, for example, a general-purpose central processing unit (central processing unit, CPU), a digital signal processor (digital signal processor, DSP), a network processor (network processor, NP), a graphics processing unit (graphics processing unit, GPU), A neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor or one or more integrated circuits for implementing the solution of the present application.
  • the processor 2001 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.
  • ASIC application-specific integrated circuit
  • PLD programmable logic device
  • the PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. It may implement or execute the various logical blocks, modules and circuits described in connection with the disclosure of the embodiments of the present invention.
  • the processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
  • the data format conversion device 2000 further includes a bus.
  • the bus is used to transfer information between the various components of the data format conversion apparatus 2000 .
  • the bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (EISA for short) bus or the like.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is shown in FIG. 12, but it does not mean that there is only one bus or one type of bus.
  • the memory 2003 is, for example, a read-only memory (read-only memory, ROM) or other types of static storage devices that can store static information and instructions, or a random access memory (random access memory, RAM) or a memory device that can store information and instructions.
  • Other types of dynamic storage devices such as electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disk storage, optical disks storage (including compact discs, laser discs, compact discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or capable of carrying or storing desired program code in the form of instructions or data structures and capable of Any other medium accessed by a computer without limitation.
  • the memory 2003 exists independently, for example, and is connected to the processor 2001 through a bus.
  • the memory 2003 may also be integrated with the processor 2001 .
  • the communication interface 2004 uses any device such as a transceiver for communicating with other devices or a communication network, which may be Ethernet, a radio access network (RAN), or a wireless local area network (WLAN), or the like.
  • Communication interface 2004 may include a wired communication interface and may also include a wireless communication interface.
  • the communication interface 2004 may be an ethernet (ethernet) interface, a fast ethernet (FE) interface, a gigabit ethernet (GE) interface, an asynchronous transfer mode (ATM) interface, a wireless local area network ( wireless local area networks, WLAN) interfaces, cellular network communication interfaces, or a combination thereof.
  • the Ethernet interface can be an optical interface, an electrical interface or a combination thereof.
  • the communication interface 2004 may be used for the data format conversion device 2000 to communicate with other devices.
  • the processor 2001 may include one or more CPUs, such as CPU0 and CPU1 as shown in FIG. 12 .
  • Each of these processors can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor.
  • a processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).
  • the data format conversion device 2000 may include multiple processors, such as the processor 2001 and the processor 2005 shown in FIG. 12 .
  • processors can be a single-core processor (single-CPU) or a multi-core processor (multi-CPU).
  • a processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).
  • the data format conversion device 2000 may further include an output device and an input device.
  • the output device communicates with the processor 2001 and can display information in a variety of ways.
  • the output device may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, a projector, or the like.
  • the input device communicates with the processor 2001 and can receive user input in various ways.
  • the input device may be a mouse, a keyboard, a touch screen device, or a sensor device, or the like.
  • the memory 2003 is used to store the program code 2010 for executing the solutions of the present application
  • the processor 2001 can execute the program code 2010 stored in the memory 2003 . That is, the data format conversion device 2000 can implement the data format conversion method provided by the method embodiment through the processor 2001 and the program code 2010 in the memory 2003 .
  • One or more software modules may be included in the program code 2010 .
  • the processor 2001 itself may also store program codes or instructions for executing the solutions of the present application.
  • the data format conversion device 2000 in this embodiment of the present application may correspond to the data format conversion device in the above-mentioned respective data format conversion method embodiments, and the processor 2001 in the data format conversion device 2000 reads
  • the instructions in the memory 2003 enable the data format conversion apparatus 2000 shown in FIG. 12 to perform all or part of the operations performed by the data format conversion apparatus.
  • the data format conversion device 2000 may also correspond to the data format conversion device shown in FIG. 11 , and each functional module in the data format conversion device is implemented by software of the data format conversion device 2000 .
  • the functional modules included in the data format conversion apparatus are generated after the processor 2001 of the data format conversion device 2000 reads the program code 2010 stored in the memory 2003 .
  • each step of the data format conversion method shown in FIG. 2 is completed by the hardware integrated logic circuit in the processor of the data format conversion device 2000 or the instructions in the form of software.
  • the steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
  • the software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art.
  • the storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware, which will not be described in detail here to avoid repetition.
  • FIG. 13 shows a schematic structural diagram of a data format conversion device 2100 provided by another exemplary embodiment of the present application.
  • the data format conversion device 2100 shown in FIG. 13 is configured to perform all or part of the operations involved in the above-mentioned data format conversion method shown in FIG. 2 .
  • the data format conversion device 2100 is, for example, a switch, a router, etc.
  • the data format conversion device 2100 can be implemented by a general bus architecture.
  • the data format conversion device 2100 includes: a main control board 2110 and an interface board 2130 .
  • the main control board is also called the main processing unit (MPU) or the route processor card (route processor card).
  • the main control board 2110 is used for the control and management of each component in the data format conversion device 2100, including route calculation. , Equipment management, equipment maintenance, protocol processing functions.
  • the main control board 2110 includes: a central processing unit 2111 and a memory 2112 .
  • the interface board 2130 is also referred to as a line processing unit (LPU), a line card (line card) or a service board.
  • the interface board 2130 is used to provide various service interfaces and realize data packet forwarding.
  • the service interface includes, but is not limited to, an Ethernet interface, a POS (packet over SONET/SDH) interface, etc.
  • the Ethernet interface is, for example, a flexible Ethernet service interface (flexible ethernet clients, FlexE Clients).
  • the interface board 2130 includes: a central processing unit 2131, a network processor 2132, a forwarding table entry memory 2134, and a physical interface card (PIC) 2133.
  • PIC physical interface card
  • the central processing unit 2131 on the interface board 2130 is used to control and manage the interface board 2130 and communicate with the central processing unit 2111 on the main control board 2110 .
  • the network processor 2132 is used to implement packet forwarding processing.
  • the form of the network processor 2132 may be a forwarding chip.
  • the forwarding chip may be a network processor (NP).
  • the forwarding chip may be implemented by an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA).
  • ASIC application-specific integrated circuit
  • FPGA field programmable gate array
  • the network processor 2132 is configured to forward the received message based on the forwarding table stored in the forwarding table entry memory 2134.
  • the message is sent to the to the CPU (such as the central processing unit 2131) for processing; if the destination address of the message is not the address of the conversion device 2100 of the data format, then find the next hop and the outgoing interface corresponding to the destination address from the forwarding table according to the destination address, Forward the packet to the outbound interface corresponding to the destination address.
  • the processing of the uplink message may include: processing of the incoming interface of the message, and forwarding table lookup; the processing of the downlink message may include: forwarding table lookup, and so on.
  • the central processing unit can also perform the function of a forwarding chip, such as implementing software forwarding based on a general-purpose CPU, so that a forwarding chip is not required in the interface board.
  • the physical interface card 2133 is used to realize the interconnection function of the physical layer, the original traffic enters the interface board 2130 through this, and the processed packets are sent from the physical interface card 2133 .
  • the physical interface card 2133 is also called a daughter card, which can be installed on the interface board 2130, and is responsible for converting the photoelectric signal into a message, and after checking the validity of the message, it is forwarded to the network processor 2132 for processing.
  • the central processing unit 2131 can also perform the functions of the network processor 2132 , such as implementing software forwarding based on a general-purpose CPU, so that the network processor 2132 is not required in the physical interface card 2133 .
  • the data format conversion device 2100 includes a plurality of interface boards.
  • the data format conversion device 2100 further includes an interface board 2140.
  • the interface board 2140 includes: a central processing unit 2141, a network processor 2142, a forwarding entry storage 2144 and Physical interface card 2143.
  • the functions and implementation manners of the components in the interface board 2140 are the same as or similar to those of the interface board 2130, and will not be repeated here.
  • the data format conversion device 2100 further includes a switch fabric board 2120 .
  • the switch fabric unit 2120 may also be referred to as a switch fabric unit (switch fabric unit, SFU).
  • SFU switch fabric unit
  • the switching network board 2120 is used to complete data exchange between the interface boards.
  • the interface board 2130 and the interface board 2140 can communicate through the switch fabric board 2120 .
  • the main control board 2110 is coupled with the interface board.
  • the main control board 2110, the interface board 2130, the interface board 2140, and the switching network board 2120 are connected to the system backplane through a system bus to achieve intercommunication.
  • an inter-process communication (IPC) channel is established between the main control board 2110 and the interface board 2130 and the interface board 2140, and the main control board 2110 and the interface board 2130 and the interface board 2140 The communication is carried out through the IPC channel.
  • IPC inter-process communication
  • the data format conversion device 2100 includes a control plane and a forwarding plane
  • the control plane includes a main control board 2110 and a central processing unit 2111
  • the forwarding plane includes various components that perform forwarding, such as forwarding entry storage 2134, physical interface card 2133 and network processor 2132.
  • the control plane performs functions such as routers, generating forwarding tables, processing signaling and protocol packets, and configuring and maintaining the status of network devices.
  • the control plane issues the generated forwarding tables to the forwarding plane.
  • the network processor 2132 controls the The following forwarding table forwards the packets received by the physical interface card 2133 by looking up the table.
  • the forwarding table issued by the control plane may be stored in the forwarding table entry storage 2134 . In some embodiments, the control plane and forwarding plane may be completely separated and not on the same network device.
  • main control boards there may be one or more main control boards, and when there are multiple main control boards, they may include the main main control board and the backup main control board.
  • the data format conversion device can have at least one switching network board, and the switching network board realizes data exchange between multiple interface boards, providing large-capacity data exchange and processing capabilities. Therefore, the data access and processing capability of the data format conversion device of the distributed architecture is greater than that of the data format conversion device of the centralized architecture.
  • the data format conversion device can also be in the form of only one board, that is, there is no switching network board, and the functions of the interface board and the main control board are integrated on this board.
  • the central processing unit on the interface board. and the central processing unit on the main control board can be combined into a central processing unit on this board to perform the superimposed functions of the two.
  • the data exchange and processing capacity of the conversion device of this morphological data format is low (for example, network devices such as low-end switches or routers).
  • the specific architecture used depends on the specific networking deployment scenario, and there is no restriction here.
  • the data format conversion device 2100 corresponds to the data format conversion apparatus shown in FIG. 11 above.
  • the acquisition module 1101 in the data format conversion apparatus shown in FIG. 11 is equivalent to the physical interface card 2133 in the data format conversion device 2100 ; the conversion module 1102 is equivalent to the center in the data format conversion device 2100 Processor 2111 or Network Processor 2132.
  • an embodiment of the present application further provides a data format conversion system, the system includes: a control device and a display interface.
  • the control device is the data format conversion device 2000 shown in FIG. 12 or the data format conversion device 2100 shown in FIG. 13
  • the display interface is the data format conversion device 2000 shown in FIG. 12 or the data format shown in FIG. 13 .
  • the data format conversion device 2100 is the data format conversion device 2000 shown in FIG. 12 or the data format shown in FIG. 13 .
  • An embodiment of the present application also provides a communication apparatus, the apparatus includes: a transceiver, a memory, and a processor.
  • the transceiver, the memory and the processor communicate with each other through an internal connection path, the memory is used for storing instructions, and the processor is used for executing the instructions stored in the memory to control the transceiver to receive signals and control the transceiver to send signals , and when the processor executes the instructions stored in the memory, the processor is made to execute the data format conversion method required to be executed by the control device.
  • An embodiment of the present application also provides a communication apparatus, the apparatus includes: a transceiver, a memory, and a processor.
  • the transceiver, the memory and the processor communicate with each other through an internal connection path, the memory is used for storing instructions, and the processor is used for executing the instructions stored in the memory to control the transceiver to receive signals and control the transceiver to send signals , and when the processor executes the instructions stored in the memory, the processor is made to execute the data format conversion method required to be executed by the display interface.
  • processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (digital signal processing, DSP), application specific integrated circuits (application specific integrated circuits, ASIC), field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general purpose processor may be a microprocessor or any conventional processor or the like. It should be noted that the processor may be a processor supporting an advanced RISC machine (ARM) architecture.
  • ARM advanced RISC machine
  • the above-mentioned memory may include read-only memory and random access memory, and provide instructions and data to the processor.
  • the memory may also include non-volatile random access memory.
  • the memory may also store device type information.
  • the memory may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically programmable Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • Volatile memory may be random access memory (RAM), which acts as an external cache. By way of example and not limitation, many forms of RAM are available.
  • SRAM static RAM
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • double data rate synchronous dynamic random access Memory double data date SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • synchronous link dynamic random access memory direct memory bus random access memory
  • direct rambus RAM direct rambus RAM
  • Embodiments of the present application further provide a computer-readable storage medium, where at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement any one of the above-described data format conversion methods.
  • the embodiments of the present application also provide a computer program (product), when the computer program is executed by a computer, the processor or the computer can be made to execute each step and/or process of the corresponding data format conversion method in the above method embodiments.
  • An embodiment of the present application further provides a chip, including a processor, configured to call and execute instructions stored in the memory from a memory, so that a communication device installed with the chip performs the data format conversion in the above aspects method.
  • An embodiment of the present application further provides another chip, including: an input interface, an output interface, a processor, and a memory, wherein the input interface, the output interface, the processor, and the memory are connected through an internal connection path, and the The processor is configured to execute the code in the memory, and when the code is executed, the processor is configured to execute the data format conversion method in the above aspects.
  • the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • software it can be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer program instructions when loaded and executed on a computer, result in whole or in part of the processes or functions described herein.
  • the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line) or wireless (eg, infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media.
  • the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state disks), and the like.
  • the computer program product includes one or more computer program instructions.
  • the methods of the embodiments of the present application may be described in the context of machine-executable instructions, such as included in program modules executed in a device on a target's real or virtual processor.
  • program modules include routines, programs, libraries, objects, classes, components, data structures, etc. that perform particular tasks or implement particular abstract data structures.
  • the functionality of the program modules may be combined or divided among the described program modules.
  • Machine-executable instructions for program modules may be executed within local or distributed devices. In a distributed facility, program modules may be located in both local and remote storage media.
  • Computer program code for implementing the methods of the embodiments of the present application may be written in one or more programming languages. Such computer program code may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus such that the program code, when executed by the computer or other programmable data processing apparatus, causes the flowchart and/or block diagrams The functions/operations specified in are implemented.
  • the program code may execute entirely on the computer, partly on the computer, as a stand-alone software package, partly on the computer and partly on a remote computer or entirely on the remote computer or server.
  • computer program code or related data may be carried by any suitable carrier to enable a device, apparatus or processor to perform the various processes and operations described above.
  • suitable carriers include signals, computer-readable media, and the like.
  • Examples of signals may include electrical, optical, radio, acoustic, or other forms of propagated signals, such as carrier waves, infrared signals, and the like.
  • a machine-readable medium may be any tangible medium that contains or stores a program for or in connection with an instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination thereof. More detailed examples of machine-readable storage media include electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only Memory (EPROM or flash memory), optical storage devices, magnetic storage devices, or any suitable combination thereof.
  • the disclosed systems, devices and methods may be implemented in other manners.
  • the device embodiments described above are only illustrative.
  • the division of the modules is only a logical function division. In actual implementation, there may be other division methods.
  • multiple modules or components may be combined or Integration into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or modules, and may also be electrical, mechanical or other forms of connection.
  • modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, may be located in one place, or may be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solutions of the embodiments of the present application.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically alone, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules.
  • the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may be stored in a computer-readable storage medium.
  • the technical solutions of the present application are essentially or part of contributions to the prior art, or all or part of the technical solutions can be embodied in the form of software products, and the computer software products are stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .
  • first, second, etc. are used to distinguish the same or similar items with basically the same function and function, and it should be understood that between “first”, “second” and “nth” There are no logical or timing dependencies, and no restrictions on the number and execution order. It will also be understood that, although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another.
  • the size of the sequence number of each process does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not be used in the embodiment of the present application. Implementation constitutes any limitation.
  • the meaning of the term “at least one” refers to one or more, and the meaning of the term “plurality” in this application refers to two or more.
  • a plurality of second messages refers to two or more more than one second message.
  • system and “network” are often used interchangeably herein.
  • determining B according to A does not mean that B is only determined according to A, and B may also be determined according to A and/or other information.
  • references throughout the specification to "one embodiment,” “an embodiment,” and “one possible implementation” mean that a particular feature, structure, or characteristic associated with the embodiment or implementation is included herein. in at least one embodiment of the application. Thus, appearances of "in one embodiment” or “in an embodiment” or “one possible implementation” in various places throughout this specification are not necessarily necessarily referring to the same embodiment. Furthermore, the particular features, structures or characteristics may be combined in any suitable manner in one or more embodiments.

Abstract

The present application discloses a data format conversion method and apparatus, a device, and a computer-readable storage medium. The method comprises: a device obtains source data and mapping information obtained on the basis of a service requirement; and the device obtains target data on the basis of the mapping information and the source data, the mapping information comprising a mapping relationship, and the mapping relationship comprising a correspondence between first position information and second position information of at least one data object in the source data, wherein the first position information is a position of the at least one data object in a data structure of the source data, the second position information is a position of the at least one data object in a data structure of the target data, and the data object in the position corresponding to the second position information comprises the data object in the position corresponding to the first position information. The conversion efficiency of the data format according to the method is high. Because the conversion of the data format is performed according to the mapping information, the structure of the target data after conversion is controllable.

Description

数据格式的转换方法、装置、设备及计算机可读存储介质Data format conversion method, apparatus, device, and computer-readable storage medium
本申请要求于2021年4月20日提交的申请号为202110423829.2、发明名称为“一种数据获取的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中;本申请还要求于2021年5月12日提交的申请号为202110518463.7、发明名称为“数据格式的转换方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202110423829.2 and the invention titled "A method and device for data acquisition" filed on April 20, 2021, the entire contents of which are incorporated into this application by reference; The application also claims the priority of the Chinese patent application with application number 202110518463.7 filed on May 12, 2021 and the invention title is "Data Format Conversion Method, Apparatus, Equipment and Computer-readable Storage Medium", the entire contents of which are by reference Incorporated in this application.
技术领域technical field
本申请涉及数据处理技术领域,特别涉及数据格式的转换方法、装置、设备及计算机可读存储介质。The present application relates to the technical field of data processing, and in particular, to a data format conversion method, apparatus, device, and computer-readable storage medium.
背景技术Background technique
随着数据格式的多样化,常常会有不同数据格式之间的转换需求。例如,针对二维数据格式和面向对象数据格式之间的转换。With the diversification of data formats, there are often conversion requirements between different data formats. For example, for conversion between two-dimensional data formats and object-oriented data formats.
相关技术中,采用硬编码转换的方式,按照客户提出的需求,开发产品发布版本。由于该种数据格式转换方式需要随产品版本发布,不仅开发周期长,发布周期长,且定制成本高。In the related art, a hard-coded conversion method is used to develop a product release version according to the requirements put forward by the customer. Since this data format conversion method needs to be released with the product version, it not only has a long development cycle, but also a long release cycle and high customization costs.
发明内容SUMMARY OF THE INVENTION
本申请提出一种数据格式的转换方法、装置、设备及计算机可读存储介质,用于提高数据格式的转换效率,实现转换后的目标数据的结构可控,适用于较广的源数据的结构。The present application proposes a data format conversion method, device, device and computer-readable storage medium, which are used to improve the conversion efficiency of the data format, realize the controllable structure of the converted target data, and are suitable for a wide range of source data structures. .
第一方面,提供了一种数据格式的转换方法,包括:设备获得源数据和映射信息,该映射信息为基于业务需求获取得到;该设备基于所述映射信息和所述源数据得到目标数据,所述映射信息包括映射关系,该映射关系包括所述源数据中的至少一个数据对象的第一位置信息与第二位置信息的对应关系;其中,所述第一位置信息为所述至少一个数据对象在所述源数据的数据结构中的位置,所述第二位置信息为所述至少一个数据对象在所述目标数据的数据结构中的位置,所述第二位置信息对应的位置中的数据对象包括所述第一位置信息对应的位置中的数据对象。A first aspect provides a data format conversion method, including: a device obtains source data and mapping information, where the mapping information is obtained based on business requirements; the device obtains target data based on the mapping information and the source data, The mapping information includes a mapping relationship, and the mapping relationship includes a corresponding relationship between the first position information and the second position information of at least one data object in the source data; wherein, the first position information is the at least one piece of data the position of the object in the data structure of the source data, the second position information is the position of the at least one data object in the data structure of the target data, the data in the position corresponding to the second position information The object includes a data object in a location corresponding to the first location information.
该方法通过根据业务需求获取映射信息,基于映射信息将源数据进行数据结构转换,得到目标数据,使得数据格式的转换效率更高。其次,由于数据转换是根据映射信息进行转换的,该映射信息包括了源数据中的至少一个数据对象的第一位置信息与第二位置信息的对应关系,使得转换后的目标数据的结构可控。对于不同的源数据的结构,按照相同映射信息转换后的目标数据的格式相同,该方法适用的源数据的结构较广。The method obtains the mapping information according to the business requirements, and converts the data structure of the source data based on the mapping information to obtain the target data, so that the conversion efficiency of the data format is higher. Secondly, since the data conversion is performed according to the mapping information, the mapping information includes the correspondence between the first position information and the second position information of at least one data object in the source data, so that the structure of the converted target data is controllable . For different source data structures, the target data converted according to the same mapping information has the same format, and this method is applicable to a wide range of source data structures.
在一种可能的实现方式中,所述映射信息还包括信息标识以及转换模式信息;所述信息标识用于标识所述映射信息;所述转换模式信息用于指示转换模式、所述源数据的格式以及所述目标数据的格式,所述转换模式用于指示由所述源数据的格式转换到所述目标数据的格式。通过该信息标识能够快速获取映射信息。In a possible implementation manner, the mapping information further includes an information identifier and conversion mode information; the information identifier is used to identify the mapping information; the conversion mode information is used to indicate the conversion mode, the source data The format and the format of the target data, the conversion mode is used to indicate the conversion from the format of the source data to the format of the target data. The mapping information can be quickly acquired through the information identification.
在一种可能的实现方式中,所述源数据的格式为面向对象数据格式,所述目标数据的格式为二维数据格式,所述映射信息用于将所述面向对象数据格式的源数据转换成所述二维数据格式的目标数据。In a possible implementation manner, the format of the source data is an object-oriented data format, the format of the target data is a two-dimensional data format, and the mapping information is used to convert the source data in the object-oriented data format. into the target data in the two-dimensional data format.
在一种可能的实现方式中,所述映射关系包括标题列以及与所述标题列对应的属性路径,所述第一位置信息包括所述属性路径,所述第二位置信息包括所述标题列;所述设备基于所述映射信息和所述源数据得到目标数据,包括:所述设备基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据。In a possible implementation manner, the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the attribute path, and the second position information includes the title column ; The device obtains target data based on the mapping information and the source data, including: the device generates target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
在一种可能的实现方式中,所述设备基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据,包括:所述设备从所述映射关系中获取第一标题列,根据所述第一标题列生成第一标题数组,所述第一标题数组包括所述属性路径、数组计数值以及所述属性路径在所述第一标题数组下的数量值;基于所述数组计数值以及所述数量值确定所述属性路径不是所述第一标题数组下的最后一个属性路径,将所述第一标题数组对应的属性路径按照所述数组计数值从所述源数据中获取数据对象并输出为所述二维数据格式的目标数据的一行。In a possible implementation manner, the device generates the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data, including: the device generates the target data from the mapping relationship Obtain a first title column, and generate a first title array according to the first title column, where the first title array includes the attribute path, the array count value, and the quantity value of the attribute path under the first title array ; Determine that the attribute path is not the last attribute path under the first title array based on the array count value and the quantity value, and change the attribute path corresponding to the first title array from the Obtain a data object from the source data and output it as a row of target data in the two-dimensional data format.
在一种可能的实现方式中,所述源数据的格式为二维数据格式,所述目标数据的格式为面向对象数据格式,所述映射信息用于将所述二维数据格式的源数据转换成所述面向对象数据格式的目标数据。In a possible implementation manner, the format of the source data is a two-dimensional data format, the format of the target data is an object-oriented data format, and the mapping information is used to convert the source data of the two-dimensional data format. into the target data in the object-oriented data format.
在一种可能的实现方式中,所述映射关系包括标题列以及与所述标题列对应的属性路径,所述第一位置信息包括所述标题列,所述第二位置信息包括所述属性路径;所述设备基于所述映射信息和所述源数据得到目标数据,包括:所述设备基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据。In a possible implementation manner, the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the title column, and the second position information includes the attribute path ; The device obtains target data based on the mapping information and the source data, including: the device generates target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
在一种可能的实现方式中,所述设备基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据,包括:所述设备从所述映射关系中获取第二标题列,根据所述第二标题列生成第二标题数组,所述第二标题数组包括属性路径以及数组计数值;响应于所述源数据的当前行小于总行数,将所述源数据中当前行指示的数据对象按照所述属性路径和所述数组计数值指定的位置填入所述目标数据的数据结构中。In a possible implementation manner, the device generates the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data, including: the device generates the target data from the mapping relationship Obtain a second title column, and generate a second title array according to the second title column, where the second title array includes a property path and an array count value; in response to the current row of the source data being less than the total number of rows, the source data The data object indicated by the current row in the data is filled into the data structure of the target data according to the position specified by the attribute path and the array count value.
在一种可能的实现方式中,所述业务需求包括用于获取所述映射信息的关联信息;所述获得映射信息,所述映射信息为基于业务需求获取得到,包括:基于所述业务需求中的所述关联信息获取所述映射信息。通过关联信息获取映射信息,该方法中获取映射信息的方式较为灵活。In a possible implementation manner, the business requirement includes associated information for acquiring the mapping information; the obtaining the mapping information, the mapping information is obtained based on the business requirement, includes: based on the business requirement to obtain the mapping information from the associated information. The mapping information is obtained through the associated information, and the method for obtaining the mapping information in this method is more flexible.
在一种可能的实现方式中,所述关联信息包括所述映射信息的信息标识。In a possible implementation manner, the association information includes an information identifier of the mapping information.
在一种可能的实现方式中,所述获得映射信息,所述映射信息为基于业务需求获取得到,包括:基于所述业务需求获取用户指定的映射信息或者默认的映射信息。获取的映射信息也可以是基于业务需求获取的指定的映射信息或默认的映射信息。该方法获取映射信息的方式较为灵活。In a possible implementation manner, the obtaining of the mapping information, where the mapping information is obtained based on business requirements, includes: obtaining user-specified mapping information or default mapping information based on the business requirements. The acquired mapping information may also be specified mapping information or default mapping information acquired based on business requirements. This method acquires the mapping information in a more flexible way.
在一种可能的实现方式中,所述源数据的格式为JSON格式,所述目标数据的格式为CSV格式,或所述源数据的格式为CSV格式,所述目标数据的格式为JSON格式。In a possible implementation manner, the format of the source data is JSON format, the format of the target data is CSV format, or the format of the source data is CSV format, and the format of the target data is JSON format.
在一种可能的实现方式中,所述设备的类型包括网络管理系统、软件定义网络SDN控制器网元设备、终端和服务器中的至少一种。In a possible implementation manner, the type of the device includes at least one of a network management system, a software-defined network SDN controller network element device, a terminal, and a server.
此外,由于映射信息中标题列与属性路径相关联,该方法实现了面向对象数据格式与二维数据格式之间的转换,以及二维数据格式与面向对象数据格式之间的转换,该方法的数据结构的转换过程可逆。在面向对象数据格式—二维数据格式—面向对象数据格式的转换过程中,转换前后的面向对象数据格式一致。In addition, since the title column in the mapping information is associated with the attribute path, the method realizes the conversion between the object-oriented data format and the two-dimensional data format, and the conversion between the two-dimensional data format and the object-oriented data format. The transformation process of the data structure is reversible. In the conversion process of object-oriented data format-two-dimensional data format-object-oriented data format, the object-oriented data format before and after the conversion is the same.
第二方面,提供了一种数据格式的转换装置,包括:In a second aspect, a data format conversion device is provided, including:
获取模块,用于获得源数据和映射信息,所述映射信息为基于业务需求获取得到;an acquisition module for acquiring source data and mapping information, where the mapping information is acquired based on business requirements;
转换模块,用于基于所述映射信息和所述源数据得到目标数据,所述映射信息包括映射关系,所述映射关系包括所述源数据中的至少一个数据对象的第一位置信息与第二位置信息的对应关系;其中,所述第一位置信息为所述至少一个数据对象在所述源数据的数据结构中的位置,所述第二位置信息为所述至少一个数据对象在所述目标数据的数据结构中的位置,所述第二位置信息对应的位置中的数据对象包括所述第一位置信息对应的位置中的数据对象。A conversion module, configured to obtain target data based on the mapping information and the source data, where the mapping information includes a mapping relationship, and the mapping relationship includes first position information and second position information of at least one data object in the source data Corresponding relationship of location information; wherein, the first location information is the location of the at least one data object in the data structure of the source data, and the second location information is the at least one data object in the target The position in the data structure of the data, the data object in the position corresponding to the second position information includes the data object in the position corresponding to the first position information.
在一种可能的实现方式中,所述映射信息还包括信息标识以及转换模式信息;所述信息标识用于标识所述映射信息;所述转换模式信息用于指示转换模式、所述源数据的格式以及所述目标数据的格式,所述转换模式用于指示由所述源数据的格式转换到所述目标数据的格式。In a possible implementation manner, the mapping information further includes an information identifier and conversion mode information; the information identifier is used to identify the mapping information; the conversion mode information is used to indicate the conversion mode, the source data The format and the format of the target data, the conversion mode is used to indicate the conversion from the format of the source data to the format of the target data.
在一种可能的实现方式中,所述源数据的格式为面向对象数据格式,所述目标数据的格式为二维数据格式,所述映射信息用于将所述面向对象数据格式的源数据转换成所述二维数据格式的目标数据。In a possible implementation manner, the format of the source data is an object-oriented data format, the format of the target data is a two-dimensional data format, and the mapping information is used to convert the source data in the object-oriented data format. into the target data in the two-dimensional data format.
在一种可能的实现方式中,所述映射关系包括标题列以及与所述标题列对应的属性路径,所述第一位置信息包括所述属性路径,所述第二位置信息包括所述标题列;所述转换模块,用于基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据。In a possible implementation manner, the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the attribute path, and the second position information includes the title column ; The conversion module is configured to generate target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
在一种可能的实现方式中,所述转换模块,用于从所述映射关系中获取第一标题列,根据所述第一标题列生成第一标题数组,所述第一标题数组包括所述属性路径、数组计数值以及所述属性路径在所述第一标题数组下的数量值;基于所述数组计数值以及所述数量值确定所述属性路径不是所述第一标题数组下的最后一个属性路径,将所述第一标题数组对应的属性路径按照所述数组计数值从所述源数据中获取数据对象并输出为所述二维数据格式的目标数据的一行。In a possible implementation manner, the conversion module is configured to obtain a first title column from the mapping relationship, and generate a first title array according to the first title column, where the first title array includes the property path, array count value, and quantity value of the property path under the first title array; determining that the property path is not the last one under the first title array based on the array count value and the quantity value an attribute path, obtaining a data object from the source data according to the attribute path corresponding to the first title array according to the array count value and outputting it as a row of the target data in the two-dimensional data format.
在一种可能的实现方式中,所述源数据的格式为二维数据格式,所述目标数据的格式为面向对象数据格式,所述映射信息用于将所述二维数据格式的源数据转换成所述面向对象数据格式的目标数据。In a possible implementation manner, the format of the source data is a two-dimensional data format, the format of the target data is an object-oriented data format, and the mapping information is used to convert the source data of the two-dimensional data format. into the target data in the object-oriented data format.
在一种可能的实现方式中,所述映射关系包括标题列以及与所述标题列对应的属性路径,所述第一位置信息包括所述标题列,所述第二位置信息包括所述属性路径;所述转换模块,用于基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据。In a possible implementation manner, the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the title column, and the second position information includes the attribute path ; The conversion module is configured to generate target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
在一种可能的实现方式中,所述转换模块,用于从所述映射关系中获取第二标题列,根据所述第二标题列生成第二标题数组,所述第二标题数组包括属性路径以及数组计数值;响应于所述源数据的当前行小于总行数,将所述源数据中当前行指示的数据对象按照所述属性路径和所述数组计数值指定的位置填入所述目标数据的数据结构中。In a possible implementation manner, the conversion module is configured to obtain a second title column from the mapping relationship, and generate a second title array according to the second title column, where the second title array includes an attribute path and an array count value; in response to the current row of the source data being less than the total number of rows, the data object indicated by the current row in the source data is filled into the target data according to the location specified by the attribute path and the array count value in the data structure.
在一种可能的实现方式中,所述业务需求包括用于获取所述映射信息的关联信息;所述 获取模块,用于基于所述业务需求中的所述关联信息获取所述映射信息。In a possible implementation manner, the business requirement includes association information for obtaining the mapping information; the obtaining module is configured to obtain the mapping information based on the association information in the business requirement.
在一种可能的实现方式中,所述关联信息包括所述映射信息的信息标识。In a possible implementation manner, the association information includes an information identifier of the mapping information.
在一种可能的实现方式中,所述获取模块,用于基于所述业务需求获取用户指定的映射信息或者默认的映射信息。In a possible implementation manner, the obtaining module is configured to obtain user-specified mapping information or default mapping information based on the business requirement.
在一种可能的实现方式中,所述源数据的格式为JSON格式,所述目标数据的格式为CSV格式,或所述源数据的格式为CSV格式,所述目标数据的格式为JSON格式。In a possible implementation manner, the format of the source data is JSON format, the format of the target data is CSV format, or the format of the source data is CSV format, and the format of the target data is JSON format.
在一种可能的实现方式中,所述设备的类型包括网络管理系统、SDN控制器网元设备、终端和服务器中的至少一种。In a possible implementation manner, the type of the device includes at least one of a network management system, an SDN controller network element device, a terminal, and a server.
第三方面,提供了一种数据格式的转换设备,包括处理器及计算机程序,处理器执行计算机程序时,以使数据格式的转换设备实现如上第一方面任一的数据格式的转换方法。In a third aspect, a data format conversion device is provided, including a processor and a computer program. When the processor executes the computer program, the data format conversion device implements the data format conversion method according to any one of the first aspect above.
第四方面,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被计算机执行时,实现如上第一方面任一的数据格式的转换方法。In a fourth aspect, a computer-readable storage medium is provided on which a computer program is stored, and when the computer program is executed by a computer, the data format conversion method according to any one of the first aspect above is implemented.
第五方面,提供了一种计算机程序产品,包括计算机程序,计算机程序被计算机执行时,实现如上第一方面任一的数据格式的转换方法。In a fifth aspect, a computer program product is provided, including a computer program. When the computer program is executed by a computer, the data format conversion method according to any one of the above first aspect is implemented.
第六方面,提供了一种通信装置,该装置包括:收发器、存储器和处理器。其中,该收发器、该存储器和该处理器通过内部连接通路互相通信,该存储器用于存储指令,该处理器用于执行该存储器存储的指令,以控制收发器接收信号,并控制收发器发送信号,并且当该处理器执行该存储器存储的指令时,使得该处理器执行第一方面或第一方面的任一种可能的实施方式中的方法。In a sixth aspect, a communication apparatus is provided, the apparatus comprising: a transceiver, a memory and a processor. The transceiver, the memory and the processor communicate with each other through an internal connection path, the memory is used for storing instructions, and the processor is used for executing the instructions stored in the memory to control the transceiver to receive signals and control the transceiver to send signals , and when the processor executes the instructions stored in the memory, the processor is caused to execute the method in the first aspect or any possible implementation manner of the first aspect.
可选地,处理器为一个或多个,存储器为一个或多个。Optionally, there are one or more processors and one or more memories.
可选地,存储器可以与处理器集成在一起,或者存储器与处理器分离设置。Alternatively, the memory may be integrated with the processor, or the memory may be provided separately from the processor.
在具体实现过程中,存储器可以为存储器,例如,只读存储器(read only memory,ROM),其可以与处理器集成在同一块芯片上,也可以分别设置在不同的芯片上,本申请对存储器的类型以及存储器与处理器的设置方式不做限定。In the specific implementation process, the memory can be a memory, for example, a read only memory (ROM), which can be integrated with the processor on the same chip, or can be respectively set on different chips. There are no restrictions on the type of memory and how the processor is set up.
第七方面,提供了一种芯片,包括处理器,用于从存储器中调用并运行存储器中存储的指令,使得安装有芯片的通信设备执行上述第一方面或第一方面的任一种可能的实施方式中的方法。In a seventh aspect, a chip is provided, including a processor for invoking and executing instructions stored in the memory from a memory, so that a communication device on which the chip is installed executes the first aspect or any of the first aspects possible. method in an embodiment.
第八方面,提供了另一种芯片,包括:输入接口、输出接口、处理器和存储器,输入接口、输出接口、处理器以及存储器之间通过内部连接通路相连,处理器用于执行存储器中的代码,当代码被执行时,处理器用于执行上述第一方面或第一方面的任一种可能的实施方式中的方法。In an eighth aspect, another chip is provided, comprising: an input interface, an output interface, a processor, and a memory, the input interface, the output interface, the processor, and the memory are connected through an internal connection path, and the processor is used to execute codes in the memory , when the code is executed, the processor is configured to execute the method in the first aspect or any possible implementation manner of the first aspect.
附图说明Description of drawings
图1是本申请实施例提供的一种数据格式的转换方法的实施环境示意图;1 is a schematic diagram of an implementation environment of a data format conversion method provided by an embodiment of the present application;
图2是本申请实施例提供的一种数据格式的转换方法的流程图;2 is a flowchart of a method for converting a data format provided by an embodiment of the present application;
图3是本申请实施例提供的一种业务规划信息的示意图;3 is a schematic diagram of service planning information provided by an embodiment of the present application;
图4是本申请实施例提供的一种数据格式的转换交互过程示意图;4 is a schematic diagram of a conversion interaction process of a data format provided by an embodiment of the present application;
图5是本申请实施例提供的一种面向对象数据的示意图;5 is a schematic diagram of an object-oriented data provided by an embodiment of the present application;
图6是本申请实施例提供的一种二维数据的示意图;6 is a schematic diagram of a two-dimensional data provided by an embodiment of the present application;
图7是本申请实施例提供的一种映射信息的示意图;7 is a schematic diagram of a mapping information provided by an embodiment of the present application;
图8是本申请实施例提供的另一种映射信息的示意图;8 is a schematic diagram of another mapping information provided by an embodiment of the present application;
图9是本申请实施例提供的一种目标数据的结构示意图;9 is a schematic structural diagram of a target data provided by an embodiment of the present application;
图10是本申请实施例提供的另一种目标数据的结构示意图;10 is a schematic structural diagram of another target data provided by an embodiment of the present application;
图11是本申请实施例提供的一种数据格式的转换装置的结构示意图;11 is a schematic structural diagram of a data format conversion device provided by an embodiment of the present application;
图12是本申请实施例提供的一种数据格式的转换设备的结构示意图;12 is a schematic structural diagram of a data format conversion device provided by an embodiment of the present application;
图13是本申请实施例提供的另一种数据格式的转换设备的结构示意图。FIG. 13 is a schematic structural diagram of another data format conversion device provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
本申请实施例提供了一种数据格式的转换方法,以将该方法应用于面向对象数据格式与二维数据格式之间的转换为例,其中,面向对象数据格式包括但不限于javascript对象表示法(javascript object notation,JSON)、可扩展标记语言(extensible markup language,xml),二维数据格式包括但不限于逗号分隔值(comma separated values,CSV)、EXCEL。以JSON与CSV之间的数据格式的转换为例,该方法的实施环境可如图1中的JSON和CSV转换接口架构图所示。An embodiment of the present application provides a method for converting a data format, taking the method applied to the conversion between an object-oriented data format and a two-dimensional data format as an example, wherein the object-oriented data format includes but is not limited to javascript object notation (javascript object notation, JSON), extensible markup language (extensible markup language, xml), two-dimensional data formats including but not limited to comma separated values (comma separated values, CSV), EXCEL. Taking the data format conversion between JSON and CSV as an example, the implementation environment of this method can be shown in the JSON and CSV conversion interface architecture diagram in FIG. 1 .
图1中,业务支持系统(operation support system,OSS)为运营商运维支撑系统,包括业务规划系统和资源系统。业务规划系统用于规划业务需求,例如按照二维数据格式输出业务需求等数据文件,资源系统用于收集网络上的资源信息,例如按照二维数据格式接收业务需求等数据文件。业务应用(application,APP)与OSS进行交互,接收OSS输入的业务需求的二维数据格式文件,并向OSS输出二维数据格式文件。In Figure 1, an operation support system (OSS) is an operator's operation and maintenance support system, including a business planning system and a resource system. The business planning system is used to plan business requirements, such as outputting data files such as business requirements in a two-dimensional data format, and the resource system is used to collect resource information on the network, such as receiving data files such as business requirements in a two-dimensional data format. The business application (application, APP) interacts with the OSS, receives the two-dimensional data format file of business requirements input by the OSS, and outputs the two-dimensional data format file to the OSS.
业务APP在应用过程中,包括业务创建流程和业务导出流程。其中,业务创建流程用于导入二维数据格式的文件,例如,用户向业务规划系统输入订单需求,业务规划系统向业务APP输入业务需求的二维数据格式的文件,使得业务APP导入二维数据格式的文件。或者,用户直接操作业务APP,向业务APP导入二维数据格式的文件。该业务创建流程还用于调用将二维数据格式和面向对象数据格式进行转换的转换模型,也称为转换器,由转换器读取对应的映射信息,将二维数据格式解析为面向对象数据格式,例如通过业务接口调用二维数据格式与面向对象数据格式的转换器解析二维数据格式的文件,通过二维数据格式转面向对象数据格式的映射信息将二维数据格式的文件转换成JSON格式的文件。In the application process of the business APP, it includes the business creation process and the business export process. Among them, the business creation process is used to import files in two-dimensional data format. For example, a user inputs order requirements to the business planning system, and the business planning system inputs files in two-dimensional data format of business requirements to the business APP, so that the business APP imports the two-dimensional data. format file. Alternatively, the user directly operates the business APP, and imports a file in a two-dimensional data format into the business APP. The business creation process is also used to invoke a conversion model that converts the two-dimensional data format and the object-oriented data format, also called a converter. The converter reads the corresponding mapping information and parses the two-dimensional data format into object-oriented data. Format, for example, calling the converter of the two-dimensional data format and the object-oriented data format through the business interface to parse the two-dimensional data format file, and converting the two-dimensional data format file into JSON through the mapping information of the two-dimensional data format to the object-oriented data format format file.
业务导出流程用于输出面向对象格式的数据,例如JSON数据,调用转换器,将面向对象格式的数据转换为二维数据格式,并传递给资源系统。其中,二维数据格式和面向对象数据格式的转换器用于接收面向对象数据格式文件,按照映射信息实现可控的面向对象数据格式文件和二维数据格式文件的互相转换。在图1中,映射信息用于控制转换的内容,其中,该映射信息用于将面向对象数据格式的源数据转换成二维数据格式的目标数据或者用于将二维数据格式的源数据转换成面向对象数据格式的目标数据。The business export process is used to output data in object-oriented format, such as JSON data, call the converter, convert the data in object-oriented format into two-dimensional data format, and pass it to the resource system. The converter of the two-dimensional data format and the object-oriented data format is used to receive the object-oriented data format file, and realize the controllable mutual conversion between the object-oriented data format file and the two-dimensional data format file according to the mapping information. In FIG. 1, mapping information is used to control the content of conversion, wherein the mapping information is used to convert source data in object-oriented data format into target data in two-dimensional data format or for converting source data in two-dimensional data format target data in an object-oriented data format.
接下来,以图2所示的方法流程为例,对本申请实施例提供的数据格式的转换过程进行解释说明。示例性地,本申请实施例提供的方法可应用于图1所示的实施环境中,包括但不限于步骤201和步骤202。其中,该方法由数据格式的转换设备执行,以下简称为设备,该 设备的类型包括但不限于网络管理系统、软件定义网络(software defined network,SDN)控制器网元设备、终端和服务器中的至少一种。Next, the method flow shown in FIG. 2 is taken as an example to explain the conversion process of the data format provided by the embodiment of the present application. Exemplarily, the methods provided in the embodiments of the present application may be applied to the implementation environment shown in FIG. 1 , including but not limited to step 201 and step 202 . Wherein, the method is performed by a data format conversion device, hereinafter referred to as a device, and the types of the device include but are not limited to network management systems, software defined networks (software defined network, SDN) controller network element devices, terminals and servers. at least one.
步骤201,设备获得源数据和映射信息,映射信息为基于业务需求获取得到。In step 201, the device obtains source data and mapping information, and the mapping information is obtained based on business requirements.
其中,源数据为需要转换数据格式的数据。示例性地,源数据和业务需求可以是用户输入的,本申请实施例不对源数据和业务需求的获取方式进行限定。The source data is the data that needs to be converted into a data format. Exemplarily, the source data and the service requirements may be input by the user, and the embodiment of the present application does not limit the acquisition method of the source data and the service requirements.
在一种可能的实现方式中,在执行本申请实施例提供的方法之前,可预先配置多个映射信息,该多个映射信息对应于不同的业务需求。示例性地,业务需求可以包括业务规划信息。例如,业务规划信息如图3所示,该业务规划信息包括业务名称、业务类型、源站点、源网元、源端口、宿站点、宿网元、宿端口、实际带宽、客户名称和业务备注。其中,业务需求包括但不限于:业务名称、业务类型、源网元、源端口、宿网元和业务备注。则根据该业务需求,可以配置与该业务需求对应的映射信息。示例性地,多个映射信息可以由用户预先配置,进而设备能够基于该多个映射信息执行本申请实施例提供的方法。例如,如图4所示的数据格式的转换交互过程,用户配置多个映射信息,指定源数据和业务需求,将该多个映射信息、源数据和业务需求输入数据格式的转换系统中,该数据格式的转换系统包括该设备;该设备基于映射信息、源数据和业务需求执行本申请实施例提供的方法。可选地,该备中存储有转换模型,该转换模型用于基于映射信息和源数据得到目标数据。其中,该转换模型的输入包括源数据和映射信息,该转换模型的输出包括数据格式转换后的目标数据。In a possible implementation manner, before executing the method provided by the embodiment of the present application, multiple mapping information may be pre-configured, and the multiple mapping information corresponds to different service requirements. Illustratively, business requirements may include business planning information. For example, the service planning information is shown in Figure 3. The service planning information includes service name, service type, source site, source network element, source port, sink site, sink network element, sink port, actual bandwidth, customer name and service remarks . The service requirements include but are not limited to: service name, service type, source network element, source port, sink network element, and service remarks. Then, according to the business requirement, mapping information corresponding to the business requirement can be configured. Exemplarily, multiple pieces of mapping information may be pre-configured by a user, and then the device can perform the method provided in this embodiment of the present application based on the multiple pieces of mapping information. For example, in the data format conversion interaction process shown in Figure 4, the user configures multiple mapping information, specifies source data and business requirements, and inputs the multiple mapping information, source data and business requirements into the data format conversion system, the The data format conversion system includes the device; the device executes the method provided by the embodiment of the present application based on the mapping information, source data and business requirements. Optionally, a conversion model is stored in the device, and the conversion model is used to obtain the target data based on the mapping information and the source data. Wherein, the input of the conversion model includes source data and mapping information, and the output of the conversion model includes target data after data format conversion.
示例性地,用户将该多个映射信息、源数据和业务需求输入数据格式的转换系统中时,可以直接输入至该设备,也可以输入该数据格式的转换系统中能够与该设备进行通信的其他设备。因此,该设备能够接收其他设备发送的映射信息、源数据和业务需求,进而基于映射信息、源数据和业务需求执行本申请实施例提供的方法。Exemplarily, when the user inputs the plurality of mapping information, source data and business requirements into the conversion system of the data format, he can directly input them into the device, or he can input the data that can communicate with the device in the conversion system of the data format. other devices. Therefore, the device can receive mapping information, source data, and service requirements sent by other devices, and then execute the methods provided by the embodiments of the present application based on the mapping information, source data, and service requirements.
在一种可能的实现方式中,业务需求包括但不限于用于获取映射信息的关联信息。示例性地,映射信息是基于业务需求中的关联信息获取得到的。也就是说,获得映射信息,映射信息为基于业务需求获取得到,包括:基于业务需求中的关联信息获取映射信息。可选地,关联信息包括映射信息的信息标识。根据信息标识的不同类型,基于业务需求中的关联信息获取映射信息包括但不限于如下两种方式。In a possible implementation manner, the business requirements include, but are not limited to, association information for acquiring mapping information. Exemplarily, the mapping information is obtained based on the associated information in the business requirement. That is to say, to obtain the mapping information, the mapping information is obtained based on the business requirement, including: obtaining the mapping information based on the associated information in the business requirement. Optionally, the associated information includes an information identifier of the mapping information. According to different types of information identifiers, the acquisition of mapping information based on the associated information in business requirements includes but is not limited to the following two ways.
方式一、基于业务需求中的映射信息的名称获取映射信息。Manner 1: Obtain the mapping information based on the name of the mapping information in the business requirement.
其中,在信息标识的类型为名称时,采用方式一获取映射信息。例如,关联信息包括的映射信息的名称为ABC,则基于该ABC从预先配置的多个映射信息中获取名称为ABC的映射信息。Wherein, when the type of the information identifier is a name, the first method is used to obtain the mapping information. For example, if the name of the mapping information included in the associated information is ABC, based on the ABC, the mapping information with the name ABC is acquired from a plurality of pre-configured mapping information.
方式二、基于业务需求中的映射信息的编号获取映射信息。Manner 2: Obtain the mapping information based on the number of the mapping information in the business requirement.
其中,在信息标识的类型为编号时,采用方式二获取映射信息。在一种可能的实现方式中,对应于预先配置的多个映射信息,用户预先配置有映射信息列表,该映射信息列表包括预先配置的多个映射信息,以及每个映射信息对应的编号。例如,关联信息包括的映射信息的编号为1,则基于该编号获取映射信息列表中的第一个映射信息。Wherein, when the type of the information identifier is a serial number, the second method is used to obtain the mapping information. In a possible implementation manner, corresponding to the multiple preconfigured mapping information, the user is preconfigured with a mapping information list, where the mapping information list includes the multiple preconfigured mapping information and a number corresponding to each mapping information. For example, if the number of the mapping information included in the associated information is 1, the first mapping information in the mapping information list is acquired based on the number.
在一种可能的实现方式中,映射信息是基于业务需求获取得到的用户指定的映射信息或者默认的映射信息。也就是说,获得映射信息,映射信息为基于业务需求获取得到,包括:基于业务需求获取用户指定的映射信息或者默认的映射信息。例如,对于任一由数据格式1转换为数据格式2的业务需求,获取映射信息1;对于任一由数据格式2转换为数据格式1的业 务需求,获取映射信息2。In a possible implementation manner, the mapping information is user-specified mapping information or default mapping information obtained based on business requirements. That is to say, the mapping information is obtained, and the mapping information is obtained based on business requirements, including: obtaining user-specified mapping information or default mapping information based on business requirements. For example, for any business requirement converted from data format 1 to data format 2, obtain mapping information 1; for any business requirement converted from data format 2 to data format 1, obtain mapping information 2.
示例性地,如前文提到的,映射信息包括信息标识,该信息标识用于标识映射信息。其次,该映射信息还包括转换模式信息,该转换模式信息用于指示转换模式(transMode)、源数据的格式(objectType)以及目标数据的格式(fileType),该转换模式用于指示由源数据的格式转换到目标数据的格式。Exemplarily, as mentioned above, the mapping information includes an information identifier, and the information identifier is used to identify the mapping information. Secondly, the mapping information also includes conversion mode information, where the conversion mode information is used to indicate the conversion mode (transMode), the format of the source data (objectType), and the format of the target data (fileType), and the conversion mode is used to indicate the conversion mode of the source data. format to convert to the format of the target data.
步骤202,设备基于映射信息和源数据得到目标数据。 Step 202, the device obtains target data based on the mapping information and the source data.
在一种可能的实现方式中,设备基于映射信息对源数据进行数据格式转换,得到目标数据。示例性地,该映射信息包括映射关系,该映射关系包括源数据中的至少一个数据对象的第一位置信息与第二位置信息的对应关系。其中,第一位置信息为至少一个数据对象在源数据的数据结构中的位置,第二位置信息为至少一个数据对象在目标数据的数据结构中的位置,第二位置信息对应的位置中的数据对象包括第一位置信息对应的位置中的数据对象。通过该映射关系,能够实现同一数据对象在源数据和目标数据的不同数据结构中的位置映射,从而实现该同一数据对象在源数据的数据格式与目标数据的数据格式之间进行转换。In a possible implementation manner, the device performs data format conversion on the source data based on the mapping information to obtain the target data. Exemplarily, the mapping information includes a mapping relationship, and the mapping relationship includes a corresponding relationship between the first location information and the second location information of at least one data object in the source data. The first location information is the location of at least one data object in the data structure of the source data, the second location information is the location of the at least one data object in the data structure of the target data, and the data in the location corresponding to the second location information The object includes a data object in a location corresponding to the first location information. Through the mapping relationship, the position mapping of the same data object in different data structures of the source data and the target data can be realized, thereby realizing the conversion of the same data object between the data format of the source data and the data format of the target data.
示例性地,源数据的格式为JSON格式,目标数据的格式为CSV格式,或源数据的格式为CSV格式,目标数据的格式为JSON格式。需要说明的是,源数据的数据格式和目标数据的数据格式也可以为需要进行转换的其他数据格式,本申请实施例不加以限定。示例性地,第一位置信息的表示方式与源数据的数据格式相对应,第二位置信息的表示方式与目标数据的数据格式相对应。本申请实施例以与面向对象数据对应的位置信息的表示方式为属性路径,与二维数据对应的位置信息的表示方式为标题列为例进行说明。例如,源数据为图5示出的面向对象数据,目标数据为图6示出的二维数据。对于数据对象“branch1”,该数据对象的第一位置信息为Root[index=0]Branch,该数据对象的第二位置信息为标题列为根节点。又例如,源数据为图6示出的二维数据,目标数据为图5示出的面向对象数据。对于数据对象“branch1”,该数据对象的第一位置信息为标题列为根节点,该数据对象的第二位置信息为Root[index=0]Branch。对于数据格式是面向对象数据或二维数据以外的其他数据格式,可以确定与该数据格式对应的位置信息的表示形式,采用本申请实施例提供的方法进行格式转换,在此不再一一赘述。Exemplarily, the format of the source data is JSON format and the format of target data is CSV format, or the format of source data is CSV format and the format of target data is JSON format. It should be noted that, the data format of the source data and the data format of the target data may also be other data formats that need to be converted, which are not limited in this embodiment of the present application. Exemplarily, the representation of the first location information corresponds to the data format of the source data, and the representation of the second location information corresponds to the data format of the target data. The embodiments of the present application are described by taking the representation of the location information corresponding to the object-oriented data as an attribute path, and the representation of the location information corresponding to the two-dimensional data as a title column as an example. For example, the source data is the object-oriented data shown in FIG. 5 , and the target data is the two-dimensional data shown in FIG. 6 . For the data object "branch1", the first position information of the data object is Root[index=0]Branch, and the second position information of the data object is the root node of the title column. For another example, the source data is the two-dimensional data shown in FIG. 6 , and the target data is the object-oriented data shown in FIG. 5 . For the data object "branch1", the first position information of the data object is the root node of the title column, and the second position information of the data object is Root[index=0]Branch. For data formats other than object-oriented data or two-dimensional data, the representation form of the location information corresponding to the data format can be determined, and the format conversion is performed by using the method provided in the embodiment of the present application, which is not repeated here. .
可选地,根据源数据的格式不同,基于映射信息和源数据得到目标数据,包括但不限于如下两种情况。Optionally, according to different formats of the source data, the target data is obtained based on the mapping information and the source data, including but not limited to the following two cases.
情况一,源数据的格式为面向对象数据格式,目标数据的格式为二维数据格式,转换模式用于指示由面向对象数据格式转换到二维数据格式,映射信息用于将面向对象数据格式的源数据转换成二维数据格式的目标数据。In case 1, the format of the source data is the object-oriented data format, the format of the target data is the two-dimensional data format, the conversion mode is used to indicate the conversion from the object-oriented data format to the two-dimensional data format, and the mapping information is used to convert the object-oriented data format into the two-dimensional data format. The source data is converted into target data in a two-dimensional data format.
针对情况一,映射关系包括标题列以及与标题列对应的属性路径,第一位置信息包括属性路径,第二位置信息包括标题列;设备基于映射信息和源数据得到目标数据,包括:设备基于映射关系中的标题列、标题列对应的属性路径和源数据生成目标数据。For case 1, the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes an attribute path, and the second position information includes a title column; the device obtains the target data based on the mapping information and the source data, including: the device obtains the target data based on the mapping information and the source data. The title column in the relationship, the attribute path corresponding to the title column, and the source data generate the target data.
示例性地,设备基于映射关系中的标题列、标题列对应的属性路径和源数据生成目标数据,包括:设备从映射关系中获取第一标题列,根据第一标题列生成第一标题数组,第一标题数组包括属性路径、数组计数值(index)以及属性路径在第一标题数组下的数量值(max);基于数组计数值以及数量值确定属性路径不是第一标题数组下的最后一个属性路径,将第一标题数组对应的属性路径按照数组计数值从源数据中获取数据对象并输出为二维数据格式的 目标数据的一行。示例性地,若第一标题数组中的属性路径的数量为1,则该属性路径的数组计数值(index)为0,该属性路径在第一标题数组下的数量值(max)为1。若第一标题数组中的属性路径的数量为2,则其中一个属性路径的数组计数值(index)为0,另一个属性路径的数组计数值(index)为1,这两个属性路径在第一标题数组下的数量值(max)为2。Exemplarily, the device generates the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data, including: the device obtains the first title column from the mapping relationship, and generates the first title array according to the first title column, The first title array includes the attribute path, the array count value (index), and the number value (max) of the attribute path under the first title array; it is determined based on the array count value and the number value that the attribute path is not the last attribute under the first title array path, obtains the data object from the source data according to the attribute path corresponding to the first title array according to the array count value, and outputs it as a row of the target data in the two-dimensional data format. Exemplarily, if the number of attribute paths in the first title array is 1, the array count value (index) of the attribute path is 0, and the number value (max) of the attribute path under the first title array is 1. If the number of attribute paths in the first title array is 2, the array count value (index) of one attribute path is 0, and the array count value (index) of the other attribute path is 1. The number value (max) under a title array is 2.
例如,如图7所示的映射信息中,映射信息的信息标识为映射信息1,该映射信息用于将面向对象数据格式的源数据转换成二维数据格式的目标数据。其中,该映射信息包括的转换模式信息指示了转换模式为由面向对象数据格式转换到二维数据格式(JSON-to-CSV),源数据的格式为JSON,目标数据的格式为CSV。标题列(title)包括根节点、网络分支、网络子分支和其他分支信息;根节点对应的属性路径(mappingScript)包括$Root[*].Branch,网络分支对应的属性路径包括$Root[*].NstBranch[*].Branch,网络子分支对应的属性路径包括$Root[*].NstBranch[*].Twig,其他分支信息对应的属性路径包括$Root[*].OthNstBranch[*]。For example, in the mapping information shown in FIG. 7 , the information of the mapping information is identified as mapping information 1, and the mapping information is used to convert the source data in the object-oriented data format into the target data in the two-dimensional data format. The conversion mode information included in the mapping information indicates that the conversion mode is from an object-oriented data format to a two-dimensional data format (JSON-to-CSV), the format of the source data is JSON, and the format of the target data is CSV. The title column (title) includes the root node, network branch, network sub-branch and other branch information; the attribute path (mappingScript) corresponding to the root node includes $Root[*].Branch, and the attribute path corresponding to the network branch includes $Root[*] .NstBranch[*].Branch, the attribute path corresponding to the network sub-branch includes $Root[*].NstBranch[*].Twig, and the attribute path corresponding to other branch information includes $Root[*].OthNstBranch[*].
则调用转换模型从映射关系获取的第一标题列包括:根节点、网络分支、网络子分支和其他分支信息。根据该第一标题列生成的第一标题数组包括:[$Root[index,max].Branch,$Root[index,max].NstBranch[index,max].Branch,$Root[index,max].NstBranch[index,max].Twig,$Root[index,max].OthNstBranch[index,max]]。其中,$Root[index,max].Branch,$Root[index,max].NstBranch[index,max].Branch,$Root[index,max].NstBranch[index,max].Twig和$Root[index,max].OthNstBranch[index,max]为该第一标题数组中的数组节点。示例性地,若在第一标题数组下包括一个该属性路径,该属性路径在第一标题数组中的数量为1,则第一标题数组中可以不包括数量值。也即,若属性路径在第一标题数组中的数量为1,第一标题数组包括属性路径和数组计数值。Then, the first title column obtained from the mapping relationship by calling the transformation model includes: root node, network branch, network sub-branch and other branch information. The first title array generated according to the first title column includes: [$Root[index, max].Branch, $Root[index, max].NstBranch[index, max].Branch, $Root[index, max]. NstBranch[index, max].Twig, $Root[index, max].OthNstBranch[index, max]]. Where, $Root[index, max].Branch, $Root[index, max].NstBranch[index, max].Branch, $Root[index, max].NstBranch[index, max].Twig and $Root[index , max].OthNstBranch[index, max] is the array node in the first title array. Exemplarily, if one attribute path is included under the first title array, and the number of the attribute path in the first title array is 1, the first title array may not include the quantity value. That is, if the number of property paths in the first header array is 1, the first header array includes property paths and an array count value.
例如,源数据为图5示出的面向对象数据,属性路径$Root[*].Branch在第一标题数组下的数量值为2,也即,max等于2。示例性地,数组计数值初始为0,也即index=0。因此,数组节点$Root[index,max].Branch为$Root[index=0,max=2].Branch。因此,第一标题数组包括:[$Root[index=0,max=2].Branch,$Root[index=0,max=2].NstBranch[index=0,max=2].Branch,$Root[index=0,max=2].NstBranch[index=0,max=2].Twig,$Root[index=0,max=2].OthNstBranch[index=0,max=0]]。在数组计数值初始为0时,响应于数组计数值小于max-1,则该属性路径不是第一标题数组下的最后一个属性路径。将第一标题数组对应的属性路径按照数组计数值从源数据中获取数据对象并输出为二维数据格式的目标数据的一行,也即,输出的目标数据的第一行包括:branch1,nbranch1.1,twig1.1。其中,branch1为对应数组节点$Root[index=0,max=2].Branch获取的数据对象,也即,branch1为将属性路径$Root[*].Branch按照index=0从源数据中获取的数据对象;nbranch1.1为对应数组节点$Root[index=0,max=2].NstBranch[index=0,max=2].Branch获取的数据对象,twig1.1为对应数组节点$Root[index=0,max=2].NstBranch[index=0,max=2].Twig获取的数据对象。由于源数据中不包括数组节点$Root[index=0,max=2].OthNstBranch[index=0,max=0]对应的数据对象,因此,目标数据的第一行不包括与其他分支信息对应的数据对象。示例性地,输出的二维数据格式的目标数据如图6所示。For example, the source data is the object-oriented data shown in FIG. 5 , and the value of the property path $Root[*].Branch under the first title array is 2, that is, max is equal to 2. Exemplarily, the array count value is initially 0, that is, index=0. Therefore, the array node $Root[index, max].Branch is $Root[index=0, max=2].Branch. Therefore, the first header array includes: [$Root[index=0, max=2].Branch, $Root[index=0, max=2].NstBranch[index=0, max=2].Branch, $Root [index=0, max=2].NstBranch[index=0, max=2].Twig, $Root[index=0, max=2].OthNstBranch[index=0, max=0]]. When the array count value is initially 0, in response to the array count value being less than max-1, the property path is not the last property path under the first title array. Obtain the data object from the source data according to the array count value corresponding to the attribute path of the first title array and output it as a row of target data in two-dimensional data format, that is, the first row of the output target data includes: branch1, nbranch1. 1. twig1.1. Among them, branch1 is the data object obtained by the corresponding array node $Root[index=0, max=2].Branch, that is, branch1 is the attribute path $Root[*].Branch obtained from the source data according to index=0 Data object; nbranch1.1 is the data object obtained by the corresponding array node $Root[index=0, max=2].NstBranch[index=0, max=2].Branch, twig1.1 is the corresponding array node $Root[index] =0,max=2].NstBranch[index=0,max=2].Twig fetched data object. Since the source data does not include the data objects corresponding to the array nodes $Root[index=0, max=2].OthNstBranch[index=0, max=0], the first row of the target data does not include other branch information corresponding to data object. Exemplarily, the output target data in a two-dimensional data format is shown in FIG. 6 .
在一种可能的实现方式中,将第一标题数组对应的属性路径按照数组计数值从源数据中获取数据对象并输出为二维数据格式的目标数据的一行之后,将数组节点中最后一个满足数组计数值小于max-1的数组计数值加1,重置该数组计数值后的其他数组计数值和与数组计数 值对应的数量值。例如,输出第一行目标数据后,该第一标题数组包括:[$Root[index=0,max=2].Branch,$Root[index=0,max=2].NstBranch[index=1,max=2].Branch,$Root[index=0,max=2].NstBranch[index=1,max=2].Twig,$Root[index=0,max=2].OthNstBranch[index=0,max=0]]。则输出的目标数据的第二行包括:nbranch1.2,twig1.2。其中,nbranch1.2为对应数组节点$Root[index=0,max=2].NstBranch[index=1,max=2].Branch获取的数据对象,twig1.2为对应数组节点$Root[index=0,max=2].NstBranch[index=1,max=2].Twig获取的数据对象。由于数组节点$Root[index=0,max=2].Branch对应的branch1已在第一行输出,该branch1不再输出。由于源数据中不包括数组节点$Root[index=0,max=2].OthNstBranch[index=0,max=0]对应的数据对象,因此,目标数据的第二行不包括与其他分支信息对应的数据对象。In a possible implementation manner, after the attribute path corresponding to the first title array is obtained from the source data according to the array count value, the data object is outputted as a row of target data in two-dimensional data format, and the last attribute path in the array node that satisfies the If the array count value is less than max-1, add 1 to the array count value, reset the other array count value and the quantity value corresponding to the array count value. For example, after outputting the first line of target data, the first title array includes: [$Root[index=0, max=2].Branch, $Root[index=0, max=2].NstBranch[index=1, max=2].Branch, $Root[index=0, max=2].NstBranch[index=1, max=2].Twig, $Root[index=0, max=2].OthNstBranch[index=0, max=0]]. Then the second line of the output target data includes: nbranch1.2, twig1.2. Among them, nbranch1.2 is the data object obtained by the corresponding array node $Root[index=0, max=2].NstBranch[index=1, max=2].Branch, and twig1.2 is the corresponding array node $Root[index= 0, max=2].NstBranch[index=1,max=2].Data object acquired by Twig. Since the branch1 corresponding to the array node $Root[index=0, max=2].Branch has been output in the first line, the branch1 is no longer output. Since the source data does not include the data objects corresponding to the array nodes $Root[index=0, max=2].OthNstBranch[index=0, max=0], the second row of the target data does not include other branch information corresponding to data object.
又例如,输出第二行目标数据后,该第一标题数组包括:[$Root[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=0,max=2].Branch,$Root[index=1,max=2].NstBranch[index=0,max=2].Twig,$Root[index=1,max=2].OthNstBranch[index=0,max=3]]。则输出的目标数据的第三行包括:branch2,nbranch2.1,twig2.1,1。其中,branch2为对应数组节点$Root[index=1,max=2].Branch获取的数据对象,nbranch2.1为对应数组节点$Root[index=1,max=2].NstBranch[index=0,max=2].Branch获取的数据对象,twig2.1为对应数组节点$Root[index=1,max=2].NstBranch[index=0,max=2].Twig获取的数据对象,1为对应数组节点$Root[index=1,max=2].OthNstBranch[index=0,max=3]获取的数据对象。For another example, after outputting the second line of target data, the first title array includes: [$Root[index=1, max=2].Branch, $Root[index=1, max=2].NstBranch[index=0 , max=2].Branch, $Root[index=1, max=2].NstBranch[index=0, max=2].Twig, $Root[index=1, max=2].OthNstBranch[index=0 , max=3]]. Then the third line of the output target data includes: branch2, nbranch2.1, twig2.1, 1. Among them, branch2 is the data object obtained by the corresponding array node $Root[index=1, max=2].Branch, and nbranch2.1 is the corresponding array node $Root[index=1, max=2].NstBranch[index=0, The data object obtained by max=2].Branch, twig2.1 is the data object obtained by the corresponding array node $Root[index=1, max=2].NstBranch[index=0, max=2].Twig, 1 is the corresponding The data object obtained by the array node $Root[index=1, max=2].OthNstBranch[index=0, max=3].
又例如,输出第三行目标数据后,该第一标题数组包括:[$Root[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=1,max=2].Twig,$Root[index=1,max=2].OthNstBranch[index=1,max=3]]。则输出的目标数据的第四行包括:nbranch2.2,twig2.2,2。其中,nbranch2.2为对应数组节点$Root[index=1,max=2].NstBranch[index=1,max=2].Branch获取的数据对象,twig2.2为对应数组节点$Root[index=1,max=2].NstBranch[index=1,max=2].Twig获取的数据对象,2为对应数组节点$Root[index=1,max=2].OthNstBranch[index=1,max=3]获取的数据对象。For another example, after outputting the third line of target data, the first title array includes: [$Root[index=1, max=2].Branch, $Root[index=1, max=2].NstBranch[index=1 , max=2].Branch, $Root[index=1, max=2].NstBranch[index=1, max=2].Twig, $Root[index=1, max=2].OthNstBranch[index=1 , max=3]]. Then the fourth line of the output target data includes: nbranch2.2, twig2.2, 2. Among them, nbranch2.2 is the data object obtained by the corresponding array node $Root[index=1, max=2].NstBranch[index=1, max=2].Branch, and twig2.2 is the corresponding array node $Root[index= 1, max=2].NstBranch[index=1, max=2]. The data object obtained by Twig, 2 is the corresponding array node $Root[index=1, max=2].OthNstBranch[index=1, max=3 ] to get the data object.
又例如,输出第四行目标数据后,该第一标题数组包括:[$Root[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=1,max=2].Twig,$Root[index=1,max=2].OthNstBranch[index=2,max=3]]。则输出的目标数据的第五行包括:3。其中,3为对应数组节点$Root[index=1,max=2].OthNstBranch[index=2,max=3]获取的数据对象。For another example, after outputting the fourth line of target data, the first title array includes: [$Root[index=1, max=2].Branch, $Root[index=1, max=2].NstBranch[index=1 , max=2].Branch, $Root[index=1, max=2].NstBranch[index=1, max=2].Twig, $Root[index=1, max=2].OthNstBranch[index=2 , max=3]]. Then the fifth row of the output target data includes: 3. Among them, 3 is the data object obtained by the corresponding array node $Root[index=1, max=2].OthNstBranch[index=2, max=3].
示例性地,响应于数组计数值均不小于max-1,则该属性路径是第一标题数组下的最后一个属性路径。示例性地,当基于数组计数值以及数量值确定属性路径是第一标题数组下的最后一个属性路径时,将第一标题数组对应的属性路径按照数组计数值从源数据中获取数据对象并输出为二维数据格式的目标数据的一行。数据格式的转换过程结束,停止输出二维数据格式的目标数据。Exemplarily, in response to the array count value being not less than max-1, the property path is the last property path under the first title array. Exemplarily, when it is determined based on the array count value and the quantity value that the attribute path is the last attribute path under the first title array, the attribute path corresponding to the first title array is obtained from the source data according to the array count value and outputs the data object. A row of target data in two-dimensional data format. The conversion process of the data format ends, and the output of the target data in the two-dimensional data format is stopped.
情况二,源数据的格式为二维数据格式,目标数据的格式为面向对象数据格式,转换模式用于指示由二维数据格式转换到面向对象数据格式,映射信息用于将二维数据格式的源数据转换成面向对象数据格式的目标数据。In case 2, the format of the source data is a two-dimensional data format, the format of the target data is an object-oriented data format, the conversion mode is used to indicate the conversion from a two-dimensional data format to an object-oriented data format, and the mapping information is used to convert the two-dimensional data format The source data is converted into target data in an object-oriented data format.
针对情况二,映射关系包括标题列以及与标题列对应的属性路径,第一位置信息包括标题列,第二位置信息包括属性路径;设备基于映射信息和源数据得到目标数据,包括:设 备基于映射关系中的标题列、标题列对应的属性路径和源数据生成目标数据。For the second case, the mapping relationship includes a title column and an attribute path corresponding to the title column, the first location information includes a title column, and the second location information includes an attribute path; the device obtains the target data based on the mapping information and the source data, including: the device obtains the target data based on the mapping information and the source data. The title column in the relationship, the attribute path corresponding to the title column, and the source data generate the target data.
示例性地,基于映射关系中的标题列、标题列对应的属性路径和源数据生成目标数据,包括:设备从映射关系中获取第二标题列,根据第二标题列生成第二标题数组,第二标题数组包括属性路径以及数组计数值;响应于源数据的当前行小于总行数,将源数据中当前行指示的数据对象按照属性路径和数组计数值指定的位置填入目标数据的数据结构中。示例性地,当前行的初始值为0。Exemplarily, generating the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data includes: the device obtains a second title column from the mapping relationship, generates a second title array according to the second title column, The second title array includes the attribute path and the array count value; in response to the current row of the source data being less than the total number of rows, the data object indicated by the current row in the source data is filled into the data structure of the target data according to the position specified by the attribute path and the array count value . Illustratively, the initial value of the current row is 0.
例如,如图8所示的映射信息中,映射信息的信息标识为映射信息2,该映射信息用于将二维数据格式的源数据转换成面向对象数据格式的目标数据。其中,该映射信息包括的转换模式信息指示了转换模式为由二维数据格式转换到面向对象数据格式(CSV-to-JSON),源数据的格式为CSV,目标数据的格式为JSON。需要说明的是,由于标题列对应的属性路径相互关联,目标数据的数据结构能够根据标题列对应的属性路径确定。For example, in the mapping information shown in FIG. 8 , the information of the mapping information is identified as mapping information 2, and the mapping information is used to convert the source data in the two-dimensional data format into the target data in the object-oriented data format. The conversion mode information included in the mapping information indicates that the conversion mode is to convert from a two-dimensional data format to an object-oriented data format (CSV-to-JSON), the format of the source data is CSV, and the format of the target data is JSON. It should be noted that, since the attribute paths corresponding to the title column are related to each other, the data structure of the target data can be determined according to the attribute paths corresponding to the title column.
在图8示出的映射信息中,标题列包括根节点、网络分支、网络子分支和其他分支信息;根节点对应的属性路径包括$Root[*].Branch,网络分支对应的属性路径包括$Root[*].NstBranch[*].Branch,网络子分支对应的属性路径包括$Root[*].NstBranch[*].Twig,其他分支信息对应的属性路径包括$Root[*].OthNstBranch[*]。则调用转换模型从映射关系获取的第二标题列包括:根节点、网络分支、网络子分支和其他分支信息。根据该第二标题列生成的第二标题数组包括:[$Root[index].Branch,$Root[index].NstBranch[index].Branch,$Root[index].NstBranch[index].Twig,$Root[index].OthNstBranch[index]]。In the mapping information shown in Figure 8, the title column includes root node, network branch, network sub-branch and other branch information; the attribute path corresponding to the root node includes $Root[*].Branch, and the attribute path corresponding to the network branch includes $ Root[*].NstBranch[*].Branch, the attribute path corresponding to the network sub-branch includes $Root[*].NstBranch[*].Twig, and the attribute path corresponding to other branch information includes $Root[*].OthNstBranch[* ]. Then, the second title column obtained from the mapping relationship by calling the transformation model includes: root node, network branch, network sub-branch and other branch information. The second title array generated according to the second title column includes: [$Root[index].Branch, $Root[index].NstBranch[index].Branch, $Root[index].NstBranch[index].Twig, $ Root[index].OthNstBranch[index]].
其中,$Root[index].Branch,$Root[index].NstBranch[index].Branch,$Root[index].NstBranch[index].Twig和$Root[index].OthNstBranch[index]为该第二标题数组中的数组节点。示例性地,根据标题列对应的属性路径确定的目标数据的数据结构如图9所示。Among them, $Root[index].Branch, $Root[index].NstBranch[index].Branch, $Root[index].NstBranch[index].Twig and $Root[index].OthNstBranch[index] are the second Array nodes in the header array. Exemplarily, the data structure of the target data determined according to the attribute path corresponding to the title column is shown in FIG. 9 .
仍以图6示出的二维数据为例进行说明,该二维数据包括5行数据对象,则该二维数据的总行数为5。也即,对于该二维数据的第一行数据对象,该当前行为0;数组计数值初始为0。因此,第二标题数组包括:Still taking the two-dimensional data shown in FIG. 6 as an example for description, the two-dimensional data includes five rows of data objects, and the total number of rows of the two-dimensional data is five. That is, for the first row data object of the two-dimensional data, the current row is 0; the array count value is initially 0. Therefore, the second header array includes:
[$Root[index=0].Branch,[$Root[index=0].Branch,
$Root[index=0].NstBranch[index=0].Branch,$Root[index=0].NstBranch[index=0].Branch,
$Root[index=0].NstBranch[index=0].Twig,$Root[index=0].NstBranch[index=0].Twig,
$Root[index=0].OthNstBranch[index=0]]。$Root[index=0].OthNstBranch[index=0]].
当前行为0,响应于当前行小于总行数,将源数据中当前行指示的数据对象按照属性路径和数组计数值指定的位置填入目标数据的数据结构中。也即,如图9所示,将当前行为0指示的数据对象branch1、nbranch1.1和twig1.1填入目标数据的数据结构中。其中,branch1按照数组节点$Root[index=0].Branch填入,也即,branch1按照属性路径$Root[*].Branch和数组计数值index=0指定的位置填入;nbranch1.1按照数组节点$Root[index=0].NstBranch[index=0].Branch填入,twig1.1按照数组节点$Root[index=0].NstBranch[index=0].Twig填入。由于当前行为0时,指示的数据对象中不包括与其他分支信息对象的数据对象,按照数组节点$Root[index=0].OthNstBranch[index=0]填入目标数据的数据结构的数据对象为空(null)。示例性地,响应于填入目标数据的数据结构的数据对象为空,删除目标数据的数据结构中与该数组节点对应的部分。例如,如图10所示的目标数据的数据结构中,不包括与数组节点$Root[index=0].OthNstBranch[index=0]对应的部分。The current row is 0. In response to the current row being less than the total number of rows, the data object indicated by the current row in the source data is filled into the data structure of the target data according to the position specified by the attribute path and the array count value. That is, as shown in FIG. 9, the data objects branch1, nbranch1.1 and twig1.1 indicated by the current behavior 0 are filled into the data structure of the target data. Among them, branch1 is filled in according to the array node $Root[index=0].Branch, that is, branch1 is filled in according to the location specified by the attribute path $Root[*].Branch and the array count value index=0; nbranch1.1 is filled in according to the array The node $Root[index=0].NstBranch[index=0].Branch is filled in, and twig1.1 is filled in according to the array node $Root[index=0].NstBranch[index=0].Twig. Since the current behavior is 0, the indicated data objects do not include data objects with other branch information objects, and the data objects filled in the data structure of the target data according to the array node $Root[index=0].OthNstBranch[index=0] are: Empty (null). Exemplarily, in response to the data object filled in the data structure of the target data being empty, the part corresponding to the array node in the data structure of the target data is deleted. For example, the data structure of the target data shown in FIG. 10 does not include the part corresponding to the array node $Root[index=0].OthNstBranch[index=0].
在一种可能的实现方式中,将源数据中当前行指示的数据对象按照属性路径和数组计数值指定的位置填入目标数据的数据结构中之后,将当前行加1。此外,第二标题数组还包括属性路径在第二标题数组下的数量值(max),响应于源数据中当前行指示的数据对象不为空,将该数组节点中最后一个满足数组计数值小于max-1的条件的数组计数值加1,重置该数组计数值后的其他数组计数值和与数组计数值对应的数量值;响应于源数据中当前行指示的数据对象为空,该数组计数值保持不变。例如,第二标题数组包括:[$Root[index,max].Branch,$Root[index,max].NstBranch[index,max].Branch,$Root[index,max].NstBranch[index,max].Twig,$Root[index,max].OthNstBranch[index,max]]。在图6示出的二维数据中,属性路径$Root[*].Branch在第二标题数组下的数量值为2,也即,max=2。In a possible implementation manner, after the data object indicated by the current row in the source data is filled into the data structure of the target data according to the position specified by the attribute path and the array count value, the current row is incremented by 1. In addition, the second title array also includes the number value (max) of the attribute path under the second title array. In response to the data object indicated by the current row in the source data is not empty, the last one in the array node satisfies the array count value less than The array count value of the condition of max-1 is incremented by 1, other array count values after resetting the array count value and the quantity value corresponding to the array count value; in response to the data object indicated by the current row in the source data being empty, the array The count value remains unchanged. For example, the second header array includes: [$Root[index,max].Branch,$Root[index,max].NstBranch[index,max].Branch,$Root[index,max].NstBranch[index,max] .Twig, $Root[index, max].OthNstBranch[index, max]]. In the two-dimensional data shown in FIG. 6 , the number value of the attribute path $Root[*].Branch under the second title array is 2, that is, max=2.
例如,填入当前行为0指示的数据对象后,当前行为1,第二标题数组包括:[$Root[index=1,max=2].Branch,$Root[index=0,max=2].NstBranch[index=1,max=2].Branch,$Root[index=0,max=2].NstBranch[index=1,max=2].Twig,$Root[index=1,max=2].OthNstBranch[index=0,max=3]]。因此,将当前行为1指示的数据对象nbranch1.2和twig1.2填入目标数据的数据结构中。其中,nbranch1.2按照数组节点$Root[index=0,max=2].NstBranch[index=1,max=2].Branch填入,twig1.2按照数组节点$Root[index=0,max=2].NstBranch[index=1,max=2].Twig填入。For example, after filling in the data object indicated by the current row 0, the current row is 1, and the second title array includes: [$Root[index=1, max=2].Branch, $Root[index=0, max=2]. NstBranch[index=1, max=2].Branch, $Root[index=0, max=2].NstBranch[index=1, max=2].Twig, $Root[index=1, max=2]. OthNstBranch[index=0, max=3]]. Therefore, the data objects nbranch1.2 and twig1.2 indicated by the current behavior 1 are filled into the data structure of the target data. Among them, nbranch1.2 is filled in according to the array node $Root[index=0, max=2].NstBranch[index=1, max=2].Branch, and twig1.2 is filled in according to the array node $Root[index=0, max= 2].NstBranch[index=1, max=2].Twig is filled in.
又例如,填入当前行为1指示的数据对象后,当前行为2,第二标题数组包括:[$Root[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=0,max=2].Branch,$Root[index=1,max=2].NstBranch[index=0,max=2].Twig,$Root[index=1,max=2].OthNstBranch[index=0,max=3]]。因此,将当前行为2指示的数据对象branch2、nbranch2.1、twig2.1和1填入目标数据的数据结构中。其中,branch2按照数组节点$Root[index=1,max=2].Branch填入,nbranch2.1按照数组节点$Root[index=1,max=2].NstBranch[index=0,max=2].Branch填入,twig2.1按照数组节点$Root[index=1,max=2].NstBranch[index=0,max=2].Twig填入,1按照数组节点$Root[index=1,max=2].OthNstBranch[index=0,max=3]填入。For another example, after filling in the data object indicated by the current row 1, the current row 2, the second title array includes: [$Root[index=1, max=2].Branch, $Root[index=1, max=2] .NstBranch[index=0, max=2].Branch, $Root[index=1, max=2].NstBranch[index=0, max=2].Twig, $Root[index=1, max=2] .OthNstBranch[index=0, max=3]]. Therefore, the data objects branch2, nbranch2.1, twig2.1 and 1 indicated by the current behavior 2 are filled into the data structure of the target data. Among them, branch2 is filled in according to the array node $Root[index=1, max=2].Branch, and nbranch2.1 is filled in according to the array node $Root[index=1, max=2].NstBranch[index=0, max=2] .Branch is filled in, twig2.1 is filled in according to the array node $Root[index=1, max=2].NstBranch[index=0, max=2].Twig is filled in, 1 is according to the array node $Root[index=1, max =2].OthNstBranch[index=0, max=3] is filled in.
又例如,填入当前行为2指示的数据对象后,当前行为3,第二标题数组包括:[$Root[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=1,max=2].Twig,$Root[index=1,max=2].OthNstBranch[index=1,max=3]]。因此,将当前行为3指示的数据对象nbranch2.2、twig2.2和2填入目标数据的数据结构中。其中,nbranch2.2按照数组节点$Root[index=1,max=2].NstBranch[index=1,max=2].Branch填入,twig2.2按照数组节点$Root[index=1,max=2].NstBranch[index=1,max=2].Twig填入,2按照数组节点$Root[index=1,max=2].OthNstBranch[index=1,max=3]填入。For another example, after filling in the data object indicated by the current behavior 2, the current behavior 3, the second title array includes: [$Root[index=1, max=2].Branch, $Root[index=1, max=2] .NstBranch[index=1, max=2].Branch, $Root[index=1, max=2].NstBranch[index=1, max=2].Twig, $Root[index=1, max=2] .OthNstBranch[index=1, max=3]]. Therefore, the data objects nbranch2.2, twig2.2 and 2 indicated by the current behavior 3 are filled into the data structure of the target data. Among them, nbranch2.2 is filled in according to the array node $Root[index=1, max=2].NstBranch[index=1, max=2].Branch, and twig2.2 is filled in according to the array node $Root[index=1, max= 2].NstBranch[index=1, max=2].Twig is filled in, and 2 is filled in according to the array node $Root[index=1, max=2].OthNstBranch[index=1, max=3].
又例如,填入当前行为3指示的数据对象后,当前行为4,第二标题数组包括:[$Root[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=1,max=2].Branch,$Root[index=1,max=2].NstBranch[index=1,max=2].Twig,$Root[index=1,max=2].OthNstBranch[index=2,max=3]]。因此,将当前行为4指示的数据对象3填入目标数据的数据结构中。其中,3按照数组节点$Root[index=1,max=2].OthNstBranch[index=2,max=3]填入。For another example, after filling in the data object indicated by the current behavior 3, the current behavior 4, the second title array includes: [$Root[index=1, max=2].Branch, $Root[index=1, max=2] .NstBranch[index=1, max=2].Branch, $Root[index=1, max=2].NstBranch[index=1, max=2].Twig, $Root[index=1, max=2] .OthNstBranch[index=2,max=3]]. Therefore, the data object 3 indicated by the current behavior 4 is filled into the data structure of the target data. Among them, 3 is filled in according to the array node $Root[index=1, max=2].OthNstBranch[index=2, max=3].
示例性地,当源数据的当前行大于等于总行数时,数据格式的转换过程结束,停止将源数据中当前行指示的数据对象按照属性路径和数组计数值指定的位置填入目标数据的数据结构中。Exemplarily, when the current row of the source data is greater than or equal to the total number of rows, the conversion process of the data format ends, and stops filling the data object indicated by the current row in the source data with the data of the target data according to the position specified by the attribute path and the array count value. in the structure.
本申请实施例通过根据业务需求获取的映射信息,基于映射信息将源数据进行数据结构转换,得到目标数据,该方法的数据格式的转换效率更高。In the embodiment of the present application, the source data is converted into the data structure based on the mapping information obtained according to the business requirements to obtain the target data, and the conversion efficiency of the data format of this method is higher.
其次,由于数据转换是根据映射信息进行转换的,转换后的目标数据的结构可控。对于不同的源数据的结构,按照相同映射信息转换后的目标数据的格式相同,该方法适用的源数据的结构较广。Secondly, since the data conversion is performed according to the mapping information, the structure of the converted target data is controllable. For different source data structures, the target data converted according to the same mapping information has the same format, and this method is applicable to a wide range of source data structures.
此外,由于映射信息中标题列与属性路径相关联,该方法实现了面向对象数据格式与二维数据格式之间的转换,以及二维数据格式与面向对象数据格式之间的转换,该方法的数据结构的转换过程可逆。在面向对象数据格式—二维数据格式—面向对象数据格式的转换过程中,转换前后的面向对象数据格式一致。In addition, since the title column in the mapping information is associated with the attribute path, the method realizes the conversion between the object-oriented data format and the two-dimensional data format, and the conversion between the two-dimensional data format and the object-oriented data format. The transformation process of the data structure is reversible. In the conversion process of object-oriented data format-two-dimensional data format-object-oriented data format, the object-oriented data format before and after the conversion is the same.
本申请实施例还提供了一种数据格式的转换装置。图11是本申请实施例提供的一种数据格式的转换装置的结构示意图。基于图11所示的如下多个模块,该图11所示的数据格式的转换装置能够执行数据格式的转换设备所执行的全部或部分操作。应理解到,该装置可以包括比所示模块更多的附加模块或者省略其中所示的一部分模块,本申请实施例对此并不进行限制。如图11所示,该装置包括:获取模块1101和转换模块1102。The embodiment of the present application also provides a data format conversion device. FIG. 11 is a schematic structural diagram of a data format conversion apparatus provided by an embodiment of the present application. Based on the following multiple modules shown in FIG. 11 , the data format conversion apparatus shown in FIG. 11 can perform all or part of the operations performed by the data format conversion device. It should be understood that the apparatus may include more additional modules than the shown modules or omit a part of the modules shown therein, which is not limited in this embodiment of the present application. As shown in FIG. 11 , the apparatus includes: an acquisition module 1101 and a conversion module 1102 .
在一种可能的实现方式中,获取模块1101,用于获得源数据和映射信息,映射信息为基于业务需求获取得到;转换模块1102,用于基于映射信息和源数据得到目标数据,映射信息包括映射关系,映射关系包括源数据中的至少一个数据对象的第一位置信息与第二位置信息的对应关系;其中,第一位置信息为至少一个数据对象在源数据的数据结构中的位置,第二位置信息为至少一个数据对象在目标数据的数据结构中的位置,第二位置信息对应的位置中的数据对象包括第一位置信息对应的位置中的数据对象。In a possible implementation manner, the obtaining module 1101 is used to obtain source data and mapping information, and the mapping information is obtained based on business requirements; the conversion module 1102 is used to obtain target data based on the mapping information and the source data, and the mapping information includes A mapping relationship, the mapping relationship includes a correspondence between the first position information and the second position information of at least one data object in the source data; wherein, the first position information is the position of the at least one data object in the data structure of the source data, and the first position information is the position of the at least one data object in the data structure of the source data. The second position information is the position of the at least one data object in the data structure of the target data, and the data object in the position corresponding to the second position information includes the data object in the position corresponding to the first position information.
在一种可能的实现方式中,映射信息还包括信息标识以及转换模式信息;信息标识用于标识映射信息;转换模式信息用于指示转换模式、源数据的格式以及目标数据的格式,转换模式用于指示由源数据的格式转换到目标数据的格式。In a possible implementation manner, the mapping information further includes an information identifier and conversion mode information; the information identifier is used to identify the mapping information; the conversion mode information is used to indicate the conversion mode, the format of the source data and the format of the target data, and the conversion mode uses Used to indicate the conversion from the format of the source data to the format of the target data.
在一种可能的实现方式中,源数据的格式为面向对象数据格式,目标数据的格式为二维数据格式,映射信息用于将面向对象数据格式的源数据转换成二维数据格式的目标数据。In a possible implementation manner, the format of the source data is an object-oriented data format, the format of the target data is a two-dimensional data format, and the mapping information is used to convert the source data of the object-oriented data format into the target data of the two-dimensional data format .
在一种可能的实现方式中,映射关系包括标题列以及与标题列对应的属性路径,第一位置信息包括属性路径,第二位置信息包括标题列;转换模块1102,用于基于映射关系中的标题列、标题列对应的属性路径和源数据生成目标数据。In a possible implementation manner, the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes an attribute path, and the second position information includes a title column; the conversion module 1102 is configured to, based on the mapping relationship, include the attribute path and the second position information. The title column, the attribute path corresponding to the title column, and the source data generate the target data.
在一种可能的实现方式中,转换模块1102,用于从映射关系中获取第一标题列,根据第一标题列生成第一标题数组,第一标题数组包括属性路径、数组计数值以及属性路径在第一标题数组下的数量值;基于数组计数值以及数量值确定属性路径不是第一标题数组下的最后一个属性路径,将第一标题数组对应的属性路径按照数组计数值从源数据中获取数据对象并输出为二维数据格式的目标数据的一行。In a possible implementation manner, the conversion module 1102 is configured to obtain the first title column from the mapping relationship, and generate a first title array according to the first title column, where the first title array includes an attribute path, an array count value, and an attribute path The quantity value under the first title array; based on the array count value and the quantity value, it is determined that the attribute path is not the last attribute path under the first title array, and the attribute path corresponding to the first title array is obtained from the source data according to the array count value Data object and output as a row of target data in two-dimensional data format.
在一种可能的实现方式中,源数据的格式为二维数据格式,目标数据的格式为面向对象数据格式,映射信息用于将二维数据格式的源数据转换成面向对象数据格式的目标数据。In a possible implementation manner, the format of the source data is a two-dimensional data format, the format of the target data is an object-oriented data format, and the mapping information is used to convert the source data of the two-dimensional data format into the target data of the object-oriented data format .
在一种可能的实现方式中,映射关系包括标题列以及与标题列对应的属性路径,第一位置信息包括标题列,第二位置信息包括属性路径;转换模块1102,用于基于映射关系中的标题列、标题列对应的属性路径和源数据生成目标数据。In a possible implementation manner, the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes a title column, and the second position information includes an attribute path; the conversion module 1102 is configured to, based on the mapping relationship, The title column, the attribute path corresponding to the title column, and the source data generate the target data.
在一种可能的实现方式中,转换模块1102,用于从映射关系中获取第二标题列,根据第二标题列生成第二标题数组,第二标题数组包括属性路径以及数组计数值;响应于源数据的当前行小于总行数,将源数据中当前行指示的数据对象按照属性路径和数组计数值指定的位置填入目标数据的数据结构中。In a possible implementation manner, the conversion module 1102 is configured to obtain the second title column from the mapping relationship, and generate a second title array according to the second title column, where the second title array includes an attribute path and an array count value; in response to If the current row of the source data is less than the total number of rows, the data object indicated by the current row in the source data is filled into the data structure of the target data according to the position specified by the attribute path and the array count value.
在一种可能的实现方式中,业务需求包括用于获取映射信息的关联信息;获取模块1101,用于基于业务需求中的关联信息获取映射信息。In a possible implementation manner, the business requirement includes association information for obtaining the mapping information; the obtaining module 1101 is configured to obtain the mapping information based on the association information in the business requirement.
在一种可能的实现方式中,关联信息包括映射信息的信息标识。In a possible implementation manner, the association information includes an information identifier of the mapping information.
在一种可能的实现方式中,获取模块1101,用于基于业务需求获取用户指定的映射信息或者默认的映射信息。In a possible implementation manner, the obtaining module 1101 is configured to obtain user-specified mapping information or default mapping information based on business requirements.
在一种可能的实现方式中,源数据的格式为JSON格式,目标数据的格式为CSV格式,或源数据的格式为CSV格式,目标数据的格式为JSON格式。In a possible implementation manner, the format of the source data is JSON format, and the format of target data is CSV format, or the format of source data is CSV format, and the format of target data is JSON format.
在一种可能的实现方式中,该设备的类型包括网络管理系统、SDN控制器网元设备、终端和服务器中的至少一种。In a possible implementation manner, the type of the device includes at least one of a network management system, an SDN controller network element device, a terminal, and a server.
应理解的是,上述图11提供的装置在实现其功能时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的装置与方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be understood that when the device provided in the above-mentioned FIG. 11 realizes its functions, it is only illustrated by the division of the above-mentioned functional modules. The internal structure is divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process thereof is detailed in the method embodiments, which will not be repeated here.
参见图12,图12示出了本申请一个示例性实施例提供的数据格式的转换设备2000的结构示意图。图12所示的数据格式的转换设备2000用于执行上述图2所示的数据格式的转换方法所涉及的操作。该数据格式的转换设备2000例如是交换机、路由器等,该数据格式的转换设备2000可以由一般性的总线体系结构来实现。Referring to FIG. 12, FIG. 12 shows a schematic structural diagram of a data format conversion device 2000 provided by an exemplary embodiment of the present application. The data format conversion apparatus 2000 shown in FIG. 12 is used to perform the operations involved in the above-described data format conversion method shown in FIG. 2 . The data format conversion device 2000 is, for example, a switch, a router, etc. The data format conversion device 2000 can be implemented by a general bus architecture.
如图12所示,数据格式的转换设备2000包括至少一个处理器2001、存储器2003以及至少一个通信接口2004。As shown in FIG. 12 , the data format conversion device 2000 includes at least one processor 2001 , memory 2003 and at least one communication interface 2004 .
处理器2001例如是通用中央处理器(central processing unit,CPU)、数字信号处理器(digital signal processor,DSP)、网络处理器(network processer,NP)、图形处理器(graphics processing unit,GPU)、神经网络处理器(neural-network processing units,NPU)、数据处理单元(data processing unit,DPU)、微处理器或者一个或多个用于实现本申请方案的集成电路。例如,处理器2001包括专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。PLD例如是复杂可编程逻辑器件(complex programmable logic device,CPLD)、现场可编程逻辑门阵列(field-programmable gate array,FPGA)、通用阵列逻辑(generic array logic,GAL)或其任意组合。其可以实现或执行结合本发明实施例公开内容所描述的各种逻辑方框、模块和电路。该处理器也可以是实现计算功能的组合,例如包括一个或多个微处理器组合,DSP和微处理器的组合等等。The processor 2001 is, for example, a general-purpose central processing unit (central processing unit, CPU), a digital signal processor (digital signal processor, DSP), a network processor (network processor, NP), a graphics processing unit (graphics processing unit, GPU), A neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor or one or more integrated circuits for implementing the solution of the present application. For example, the processor 2001 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. It may implement or execute the various logical blocks, modules and circuits described in connection with the disclosure of the embodiments of the present invention. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
可选的,数据格式的转换设备2000还包括总线。总线用于在数据格式的转换设备2000 的各组件之间传送信息。总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图12中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。Optionally, the data format conversion device 2000 further includes a bus. The bus is used to transfer information between the various components of the data format conversion apparatus 2000 . The bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (EISA for short) bus or the like. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is shown in FIG. 12, but it does not mean that there is only one bus or one type of bus.
存储器2003例如是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其它类型的静态存储设备,又如是随机存取存储器(random access memory,RAM)或者可存储信息和指令的其它类型的动态存储设备,又如是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其它光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其它磁存储设备,或者是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其它介质,但不限于此。存储器2003例如是独立存在,并通过总线与处理器2001相连接。存储器2003也可以和处理器2001集成在一起。The memory 2003 is, for example, a read-only memory (read-only memory, ROM) or other types of static storage devices that can store static information and instructions, or a random access memory (random access memory, RAM) or a memory device that can store information and instructions. Other types of dynamic storage devices, such as electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disk storage, optical disks storage (including compact discs, laser discs, compact discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or capable of carrying or storing desired program code in the form of instructions or data structures and capable of Any other medium accessed by a computer without limitation. The memory 2003 exists independently, for example, and is connected to the processor 2001 through a bus. The memory 2003 may also be integrated with the processor 2001 .
通信接口2004使用任何收发器一类的装置,用于与其它设备或通信网络通信,通信网络可以为以太网、无线接入网(RAN)或无线局域网(wireless local area network,WLAN)等。通信接口2004可以包括有线通信接口,还可以包括无线通信接口。具体的,通信接口2004可以为以太(ethernet)接口、快速以太(fast ethernet,FE)接口、千兆以太(gigabit ethernet,GE)接口,异步传输模式(asynchronous transfer mode,ATM)接口,无线局域网(wireless local area networks,WLAN)接口,蜂窝网络通信接口或其组合。以太网接口可以是光接口,电接口或其组合。在本申请实施例中,通信接口2004可以用于数据格式的转换设备2000与其他设备进行通信。The communication interface 2004 uses any device such as a transceiver for communicating with other devices or a communication network, which may be Ethernet, a radio access network (RAN), or a wireless local area network (WLAN), or the like. Communication interface 2004 may include a wired communication interface and may also include a wireless communication interface. Specifically, the communication interface 2004 may be an ethernet (ethernet) interface, a fast ethernet (FE) interface, a gigabit ethernet (GE) interface, an asynchronous transfer mode (ATM) interface, a wireless local area network ( wireless local area networks, WLAN) interfaces, cellular network communication interfaces, or a combination thereof. The Ethernet interface can be an optical interface, an electrical interface or a combination thereof. In this embodiment of the present application, the communication interface 2004 may be used for the data format conversion device 2000 to communicate with other devices.
在具体实现中,作为一种实施例,处理器2001可以包括一个或多个CPU,如图12中所示的CPU0和CPU1。这些处理器中的每一个可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。In a specific implementation, as an embodiment, the processor 2001 may include one or more CPUs, such as CPU0 and CPU1 as shown in FIG. 12 . Each of these processors can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).
在具体实现中,作为一种实施例,数据格式的转换设备2000可以包括多个处理器,如图12中所示的处理器2001和处理器2005。这些处理器中的每一个可以是一个单核处理器(single-CPU),也可以是一个多核处理器(multi-CPU)。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(如计算机程序指令)的处理核。In a specific implementation, as an embodiment, the data format conversion device 2000 may include multiple processors, such as the processor 2001 and the processor 2005 shown in FIG. 12 . Each of these processors can be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).
在具体实现中,作为一种实施例,数据格式的转换设备2000还可以包括输出设备和输入设备。输出设备和处理器2001通信,可以以多种方式来显示信息。例如,输出设备可以是液晶显示器(liquid crystal display,LCD)、发光二级管(light emitting diode,LED)显示设备、阴极射线管(cathode ray tube,CRT)显示设备或投影仪(projector)等。输入设备和处理器2001通信,可以以多种方式接收用户的输入。例如,输入设备可以是鼠标、键盘、触摸屏设备或传感设备等。In a specific implementation, as an embodiment, the data format conversion device 2000 may further include an output device and an input device. The output device communicates with the processor 2001 and can display information in a variety of ways. For example, the output device may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, a projector, or the like. The input device communicates with the processor 2001 and can receive user input in various ways. For example, the input device may be a mouse, a keyboard, a touch screen device, or a sensor device, or the like.
在一些实施例中,存储器2003用于存储执行本申请方案的程序代码2010,处理器2001可以执行存储器2003中存储的程序代码2010。也即是,数据格式的转换设备2000可以通过处理器2001以及存储器2003中的程序代码2010,来实现方法实施例提供的数据格式的转换方法。程序代码2010中可以包括一个或多个软件模块。可选地,处理器2001自身也可以存 储执行本申请方案的程序代码或指令。In some embodiments, the memory 2003 is used to store the program code 2010 for executing the solutions of the present application, and the processor 2001 can execute the program code 2010 stored in the memory 2003 . That is, the data format conversion device 2000 can implement the data format conversion method provided by the method embodiment through the processor 2001 and the program code 2010 in the memory 2003 . One or more software modules may be included in the program code 2010 . Optionally, the processor 2001 itself may also store program codes or instructions for executing the solutions of the present application.
在具体实施例中,本申请实施例的数据格式的转换设备2000可对应于上述各个数据格式的转换方法实施例中的数据格式的转换设备,数据格式的转换设备2000中的处理器2001读取存储器2003中的指令,使图12所示的数据格式的转换设备2000能够执行数据格式的转换设备所执行的全部或部分操作。In a specific embodiment, the data format conversion device 2000 in this embodiment of the present application may correspond to the data format conversion device in the above-mentioned respective data format conversion method embodiments, and the processor 2001 in the data format conversion device 2000 reads The instructions in the memory 2003 enable the data format conversion apparatus 2000 shown in FIG. 12 to perform all or part of the operations performed by the data format conversion apparatus.
数据格式的转换设备2000还可以对应于上述图11所示的数据格式的转换装置,数据格式的转换装置中的每个功能模块采用数据格式的转换设备2000的软件实现。换句话说,数据格式的转换装置中包括的功能模块为数据格式的转换设备2000的处理器2001读取存储器2003中存储的程序代码2010后生成的。The data format conversion device 2000 may also correspond to the data format conversion device shown in FIG. 11 , and each functional module in the data format conversion device is implemented by software of the data format conversion device 2000 . In other words, the functional modules included in the data format conversion apparatus are generated after the processor 2001 of the data format conversion device 2000 reads the program code 2010 stored in the memory 2003 .
其中,图2所示的数据格式的转换方法的各步骤通过数据格式的转换设备2000的处理器中的硬件的集成逻辑电路或者软件形式的指令完成。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤,为避免重复,这里不再详细描述。Wherein, each step of the data format conversion method shown in FIG. 2 is completed by the hardware integrated logic circuit in the processor of the data format conversion device 2000 or the instructions in the form of software. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor. The software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art. The storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware, which will not be described in detail here to avoid repetition.
参见图13,图13示出了本申请另一个示例性实施例提供的数据格式的转换设备2100的结构示意图。图13所示的数据格式的转换设备2100用于执行上述图2所示的数据格式的转换方法所涉及的全部或部分操作。该数据格式的转换设备2100例如是交换机、路由器等,该数据格式的转换设备2100可以由一般性的总线体系结构来实现。Referring to FIG. 13, FIG. 13 shows a schematic structural diagram of a data format conversion device 2100 provided by another exemplary embodiment of the present application. The data format conversion device 2100 shown in FIG. 13 is configured to perform all or part of the operations involved in the above-mentioned data format conversion method shown in FIG. 2 . The data format conversion device 2100 is, for example, a switch, a router, etc. The data format conversion device 2100 can be implemented by a general bus architecture.
如图13所示,数据格式的转换设备2100包括:主控板2110和接口板2130。As shown in FIG. 13 , the data format conversion device 2100 includes: a main control board 2110 and an interface board 2130 .
主控板也称为主处理单元(main processing unit,MPU)或路由处理卡(route processor card),主控板2110用于对数据格式的转换设备2100中各个组件的控制和管理,包括路由计算、设备管理、设备维护、协议处理功能。主控板2110包括:中央处理器2111和存储器2112。The main control board is also called the main processing unit (MPU) or the route processor card (route processor card). The main control board 2110 is used for the control and management of each component in the data format conversion device 2100, including route calculation. , Equipment management, equipment maintenance, protocol processing functions. The main control board 2110 includes: a central processing unit 2111 and a memory 2112 .
接口板2130也称为线路接口单元卡(line processing unit,LPU)、线卡(line card)或业务板。接口板2130用于提供各种业务接口并实现数据包的转发。业务接口包括而不限于以太网接口、POS(packet over SONET/SDH)接口等,以太网接口例如是灵活以太网业务接口(flexible ethernet clients,FlexE Clients)。接口板2130包括:中央处理器2131网络处理器2132、转发表项存储器2134和物理接口卡(physical interface card,PIC)2133。The interface board 2130 is also referred to as a line processing unit (LPU), a line card (line card) or a service board. The interface board 2130 is used to provide various service interfaces and realize data packet forwarding. The service interface includes, but is not limited to, an Ethernet interface, a POS (packet over SONET/SDH) interface, etc. The Ethernet interface is, for example, a flexible Ethernet service interface (flexible ethernet clients, FlexE Clients). The interface board 2130 includes: a central processing unit 2131, a network processor 2132, a forwarding table entry memory 2134, and a physical interface card (PIC) 2133.
接口板2130上的中央处理器2131用于对接口板2130进行控制管理并与主控板2110上的中央处理器2111进行通信。The central processing unit 2131 on the interface board 2130 is used to control and manage the interface board 2130 and communicate with the central processing unit 2111 on the main control board 2110 .
网络处理器2132用于实现报文的转发处理。网络处理器2132的形态可以是转发芯片。转发芯片可以是网络处理器(network processor,NP)。在一些实施例中,转发芯片可以通过专用集成电路(application-specific integrated circuit,ASIC)或现场可编程门阵列(field programmable gate array,FPGA)实现。具体而言,网络处理器2132用于基于转发表项存储器2134保存的转发表转发接收到的报文,如果报文的目的地址为数据格式的转换设备2100的地址,则将该报文上送至CPU(如中央处理器2131)处理;如果报文的目的地址不是数据格式的转换设备2100的地址,则根据该目的地址从转发表中查找到该目的地址对应的下一跳和出接口,将该报文转发到该目的地址对应的出接口。其中,上行报文的处理可以包括:报文入接口的处理,转发表查找;下行报文的处理可以包括:转发表查找等等。在一些实施例 中,中央处理器也可执行转发芯片的功能,比如基于通用CPU实现软件转发,从而接口板中不需要转发芯片。The network processor 2132 is used to implement packet forwarding processing. The form of the network processor 2132 may be a forwarding chip. The forwarding chip may be a network processor (NP). In some embodiments, the forwarding chip may be implemented by an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA). Specifically, the network processor 2132 is configured to forward the received message based on the forwarding table stored in the forwarding table entry memory 2134. If the destination address of the message is the address of the data format conversion device 2100, the message is sent to the to the CPU (such as the central processing unit 2131) for processing; if the destination address of the message is not the address of the conversion device 2100 of the data format, then find the next hop and the outgoing interface corresponding to the destination address from the forwarding table according to the destination address, Forward the packet to the outbound interface corresponding to the destination address. Wherein, the processing of the uplink message may include: processing of the incoming interface of the message, and forwarding table lookup; the processing of the downlink message may include: forwarding table lookup, and so on. In some embodiments, the central processing unit can also perform the function of a forwarding chip, such as implementing software forwarding based on a general-purpose CPU, so that a forwarding chip is not required in the interface board.
物理接口卡2133用于实现物理层的对接功能,原始的流量由此进入接口板2130,以及处理后的报文从该物理接口卡2133发出。物理接口卡2133也称为子卡,可安装在接口板2130上,负责将光电信号转换为报文并对报文进行合法性检查后转发给网络处理器2132处理。在一些实施例中,中央处理器2131也可执行网络处理器2132的功能,比如基于通用CPU实现软件转发,从而物理接口卡2133中不需要网络处理器2132。The physical interface card 2133 is used to realize the interconnection function of the physical layer, the original traffic enters the interface board 2130 through this, and the processed packets are sent from the physical interface card 2133 . The physical interface card 2133 is also called a daughter card, which can be installed on the interface board 2130, and is responsible for converting the photoelectric signal into a message, and after checking the validity of the message, it is forwarded to the network processor 2132 for processing. In some embodiments, the central processing unit 2131 can also perform the functions of the network processor 2132 , such as implementing software forwarding based on a general-purpose CPU, so that the network processor 2132 is not required in the physical interface card 2133 .
可选地,数据格式的转换设备2100包括多个接口板,例如数据格式的转换设备2100还包括接口板2140,接口板2140包括:中央处理器2141、网络处理器2142、转发表项存储器2144和物理接口卡2143。接口板2140中各部件的功能和实现方式与接口板2130相同或相似,在此不再赘述。Optionally, the data format conversion device 2100 includes a plurality of interface boards. For example, the data format conversion device 2100 further includes an interface board 2140. The interface board 2140 includes: a central processing unit 2141, a network processor 2142, a forwarding entry storage 2144 and Physical interface card 2143. The functions and implementation manners of the components in the interface board 2140 are the same as or similar to those of the interface board 2130, and will not be repeated here.
可选地,数据格式的转换设备2100还包括交换网板2120。交换网板2120也可以称为交换网板单元(switch fabric unit,SFU)。在数据格式的转换设备有多个接口板的情况下,交换网板2120用于完成各接口板之间的数据交换。例如,接口板2130和接口板2140之间可以通过交换网板2120通信。Optionally, the data format conversion device 2100 further includes a switch fabric board 2120 . The switch fabric unit 2120 may also be referred to as a switch fabric unit (switch fabric unit, SFU). When the data format conversion device has multiple interface boards, the switching network board 2120 is used to complete data exchange between the interface boards. For example, the interface board 2130 and the interface board 2140 can communicate through the switch fabric board 2120 .
主控板2110和接口板耦合。例如。主控板2110、接口板2130和接口板2140,以及交换网板2120之间通过系统总线与系统背板相连实现互通。在一种可能的实现方式中,主控板2110和接口板2130及接口板2140之间建立进程间通信协议(inter-process communication,IPC)通道,主控板2110和接口板2130及接口板2140之间通过IPC通道进行通信。The main control board 2110 is coupled with the interface board. E.g. The main control board 2110, the interface board 2130, the interface board 2140, and the switching network board 2120 are connected to the system backplane through a system bus to achieve intercommunication. In a possible implementation manner, an inter-process communication (IPC) channel is established between the main control board 2110 and the interface board 2130 and the interface board 2140, and the main control board 2110 and the interface board 2130 and the interface board 2140 The communication is carried out through the IPC channel.
在逻辑上,数据格式的转换设备2100包括控制面和转发面,控制面包括主控板2110和中央处理器2111,转发面包括执行转发的各个组件,比如转发表项存储器2134、物理接口卡2133和网络处理器2132。控制面执行路由器、生成转发表、处理信令和协议报文、配置与维护网络设备的状态等功能,控制面将生成的转发表下发给转发面,在转发面,网络处理器2132基于控制面下发的转发表对物理接口卡2133收到的报文查表转发。控制面下发的转发表可以保存在转发表项存储器2134中。在有些实施例中,控制面和转发面可以完全分离,不在同一网络设备上。Logically, the data format conversion device 2100 includes a control plane and a forwarding plane, the control plane includes a main control board 2110 and a central processing unit 2111, and the forwarding plane includes various components that perform forwarding, such as forwarding entry storage 2134, physical interface card 2133 and network processor 2132. The control plane performs functions such as routers, generating forwarding tables, processing signaling and protocol packets, and configuring and maintaining the status of network devices. The control plane issues the generated forwarding tables to the forwarding plane. On the forwarding plane, the network processor 2132 controls the The following forwarding table forwards the packets received by the physical interface card 2133 by looking up the table. The forwarding table issued by the control plane may be stored in the forwarding table entry storage 2134 . In some embodiments, the control plane and forwarding plane may be completely separated and not on the same network device.
值得说明的是,主控板可能有一块或多块,有多块的时候可以包括主用主控板和备用主控板。接口板可能有一块或多块,数据格式的转换设备的数据处理能力越强,提供的接口板越多。接口板上的物理接口卡也可以有一块或多块。交换网板可能没有,也可能有一块或多块,有多块的时候可以共同实现负荷分担冗余备份。在集中式转发架构下,数据格式的转换设备可以不需要交换网板,接口板承担整个系统的业务数据的处理功能。在分布式转发架构下,数据格式的转换设备可以有至少一块交换网板,通过交换网板实现多块接口板之间的数据交换,提供大容量的数据交换和处理能力。所以,分布式架构的数据格式的转换设备的数据接入和处理能力要大于集中式架构的数据格式的转换设备。可选地,数据格式的转换设备的形态也可以是只有一块板卡,即没有交换网板,接口板和主控板的功能集成在该一块板卡上,此时接口板上的中央处理器和主控板上的中央处理器在该一块板卡上可以合并为一个中央处理器,执行两者叠加后的功能,这种形态数据格式的转换设备的数据交换和处理能力较低(例如,低端交换机或路由器等网络设备)。具体采用哪种架构,取决于具体的组网部署场景,此处不做任何限定。It is worth noting that there may be one or more main control boards, and when there are multiple main control boards, they may include the main main control board and the backup main control board. There may be one or more interface boards. The stronger the data processing capability of the data format conversion device, the more interface boards provided. There can also be one or more physical interface cards on the interface board. There may be no switch fabric boards, or there may be one or more boards. When there are multiple boards, load sharing and redundancy backup can be implemented together. Under the centralized forwarding architecture, the data format conversion device does not need to switch the network board, and the interface board is responsible for the processing function of the service data of the entire system. Under the distributed forwarding architecture, the data format conversion device can have at least one switching network board, and the switching network board realizes data exchange between multiple interface boards, providing large-capacity data exchange and processing capabilities. Therefore, the data access and processing capability of the data format conversion device of the distributed architecture is greater than that of the data format conversion device of the centralized architecture. Optionally, the data format conversion device can also be in the form of only one board, that is, there is no switching network board, and the functions of the interface board and the main control board are integrated on this board. At this time, the central processing unit on the interface board. and the central processing unit on the main control board can be combined into a central processing unit on this board to perform the superimposed functions of the two. The data exchange and processing capacity of the conversion device of this morphological data format is low (for example, network devices such as low-end switches or routers). The specific architecture used depends on the specific networking deployment scenario, and there is no restriction here.
在具体实施例中,数据格式的转换设备2100对应于上述图11所示的数据格式的转换装置。在一些实施例中,图11所示的数据格式的转换装置中的获取模块1101相当于数据格式的转换设备2100中的物理接口卡2133;转换模块1102相当于数据格式的转换设备2100中的中央处理器2111或网络处理器2132。In a specific embodiment, the data format conversion device 2100 corresponds to the data format conversion apparatus shown in FIG. 11 above. In some embodiments, the acquisition module 1101 in the data format conversion apparatus shown in FIG. 11 is equivalent to the physical interface card 2133 in the data format conversion device 2100 ; the conversion module 1102 is equivalent to the center in the data format conversion device 2100 Processor 2111 or Network Processor 2132.
基于上述图12及图13所示的数据格式的转换设备,本申请实施例还提供了一种数据格式的转换系统,该系统包括:控制设备以及显示界面。可选的,控制设备为图12所示的数据格式的转换设备2000或图13所示的数据格式的转换设备2100,显示界面为图12所示的数据格式的转换设备2000或图13所示的数据格式的转换设备2100。Based on the data format conversion device shown in FIG. 12 and FIG. 13 , an embodiment of the present application further provides a data format conversion system, the system includes: a control device and a display interface. Optionally, the control device is the data format conversion device 2000 shown in FIG. 12 or the data format conversion device 2100 shown in FIG. 13 , and the display interface is the data format conversion device 2000 shown in FIG. 12 or the data format shown in FIG. 13 . The data format conversion device 2100.
数据格式的转换设备所执行的数据格式的转换方法可参见上述图2所示实施例的相关描述,此处不再加以赘述。For the data format conversion method performed by the data format conversion device, reference may be made to the relevant description of the embodiment shown in FIG. 2 above, which will not be repeated here.
本申请实施例还提供了一种通信装置,该装置包括:收发器、存储器和处理器。其中,该收发器、该存储器和该处理器通过内部连接通路互相通信,该存储器用于存储指令,该处理器用于执行该存储器存储的指令,以控制收发器接收信号,并控制收发器发送信号,并且当该处理器执行该存储器存储的指令时,使得该处理器执行控制设备所需执行的数据格式的转换方法。An embodiment of the present application also provides a communication apparatus, the apparatus includes: a transceiver, a memory, and a processor. The transceiver, the memory and the processor communicate with each other through an internal connection path, the memory is used for storing instructions, and the processor is used for executing the instructions stored in the memory to control the transceiver to receive signals and control the transceiver to send signals , and when the processor executes the instructions stored in the memory, the processor is made to execute the data format conversion method required to be executed by the control device.
本申请实施例还提供了一种通信装置,该装置包括:收发器、存储器和处理器。其中,该收发器、该存储器和该处理器通过内部连接通路互相通信,该存储器用于存储指令,该处理器用于执行该存储器存储的指令,以控制收发器接收信号,并控制收发器发送信号,并且当该处理器执行该存储器存储的指令时,使得该处理器执行显示界面所需执行的数据格式的转换方法。An embodiment of the present application also provides a communication apparatus, the apparatus includes: a transceiver, a memory, and a processor. The transceiver, the memory and the processor communicate with each other through an internal connection path, the memory is used for storing instructions, and the processor is used for executing the instructions stored in the memory to control the transceiver to receive signals and control the transceiver to send signals , and when the processor executes the instructions stored in the memory, the processor is made to execute the data format conversion method required to be executed by the display interface.
应理解的是,上述处理器可以是中央处理器(central processing unit,CPU),还可以是其他通用处理器、数字信号处理器(digital signal processing,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者是任何常规的处理器等。值得说明的是,处理器可以是支持进阶精简指令集机器(advanced RISC machines,ARM)架构的处理器。It should be understood that the above-mentioned processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (digital signal processing, DSP), application specific integrated circuits (application specific integrated circuits, ASIC), field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or any conventional processor or the like. It should be noted that the processor may be a processor supporting an advanced RISC machine (ARM) architecture.
进一步地,在一种可选的实施例中,上述存储器可以包括只读存储器和随机存取存储器,并向处理器提供指令和数据。存储器还可以包括非易失性随机存取存储器。例如,存储器还可以存储设备类型的信息。Further, in an optional embodiment, the above-mentioned memory may include read-only memory and random access memory, and provide instructions and data to the processor. The memory may also include non-volatile random access memory. For example, the memory may also store device type information.
该存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用。例如,静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic random access memory,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data date SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、 同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。The memory may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically programmable Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory. Volatile memory may be random access memory (RAM), which acts as an external cache. By way of example and not limitation, many forms of RAM are available. For example, static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access Memory (double data date SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synchlink DRAM, SLDRAM) and direct memory bus random access memory (direct rambus RAM, DR RAM).
本申请实施例还提供了一种计算机可读存储介质,存储介质中存储有至少一条指令,指令由处理器加载并执行以实现如上任一所述的数据格式的转换方法。Embodiments of the present application further provide a computer-readable storage medium, where at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement any one of the above-described data format conversion methods.
本申请实施例还提供了一种计算机程序(产品),当计算机程序被计算机执行时,可以使得处理器或计算机执行上述方法实施例中对应的数据格式的转换方法的各个步骤和/或流程。The embodiments of the present application also provide a computer program (product), when the computer program is executed by a computer, the processor or the computer can be made to execute each step and/or process of the corresponding data format conversion method in the above method embodiments.
本申请实施例还提供了一种芯片,包括处理器,用于从存储器中调用并运行所述存储器中存储的指令,使得安装有所述芯片的通信设备执行上述各方面中的数据格式的转换方法。An embodiment of the present application further provides a chip, including a processor, configured to call and execute instructions stored in the memory from a memory, so that a communication device installed with the chip performs the data format conversion in the above aspects method.
本申请实施例还提供另一种芯片,包括:输入接口、输出接口、处理器和存储器,所述输入接口、输出接口、所述处理器以及所述存储器之间通过内部连接通路相连,所述处理器用于执行所述存储器中的代码,当所述代码被执行时,所述处理器用于执行上述各方面中的数据格式的转换方法。An embodiment of the present application further provides another chip, including: an input interface, an output interface, a processor, and a memory, wherein the input interface, the output interface, the processor, and the memory are connected through an internal connection path, and the The processor is configured to execute the code in the memory, and when the code is executed, the processor is configured to execute the data format conversion method in the above aspects.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘solid state disk)等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer program instructions, when loaded and executed on a computer, result in whole or in part of the processes or functions described herein. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state disks), and the like.
本领域普通技术人员可以意识到,结合本文中所公开的实施例中描述的各方法步骤和模块,能够以软件、硬件、固件或者其任意组合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各实施例的步骤及组成。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that, in combination with the method steps and modules described in the embodiments disclosed herein, they can be implemented in software, hardware, firmware or any combination thereof, in order to clearly illustrate the interoperability of hardware and software Alternatively, the steps and components of each embodiment have been generally described in terms of their functions in the foregoing description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Persons of ordinary skill in the art may use different methods of implementing the described functionality for each particular application, but such implementations should not be considered beyond the scope of this application.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,该程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium can be read-only memory, magnetic disk or optical disk, etc.
当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机程序指令。作为示例,本申请实施例的方法可以在机器可执行指令的上下文中被描述,机器可执行指令诸如包括在目标的真实或者虚拟处理器上的器件中执行的程序模块中。一般而言,程序模块包括例程、程序、库、对象、类、组件、数据结构等,其执行特定的任务或者实现特定的抽象数据结构。在各实施例中,程序模块的功能可以在所描述的程序模块之间合并或者分割。用于程序模块的机器可执行指令可以在本地或者分布式设备内执行。在分布式设备中,程序模块可以位于本地和远程存储介质二者中。When implemented in software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer program instructions. As an example, the methods of the embodiments of the present application may be described in the context of machine-executable instructions, such as included in program modules executed in a device on a target's real or virtual processor. Generally, program modules include routines, programs, libraries, objects, classes, components, data structures, etc. that perform particular tasks or implement particular abstract data structures. In various embodiments, the functionality of the program modules may be combined or divided among the described program modules. Machine-executable instructions for program modules may be executed within local or distributed devices. In a distributed facility, program modules may be located in both local and remote storage media.
用于实现本申请实施例的方法的计算机程序代码可以用一种或多种编程语言编写。这些计算机程序代码可以提供给通用计算机、专用计算机或其他可编程的数据处理装置的处理器,使得程序代码在被计算机或其他可编程的数据处理装置执行的时候,引起在流程图和/或框图中规定的功能/操作被实施。程序代码可以完全在计算机上、部分在计算机上、作为独立的软件包、部分在计算机上且部分在远程计算机上或完全在远程计算机或服务器上执行。Computer program code for implementing the methods of the embodiments of the present application may be written in one or more programming languages. Such computer program code may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus such that the program code, when executed by the computer or other programmable data processing apparatus, causes the flowchart and/or block diagrams The functions/operations specified in are implemented. The program code may execute entirely on the computer, partly on the computer, as a stand-alone software package, partly on the computer and partly on a remote computer or entirely on the remote computer or server.
在本申请实施例的上下文中,计算机程序代码或者相关数据可以由任意适当载体承载,以使得设备、装置或者处理器能够执行上文描述的各种处理和操作。载体的示例包括信号、计算机可读介质等等。In the context of embodiments of the present application, computer program code or related data may be carried by any suitable carrier to enable a device, apparatus or processor to perform the various processes and operations described above. Examples of carriers include signals, computer-readable media, and the like.
信号的示例可以包括电、光、无线电、声音或其它形式的传播信号,诸如载波、红外信号等。Examples of signals may include electrical, optical, radio, acoustic, or other forms of propagated signals, such as carrier waves, infrared signals, and the like.
机器可读介质可以是包含或存储用于或有关于指令执行系统、装置或设备的程序的任何有形介质。机器可读介质可以是机器可读信号介质或机器可读存储介质。机器可读介质可以包括但不限于电子的、磁的、光学的、电磁的、红外的或半导体系统、装置或设备,或其任意合适的组合。机器可读存储介质的更详细示例包括带有一根或多根导线的电气连接、便携式计算机磁盘、硬盘、随机存储存取器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或闪存)、光存储设备、磁存储设备,或其任意合适的组合。A machine-readable medium may be any tangible medium that contains or stores a program for or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination thereof. More detailed examples of machine-readable storage media include electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only Memory (EPROM or flash memory), optical storage devices, magnetic storage devices, or any suitable combination thereof.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的系统、设备和模块的具体工作过程,可以参见前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, for the specific working process of the above-described systems, devices and modules, reference may be made to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、设备和方法,可以通过其它的方式实现。例如,以上所描述的设备实施例仅仅是示意性的,例如,该模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、设备或模块的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other manners. For example, the device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components may be combined or Integration into another system, or some features can be ignored, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or modules, and may also be electrical, mechanical or other forms of connection.
该作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本申请实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, may be located in one place, or may be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solutions of the embodiments of the present application.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以是两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically alone, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules.
该集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例中方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application are essentially or part of contributions to the prior art, or all or part of the technical solutions can be embodied in the form of software products, and the computer software products are stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .
本申请中术语“第一”“第二”等字样用于对作用和功能基本相同的相同项或相似项进行区分,应理解,“第一”、“第二”、“第n”之间不具有逻辑或时序上的依赖关系,也不对数量 和执行顺序进行限定。还应理解,尽管以下描述使用术语第一、第二等来描述各种元素,但这些元素不应受术语的限制。这些术语只是用于将一元素与另一元素区别分开。In this application, the terms "first", "second" and other words are used to distinguish the same or similar items with basically the same function and function, and it should be understood that between "first", "second" and "nth" There are no logical or timing dependencies, and no restrictions on the number and execution order. It will also be understood that, although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another.
还应理解,在本申请的各个实施例中,各个过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should also be understood that, in each embodiment of the present application, the size of the sequence number of each process does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not be used in the embodiment of the present application. Implementation constitutes any limitation.
本申请中术语“至少一个”的含义是指一个或多个,本申请中术语“多个”的含义是指两个或两个以上,例如,多个第二报文是指两个或两个以上的第二报文。本文中术语“系统”和“网络”经常可互换使用。In this application, the meaning of the term "at least one" refers to one or more, and the meaning of the term "plurality" in this application refers to two or more. For example, a plurality of second messages refers to two or more more than one second message. The terms "system" and "network" are often used interchangeably herein.
应理解,在本文中对各种所述示例的描述中所使用的术语只是为了描述特定示例,而并非旨在进行限制。如在对各种所述示例的描述和所附权利要求书中所使用的那样,单数形式“一个(“a”,“an”)”和“该”旨在也包括复数形式,除非上下文另外明确地指示。It is to be understood that the terminology used in describing the various described examples herein is for the purpose of describing particular examples and is not intended to be limiting. As used in the description of the various described examples and the appended claims, the singular forms "a", "an")" and "the" are intended to include the plural forms as well, unless the context dictates otherwise. clearly instructed.
还应理解,本文中所使用的术语“和/或”是指并且涵盖相关联的所列出的项目中的一个或多个项目的任何和全部可能的组合。术语“和/或”,是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本申请中的字符“/”,一般表示前后关联对象是一种“或”的关系。It will also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. The term "and/or" is an association relationship that describes an associated object, indicating that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist simultaneously, and B exists alone. a situation. In addition, the character "/" in this application generally indicates that the related objects are an "or" relationship.
还应理解,术语“包括”(也称“includes”、“including”、“comprises”和/或“comprising”)当在本说明书中使用时指定存在所陈述的特征、整数、步骤、操作、元素、和/或部件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元素、部件、和/或其分组。It will also be understood that the term "includes" (also referred to as "includes", "including", "comprises" and/or "comprising") when used in this specification designates the presence of stated features, integers, steps, operations, elements , and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groupings thereof.
还应理解,术语“若”和“如果”可被解释为意指“当...时”(“when”或“upon”)或“响应于确定”或“响应于检测到”。类似地,根据上下文,短语“若确定...”或“若检测到[所陈述的条件或事件]”可被解释为意指“在确定...时”或“响应于确定...”或“在检测到[所陈述的条件或事件]时”或“响应于检测到[所陈述的条件或事件]”。It should also be understood that the terms "if" and "if" may be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting." Similarly, depending on the context, the phrases "if it is determined..." or "if the [stated condition or event] is detected" can be interpreted to mean "when determining..." or "in response to determining... ” or “on detection of [recited condition or event]” or “in response to detection of [recited condition or event]”.
应理解,根据A确定B并不意味着仅仅根据A确定B,还可以根据A和/或其它信息确定B。It should be understood that determining B according to A does not mean that B is only determined according to A, and B may also be determined according to A and/or other information.
还应理解,说明书通篇中提到的“一个实施例”、“一实施例”、“一种可能的实现方式”意味着与实施例或实现方式有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”、“一种可能的实现方式”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。It should also be understood that references throughout the specification to "one embodiment," "an embodiment," and "one possible implementation" mean that a particular feature, structure, or characteristic associated with the embodiment or implementation is included herein. in at least one embodiment of the application. Thus, appearances of "in one embodiment" or "in an embodiment" or "one possible implementation" in various places throughout this specification are not necessarily necessarily referring to the same embodiment. Furthermore, the particular features, structures or characteristics may be combined in any suitable manner in one or more embodiments.
以上描述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above descriptions are only optional embodiments of the present application, and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application. within.

Claims (29)

  1. 一种数据格式的转换方法,其特征在于,包括:A method for converting data formats, comprising:
    设备获得源数据和映射信息,所述映射信息为基于业务需求获取得到;The device obtains source data and mapping information, and the mapping information is obtained based on business requirements;
    所述设备基于所述映射信息和所述源数据得到目标数据,所述映射信息包括映射关系,所述映射关系包括所述源数据中的至少一个数据对象的第一位置信息与第二位置信息的对应关系;其中,所述第一位置信息为所述至少一个数据对象在所述源数据的数据结构中的位置,所述第二位置信息为所述至少一个数据对象在所述目标数据的数据结构中的位置,所述第二位置信息对应的位置中的数据对象包括所述第一位置信息对应的位置中的数据对象。The device obtains target data based on the mapping information and the source data, where the mapping information includes a mapping relationship, and the mapping relationship includes first position information and second position information of at least one data object in the source data The corresponding relationship; wherein, the first position information is the position of the at least one data object in the data structure of the source data, and the second position information is the at least one data object in the target data. The position in the data structure, the data object in the position corresponding to the second position information includes the data object in the position corresponding to the first position information.
  2. 根据权利要求1所述的方法,其特征在于,所述映射信息还包括信息标识以及转换模式信息;The method according to claim 1, wherein the mapping information further comprises information identification and conversion mode information;
    所述信息标识用于标识所述映射信息;The information identifier is used to identify the mapping information;
    所述转换模式信息用于指示转换模式、所述源数据的格式以及所述目标数据的格式,所述转换模式用于指示由所述源数据的格式转换到所述目标数据的格式。The conversion mode information is used to indicate a conversion mode, the format of the source data, and the format of the target data, and the conversion mode is used to indicate the conversion from the format of the source data to the format of the target data.
  3. 根据权利要求1或2所述的方法,其特征在于,所述源数据的格式为面向对象数据格式,所述目标数据的格式为二维数据格式,所述映射信息用于将所述面向对象数据格式的源数据转换成所述二维数据格式的目标数据。The method according to claim 1 or 2, wherein the format of the source data is an object-oriented data format, the format of the target data is a two-dimensional data format, and the mapping information is used to convert the object-oriented data The source data in the data format is converted into the target data in the two-dimensional data format.
  4. 根据权利要求3所述的方法,其特征在于,所述映射关系包括标题列以及与所述标题列对应的属性路径,所述第一位置信息包括所述属性路径,所述第二位置信息包括所述标题列;The method according to claim 3, wherein the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the attribute path, and the second position information includes the title column;
    所述设备基于所述映射信息和所述源数据得到目标数据,包括:The device obtains target data based on the mapping information and the source data, including:
    所述设备基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据。The device generates target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data.
  5. 根据权利要求4所述的方法,其特征在于,所述设备基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据,包括:The method according to claim 4, wherein the device generates the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data, comprising:
    所述设备从所述映射关系中获取第一标题列,根据所述第一标题列生成第一标题数组,所述第一标题数组包括所述属性路径、数组计数值以及所述属性路径在所述第一标题数组下的数量值;The device obtains the first title column from the mapping relationship, and generates a first title array according to the first title column, where the first title array includes the attribute path, the array count value, and where the attribute path is located. Describe the quantity value under the first title array;
    基于所述数组计数值以及所述数量值确定所述属性路径不是所述第一标题数组下的最后一个属性路径,将所述第一标题数组对应的属性路径按照所述数组计数值从所述源数据中获取数据对象并输出为所述二维数据格式的目标数据的一行。Based on the array count value and the quantity value, it is determined that the attribute path is not the last attribute path under the first title array, and the attribute path corresponding to the first title array is converted from the A data object is obtained from the source data and output as a row of the target data in the two-dimensional data format.
  6. 根据权利要求1或2所述的方法,其特征在于,所述源数据的格式为二维数据格式,所述目标数据的格式为面向对象数据格式,所述映射信息用于将所述二维数据格式的源数据转换成所述面向对象数据格式的目标数据。The method according to claim 1 or 2, wherein the format of the source data is a two-dimensional data format, the format of the target data is an object-oriented data format, and the mapping information is used to convert the two-dimensional data The source data in the data format is converted into the target data in the object-oriented data format.
  7. 根据权利要求6所述的方法,其特征在于,所述映射关系包括标题列以及与所述标题列对应的属性路径,所述第一位置信息包括所述标题列,所述第二位置信息包括所述属性路径;The method according to claim 6, wherein the mapping relationship includes a title column and an attribute path corresponding to the title column, the first location information includes the title column, and the second location information includes the property path;
    所述设备基于所述映射信息和所述源数据得到目标数据,包括:The device obtains target data based on the mapping information and the source data, including:
    所述设备基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据。The device generates target data based on the title column in the mapping relationship, the attribute path corresponding to the title column, and the source data.
  8. 根据权利要求7所述的方法,其特征在于,所述设备基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据,包括:The method according to claim 7, wherein the device generates the target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data, comprising:
    所述设备从所述映射关系中获取第二标题列,根据所述第二标题列生成第二标题数组,所述第二标题数组包括属性路径以及数组计数值;The device obtains a second title column from the mapping relationship, and generates a second title array according to the second title column, where the second title array includes an attribute path and an array count value;
    响应于所述源数据的当前行小于总行数,将所述源数据中当前行指示的数据对象按照所述属性路径和所述数组计数值指定的位置填入所述目标数据的数据结构中。In response to the current row of the source data being less than the total number of rows, the data object indicated by the current row in the source data is filled into the data structure of the target data according to the location specified by the attribute path and the array count value.
  9. 根据权利要求1-8任一所述的方法,其特征在于,所述业务需求包括用于获取所述映射信息的关联信息;The method according to any one of claims 1-8, wherein the business requirement includes association information for acquiring the mapping information;
    所述获得映射信息,所述映射信息为基于业务需求获取得到,包括:基于所述业务需求中的所述关联信息获取所述映射信息。The obtaining of the mapping information, where the mapping information is obtained based on business requirements, includes: acquiring the mapping information based on the association information in the business requirements.
  10. 根据权利要求9所述的方法,其特征在于,所述关联信息包括所述映射信息的信息标识。The method according to claim 9, wherein the associated information includes an information identifier of the mapping information.
  11. 根据权利要求1-8任一所述的方法,其特征在于,所述获得映射信息,所述映射信息为基于业务需求获取得到,包括:基于所述业务需求获取用户指定的映射信息或者默认的映射信息。The method according to any one of claims 1-8, wherein the obtaining mapping information is obtained based on business requirements, comprising: obtaining user-specified mapping information or default mapping information based on the business requirements mapping information.
  12. 根据权利要求1-11任一所述的方法,其特征在于,所述源数据的格式为Javascript对象表示法JSON格式,所述目标数据的格式为逗号分隔值CSV格式,或The method according to any one of claims 1-11, wherein the source data is in a Javascript Object Notation JSON format, and the target data is in a comma-separated value CSV format, or
    所述源数据的格式为CSV格式,所述目标数据的格式为JSON格式。The format of the source data is CSV format, and the format of the target data is JSON format.
  13. 根据权利要求1-12任一所述的方法,其特征在于,所述设备的类型包括网络管理系统、软件定义网络SDN控制器网元设备、终端和服务器中的至少一种。The method according to any one of claims 1-12, wherein the type of the device includes at least one of a network management system, a software-defined network SDN controller network element device, a terminal, and a server.
  14. 一种数据格式的转换装置,其特征在于,包括:A conversion device of a data format, comprising:
    获取模块,用于获得源数据和映射信息,所述映射信息为基于业务需求获取得到;an acquisition module for acquiring source data and mapping information, where the mapping information is acquired based on business requirements;
    转换模块,用于基于所述映射信息和所述源数据得到目标数据,所述映射信息包括映射关系,所述映射关系包括所述源数据中的至少一个数据对象的第一位置信息与第二位置信息的对应关系;其中,所述第一位置信息为所述至少一个数据对象在所述源数据的数据结构中的位置,所述第二位置信息为所述至少一个数据对象在所述目标数据的数据结构中的位 置,所述第二位置信息对应的位置中的数据对象包括所述第一位置信息对应的位置中的数据对象。A conversion module, configured to obtain target data based on the mapping information and the source data, where the mapping information includes a mapping relationship, and the mapping relationship includes first position information and second position information of at least one data object in the source data Corresponding relationship of location information; wherein, the first location information is the location of the at least one data object in the data structure of the source data, and the second location information is the at least one data object in the target The position in the data structure of the data, the data object in the position corresponding to the second position information includes the data object in the position corresponding to the first position information.
  15. 根据权利要求14所述的装置,其特征在于,所述映射信息还包括信息标识以及转换模式信息;The apparatus according to claim 14, wherein the mapping information further comprises information identification and conversion mode information;
    所述信息标识用于标识所述映射信息;The information identifier is used to identify the mapping information;
    所述转换模式信息用于指示转换模式、所述源数据的格式以及所述目标数据的格式,所述转换模式用于指示由所述源数据的格式转换到所述目标数据的格式。The conversion mode information is used to indicate a conversion mode, the format of the source data, and the format of the target data, and the conversion mode is used to indicate the conversion from the format of the source data to the format of the target data.
  16. 根据权利要求14或15所述的装置,其特征在于,所述源数据的格式为面向对象数据格式,所述目标数据的格式为二维数据格式,所述映射信息用于将所述面向对象数据格式的源数据转换成所述二维数据格式的目标数据。The apparatus according to claim 14 or 15, wherein the source data is in an object-oriented data format, the target data is in a two-dimensional data format, and the mapping information is used to convert the object-oriented data The source data in the data format is converted into the target data in the two-dimensional data format.
  17. 根据权利要求16所述的装置,其特征在于,所述映射关系包括标题列以及与所述标题列对应的属性路径,所述第一位置信息包括所述属性路径,所述第二位置信息包括所述标题列;The apparatus according to claim 16, wherein the mapping relationship includes a title column and an attribute path corresponding to the title column, the first position information includes the attribute path, and the second position information includes the title column;
    所述转换模块,用于基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据。The conversion module is configured to generate target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
  18. 根据权利要求17所述的装置,其特征在于,所述转换模块,用于从所述映射关系中获取第一标题列,根据所述第一标题列生成第一标题数组,所述第一标题数组包括所述属性路径、数组计数值以及所述属性路径在所述第一标题数组下的数量值;基于所述数组计数值以及所述数量值确定所述属性路径不是所述第一标题数组下的最后一个属性路径,将所述第一标题数组对应的属性路径按照所述数组计数值从所述源数据中获取数据对象并输出为所述二维数据格式的目标数据的一行。The apparatus according to claim 17, wherein the conversion module is configured to obtain a first title column from the mapping relationship, and generate a first title array according to the first title column, and the first title The array includes the attribute path, an array count value, and a quantity value of the attribute path under the first title array; determining that the attribute path is not the first title array based on the array count value and the quantity value In the last attribute path below, the attribute path corresponding to the first title array is to obtain a data object from the source data according to the array count value and output it as a row of the target data in the two-dimensional data format.
  19. 根据权利要求14或15所述的装置,其特征在于,所述源数据的格式为二维数据格式,所述目标数据的格式为面向对象数据格式,所述映射信息用于将所述二维数据格式的源数据转换成所述面向对象数据格式的目标数据。The device according to claim 14 or 15, wherein the format of the source data is a two-dimensional data format, the format of the target data is an object-oriented data format, and the mapping information is used to convert the two-dimensional data format. The source data in the data format is converted into the target data in the object-oriented data format.
  20. 根据权利要求19所述的装置,其特征在于,所述映射关系包括标题列以及与所述标题列对应的属性路径,所述第一位置信息包括所述标题列,所述第二位置信息包括所述属性路径;The apparatus according to claim 19, wherein the mapping relationship includes a title column and an attribute path corresponding to the title column, the first location information includes the title column, and the second location information includes the property path;
    所述转换模块,用于基于所述映射关系中的标题列、所述标题列对应的属性路径和所述源数据生成目标数据。The conversion module is configured to generate target data based on the title column in the mapping relationship, the attribute path corresponding to the title column and the source data.
  21. 根据权利要求20所述的装置,其特征在于,所述转换模块,用于从所述映射关系中获取第二标题列,根据所述第二标题列生成第二标题数组,所述第二标题数组包括属性路径以及数组计数值;响应于所述源数据的当前行小于总行数,将所述源数据中当前行指示的数据 对象按照所述属性路径和所述数组计数值指定的位置填入所述目标数据的数据结构中。The device according to claim 20, wherein the conversion module is configured to obtain a second title column from the mapping relationship, and generate a second title array according to the second title column, the second title The array includes a property path and an array count value; in response to the current row of the source data being less than the total number of rows, the data object indicated by the current row in the source data is filled in according to the location specified by the property path and the array count value in the data structure of the target data.
  22. 根据权利要求14-21任一所述的装置,其特征在于,所述业务需求包括用于获取所述映射信息的关联信息;The apparatus according to any one of claims 14-21, wherein the service requirement includes association information for acquiring the mapping information;
    所述获取模块,用于基于所述业务需求中的所述关联信息获取所述映射信息。The obtaining module is configured to obtain the mapping information based on the association information in the business requirement.
  23. 根据权利要求22所述的装置,其特征在于,所述关联信息包括所述映射信息的信息标识。The apparatus according to claim 22, wherein the association information includes an information identifier of the mapping information.
  24. 根据权利要求14-21任一所述的装置,其特征在于,所述获取模块,用于基于所述业务需求获取用户指定的映射信息或者默认的映射信息。The apparatus according to any one of claims 14-21, wherein the acquiring module is configured to acquire mapping information specified by a user or default mapping information based on the business requirement.
  25. 根据权利要求14-24任一所述的装置,其特征在于,所述源数据的格式为Javascript对象表示法JSON格式,所述目标数据的格式为逗号分隔值CSV格式,或所述源数据的格式为CSV格式,所述目标数据的格式为JSON格式。The device according to any one of claims 14-24, wherein the format of the source data is Javascript Object Notation JSON format, and the format of the target data is a comma-separated value CSV format, or the format of the source data is The format is CSV format, and the format of the target data is JSON format.
  26. 根据权利要求14-25任一所述的装置,其特征在于,所述设备的类型包括网络管理系统、软件定义网络SDN控制器网元设备、终端和服务器中的至少一种。The apparatus according to any one of claims 14-25, wherein the type of the device includes at least one of a network management system, a software-defined network SDN controller network element device, a terminal, and a server.
  27. 一种数据格式的转换设备,其特征在于,包括处理器及计算机程序,所述处理器执行所述计算机程序时,以使所述数据格式的转换设备实现权利要求1-13中任一所述的数据格式的转换方法。A data format conversion device, characterized in that it includes a processor and a computer program, and when the processor executes the computer program, the data format conversion device realizes any one of claims 1-13. The conversion method of the data format.
  28. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被计算机执行时,实现权利要求1-13中任一所述的数据格式的转换方法。A computer-readable storage medium on which a computer program is stored, characterized in that, when the computer program is executed by a computer, the data format conversion method according to any one of claims 1-13 is implemented.
  29. 一种计算机程序产品,其特征在于,包括计算机程序,所述计算机程序被计算机执行时,实现权利要求1-13中任一所述的数据格式的转换方法。A computer program product is characterized in that it includes a computer program, and when the computer program is executed by a computer, the data format conversion method according to any one of claims 1-13 is implemented.
PCT/CN2022/075563 2021-04-20 2022-02-08 Data format conversion method and apparatus, device, and computer-readable storage medium WO2022222577A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202110423829 2021-04-20
CN202110423829.2 2021-04-20
CN202110518463.7A CN115221113A (en) 2021-04-20 2021-05-12 Data format conversion method, device, equipment and computer readable storage medium
CN202110518463.7 2021-05-12

Publications (1)

Publication Number Publication Date
WO2022222577A1 true WO2022222577A1 (en) 2022-10-27

Family

ID=83606495

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/075563 WO2022222577A1 (en) 2021-04-20 2022-02-08 Data format conversion method and apparatus, device, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN115221113A (en)
WO (1) WO2022222577A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116383883A (en) * 2023-04-14 2023-07-04 于诚优品信息科技(福州)有限责任公司 Big data-based data management authority processing method and system
CN116522871A (en) * 2023-07-05 2023-08-01 鹏城实验室 Data format conversion method, device, equipment and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115543485B (en) * 2022-10-24 2023-06-30 清华大学 Data conversion configuration generation method, device, computer equipment and medium
CN115659941B (en) * 2022-11-11 2023-07-21 摩尔线程智能科技(北京)有限责任公司 File generation method and device suitable for multiple types of interfaces

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6754670B1 (en) * 1999-12-17 2004-06-22 International Business Machines Corporation Mapping relational tables to object oriented classes
CN1687927A (en) * 2005-05-08 2005-10-26 浙江大学 Method for implementing automatic exchange of information system data
US20060004844A1 (en) * 2003-04-28 2006-01-05 Microsoft Corporation Management of markup language data mappings available to a spreadsheet application workbook
CN102662997A (en) * 2012-03-15 2012-09-12 北京播思软件技术有限公司 Method of storing XML data into relational database
CN103559322A (en) * 2013-11-22 2014-02-05 方正国际软件有限公司 Document format conversion method
CN105867886A (en) * 2015-01-19 2016-08-17 阿里巴巴集团控股有限公司 Method and device for writing table
CN111507075A (en) * 2019-01-31 2020-08-07 贵州白山云科技股份有限公司 Method and device for data format conversion
CN111984739A (en) * 2019-05-24 2020-11-24 中移(苏州)软件技术有限公司 Conversion method, terminal and storage medium for XML and relational database

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6754670B1 (en) * 1999-12-17 2004-06-22 International Business Machines Corporation Mapping relational tables to object oriented classes
US20060004844A1 (en) * 2003-04-28 2006-01-05 Microsoft Corporation Management of markup language data mappings available to a spreadsheet application workbook
CN1687927A (en) * 2005-05-08 2005-10-26 浙江大学 Method for implementing automatic exchange of information system data
CN102662997A (en) * 2012-03-15 2012-09-12 北京播思软件技术有限公司 Method of storing XML data into relational database
CN103559322A (en) * 2013-11-22 2014-02-05 方正国际软件有限公司 Document format conversion method
CN105867886A (en) * 2015-01-19 2016-08-17 阿里巴巴集团控股有限公司 Method and device for writing table
CN111507075A (en) * 2019-01-31 2020-08-07 贵州白山云科技股份有限公司 Method and device for data format conversion
CN111984739A (en) * 2019-05-24 2020-11-24 中移(苏州)软件技术有限公司 Conversion method, terminal and storage medium for XML and relational database

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116383883A (en) * 2023-04-14 2023-07-04 于诚优品信息科技(福州)有限责任公司 Big data-based data management authority processing method and system
CN116383883B (en) * 2023-04-14 2023-12-22 水发科技信息(山东)有限公司 Big data-based data management authority processing method and system
CN116522871A (en) * 2023-07-05 2023-08-01 鹏城实验室 Data format conversion method, device, equipment and storage medium
CN116522871B (en) * 2023-07-05 2024-01-09 鹏城实验室 Data format conversion method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN115221113A (en) 2022-10-21

Similar Documents

Publication Publication Date Title
WO2022222577A1 (en) Data format conversion method and apparatus, device, and computer-readable storage medium
US9621685B2 (en) Architecture for an access network system management protocol control under heterogeneous network management environment
CN111865810B (en) Congestion information acquisition method, system, related equipment and computer storage medium
EP4149058A1 (en) Network performance measurement method, apparatus, device and system, and storage medium
WO2021185083A1 (en) Vnf instantiation method and device
CN117240790A (en) Flow table rule management method, flow management system and storage medium
CN109286564B (en) Message forwarding method and device
CN114697403A (en) Method, device, equipment, system and storage medium for processing service message
CN114285757A (en) Network simulation method, device, equipment and computer readable storage medium
WO2023179457A1 (en) Method, apparatus and system for identifying service connection, and storage medium
CN112272933B (en) Queue control method, device and storage medium
WO2022042403A1 (en) Method for generating routing information, method for sending location information, method for forwarding message, and device
CN116962161A (en) Path detection method, device, system and computer readable storage medium
CN116828024A (en) Service connection identification method, device, system and storage medium
CN115914087A (en) Message forwarding method, device, equipment, system and storage medium
CN114205172A (en) Table item issuing method and message forwarding method
CN114826898A (en) Cross-host communication method, device, equipment, system and readable storage medium
CN115842757A (en) Stream following detection method, device, equipment, system and storage medium
CN114327850A (en) Service grid system based on micro-service and service management method
CN114513485A (en) Method, device, equipment and system for obtaining mapping rule and readable storage medium
WO2022048482A1 (en) Message processing method and apparatus, device, system, and storage medium
CN114697218B (en) Network management method and device
US20240056383A1 (en) Packet transmission method, apparatus, and device
CN117768292A (en) Management method, device and system of logic binding port and storage medium
CN115225610A (en) Method, device and equipment for configuring address and computer readable storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22790687

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22790687

Country of ref document: EP

Kind code of ref document: A1