CN106951404B - Data format conversion method and device - Google Patents

Data format conversion method and device Download PDF

Info

Publication number
CN106951404B
CN106951404B CN201710174825.9A CN201710174825A CN106951404B CN 106951404 B CN106951404 B CN 106951404B CN 201710174825 A CN201710174825 A CN 201710174825A CN 106951404 B CN106951404 B CN 106951404B
Authority
CN
China
Prior art keywords
code table
version information
product information
conversion rule
onix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710174825.9A
Other languages
Chinese (zh)
Other versions
CN106951404A (en
Inventor
王帅
杨勇
魏超鹏
李岩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING JETSEN TECHNOLOGY CO LTD
Original Assignee
BEIJING JETSEN TECHNOLOGY CO LTD
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING JETSEN TECHNOLOGY CO LTD filed Critical BEIJING JETSEN TECHNOLOGY CO LTD
Priority to CN201710174825.9A priority Critical patent/CN106951404B/en
Publication of CN106951404A publication Critical patent/CN106951404A/en
Application granted granted Critical
Publication of CN106951404B publication Critical patent/CN106951404B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • 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/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • G06F16/1794Details of file format conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Document Processing Apparatus (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a data format conversion method and a data format conversion device, wherein a data format conversion request is received; based on the determined XML file conversion rule matched with the ONIX standard version information and the CNONIX standard version information and the determined code table set conversion rule matched with the ONIX code table version information and the CNONIX code table version information, the data format of the publication product information based on the CNONIX standard version information is converted to obtain the publication product information based on the ONIX standard version information, so that the purpose of converting the publication product information based on the CNONIX standard version information into the publication product information based on the ONIX standard version information is achieved, and the export trade of the publication product is facilitated.

Description

Data format conversion method and device
Technical Field
The invention relates to the technical field of digital publishing, in particular to a data format conversion method and device.
Background
At present, the ONIX (Online Information Exchange) standard is widely applied to global publishing trade, and the ONIX standard is a set of international universal publication product Information Exchange format standards and aims to provide a uniform publication product Information format for all participants in industrial chains such as book publishers, wholesalers, retailers, internet booksellers and the like so as to solve the problem caused by the coexistence of multiple data formats among various organizations and the Exchange of publication product Information.
CNONIX (CN Online Information Exchange, chinese Online Information Exchange) is a set of published product Information Exchange format standards developed according to international universal ONIX standards and applicable to the chinese situation, which is being gradually popularized and used in the domestic publishing industry.
In view of the above, it is an urgent need to provide a data format conversion method and apparatus for converting the publication product information based on the CNONIX standard version information into the publication product information based on the ONIX standard version information, thereby facilitating the export trade of the publication product.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data format conversion method and apparatus, so as to facilitate export trade of a publication product by converting publication product information based on CNONIX standard version information into publication product information based on ONIX standard version information.
In order to achieve the above purpose, the technical solutions provided by the embodiments of the present invention are as follows:
a data format conversion method, comprising:
receiving a data format conversion request indicating ONIX standard version information, publication product information based on CNONIX standard version information, ONIX code table version information corresponding to the ONIX standard version information, and CNONIX code table version information corresponding to the CNONIX standard version information;
determining an XML file conversion rule matched with the ONIX standard version information and the CNONIX standard version information from at least one preset XML file conversion rule;
determining a code table set conversion rule matched with the ONIX code table version information and the CNONIX code table version information from at least one preset code table set conversion rule;
and converting the data format of the publication product information based on the determined XML file conversion rule and the code table set conversion rule to obtain the publication product information based on the ONIX standard version information.
Preferably, the converting the data format of the publication product information based on the determined XML file conversion rule and the code table set conversion rule to obtain the publication product information based on the ONIX standard version information includes:
converting the data format of the publication product information based on the determined XML file conversion rule to obtain first publication product information based on the ONIX standard version information;
and converting the data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information.
Preferably, the publication product information includes data elements, and data items corresponding to the data elements indicate data item attributes, where the data item attributes are optional attributes or mandatory attributes; the determined XML file conversion rule indicates that there is a target data element,
the converting the data format of the publication product information based on the determined XML file conversion rule to obtain the first publication product information based on the ONIX standard version information includes:
s1, determining whether the target data element exists in the publication product information; if so, go to step S2;
s2, determining whether the data item attribute corresponding to the target data element is a mandatory fill attribute; if the data item attribute corresponding to the target data element is the mandatory fill attribute, executing step S3; if the data item attribute corresponding to the target data element is an optional attribute, executing step S4;
s3, the data element of the upper compound of the target data element is used as a new target data element, and the step S2 is executed again;
s4, deleting the target data element and all the sub data elements thereof from the publication product information.
Preferably, the determined code table set conversion rule indicates that there is a masked code table and a masked code value,
the converting the data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information includes:
s1, acquiring a code table adopted in the first publication product information as a data element of the mask code table, and acquiring a code value adopted in the first publication product information as a data element of the mask code value;
s2, determining whether the attribute of the data item corresponding to the acquired data element is a mandatory filling attribute; if the data item attribute corresponding to the acquired data element is the mandatory fill attribute, go to step S3; if the attribute of the data item corresponding to the acquired data element is an optional attribute, executing step S4;
s3, re-executing step S2 with the data element of the acquired data element superordinate composite as a new acquired data element;
s4, deleting the acquired data elements and all the sub data elements thereof from the first publication product information.
Preferably, the determined generating method of the XML file conversion rule includes:
acquiring a first schema corresponding to the ONIX standard version information and a second schema corresponding to the CNONIX standard version information;
converting the first schema into a first XML standard file and converting the second schema into a second XML standard file;
and generating the determined XML file conversion rule according to the structural difference between the first XML standard file and the second XML standard file.
Preferably, the generating method of the determined code table set conversion rule includes:
acquiring a first code table set which comprises at least one code table and corresponds to the ONIX code table version information, and a second code table set which comprises at least one code table and corresponds to the CNONIX code table version information;
converting the first code expression set into a third XML standard file and converting the second code expression set into a fourth XML standard file;
and generating the determined code table set conversion rule according to the structural difference between the third XML standard file and the fourth XML standard file.
A data format conversion apparatus comprising:
a data format conversion request receiving unit configured to receive a data format conversion request indicating ONIX standard version information, publication product information based on CNONIX standard version information, ONIX code table version information corresponding to the ONIX standard version information, and CNONIX code table version information corresponding to the CNONIX standard version information;
an XML file conversion rule determining unit, configured to determine, from at least one preset XML file conversion rule, an XML file conversion rule that matches the ONIX standard version information and the CNONIX standard version information;
a code table set conversion rule determining unit, configured to determine, from at least one preset code table set conversion rule, a code table set conversion rule that matches the ONIX code table version information and the CNONIX code table version information;
and the data format conversion unit is used for converting the data format of the publication product information based on the determined XML file conversion rule and the code table set conversion rule to obtain the publication product information based on the ONIX standard version information.
Preferably, the data format conversion unit includes:
the first data format conversion unit is used for converting the data format of the publication product information based on the determined XML file conversion rule to obtain first publication product information based on the ONIX standard version information;
and the second data format conversion unit is used for converting the data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information.
Preferably, the publication product information includes data elements, and data items corresponding to the data elements indicate data item attributes, where the data item attributes are optional attributes or mandatory attributes; the determined XML file conversion rule indicates that there is a target data element,
the first data format conversion unit includes:
a target data element for performing step S1, determining whether the target data element exists in the publication product information; if so, go to step S2;
a first fill-necessary attribute determining unit, configured to perform step S2, and determine whether the data item attribute corresponding to the target data element is a fill-necessary attribute; if the data item attribute corresponding to the target data element is the mandatory fill attribute, executing step S3; if the data item attribute corresponding to the target data element is an optional attribute, executing step S4;
a first determination unit for performing the step S3, re-performing the step S2 with the data element of the target data element upper-level composite as a new target data element;
a first deletion unit configured to perform step S4 of deleting the target data element and all the child data elements thereof from the publication product information.
Preferably, the determined code table set conversion rule indicates that there is a masked code table and a masked code value,
the second data format conversion unit includes:
a data element acquisition unit configured to execute step S1, acquire a code table employed in the first publication product information as a data element of the mask code table, and a code value employed in the first publication product information as a data element of the mask code value;
a second fill-necessary attribute determining unit, configured to perform step S2, and determine whether the attribute of the data item corresponding to the acquired data element is a fill-necessary attribute; if the data item attribute corresponding to the acquired data element is the mandatory fill attribute, go to step S3; if the attribute of the data item corresponding to the acquired data element is an optional attribute, executing step S4;
a second determination unit operable to execute step S3, re-execute step S2 with the acquired data element being an upper-level composite data element as a new acquired data element;
a second deletion unit configured to perform step S4 of deleting the acquired data elements and all the child data elements thereof from the first publication product information.
The embodiment of the application provides a data format conversion method and a data format conversion device, wherein a data format conversion request is received; based on the determined XML file conversion rule matched with the ONIX standard version information and the CNONIX standard version information and the determined code table set conversion rule matched with the ONIX code table version information and the CNONIX code table version information, the data format of the publication product information based on the CNONIX standard version information is converted to obtain the publication product information based on the ONIX standard version information, so that the purpose of converting the publication product information based on the CNONIX standard version information into the publication product information based on the ONIX standard version information is achieved, and the export trade of the publication product is facilitated.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a data format conversion method according to an embodiment of the present application;
fig. 2 is a flowchart of a method for converting a data format of the publication product information based on the determined XML file conversion rule and the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information according to an embodiment of the present application;
fig. 3 is a flowchart of a method for converting a data format of the publication product information based on the determined XML file conversion rule to obtain first publication product information based on the ONIX standard version information according to an embodiment of the present application;
fig. 4 is a flowchart of a method for converting a data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information according to an embodiment of the present application;
fig. 5 is a flowchart of a method for generating a determined XML document conversion rule according to an embodiment of the present application;
fig. 6 is a flowchart of a method for generating a determined conversion rule of a code table set according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a data format conversion device according to an embodiment of the present application.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example (b):
fig. 1 is a flowchart of a data format conversion method according to an embodiment of the present application.
As shown in fig. 1, the method includes:
s101, receiving a data format conversion request, wherein the data format conversion request indicates ONIX standard version information, publication product information based on CNONIX standard version information, ONIX code table version information corresponding to the ONIX standard version information, and CNONIX code table version information corresponding to the CNONIX standard version information;
optionally, the ONIX standard version information indicates a version of the ONIX standard (e.g., the ONIX standard version 3.0.2).
Optionally, the CNONIX standard version information indicates a version of the CNONIX standard (e.g., CNONIX standard version 1.0).
Optionally, the ONIX code table version information corresponding to the ONIX standard version information indicates: a version of an ONIX code table corresponding to the ONIX standard version information (e.g., an ONIX code table No. 32).
Optionally, version information of the CNONIX code table corresponding to the version information of the CNONIX standard indicates: a version of a CNONIX code table (e.g., CNONIX stage 1 code table) corresponding to the CNONIX standard version information.
Optionally, the publication product information based on the CNONIX standard version information is: publication product information generated based on the version of the CNONIX standard indicated by the CNONIX standard version information.
S102, determining an XML file conversion rule matched with the ONIX standard version information and the CNONIX standard version information from at least one preset XML file conversion rule;
optionally, at least one XML file conversion rule is preset; each preset XML file conversion rule corresponds to one ONIX standard version information and one CNONIX standard version information; and the first information corresponding to each preset XML file conversion rule is different from each other, and the first information is ONIX standard version information and CNONIX standard version information.
Optionally, determining an XML file conversion rule matching the ONIX standard version information and the CNONIX standard version information from at least one preset XML file conversion rule includes: and searching at least one preset XML file conversion rule for the corresponding ONIX standard version information as the ONIX standard version information indicated by the data format conversion request, and searching for a corresponding CNONIX standard version information as the XML file conversion rule of the CNONIX standard version information indicated by the data format conversion request, wherein the searched XML file conversion rule is the determined XML file conversion rule matched with the ONIX standard version information and the CNONIX standard version information.
S103, determining a code table set conversion rule matched with the ONIX code table version information and the CNONIX code table version information from at least one preset code table set conversion rule;
optionally, at least one code table set conversion rule is preset; each preset code table set conversion rule corresponds to one ONIX code table version information and one CNONIX code table version information; and second information corresponding to each preset code table set conversion rule is different from each other, and the second information is ONIX code table version information and CNONIX code table version information.
Optionally, determining a code table set conversion rule matching with the ONIX code table version information and the CNONIX code table version information from at least one preset code table set conversion rule includes: and searching at least one preset code table set conversion rule for the corresponding ONIX code table version information as the ONIX code table version information indicated by the data format conversion request, and searching a corresponding CNONIX code table version information as the code table set conversion rule of the CNONIX code table version information indicated by the data format conversion request, wherein the searched code table set conversion rule is the determined code table set conversion rule matched with the ONIX code table version information and the CNONIX code table version information.
S104, converting the data format of the publication product information based on the determined XML file conversion rule and the code table set conversion rule to obtain the publication product information based on the ONIX standard version information.
Optionally, the data format of the publication product information is converted based on the determined XML file conversion rule and the code table set conversion rule, so that the publication product information based on the ONIX standard version information indicated by the data format conversion request can be obtained.
The embodiment of the application provides a data format conversion method, which comprises the steps of receiving a data format conversion request; based on the determined XML file conversion rule matched with the ONIX standard version information and the CNONIX standard version information and the determined code table set conversion rule matched with the ONIX code table version information and the CNONIX code table version information, the data format of the publication product information based on the CNONIX standard version information is converted to obtain the publication product information based on the ONIX standard version information, so that the purpose of converting the publication product information based on the CNONIX standard version information into the publication product information based on the ONIX standard version information is achieved, and the export trade of the publication product is facilitated.
For more fully explaining a data format conversion method provided by the embodiment of the present application, a method for converting a data format of the publication product information based on the determined XML file conversion rule and the determined code table set conversion rule to obtain the publication product information based on the version information of the ONIX standard, which is provided by the embodiment of the present application, is described in detail with reference to fig. 2.
As shown in fig. 2, the method includes:
s201, converting the data format of the publication product information based on the determined XML file conversion rule to obtain first publication product information based on the ONIX standard version information;
optionally, the data format of the publication product information is converted based on the determined XML file conversion rule, so that the first publication product information based on the ONIX standard version information indicated by the data format conversion request can be obtained.
S202, converting the data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information.
Optionally, after the first publication product information is obtained in step S201, the obtained first publication product information needs to be further processed, and the specific manner of the processing is shown in step S202. Step S202 specifically includes: and converting the data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information indicated by the data format conversion request.
Through the above-mentioned conversion rule based on the determined XML file and the code table set provided by the embodiment of the present application, the data format of the publication product information is converted to obtain a further introduction of the publication product information method based on the ONIX standard version information, so that the data format conversion method provided by the embodiment of the present application is clearer and more complete, and is convenient for a person skilled in the art to understand.
Optionally, the publication product information includes data elements (the number of the data elements included in the publication product information is at least one), a data item corresponding to the data element indicates a data item attribute, and the data item attribute is an optional attribute or a mandatory attribute; the determined XML file conversion rule indicates that there is a target data element.
Accordingly, in order to more fully explain a data format conversion method provided in the embodiment of the present application, a method for converting the data format of the publication product information based on the determined XML file conversion rule to obtain the first publication product information based on the ONIX standard version information, which is provided in the embodiment of the present application, is described in detail with reference to fig. 3.
As shown in fig. 3, the method includes:
s301, determining whether the target data element exists in the publication product information; if yes, go to step S302;
optionally, determining whether a target data element indicated by the determined XML file conversion rule exists in the publication product information; if the target data element indicated by the determined XML file conversion rule exists in the publication product information, executing step S302; and if the target data element indicated by the determined XML file conversion rule does not exist in the publication product information, executing an ending flow.
S302, determining whether the data item attribute corresponding to the target data element is a mandatory filling attribute; if the data item attribute corresponding to the target data element is the mandatory fill attribute, executing step S303; if the data item attribute corresponding to the target data element is an optional attribute, executing step S304;
s303, taking the data element of the upper-level composite of the target data elements as a new target data element, and returning to execute the step S302;
optionally, if a target data element indicated by the determined XML file conversion rule exists in the publication product information, determining whether a data item attribute indicated by a data item corresponding to the target data element in the publication product information is a padding attribute, if the data item attribute indicated by the data item corresponding to the target data element in the publication product information is the padding attribute, taking a data element of a higher-level composite of the target data element as a new target data element, and re-executing step S302; if the data item attribute indicated by the data item corresponding to the target data element in the publication product information is an optional attribute (i.e., if the data item attribute indicated by the data item corresponding to the target data element in the publication product information is not a padding attribute), step S304 is performed.
S304, deleting the target data element and all the sub data elements thereof from the publication product information.
Optionally, the number of the target data elements indicated by the determined XML file conversion rule is at least one, and when the number of the target data elements indicated by the determined XML file conversion rule is multiple, steps S301 to S304 provided in this embodiment of the present application are performed once for each target data element.
It should be noted that, after the steps S301 to S304 provided in the embodiment of the present application are completed for the last target data element in the target data elements indicated by the determined XML file conversion rule, the current publication product information (the publication product information from which the target data element and all the child data elements thereof are deleted for the last time) is the obtained first publication product information based on the ONIX standard version information.
Through the above-mentioned conversion rule based on the determined XML file provided in the embodiment of the present application, the data format of the publication product information is converted to obtain a further introduction of the first publication product information method based on the ONIX standard version information, so that the data format conversion method provided in the embodiment of the present application is clearer and more complete, which is convenient for a person skilled in the art to understand.
Optionally, the determined code table set conversion rule indicates that there is a masked code table and a masked code value.
Accordingly, in order to more fully explain a data format conversion method provided in the embodiment of the present application, a method for converting a data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the version information of the ONIX standard, which is provided in the embodiment of the present application, is described in detail with reference to fig. 4.
As shown in fig. 4, the method includes:
s401, acquiring a code table adopted in the first publication product information as a data element of the mask code table, and acquiring a code value adopted in the first publication product information as a data element of the mask code value;
optionally, the steps S402-S403 are performed once for each acquired data element.
S402, determining whether the attribute of the data item corresponding to the acquired data element is a mandatory filling attribute; if the data item attribute corresponding to the acquired data element is the mandatory fill attribute, executing step S403; if the data item attribute corresponding to the acquired data element is an optional attribute, executing step S404;
s403, taking the data element of the acquired data element superior composite as a new acquired data element, and returning to execute the step S402;
optionally, determining whether a data item attribute indicated by a data item corresponding to the data element acquired in the first publication product information is a mandatory filling attribute; if the data item attribute indicated by the data item corresponding to the data element acquired in the first publication product information is a mandatory filling attribute, taking the data element of the acquired data element superior composite as a new acquired data element, and re-executing step S402; the data item attribute indicated by the data item corresponding to the data element acquired in the first publication product information is an optional attribute (i.e., the data item attribute indicated by the data item corresponding to the data element acquired in the first publication product information is not a padding attribute), and step S404 is executed.
S404, deleting the acquired data elements and all the sub data elements from the first publication product information.
Optionally, the steps S402-S404 are performed once for each acquired data element; when the steps S402-S404 are completed for the last acquired data element, the current first publication product information (the first publication product information of the acquired data element and all sub-data elements thereof deleted for the last time) is the obtained publication product information based on the ONIX standard version information.
By converting the data format of the first publication product information based on the determined code table set conversion rule provided by the embodiment of the application to obtain further introduction of the publication product information method based on the ONIX standard version information, the data format conversion method provided by the embodiment of the application is clearer and more complete, and is convenient for a person skilled in the art to understand.
For more fully explaining a data format conversion method provided in the embodiment of the present application, a detailed description will now be given of a method for generating a determined XML document conversion rule provided in the embodiment of the present application, please refer to fig. 5.
As shown in fig. 5, the method includes:
s501, acquiring a first schema corresponding to the ONIX standard version information and a second schema corresponding to the CNONIX standard version information;
optionally, a schema corresponding to the obtained ONIX standard version information is called a first schema; and the schema corresponding to the obtained CNONIX standard version information is called a second schema.
S502, converting the first schema into a first XML standard file, and converting the second schema into a second XML standard file;
optionally, the first schema may be converted into a first XML standard file and the second schema may be converted into a second XML standard file by using a preset document format conversion tool.
The above is only a preferred mode of the embodiment of the present application, and the inventor may arbitrarily set a specific implementation manner of "converting the first schema into the first XML standard file and converting the second schema into the second XML standard file" according to his own requirements, which is not limited herein.
S503, generating the determined XML file conversion rule according to the structural difference between the first XML standard file and the second XML standard file.
Optionally, generating the determined XML file conversion rule according to the structural difference between the first XML standard file and the second XML standard file includes: and determining the structural difference between the first XML standard file and the second XML standard file, and generating the determined XML file conversion rule according to the determined structural difference.
Optionally, if it is determined that an XML file conversion rule matching the ONIX standard version information and the CNONIX standard version information does not exist in at least one preset XML file conversion rule during the execution of step S102, before step S104 is executed, the XML file conversion rule matching the ONIX standard version information and the CNONIX standard version information is directly generated through steps S501 to S503 provided in this embodiment of the present application, and the generated XML file conversion rule is used as the XML file conversion rule determined in step S102 to execute step S104.
Through the further introduction of the method for generating the determined XML file conversion rule provided by the embodiment of the present application, the data format conversion method provided by the embodiment of the present application is clearer and more complete, which is convenient for the understanding of the skilled person in the art.
For more fully explaining a data format conversion method provided in the embodiment of the present application, a detailed description will now be given of a method for generating a determined code table set conversion rule provided in the embodiment of the present application, please refer to fig. 6.
As shown in fig. 6, the method includes:
s601, acquiring a first code table set which corresponds to the ONIX code table version information and comprises at least one code table, and a second code table set which corresponds to the CNONIX code table version information and comprises at least one code table;
s602, converting the first code table set into a third XML standard file, and converting the second code table set into a fourth XML standard file;
optionally, the third XML standard file includes at least one third sub XML standard file, and one third sub XML standard file is obtained by converting one code table in the first code table set by using the document format conversion tool. The third XML standard file includes a third sub XML standard file corresponding to each code table in the first code table set.
Correspondingly, the fourth XML standard file includes at least one fourth sub-XML standard file, and one fourth sub-XML standard file is obtained by converting one code table in the second code table set by using the document format conversion tool. And the fourth XML standard file comprises a fourth sub XML standard file corresponding to each code table in the second code table set.
Or, the third XML standard file is a file, and a third XML standard file is obtained by placing the content sets in each third sub-XML standard file in a file (the third XML standard file is the file with the content sets placed therein).
Or, the fourth XML standard file is a file, and a fourth XML standard file is obtained by placing the content sets in the fourth sub-XML standard files in a file (the fourth XML standard file is the file with the content sets placed therein).
The above is only a preferred mode of the embodiment of the present application, and the inventor may set a specific implementation manner of "converting the first code table set into the third XML standard file and converting the second code table set into the fourth XML standard file" at will according to his own needs, which is not limited herein.
S603, generating the determined code table set conversion rule according to the structural difference between the third XML standard file and the fourth XML standard file.
Optionally, generating the determined XML file conversion rule according to the structural difference between the third XML standard file and the fourth XML standard file includes: determining a structural difference between the third XML standard file and a fourth XML standard file; generating the determined code table set conversion rule according to the determined structural difference.
Alternatively, if it is determined during the execution of step S103 that there is no matching code table set conversion rule in at least one preset code table set conversion rule with the ONIX code table version information and the CNONIX code table version information, before executing step S104, directly generating a code table set conversion rule matching the ONIX code table version information and the CNONIX code table version information by using steps S601 to S603 provided in the embodiment of the present application, and executing step S104 by using the generated code table set conversion rule as the determined code table set conversion rule of step S103.
Through the further introduction of the method for generating the determined code table set conversion rule provided by the embodiment of the application, the data format conversion method provided by the embodiment of the application is clearer and more complete, and is convenient for a person skilled in the art to understand.
The method is described in detail in the embodiments disclosed above, and the method of the present invention can be implemented by various types of apparatuses, so that the present invention also discloses an apparatus, and the following detailed description will be given of specific embodiments.
Fig. 7 is a schematic structural diagram of a data format conversion device according to an embodiment of the present application.
As shown in fig. 7, the apparatus includes:
a data format conversion request receiving unit 71 configured to receive a data format conversion request indicating that there is ONIX standard version information, publication product information based on CNONIX standard version information, ONIX code table version information corresponding to the ONIX standard version information, and CNONIX code table version information corresponding to the CNONIX standard version information;
an XML file conversion rule determining unit 72, configured to determine, from at least one preset XML file conversion rule, an XML file conversion rule that matches the ONIX standard version information and the CNONIX standard version information;
a code table set conversion rule determining unit 73, configured to determine, from at least one preset code table set conversion rule, a code table set conversion rule that matches the ONIX code table version information and the CNONIX code table version information;
and a data format conversion unit 74, configured to convert the data format of the publication product information based on the determined XML file conversion rule and the code table set conversion rule, so as to obtain the publication product information based on the ONIX standard version information.
Optionally, the data format conversion unit includes:
the first data format conversion unit is used for converting the data format of the publication product information based on the determined XML file conversion rule to obtain first publication product information based on the ONIX standard version information;
and the second data format conversion unit is used for converting the data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information.
Optionally, the publication product information includes data elements, and data items corresponding to the data elements indicate data item attributes, where the data item attributes are optional attributes or mandatory fill attributes; the determined XML file conversion rule indicates that there is a target data element,
the first data format conversion unit includes:
a target data element for performing step S1, determining whether the target data element exists in the publication product information; if so, go to step S2;
a first fill-necessary attribute determining unit, configured to perform step S2, and determine whether the data item attribute corresponding to the target data element is a fill-necessary attribute; if the data item attribute corresponding to the target data element is the mandatory fill attribute, executing step S3; if the data item attribute corresponding to the target data element is an optional attribute, executing step S4;
a first determination unit for performing the step S3, re-performing the step S2 with the data element of the target data element upper-level composite as a new target data element;
a first deletion unit configured to perform step S4 of deleting the target data element and all the child data elements thereof from the publication product information.
Optionally, the determined code table set conversion rule indicates that there is a masked code table and a masked code value,
the second data format conversion unit includes:
a data element acquisition unit configured to execute step S1, acquire a code table employed in the first publication product information as a data element of the mask code table, and a code value employed in the first publication product information as a data element of the mask code value;
a second fill-necessary attribute determining unit, configured to perform step S2, and determine whether the attribute of the data item corresponding to the acquired data element is a fill-necessary attribute; if the data item attribute corresponding to the acquired data element is the mandatory fill attribute, go to step S3; if the attribute of the data item corresponding to the acquired data element is an optional attribute, executing step S4;
a second determination unit operable to execute step S3, re-execute step S2 with the acquired data element being an upper-level composite data element as a new acquired data element;
a second deletion unit configured to perform step S4 of deleting the acquired data elements and all the child data elements thereof from the first publication product information.
The embodiment of the application provides a data format conversion device, which receives a data format conversion request; based on the determined XML file conversion rule matched with the ONIX standard version information and the CNONIX standard version information and the determined code table set conversion rule matched with the ONIX code table version information and the CNONIX code table version information, the data format of the publication product information based on the CNONIX standard version information is converted to obtain the publication product information based on the ONIX standard version information, so that the purpose of converting the publication product information based on the CNONIX standard version information into the publication product information based on the ONIX standard version information is achieved, and the export trade of the publication product is facilitated.
The embodiments of the invention are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments can be referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The foregoing are merely preferred embodiments of the present invention to enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (4)

1. A data format conversion method, comprising:
receiving a data format conversion request indicating ONIX standard version information, publication product information based on CNONIX standard version information, ONIX code table version information corresponding to the ONIX standard version information, and CNONIX code table version information corresponding to the CNONIX standard version information;
determining an XML file conversion rule matched with the ONIX standard version information and the CNONIX standard version information from at least one preset XML file conversion rule;
determining a code table set conversion rule matched with the ONIX code table version information and the CNONIX code table version information from at least one preset code table set conversion rule;
converting the data format of the publication product information based on the determined XML file conversion rule and the code table set conversion rule to obtain the publication product information based on the ONIX standard version information;
wherein the converting the data format of the publication product information based on the determined XML file conversion rule and the code table set conversion rule to obtain the publication product information based on the ONIX standard version information includes:
converting the data format of the publication product information based on the determined XML file conversion rule to obtain first publication product information based on the ONIX standard version information;
converting the data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information;
the publication product information comprises data elements, data items corresponding to the data elements indicate data item attributes, and the data item attributes are optional attributes or must-fill attributes; the determined XML file conversion rule indicates that there is a target data element,
the converting the data format of the publication product information based on the determined XML file conversion rule to obtain the first publication product information based on the ONIX standard version information includes:
s1, determining whether the target data element exists in the publication product information; if so, go to step S2;
s2, determining whether the data item attribute corresponding to the target data element is a mandatory fill attribute; if the data item attribute corresponding to the target data element is the mandatory fill attribute, executing step S3; if the data item attribute corresponding to the target data element is an optional attribute, executing step S4;
s3, the data element of the upper compound of the target data element is used as a new target data element, and the step S2 is executed again;
s4, deleting the target data element and all the subdata elements thereof from the publication product information;
the determined code table set conversion rule indicates that there is a masked code table and a masked code value,
the converting the data format of the first publication product information based on the determined code table set conversion rule to obtain the publication product information based on the ONIX standard version information includes:
s1, acquiring a code table adopted in the first publication product information as a data element of the mask code table, and acquiring a code value adopted in the first publication product information as a data element of the mask code value;
s2, determining whether the attribute of the data item corresponding to the acquired data element is a mandatory filling attribute; if the data item attribute corresponding to the acquired data element is the mandatory fill attribute, go to step S3; if the attribute of the data item corresponding to the acquired data element is an optional attribute, executing step S4;
s3, re-executing step S2 with the data element of the acquired data element superordinate composite as a new acquired data element;
s4, deleting the acquired data elements and all the sub data elements thereof from the first publication product information.
2. The method according to claim 1, wherein the determined XML document conversion rule is generated according to a method comprising:
acquiring a first schema corresponding to the ONIX standard version information and a second schema corresponding to the CNONIX standard version information;
converting the first schema into a first XML standard file and converting the second schema into a second XML standard file;
and generating the determined XML file conversion rule according to the structural difference between the first XML standard file and the second XML standard file.
3. The method of claim 1, wherein the determined manner of generating the code table set transformation rule comprises:
acquiring a first code table set which comprises at least one code table and corresponds to the ONIX code table version information, and a second code table set which comprises at least one code table and corresponds to the CNONIX code table version information;
converting the first code expression set into a third XML standard file and converting the second code expression set into a fourth XML standard file;
and generating the determined code table set conversion rule according to the structural difference between the third XML standard file and the fourth XML standard file.
4. A data format conversion apparatus, comprising:
a data format conversion request receiving unit configured to receive a data format conversion request indicating ONIX standard version information, publication product information based on CNONIX standard version information, ONIX code table version information corresponding to the ONIX standard version information, and CNONIX code table version information corresponding to the CNONIX standard version information;
an XML file conversion rule determining unit, configured to determine, from at least one preset XML file conversion rule, an XML file conversion rule that matches the ONIX standard version information and the CNONIX standard version information;
a code table set conversion rule determining unit, configured to determine, from at least one preset code table set conversion rule, a code table set conversion rule that matches the ONIX code table version information and the CNONIX code table version information;
the data format conversion unit is used for converting the data format of the publication product information based on the determined XML file conversion rule and the code table set conversion rule to obtain the publication product information based on the ONIX standard version information;
wherein, the data format conversion unit includes:
the first data format conversion unit is used for converting the data format of the publication product information based on the determined XML file conversion rule to obtain first publication product information based on the ONIX standard version information;
a second data format conversion unit, configured to convert, based on the determined code table set conversion rule, the data format of the first publication product information to obtain publication product information based on the ONIX standard version information;
the publication product information comprises data elements, data items corresponding to the data elements indicate data item attributes, and the data item attributes are optional attributes or must-fill attributes; the determined XML file conversion rule indicates that there is a target data element,
the first data format conversion unit includes:
a target data element for performing step S1, determining whether the target data element exists in the publication product information; if so, go to step S2;
a first fill-necessary attribute determining unit, configured to perform step S2, and determine whether the data item attribute corresponding to the target data element is a fill-necessary attribute; if the data item attribute corresponding to the target data element is the mandatory fill attribute, executing step S3; if the data item attribute corresponding to the target data element is an optional attribute, executing step S4;
a first determination unit for performing the step S3, re-performing the step S2 with the data element of the target data element upper-level composite as a new target data element;
a first deletion unit configured to perform step S4 of deleting the target data element and all the child data elements thereof from the publication product information;
the determined code table set conversion rule indicates that there is a masked code table and a masked code value,
the second data format conversion unit includes:
a data element acquisition unit configured to execute step S1, acquire a code table employed in the first publication product information as a data element of the mask code table, and a code value employed in the first publication product information as a data element of the mask code value;
a second fill-necessary attribute determining unit, configured to perform step S2, and determine whether the attribute of the data item corresponding to the acquired data element is a fill-necessary attribute; if the data item attribute corresponding to the acquired data element is the mandatory fill attribute, go to step S3; if the attribute of the data item corresponding to the acquired data element is an optional attribute, executing step S4;
a second determination unit operable to execute step S3, re-execute step S2 with the acquired data element being an upper-level composite data element as a new acquired data element;
a second deletion unit configured to perform step S4 of deleting the acquired data elements and all the child data elements thereof from the first publication product information.
CN201710174825.9A 2017-03-22 2017-03-22 Data format conversion method and device Active CN106951404B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710174825.9A CN106951404B (en) 2017-03-22 2017-03-22 Data format conversion method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710174825.9A CN106951404B (en) 2017-03-22 2017-03-22 Data format conversion method and device

Publications (2)

Publication Number Publication Date
CN106951404A CN106951404A (en) 2017-07-14
CN106951404B true CN106951404B (en) 2020-05-19

Family

ID=59473016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710174825.9A Active CN106951404B (en) 2017-03-22 2017-03-22 Data format conversion method and device

Country Status (1)

Country Link
CN (1) CN106951404B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110109681B (en) * 2019-05-08 2023-06-09 上海携程商务有限公司 Method and system for converting codes between different platforms

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005001708A1 (en) * 2003-06-27 2005-01-06 Common Ground Publishing Pty Ltd Method and apparatus for the creation, location and formatting of digital content
CN104765717A (en) * 2014-01-08 2015-07-08 北大方正集团有限公司 Method and device for mass document format conversion

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005001708A1 (en) * 2003-06-27 2005-01-06 Common Ground Publishing Pty Ltd Method and apparatus for the creation, location and formatting of digital content
CN104765717A (en) * 2014-01-08 2015-07-08 北大方正集团有限公司 Method and device for mass document format conversion

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CNONIX对ONIX的继承与创新;张秀兰、薄丽辉、张文亮;《图书馆建设》;20150531;第38卷(第05期);全文 *
ONIX与我国编目标准的统一;张秀兰、党梦娇、马科;《高校图书馆工作》;20151031;第35卷(第05期);全文 *

Also Published As

Publication number Publication date
CN106951404A (en) 2017-07-14

Similar Documents

Publication Publication Date Title
US6408303B1 (en) System and method for automated building of a trading partner profile
CN110888842A (en) File storage method, file query method, file storage device, file query device and file query equipment
CN102779063A (en) Method for providing application invocation and server
CN104079623B (en) Multistage cloud storage synchronisation control means and system
CN111414727B (en) Editing method and device for PDF document header footer and electronic equipment
CN104639973B (en) Information pushing method and device
CN106951404B (en) Data format conversion method and device
JP2005043932A (en) Accounting data processing method and system
TW201409386A (en) System and method for managing prior arts
CN108197090B (en) Method and system for processing default value in file format conversion process
US20140222865A1 (en) Method, System and Program for Interactive Information Services
JP6171703B2 (en) Document management apparatus and document management program
KR102023999B1 (en) Method and apparatus for generating web pages
CN111339656A (en) Cabinet production method and system and electronic equipment
CN108614844B (en) Multimedia file generation method and device
CN103095644A (en) Data content analytic method and data content analytic device
CN111522748B (en) Automatic test case generation method, device, server and storage medium
CN103294788A (en) Universal background processing method and system for websites
CN113313492A (en) Electronic certificate generation method and related device
CN102148687A (en) Signature method and device in information management system
US20150205870A1 (en) Method, system and program product for interactive information services
US9052906B2 (en) Modularized customization of a model in a model driven development environment
CN110888883A (en) Data storage method, device, system and storage medium
CN104133872A (en) News list showing method and device
CN105468611A (en) Webpage toolbar insertion method and apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A data format conversion method and device

Effective date of registration: 20220811

Granted publication date: 20200519

Pledgee: Beijing Beitou Financing Guarantee Co.,Ltd.

Pledgor: BEIJING JETSEN TECHNOLOGY Co.,Ltd.

Registration number: Y2022110000176