CN106777025B - Analysis method and system of database physical model - Google Patents

Analysis method and system of database physical model Download PDF

Info

Publication number
CN106777025B
CN106777025B CN201611123126.3A CN201611123126A CN106777025B CN 106777025 B CN106777025 B CN 106777025B CN 201611123126 A CN201611123126 A CN 201611123126A CN 106777025 B CN106777025 B CN 106777025B
Authority
CN
China
Prior art keywords
similar
elements
xml file
physical model
database
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
CN201611123126.3A
Other languages
Chinese (zh)
Other versions
CN106777025A (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.)
State Grid Corp of China SGCC
State Grid Information and Telecommunication Co Ltd
Beijing Guodiantong Network Technology Co Ltd
Original Assignee
State Grid Corp of China SGCC
State Grid Information and Telecommunication Co Ltd
Beijing Guodiantong Network 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 State Grid Corp of China SGCC, State Grid Information and Telecommunication Co Ltd, Beijing Guodiantong Network Technology Co Ltd filed Critical State Grid Corp of China SGCC
Priority to CN201611123126.3A priority Critical patent/CN106777025B/en
Publication of CN106777025A publication Critical patent/CN106777025A/en
Application granted granted Critical
Publication of CN106777025B publication Critical patent/CN106777025B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/83Querying
    • 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/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • G06F16/212Schema design and management with details for data modelling support

Abstract

The invention discloses an analysis method of a database physical model, which comprises the following steps: acquiring a database physical model file to be analyzed; converting the database physical model file into an XML file; analyzing the XML file, and counting a similar table in the XML file and similar field length difference information in the similar table; therefore, in the embodiment, the field length abnormality of the similar table and the similar table in the physical model can be counted through analyzing the physical model of the database, so that the whole database is clearly understood at the initial stage of the project, and a series of immeasurable costs caused by later-stage rectification due to the design defect of the database are avoided; the invention also discloses an analysis system of the database physical model, which can also realize the technical effects.

Description

Analysis method and system of database physical model
Technical Field
The invention relates to the technical field of database physical model analysis, in particular to a method and a system for analyzing a database physical model.
Background
The current environment is an era requiring rapid development, the time for planning a database design document at the initial stage of a project is not sufficient, a database design file suitable for system development is difficult to make in only a short time, even if the design of the database is completed in a short time, the deficiency may be found in the development process at the later stage, and a large amount of time is wasted for modifying the design document at that time, so that how to check and analyze the coupling and consistency of a physical model of the database, and how to locate the careless mistakes of the database design are problems to be solved by technical personnel in the field.
Disclosure of Invention
The invention aims to provide an analysis method and an analysis system for a database physical model, so as to realize the verification and analysis of the database physical model.
In order to achieve the above purpose, the embodiment of the present invention provides the following technical solutions:
a method of analyzing a physical model of a database, comprising:
acquiring a database physical model file to be analyzed;
converting the database physical model file into an XML file;
analyzing the XML file, and counting a similar table in the XML file and similar field length difference information in the similar table.
Wherein the XML file comprises: document root nodes, root node table elements, column set elements, and column set attribute elements.
Analyzing the XML file, and counting a similar table in the XML file and similar field length difference information in the similar table, wherein the analyzing the XML file and the counting the similar table comprise:
analyzing the document root node and the column set elements, counting column elements with the same table name in the column elements, and taking the column elements with the same table name as a similar table;
and if the field lengths between the similar tables are different, generating similar field length difference information corresponding to the similar tables.
After the statistics of the similar table in the XML file and the length difference information of the similar fields in the similar table, the method further includes:
and displaying the similar table and the similar field length difference information in the similar table in a list form.
A system for analyzing a physical model of a database, comprising:
the acquisition module is used for acquiring a database physical model file to be analyzed;
the physical model file conversion module is used for converting the database physical model file into an XML file;
and the statistic module is used for analyzing the XML file, and counting the similar table in the XML file and the length difference information of the similar fields in the similar table.
Wherein the XML file comprises: document root nodes, root node table elements, column set elements, and column set attribute elements.
Wherein, the statistic module comprises:
an analysis unit configured to analyze the document root node and the column set element;
the statistical unit is used for counting the column elements with the same table name in the column elements and taking the column elements with the same table name as a similar table;
and the similar table field difference information generation module is used for detecting that the field lengths between the similar tables are different and generating similar field length difference information corresponding to the similar tables.
Wherein, this scheme still includes:
and the display module is used for displaying the similar table and the length difference information of the similar fields in the similar table in a list form.
According to the scheme, the analysis method for the physical model of the database, provided by the embodiment of the invention, comprises the following steps: acquiring a database physical model file to be analyzed; converting the database physical model file into an XML file; analyzing the XML file, and counting a similar table in the XML file and similar field length difference information in the similar table; therefore, in the embodiment, the field length abnormality of the similar table and the similar table in the physical model can be counted through analyzing the physical model of the database, so that the whole database is clearly understood at the initial stage of the project, and a series of immeasurable costs caused by later-stage rectification due to the design defect of the database are avoided; the invention also discloses an analysis system of the database physical model, which can also realize the technical effects.
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 of 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 schematic flow chart of a method for analyzing a physical model of a database according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an XML file composition structure disclosed in the embodiment of the present invention;
fig. 3 is a schematic structural diagram of an analysis system of a database physical model according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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.
The embodiment of the invention discloses an analysis method and system of a database physical model, which are used for verifying and analyzing the database physical model.
Referring to fig. 1, an analysis method for a database physical model provided by an embodiment of the present invention includes:
s101, obtaining a database physical model file to be analyzed;
specifically, in this embodiment, the database physical model file to be analyzed is an existing database physical model file, and supports obtaining a plurality of physical model files from a directory or obtaining a single physical model file from a single data source, which is not limited herein.
S102, converting the physical model file of the database into an XML file;
wherein the XML file comprises: document root nodes, root node table elements, column set elements, and column set attribute elements. It should be noted that, after the database physical model file is converted into the XML file, two or more associated relational tables in the physical model file may also be extracted, or a single table that is not associated with any table in the model may be extracted.
Specifically, in this embodiment, the database physical model file may be parsed into a corresponding XML file, and referring to fig. 2, the main constituent elements of the converted XML document include: the document root node, a plurality of root node table elements, column set elements under the table elements, attribute elements under the column set, text elements in the attributes and the like are in tree-shaped inclusion relation from top to bottom, and the hierarchical structure is clear.
S103, analyzing the XML file, and counting a similar table in the XML file and the length difference information of the similar fields in the similar table.
Analyzing the XML file, and counting a similar table in the XML file and similar field length difference information in the similar table, wherein the analyzing the XML file and the counting the similar table comprise:
analyzing the document root node and the column set elements, counting column elements with the same table name in the column elements, and taking the column elements with the same table name as a similar table;
and if the field lengths between the similar tables are different, generating similar field length difference information corresponding to the similar tables.
Specifically, in this embodiment, taking fig. 2 as an example, a document root node in an XML file stores a plurality of root node Table elements o, Table, for identifying different tables; a plurality of Column elements o, Column, for identifying how many columns are in the data Table under each Table element o, Table; a number of elements below the column element are used to illustrate the column:
a, the Name is used for marking the field Chinese Name;
code is used for marking field English name, namely field name;
a, DataType is used for marking field types;
comment is used to mark the fixation of a field;
creator is used for marking the Creator of the field, namely the field created by the Creator;
correspondingly, in this embodiment, by analyzing the document root node and the column set element, the column elements with the same table name in the column elements are counted, and the specific way of taking the column elements with the same table name as the similarity table is as follows:
the comparison is made by different attributes in the column set elements, for example: and comparing the two attributes of Code (field English Name) and DataType (field type), wherein if the two attributes are the same, the two attributes are similar tables, and correspondingly, in order to improve the accuracy of the similar tables, other attributes needing to be compared, such as Name, can be added.
It should be noted that the similarity table may also be determined in other ways in this embodiment, for example: similarity table is counted by percent similarity: if a: Code (field English name) and a: DataType (field type) of fields (columns) between tables are completely the same, the similarity of the tables is 100%; if the similarity of a: Code (field English name) and a: DataType (field type) of fields (columns) between tables is 80%, the similarity of the tables is 80%; if a: Code (field english name) and a: DataType (field type) of a field (column) between tables are not repeated, the similarity of the tables is 0, thereby determining the similarity between the tables, and a similarity determination threshold may be predetermined, and if the similarity between the tables is greater than the predetermined threshold, a similarity table is determined.
It can be understood that the similar field Length difference information in the similar tables in the present scheme may be determined by the a: Length (field Length) of the associated field between different tables, and if the a: Length (field Length) of the associated field between two similar tables is different, it indicates that there is a similar field Length difference between the two similar tables, so as to generate corresponding difference information.
Based on the foregoing embodiment, in this embodiment, after the counting the similarity table in the XML file and the difference information of the lengths of the similar fields in the similarity table, the method further includes:
and displaying the similar table and the similar field length difference information in the similar table in a list form.
Specifically, after counting the length difference of the similar table in the XML file and the field length in the similar table, the field length difference can be displayed in a list form, so that the user can know the problems existing in the database physical model. Therefore, the analysis method of the physical model of the database provided by the embodiment has the advantages of being capable of quickly positioning repeated fields in the similarity table and quickly extracting abnormal field information in the design document. Compared with the existing manual examination, the method reduces the examination cost and avoids the occurrence of errors in manual examination.
The following describes an analysis system provided in an embodiment of the present invention, and the analysis system described below and the analysis method described above may be referred to each other.
Referring to fig. 3, an analysis system of a database physical model provided in an embodiment of the present invention includes:
an obtaining module 100, configured to obtain a database physical model file to be analyzed;
a physical model file conversion module 200, configured to convert the database physical model file into an XML file;
the statistical module 300 is configured to parse the XML file, and perform statistics on the similarity table in the XML file and the difference information of the lengths of the similar fields in the similarity table.
Wherein the XML file comprises: document root nodes, root node table elements, column set elements, and column set attribute elements.
Based on the above embodiment, the statistical module includes:
an analysis unit configured to analyze the document root node and the column set element;
the statistical unit is used for counting the column elements with the same table name in the column elements and taking the column elements with the same table name as a similar table;
and the similar table field difference information generation module is used for detecting that the field lengths between the similar tables are different and generating similar field length difference information corresponding to the similar tables.
Based on any of the above embodiments, the present embodiment further includes:
and the display module is used for displaying the similar table and the length difference information of the similar fields in the similar table in a list form.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use 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 method for analyzing a physical model of a database, comprising:
acquiring a database physical model file to be analyzed;
converting the database physical model file into an XML file; the XML file includes: document root nodes, root node table elements, column set elements and column set attribute elements; a plurality of root node table elements are stored in a document root node in the XML file, and a plurality of column elements are arranged under each root node table element;
analyzing the XML file, and counting a similar table in the XML file and similar field length difference information in the similar table;
analyzing the XML file, and counting a similar table in the XML file and similar field length difference information in the similar table, wherein the analyzing the XML file and the counting the similar table comprise:
analyzing the document root node and the column set elements, counting column elements with the same table name in the column elements, and taking the column elements with the same table name as a similar table;
and if the field lengths between the similar tables are different, generating similar field length difference information corresponding to the similar tables.
2. The analysis method according to claim 1, wherein after the statistics of the similarity table in the XML file and the similarity field length difference information in the similarity table, further comprising:
and displaying the similar table and the similar field length difference information in the similar table in a list form.
3. A system for analyzing a physical model of a database, comprising:
the acquisition module is used for acquiring a database physical model file to be analyzed;
the physical model file conversion module is used for converting the database physical model file into an XML file; the XML file includes: document root nodes, root node table elements, column set elements and column set attribute elements; a plurality of root node table elements are stored in a document root node in the XML file, and a plurality of column elements are arranged under each root node table element;
the statistical module is used for analyzing the XML file, and counting a similar table in the XML file and the length difference information of similar fields in the similar table;
wherein, the statistic module comprises:
an analysis unit configured to analyze the document root node and the column set element;
the statistical unit is used for counting the column elements with the same table name in the column elements and taking the column elements with the same table name as a similar table;
and the similar table field difference information generation module is used for detecting that the field lengths between the similar tables are different and generating similar field length difference information corresponding to the similar tables.
4. The analytical system of claim 3, further comprising:
and the display module is used for displaying the similar table and the length difference information of the similar fields in the similar table in a list form.
CN201611123126.3A 2016-12-08 2016-12-08 Analysis method and system of database physical model Active CN106777025B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611123126.3A CN106777025B (en) 2016-12-08 2016-12-08 Analysis method and system of database physical model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611123126.3A CN106777025B (en) 2016-12-08 2016-12-08 Analysis method and system of database physical model

Publications (2)

Publication Number Publication Date
CN106777025A CN106777025A (en) 2017-05-31
CN106777025B true CN106777025B (en) 2020-10-27

Family

ID=58877391

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611123126.3A Active CN106777025B (en) 2016-12-08 2016-12-08 Analysis method and system of database physical model

Country Status (1)

Country Link
CN (1) CN106777025B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109165669B (en) * 2018-07-09 2021-11-16 浙江大学 Three-dimensional patch model file similarity detection method based on model identification code
CN109325035A (en) * 2018-11-29 2019-02-12 阿里巴巴集团控股有限公司 The recognition methods of similar table and device

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7085762B2 (en) * 2003-05-22 2006-08-01 International Business Machines Corporation Methods, systems and computer program products for web services access of analytical models
CN100570604C (en) * 2006-11-13 2009-12-16 中兴通讯股份有限公司 A kind of method of relation data base applications automatic upgrade
CN102411588A (en) * 2010-09-26 2012-04-11 金蝶软件(中国)有限公司 Comparison checking method and system of data table
CN102065413B (en) * 2010-11-17 2014-03-12 北京北方烽火科技有限公司 Database updating method and system, and base station self-starting method and system
US8762428B2 (en) * 2011-06-06 2014-06-24 International Business Machines Corporation Rapidly deploying virtual database applications using data model analysis
CN102609777A (en) * 2012-02-17 2012-07-25 中国科学院合肥物质科学研究院 Method for controlling emergency decision knowledge base system for disaster reduction
CN102890720A (en) * 2012-10-16 2013-01-23 南京通达海信息技术有限公司 Database inspection and maintenance method
CN102982168B (en) * 2012-12-12 2015-10-21 江苏省电力公司信息通信分公司 A kind of metadata model matching process based on XML document
CN104216948B (en) * 2014-08-12 2017-12-05 上海新炬网络技术有限公司 A kind of difference control method of data model
CN104598610B (en) * 2015-01-29 2017-12-12 无锡江南计算技术研究所 A kind of distributed data base data distribution uploads synchronous method
CN105786998B (en) * 2016-02-19 2019-02-26 创元网络技术股份有限公司 Database middleware system and the method for handling data using it

Also Published As

Publication number Publication date
CN106777025A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN106777644B (en) Automatic generation method and device for power plant identification system code
CN105868171B (en) A kind of method of calibration and device of Excel file
US8615526B2 (en) Markup language based query and file generation
CN110908890A (en) Automatic test method and device for interface
US20100235296A1 (en) Flow comparison processing method and apparatus
CN107783780B (en) Code review method and system
CN111367938B (en) Database instruction generation method and device and computer storage medium
CN106919612A (en) A kind of processing method and processing device of SQL script of reaching the standard grade
CN113672781A (en) Data query method and device, electronic equipment and storage medium
CN106777025B (en) Analysis method and system of database physical model
CN111127068A (en) Automatic pricing method and device for engineering quantity list
CN105302730A (en) Calculation model detection method, testing server and service platform
CN103793437A (en) Wafer test data processing method and system
CN109408502A (en) A kind of data standard processing method, device and its storage medium
CN103198071A (en) Data report generation method and device adopting same
JP4928848B2 (en) Message converter in computer system integrated management environment.
CN113360603B (en) Contract similarity and compliance detection method and device
CN114637811A (en) Data table entity relation graph generation method, device, equipment and storage medium
CN103593182A (en) Method for reconfiguring software by using clustering mode
CN107203525B (en) Database processing method and device
CN116303641B (en) Laboratory report management method supporting multi-data source visual configuration
CN104123138A (en) Rapid building method for ERP system
CN106557569B (en) Method and device for importing unstructured document based on meta-model
Polychniatis et al. Detecting cross-language dependencies generically
Eichelberger et al. A comprehensive survey of UML compliance in current modelling tools

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100192 Beijing city Haidian District Qinghe small Camp Road No. 15 building 710 room research

Applicant after: BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd.

Applicant after: STATE GRID INFORMATION & TELECOMMUNICATION GROUP Co.,Ltd.

Applicant after: STATE GRID CORPORATION OF CHINA

Address before: 100192 Beijing city Haidian District Qinghe small Camp Road No. 15 building 710 room research

Applicant before: BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd.

Applicant before: STATE GRID INFORMATION & TELECOMMUNICATION GROUP Co.,Ltd.

Applicant before: State Grid Corporation of China

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190725

Address after: 100085 Building 32-3-4108-4109, Pioneer Road, Haidian District, Beijing

Applicant after: BEIJING GUODIANTONG NETWORK TECHNOLOGY Co.,Ltd.

Applicant after: STATE GRID CORPORATION OF CHINA

Applicant after: STATE GRID INFORMATION & TELECOMMUNICATION GROUP Co.,Ltd.

Address before: 100192 Beijing city Haidian District Qinghe small Camp Road No. 15 building 710 room research

Applicant before: BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd.

Applicant before: STATE GRID INFORMATION & TELECOMMUNICATION GROUP Co.,Ltd.

Applicant before: STATE GRID CORPORATION OF CHINA

GR01 Patent grant
GR01 Patent grant