CN111061917A - Data driving mapping conversion method - Google Patents

Data driving mapping conversion method Download PDF

Info

Publication number
CN111061917A
CN111061917A CN201911228778.7A CN201911228778A CN111061917A CN 111061917 A CN111061917 A CN 111061917A CN 201911228778 A CN201911228778 A CN 201911228778A CN 111061917 A CN111061917 A CN 111061917A
Authority
CN
China
Prior art keywords
data
mapping
database
model
constraint
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911228778.7A
Other languages
Chinese (zh)
Inventor
孙涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xi'an Dinglan Communication Technology Co ltd
Original Assignee
Xi'an Dinglan Communication 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 Xi'an Dinglan Communication Technology Co ltd filed Critical Xi'an Dinglan Communication Technology Co ltd
Priority to CN201911228778.7A priority Critical patent/CN111061917A/en
Publication of CN111061917A publication Critical patent/CN111061917A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • G06F16/86Mapping to a database

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a data driving mapping conversion method, which comprises the following steps: step 1: extracting a general relation mode from data in a relational database; step 2: after the data in the database is extracted out of the general relation model, each table is constructed into a tree structure according to the foreign key constraint relation among the data tables, so that the relation among the data in the XML document can be more clearly described; and step 3: and (3) using the tree structure generated in the step (2) for model mapping. The invention relates to a data-driven mapping conversion method, which utilizes the structure of XML to store the relational mode in a relational database, is a mapping relation which is deeper than the mapping conversion of a database template, and generates a specific model to embody the mapping by finding the mapping relation between the XML structure and the database.

Description

Data driving mapping conversion method
Technical Field
The invention belongs to the technical field of data exchange of electronic government affair platforms, and particularly relates to a data-driven mapping conversion method.
Background
Before data exchange of the e-government platform is carried out, data needs to be extracted from a corresponding database to generate XML, then the data is sent out on a data sending interface, and in order to extract corresponding exchange data, an extraction method of the exchange data needs to be achieved.
Most of the structured data comes from the relational database, and the unstructured data can be recorded and stored in the relational database after being washed. In order to realize the mutual conversion between the XML and the data, the core is to realize the mutual mapping between the XML and the database data. Because the data in the XML is only text information, a data model cannot be supported independently, and a conversion relation needs to be established.
Disclosure of Invention
The invention aims to provide a data driving mapping conversion method which can realize mutual mapping between XML and database data.
The technical scheme adopted by the invention is as follows: a data driven mapping transformation method, comprising the steps of:
step 1: extracting a general relation mode from data in a relational database;
step 2: after the data in the database is extracted out of the general relation model, each table is constructed into a tree structure according to the foreign key constraint relation among the data tables, so that the relation among the data in the XML document can be more clearly described;
and step 3: and (3) using the tree structure generated in the step (2) for model mapping.
The present invention is also characterized in that,
the step 1 specifically comprises the following steps: in a relational database, four types of data type constraint, primary key constraint, foreign key constraint and complete new constraint are adopted; in the database ER model, R is defined to represent a general data relationship model, and R can be represented by a five-element array, where R is (T, C, M, PK, FK):
1) t represents the existence of a set of data tables, C represents the set of column names in the tables, and any C belongs to C;
2) m represents a mapping corresponding to C e C to the type definition thereof, and M (C) is (t, l, p, f, N, u, d), wherein t represents the type of data, l represents the length of the data, p represents whether the data is a primary key, f represents whether the data is a foreign key, N represents whether the data is empty, u represents whether the data is unique, d represents whether the data is default, and the values of p, f, u, N and d are all Y or N;
3) PK represents the primary key constraint and FK represents the foreign key constraint.
In step 2, a tree structure is constructed by the following algorithm:
step 2.1: acquiring information of all tables according to a definition R ═ (T, C, M, PK, FK) and establishing nodes;
step 2.2: traversing all column nodes in the table once, and if the column nodes have foreign key constraints, searching the corresponding associated table as child nodes of the table;
step 2.3: nodes that remain as no other child nodes are reorganized into a tree with the previously formed subtrees.
The mapping content in the step 3 is divided into two parts; one part is to map the table names and column names in the relational model into the element and tag names in XML; another part relates to constraints on the elements, including primary key constraints, foreign key constraints, and integrity constraints.
The step of model mapping in step 3 is as follows:
step 3.1: the database name corresponds to the root node of the XML, namely R, and the database name is mapped into a root element;
step 3.2: the data table name corresponds to a first-level sub-element under the root element, namely T in the relational schema, the table name is mapped into a label of the sub-element, and each sub-element is of a complex type;
step 3.3: the column names in the table correspond to the constituent elements under the sub-elements, the column names are mapped into the constituent elements, and corresponding type and length constraints are not set for the elements;
step 3.4: and mapping the primary key constraint in the relational model into a key constraint and mapping the external key constraint into a key constraint.
The invention has the beneficial effects that: the invention relates to a data-driven mapping conversion method, which utilizes the structure of XML to store the relational mode in a relational database, is a mapping relation which is deeper than the mapping conversion of a database template, and generates a specific model to embody the mapping by finding the mapping relation between the XML structure and the database.
Detailed Description
The present invention will be described in detail with reference to the following embodiments.
The invention provides a data driving mapping conversion method, which comprises the following steps:
step 1: extracting a general relation mode from data in a relational database, which specifically comprises the following steps: in a relational database, four types of data type constraint, primary key constraint, foreign key constraint and complete new constraint are adopted; in the database ER model, R is defined to represent a general data relationship model, and R can be represented by a five-element array, where R is (T, C, M, PK, FK):
1) t represents the existence of a set of data tables, C represents the set of column names in the tables, and any C belongs to C;
2) m represents a mapping corresponding to C e C to the type definition thereof, and M (C) is (t, l, p, f, N, u, d), wherein t represents the type of data, l represents the length of the data, p represents whether the data is a primary key, f represents whether the data is a foreign key, N represents whether the data is empty, u represents whether the data is unique, d represents whether the data is default, and the values of p, f, u, N and d are all Y or N;
3) PK represents the primary key constraint and FK represents the foreign key constraint. (ii) a
Step 2: after data in a database is extracted out of a general relation model, each table is constructed into a tree structure according to the foreign key constraint relation among the data tables so as to more clearly describe the relation among the data in the XML document, and a tree structure is constructed through the following algorithm:
step 2.1: acquiring information of all tables according to a definition R ═ (T, C, M, PK, FK) and establishing nodes;
step 2.2: traversing all column nodes in the table once, and if the column nodes have foreign key constraints, searching the corresponding associated table as child nodes of the table;
step 2.3: nodes that remain as no other child nodes are reorganized into a tree with the previously formed subtrees.
And step 3: using the tree structure generated in the step 2 for model mapping, wherein the mapping content is divided into two parts; one part is to map the table names and column names in the relational model into the element and tag names in XML; another part relates to constraints of elements, including primary key constraints, foreign key constraints and integrity constraints; the model mapping steps are as follows:
step 3.1: the database name corresponds to the root node of the XML, namely R, and the database name is mapped into a root element;
step 3.2: the data table name corresponds to a first-level sub-element under the root element, namely T in the relational schema, the table name is mapped into a label of the sub-element, and each sub-element is of a complex type;
step 3.3: the column names in the table correspond to the constituent elements under the sub-elements, the column names are mapped into the constituent elements, and corresponding type and length constraints are not set for the elements;
step 3.4: and mapping the primary key constraint in the relational model into a key constraint and mapping the external key constraint into a key constraint.
Through the mode, the data-driven mapping conversion method utilizes the structure of the XML to store the relational mode in the relational database, is a mapping relation which is deeper than the mapping conversion of a database template, and generates a specific model to embody the mapping by finding the mapping relation between the XML structure and the database.

Claims (5)

1. A data driven mapping conversion method, comprising the steps of:
step 1: extracting a general relation mode from data in a relational database;
step 2: after the data in the database is extracted out of the general relation model, each table is constructed into a tree structure according to the foreign key constraint relation among the data tables, so that the relation among the data in the XML document can be more clearly described;
and step 3: and (3) using the tree structure generated in the step (2) for model mapping.
2. The data-driven mapping transformation method of claim 1, wherein the step 1 specifically comprises: in a relational database, four types of data type constraint, primary key constraint, foreign key constraint and complete new constraint are adopted; in the database ER model, R is defined to represent a general data relationship model, and R can be represented by a five-element array, where R is (T, C, M, PK, FK):
1) t represents the existence of a set of data tables, C represents the set of column names in the tables, and any C belongs to C;
2) m represents a mapping corresponding to C e C to the type definition thereof, and M (C) is (t, l, p, f, N, u, d), wherein t represents the type of data, l represents the length of the data, p represents whether the data is a primary key, f represents whether the data is a foreign key, N represents whether the data is empty, u represents whether the data is unique, d represents whether the data is default, and the values of p, f, u, N and d are all Y or N;
3) PK represents the primary key constraint and FK represents the foreign key constraint.
3. A data driven mapping transformation method as claimed in claim 2, characterized in that in step 2, the tree structure is constructed by the following algorithm:
step 2.1: acquiring information of all tables according to a definition R ═ (T, C, M, PK, FK) and establishing nodes;
step 2.2: traversing all column nodes in the table once, and if the column nodes have foreign key constraints, searching the corresponding associated table as child nodes of the table;
step 2.3: nodes that remain as no other child nodes are reorganized into a tree with the previously formed subtrees.
4. A data driven map conversion method as claimed in claim 3, wherein the map content in step 3 is divided into two parts; one part is to map the table names and column names in the relational model into the element and tag names in XML; another part relates to constraints on the elements, including primary key constraints, foreign key constraints, and integrity constraints.
5. A data driven mapping conversion method according to claim 4, characterized in that the step of model mapping in step 3 is as follows:
step 3.1: the database name corresponds to the root node of the XML, namely R, and the database name is mapped into a root element;
step 3.2: the data table name corresponds to a first-level sub-element under the root element, namely T in the relational schema, the table name is mapped into a label of the sub-element, and each sub-element is of a complex type;
step 3.3: the column names in the table correspond to the constituent elements under the sub-elements, the column names are mapped into the constituent elements, and corresponding type and length constraints are not set for the elements;
step 3.4: and mapping the primary key constraint in the relational model into a key constraint and mapping the external key constraint into a key constraint.
CN201911228778.7A 2019-12-04 2019-12-04 Data driving mapping conversion method Pending CN111061917A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911228778.7A CN111061917A (en) 2019-12-04 2019-12-04 Data driving mapping conversion method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911228778.7A CN111061917A (en) 2019-12-04 2019-12-04 Data driving mapping conversion method

Publications (1)

Publication Number Publication Date
CN111061917A true CN111061917A (en) 2020-04-24

Family

ID=70299661

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911228778.7A Pending CN111061917A (en) 2019-12-04 2019-12-04 Data driving mapping conversion method

Country Status (1)

Country Link
CN (1) CN111061917A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102841892A (en) * 2011-06-21 2012-12-26 中国科学院计算技术研究所 Service encapsulation system and method of relational data
CN105550176A (en) * 2014-10-29 2016-05-04 镇江华扬信息科技有限公司 Basic mapping method for relational database and XML
CN108228774A (en) * 2017-12-28 2018-06-29 重庆邮电大学 A kind of relational model is to the method for transformation of XML
CN108733793A (en) * 2018-05-14 2018-11-02 北京大学 A kind of the ontology model building method and system of facing relation database

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102841892A (en) * 2011-06-21 2012-12-26 中国科学院计算技术研究所 Service encapsulation system and method of relational data
CN105550176A (en) * 2014-10-29 2016-05-04 镇江华扬信息科技有限公司 Basic mapping method for relational database and XML
CN108228774A (en) * 2017-12-28 2018-06-29 重庆邮电大学 A kind of relational model is to the method for transformation of XML
CN108733793A (en) * 2018-05-14 2018-11-02 北京大学 A kind of the ontology model building method and system of facing relation database

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
张弛: "基于XML的异构数据库数据交换技术研究", 《电脑知识与技术》 *
曹温华等: "XML与关系数据库之间转换技术的研究", 《科技风》 *
杨海燕: "基于XML异构数据库转换研究", 《电脑知识与技术》 *

Similar Documents

Publication Publication Date Title
CN107491561B (en) Ontology-based urban traffic heterogeneous data integration system and method
US8209352B2 (en) Method and mechanism for efficient storage and query of XML documents based on paths
US7398265B2 (en) Efficient query processing of XML data using XML index
CN103020301B (en) A kind of multidimensional data query and storage means and system
CN108446313B (en) Data format conversion method and device
CN104636389B (en) Realize the method and system of Hbase database real-time queries
CN107025290B (en) Storage method and reading method of fault tree data
CN103123650A (en) Extensible markup language (XML) data bank full-text indexing method based on integer mapping
CN102867049B (en) Chinese PINYIN quick word segmentation method based on word search tree
CN104933162B (en) A kind of conversion method of CSV data from metadata mark to RDF data
CN103106198A (en) Tree structure implementation method and tree structure implementation device
CN105335366A (en) SQL statement processing method and apparatus and server
CN110059086A (en) Structuring automatic storage method based on IFC mode and its mapping model
JP4247135B2 (en) Structured document storage method, structured document storage device, structured document search method
CN108256080A (en) A kind of method and system using python grammatical and semantics structure complexity sql sentences
CN112905642B (en) Method for storing IEC61850 report data into relational database based on CSV mapping file
CN106503040A (en) It is suitable for KV data bases and its creation method of SQL query method
CN117807137A (en) Rule-based SQL (structured query language) to PromQL (PromQL) conversion method
CN109271560A (en) A kind of link data critical word querying method based on tree template
JP3560043B2 (en) XML data storage method and storage device, program and recording medium storing program
CN111061917A (en) Data driving mapping conversion method
CN101799890A (en) Certificate data processing method and system
CN1560763B (en) Method for translating expandable mark language path inquiry into structure inquiry
CN114003231B (en) SQL syntax parse tree optimization method and system
CN110147396A (en) A kind of mapping relations generation method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200424

RJ01 Rejection of invention patent application after publication