CN105701256A - Communication point table file comparison method - Google Patents

Communication point table file comparison method Download PDF

Info

Publication number
CN105701256A
CN105701256A CN201610170469.9A CN201610170469A CN105701256A CN 105701256 A CN105701256 A CN 105701256A CN 201610170469 A CN201610170469 A CN 201610170469A CN 105701256 A CN105701256 A CN 105701256A
Authority
CN
China
Prior art keywords
sequence
matrix
row
currentelement
communication point
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
CN201610170469.9A
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.)
NR Electric Co Ltd
NR Engineering Co Ltd
Original Assignee
NR Electric Co Ltd
NR Engineering 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 NR Electric Co Ltd, NR Engineering Co Ltd filed Critical NR Electric Co Ltd
Priority to CN201610170469.9A priority Critical patent/CN105701256A/en
Publication of CN105701256A publication Critical patent/CN105701256A/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/90Details of database functions independent of the retrieved data types
    • G06F16/93Document management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (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 Communication point table file comparison method.Signals in two communication point table files are constructed into two sequences respectively to form a matching matrix, values of elements in the matrix are sequentially calculated from the upper left corner to the lower right corner of the matrix, and backtracking is conducted from the lower right corner to the upper left corner of the matrix according to a pre-defined rule to obtain the optimal matching of the sequence A and the sequence B.The sequence A and the sequence B are aligned according to the optimal matching, and therefore same items and different items in the communication point table files can be determined, and display is conducted.

Description

A kind of communication point list file comparative approach
Technical field
The invention belongs to Documents Comparison process field, be specifically related to a kind of communication point list file comparative approach。
Background technology
Between power system device, the communication of (device and device, device and backstage, device and scheduling), according to concrete functional requirement and use scene, can be used different communication protocols, including IEC101, IEC103, IEC104, DNP, Modbus etc.。Every kind of communication protocol all can define respective communication point table, and communication point table is communication two party agreement in transmission data。The corresponding period of each signal in some table, communication two party identifies concrete signal according to the period of transmission。
In actual applications, the device put into operation at the scene, due to change or the function adjustment of demand, it is necessary to carry out the upgrading amendment of communication point table。In the process of upgrading, some signal demand remains unchanged, and some signal demand is deleted, and some signal demand increases newly, it is therefore desirable to can difference between new and old some table of comparison intuitively。And from new some table, signal can be increased toward old some table easily, or from old some table erasure signal。But compare instrument modifying point table by manual modifying point table or text, first maximum same sections and the difference section of two some tables cannot be shown intuitively, secondly workload can be relatively larger, need manually to judge, and in the process of amendment, the legitimacy of data content be cannot be carried out verification。Therefore need a kind of comparative approach automatically, can at utmost extract common portion content, and contrast difference section。This case thus produces。
Summary of the invention
It is an object of the invention to provide a kind of file comparision method, can intuitively show that communication point list file is identical and different piece。In order to reach above-mentioned purpose, the present invention provides a kind of communication point list file comparative approach, it is characterised in that imports two communication point list files and builds signal sequence, signal calculated sequences match matrix, search Optimum Matching result, based on Optimum Matching results contrast signal content。Specifically include following steps:
The first step: build signal sequence。
Read the signal in two communication point list files, form two signal sequence tables, be defined as sequence A and B。Wherein A=a1a2……aM, namely A is by a1a2……aMThis M signal sequence composition;B=b1b2……bN, namely B is by b1b2……bNThis N number of signal sequence forms。Each signal is made up of multiple attributes, takes one of them attribute or several attribute as keyword。
In sequence A, continuous print signal sequence table is called a subsequence of sequence A, for instance sequence a1a2……ai(1≤i≤N) is a subsequence of sequence A。If a subsequence all exists in sequence A and sequence B, then this sequence is the common subsequence of sequence A and sequence B。
Comparative sequences A and sequence B is converted to, i.e. the longest common subsequence of sequence of calculation A and sequence B by of equal value for the comparison of two communication point tables。
Second step: the coupling matrix of signal calculated sequence。
The matrix P [M] [N] of one M*N of definition, calculates the length of the longest common subsequence of all subsequences in A and B。The line number of matrix is the length of sequence A, and matrix column number is the length of sequence B。Namely the element value that in matrix, the i-th row, jth arrange represents the subsequence a of A1a2……aiSubsequence b with B1b2……bjThe length of longest common subsequence。
First the element of the 0th row of matrix P and the 0th row is initialized to 0。Then the value of each element is calculated successively from the upper left corner of matrix toward the lower right corner。For element P [i] [j], if aiWith bjEqual, then the value that value is its upper left element of P [i] [j] adds 1;If aiWith bjUnequal, then the value of P [i] [j] is that left element, upper left element, three intermediate values of upper surface element are maximum。Computation rule is summarized as follows:
For 1≤i≤N, 1≤j≤M,
If ai=bj, then P (i, j)=P (i-1, j-1)+1
If ai≠bj, then P (i, j)=Max (P (i-1, j-1), P (i-1, j), P (i, j-1))
At relatively aiAnd bjTime whether equal, represent a signal due to them respectively, be therefore really the keyword comparing them, if their keyword is equal, then aiWith bjEqual, if their keyword is unequal, aiWith bjUnequal。
3rd step: calculate the Optimum Matching of two signal sequences。
In the calculated matrix of second step, recall from the lower right corner of matrix toward the upper left corner, it is possible to obtain a backtracking path。Assuming the i-th row jth row that current location is matrix, definition backtracking rule is as follows:
If ai=bj, then the top left hand element of currentElement is traced back to。
If ai≠bj, then trace back to that the top left hand element of currentElement, top element and left side element intermediate value are maximum one。If there is equal situation, then can take therein any one。
If currentElement is positioned at the first row of matrix, then trace back to the left side element of currentElement。
If currentElement is positioned at the first row of matrix, then trace back to the top element of currentElement。
The matching sequence A ' and B ' with maximum common portion corresponding respectively according to backtracking path computing sequence A and sequence B。Sequence A ' and B ' represent an Optimum Matching of original series A and B, the maximum identical contents namely having on correspondence position。In coupling matrix, move toward the upper left corner along backtracking path from the lower right corner, it is assumed that currentElement is positioned at the i-th row jth row:
If the next element on backtracking path is in the upper left corner (the i-th-1 row jth-1 row) of currentElement, then by ai-1Add the starting position of A ' to, by bj-1Add the starting position of B ' to。
If the next element on backtracking path is on the left side (the i-th row jth-1 row) of currentElement, then an empty element is added the starting position of A ' to, by bj-1Add the starting position of B ' to。
If the next element on backtracking path is in the top (the i-th-1 row jth row) of currentElement, then by ai-1Add the starting position of A ' to, an empty element is added to the starting position of B '。
Until tracing back to the upper left corner of matrix, it is possible to calculate and obtain sequence A ' and sequence B '。Sequence A ' and sequence B ' is exactly the comparative result of sequence A and sequence B。Sequence A ' and sequence B ' illustrate maximum same section of sequence A and sequence B and remaining difference section。
4th step: comparison signal property content also shows difference。
After the Optimum Matching obtaining sequence A and sequence B, it is possible to obtain sequence A and the maximum same section of sequence B, namely the element in sequence A and sequence B can farthest align。For the element of alignment, the element that namely keyword is identical, other attribute of further comparison element。Adopt form or tree structure contrast show file, for each some table, according to comparative result, show equal, unequal, without respective items labelling。
Communication point list file comparative approach provided by the present invention, respectively the signal in two some list files is built into two sequences, then the value of element matrix is calculated successively from the matrix upper left corner toward the lower right corner, recall toward the upper left corner from the lower right corner of matrix according still further to specific rule, obtain an Optimum Matching of sequence A and sequence B。According to this Optimum Matching, sequence A and sequence B being alignd, may thereby determine which signal is identical, which signal is discrepant, and which signal only exists in single file。Intuitively can show identical entry and the different item of communication point list file rapidly, conveniently carry out the simultaneously operating of different content, batch application in communication device。
Accompanying drawing explanation
Fig. 1 be embodiment of the present invention communication point table comparative approach realize schematic flow sheet;
Fig. 2 is that communication point table 1 is changed into sequence 1 schematic diagram by the embodiment of the present invention;
Fig. 3 is that communication point table 2 is changed into sequence 2 schematic diagram by the embodiment of the present invention;
Fig. 4 is that the embodiment of the present invention builds and initialize coupling matrix intention;
Fig. 5 is that the embodiment of the present invention calculates coupling matrix schematic diagram;
Fig. 6 is the backtracking path schematic diagram that the embodiment of the present invention obtains coupling matrix;
Fig. 7 is that sequence 1 and sequence 2 are carried out alignment coupling schematic diagram by the embodiment of the present invention;
Fig. 8 is embodiment of the present invention communication point table comparative result schematic diagram。
Detailed description of the invention
Below with reference to accompanying drawing, technical scheme is described in detail。
Embodiment one
Fig. 1 be embodiment of the present invention communication point table comparative approach realize schematic flow sheet, as it is shown in figure 1, embodiment of the present invention communication point table comparative approach includes:
Step S101: convert two some list files to be compared to two sequences according to the keyword of signal therein respectively;
Specifically, as in figure 2 it is shown, communication point list file is a kind of Form data file, a line in form represents a signaling point, and the string in form represents the attribute of signal。Generally we can an attribute of the number of winning the confidence or multiple attribute as keyword, determine a signal uniquely。So the list of this keyword just can change into one with the sequence of character representation。Fig. 2 and Fig. 3 converts two communication point tables to two sequences respectively。
Step S102: according to two sequence constructs and initialize coupling matrix;
Specifically, as shown in Figure 4, the length that matrix columns is sequence 1 adds 1, and the length that the line number of matrix is sequence 2 adds 1。Each row of matrix are corresponding in turn to the member of sequence 1, and every a line of matrix is corresponding in turn to the member of sequence 2。The element of the 0th row of matrix and the 0th row is all initialized as 0。
Step S103: calculate the element value in coupling matrix according to rule;
Specifically, as it is shown in figure 5, from the first row first row of matrix, from left to right, from top to bottom, calculate the value of element in coupling matrix successively。If being currently located at the i-th row jth row of matrix, then first find the i-th-1 row jth row, the i-th row jth-1 row and the i-th-1 row jth-1 row, maximum in these three element one, be designated as Max。Then whether the ith member of comparative sequences 1 and the jth member of sequence 2 be equal, if equal, then the value of the i-th row jth column element is Max+1, if unequal, then the value of the i-th row jth column element is Max。
Step S104: trace back toward upper left angular convolution from the lower right corner of coupling matrix, it is thus achieved that a backtracking path;
Specifically, as shown in Figure 6, from the lower right corner element of matrix, maximum in the left element of this element, upside element, top left hand element one is traced back to。If three elements are equal, it is possible to take wherein any one。Finally trace back to the upper left corner of matrix, form a backtracking path。
Step S105: according to backtracking path, two sequences are carried out alignment and mate;
The embodiment of the present invention sequence 1 and sequence 2 are carried out alignment coupling schematic diagram as it is shown in fig. 7, communication point table comparative result schematic diagram as shown in Figure 8。
Along backtracking path, move from the lower right corner of matrix toward the upper left corner, it is assumed that be currently located at the i-th row jth row of matrix。If the next element on backtracking path is in the upper left corner of currentElement, then the jth member of sequence 1 and the ith member of sequence 2 are mapped。If the next element on backtracking path is in the left side of currentElement, then insert empty member's item at the position i of sequence 2, corresponding with the jth member of sequence 1。If the next element on backtracking path is in the upside of currentElement, then insert empty member's item at the position j of sequence 1, corresponding with the ith member of sequence 2。So far the Optimum Matching of two sequences has been obtained。
Step S106: for the signal of alignment, compare property content further;
For the signal of alignment, if keyword is unequal, then signal is unequal。If keyword is equal, then comparing attribute further, if attribute is also equal, then two signals are equal, otherwise then signal is unequal。
So far can obtain the comparative result of two communication point tables, also be an optimum comparative result, namely there is maximum same sections。Show some list file comparative result afterwards, as shown in Figure 8, each some table data have that equal (keyword is identical, attribute is identical), unequal (keyword is identical, and attribute is incomplete same), without the results such as occurrence (keyword does not find in another list file)。
Above example is only the technological thought that the present invention is described, it is impossible to limits protection scope of the present invention, every technological thought proposed according to the present invention, any change done on technical scheme basis with this, each falls within scope。

Claims (6)

1. a communication point list file comparative approach, it is characterised in that comprise the steps:
Step 1,2 communication point list files of importing also build signal sequence;
The signal sequence coupling matrix obtained in step 2, calculation procedure 1;
Step 3, search described signal sequence coupling matrix Optimum Matching result;
Step 4, based on described Optimum Matching results contrast signal attribute content and show difference。
2. a kind of communication point list file comparative approach as claimed in claim 1, it is characterised in that described step 1 farther includes:
Read the signal in two communication point list files, form two signal sequence tables, be defined as sequence A and B;
Wherein, A=a1a2……aM, B=b1b2……bN, a and b represents that single signal, M and N value are natural number, and each signal is made up of plurality of attributes, is keyword by one of them attribute or multiple attribute definition。
3. a kind of communication point list file comparative approach as claimed in claim 2, it is characterised in that described step 2 farther includes:
The matrix P [M] [N] of one M*N of definition, in order to calculate the length of the longest common subsequence of all subsequences in A and B, the line number of matrix is the length of sequence A, and matrix column number is the length of sequence B, and namely the element value that in matrix, the i-th row, jth arrange represents the subsequence a of A1a2……aiSubsequence b with B1b2……bjThe length of longest common subsequence;
The element of the 0th row of matrix P and the 0th row is initialized to 0, then calculates the value of each element from the upper left corner of matrix toward the lower right corner successively, for element P [i] [j], if aiWith bjEqual, then the value that value is its upper left element of P [i] [j] adds 1;If aiWith bjUnequal, then the value of P [i] [j] is that left element, upper left element, three intermediate values of upper surface element are maximum;
Concrete computation rule is:
For 1≤i≤N, 1≤j≤M,
If ai=bj, then P (i, j)=P (i-1, j-1)+1;
If ai≠bj, then P (i, j)=Max (P (i-1, j-1), P (i-1, j), P (i, j-1));
Work as aiAnd bjKeyword equal time, then aiWith bjEqual;Work as aiAnd bjKeyword unequal time, then aiWith bjUnequal。
4. a kind of communication point list file comparative approach as claimed in claim 3, it is characterised in that described step 3 farther includes:
In the calculated matrix of step 2, recalling toward the upper left corner from the lower right corner of matrix, obtain backtracking path, set the current location the i-th row jth row as matrix, definition backtracking rule is as follows:
If ai=bj, then the top left hand element of currentElement is traced back to;
If ai≠bj, then trace back to that the top left hand element of currentElement, top element and left side element intermediate value are maximum one, if there is the situation that top left hand element, top element and left side element are equal, then can take therein any one;
If currentElement is positioned at the first row of matrix, then trace back to the left side element of currentElement;
If currentElement is positioned at the first row of matrix, then trace back to the top element of currentElement;
The matching sequence A ' and B ' with maximum common portion corresponding respectively according to backtracking path computing sequence A and sequence B, sequence A ' and B ' be the comparative result of sequence A and sequence B, represent an Optimum Matching of original series A and B, illustrate maximum same section of sequence A and sequence B and remaining difference section。
5. a kind of communication point list file comparative approach as claimed in claim 4, it is characterized in that, described step 4 farther includes: after the Optimum Matching obtaining sequence A and sequence B, draws sequence A and the maximum same section of sequence B, and namely the element in sequence A and sequence B can farthest align;
For the element of alignment, the element that namely keyword is identical, other attribute of further comparison element;
Adopt form or tree structure contrast show file, for each some table, according to comparative result, show equal, unequal, without respective items labelling。
6. a kind of communication point list file comparative approach as claimed in claim 4, it is characterised in that the described matching sequence A ' with maximum common portion corresponding respectively according to backtracking path computing sequence A and sequence B and B ' concrete grammar include:
In coupling matrix, move toward the upper left corner from the lower right corner along backtracking path, set currentElement and be positioned at the i-th row jth row:
If the next element on backtracking path is in the upper left corner of currentElement, i.e. the i-th-1 row jth-1 row, then by ai-1Add the starting position of A ' to, by bj-1Add the starting position of B ' to;
If the next element on backtracking path is on the left side of currentElement, namely the i-th row jth-1 row, then add the starting position of A ' to, by b by an empty elementj-1Add the starting position of B ' to;
If the next element on backtracking path is in the top of currentElement, i.e. the i-th-1 row jth row, then by ai-1Add the starting position of A ' to, an empty element is added to the starting position of B ';
Until tracing back to the upper left corner of matrix, calculating and obtaining sequence A ' and sequence B '。
CN201610170469.9A 2016-03-23 2016-03-23 Communication point table file comparison method Pending CN105701256A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610170469.9A CN105701256A (en) 2016-03-23 2016-03-23 Communication point table file comparison method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610170469.9A CN105701256A (en) 2016-03-23 2016-03-23 Communication point table file comparison method

Publications (1)

Publication Number Publication Date
CN105701256A true CN105701256A (en) 2016-06-22

Family

ID=56232590

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610170469.9A Pending CN105701256A (en) 2016-03-23 2016-03-23 Communication point table file comparison method

Country Status (1)

Country Link
CN (1) CN105701256A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766314A (en) * 2017-10-20 2018-03-06 网易(杭州)网络有限公司 The data processing method and device of electrical form
CN109271350A (en) * 2018-10-24 2019-01-25 雅砻江流域水电开发有限公司 A kind of database and information point table automatic comparison and synchronous method based on telemechanical communication
CN110689050A (en) * 2019-09-04 2020-01-14 大连理工大学 Alignment method of multiple alarm surge sequences
CN113379296A (en) * 2021-06-28 2021-09-10 平安信托有限责任公司 Report index normalization method and device, electronic equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101826099A (en) * 2010-02-04 2010-09-08 蓝盾信息安全技术股份有限公司 Method and system for identifying similar documents and determining document diffusance
CN101853444A (en) * 2010-05-17 2010-10-06 清华大学 Method for building integrated enterprise process reference model based on model combination
CN103823838A (en) * 2013-12-18 2014-05-28 江苏省电力公司常州供电公司 Method for inputting and comparing multi-format documents
CN105183832A (en) * 2015-08-31 2015-12-23 成都康赛信息技术有限公司 Data similarity analysis method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101826099A (en) * 2010-02-04 2010-09-08 蓝盾信息安全技术股份有限公司 Method and system for identifying similar documents and determining document diffusance
CN101853444A (en) * 2010-05-17 2010-10-06 清华大学 Method for building integrated enterprise process reference model based on model combination
CN103823838A (en) * 2013-12-18 2014-05-28 江苏省电力公司常州供电公司 Method for inputting and comparing multi-format documents
CN105183832A (en) * 2015-08-31 2015-12-23 成都康赛信息技术有限公司 Data similarity analysis method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
L.BERGROTH等: "A Survey of Longest Common Subsequence Algorithms", 《PROCEEDINGS OF SEVENTH INTERNATIONAL SYMPOSIUM ON STRING PROCESSING INFORMATION RETRIEVAL》 *
曾波等: "改进的LCS方法在测试脚本序列比对中的应用", 《计算机工程与应用》 *
李川: "双序列比对算法研究与并行优化", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766314A (en) * 2017-10-20 2018-03-06 网易(杭州)网络有限公司 The data processing method and device of electrical form
CN109271350A (en) * 2018-10-24 2019-01-25 雅砻江流域水电开发有限公司 A kind of database and information point table automatic comparison and synchronous method based on telemechanical communication
CN109271350B (en) * 2018-10-24 2021-11-05 雅砻江流域水电开发有限公司 Database and information point table automatic comparison and synchronization method based on telecontrol communication
CN110689050A (en) * 2019-09-04 2020-01-14 大连理工大学 Alignment method of multiple alarm surge sequences
CN110689050B (en) * 2019-09-04 2022-03-04 大连理工大学 Alignment method of multiple alarm surge sequences
CN113379296A (en) * 2021-06-28 2021-09-10 平安信托有限责任公司 Report index normalization method and device, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN104461578B (en) The automatic merging method of code and system
CN105701256A (en) Communication point table file comparison method
CN101359254B (en) Character input method and system for enhancing input efficiency of name entry
CN106326484A (en) Error correction method and device for search terms
CN102122280B (en) Method and system for intelligently extracting content object
CN102622371B (en) Historical association database system, implementation method and electronic learning equipment thereof
CN104598635A (en) Automatic complex document generating method based on XML (Extensive Markup Language) description
CN101853449A (en) Legal question intelligent diagnosis method and system
CN104008186A (en) Method and device for determining keywords in target text
JP7500654B2 (en) Data transformation system and method
CN104573022A (en) Data query method and device for HBase
CN104866985A (en) Express bill number identification method, device and system
CN105426305A (en) Control attribute analysis system and method
CN105096023A (en) System and method for pushing data relevant to working standard
CN110909168A (en) Knowledge graph updating method and device, storage medium and electronic device
PH12019000378A1 (en) Systems and methods for converting human interactions to populate an electronic form
CN103076894A (en) Method and equipment for building input entries for object identity information according to object identity information
SE0202593D0 (en) A Computer program product and associated methods for searching a database of objects, connecting objects in such a database, and exporting data from at least arbitrary database
CN108388606A (en) A kind of method and computer equipment verifying library literary name section name in Sql sentences
CN104615782A (en) Address matching method based on sliding window maximum matching algorithm
CN115617773A (en) Data migration method, device and system
CN105912723A (en) Storage method of custom field
CN105894179A (en) Business state transition method and system based on dynamic planning
CN105550220A (en) Fetching method and apparatus for heterogeneous system
CN105589813A (en) Electronic document version change tracking method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160622

WD01 Invention patent application deemed withdrawn after publication