Data comparison method, device, electronic device and computer readable storage medium

By comparing the characteristic information of structured data in the rectangular coordinate system, the newly added, deleted or unchanged content of the data modification is determined, which solves the problem that the hash comparison method in the existing technology cannot accurately determine the modified content, and achieves efficient and accurate data comparison results.

CN117891871BActive Publication Date: 2024-09-17EEO EDUCATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410057854.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-15
Publication Date
2024-09-17
Estimated Expiration
2044-01-15

AI Technical Summary

Technical Problem

In the existing technology, after the structured data is modified, when automatic comparison is performed through the hash comparison method, the specific modification content cannot be determined, resulting in inaccurate comparison results.

Method used

By extracting preset feature information from structured data, generating a one-dimensional array and projecting it into a Cartesian coordinate system, determining candidate paths based on similarities and differences, and calculating the minimum path to determine new, deleted or unchanged feature information, thereby generating detailed Data comparison results.

Benefits of technology

The accuracy and efficiency of data comparison are improved, and the specific content of data modification can be accurately determined.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117891871B
    Figure CN117891871B
Patent Text Reader

Abstract

The present application provides a data comparison method, device, electronic device and computer-readable storage medium, wherein the method comprises: in a rectangular coordinate system, starting from the origin, taking each first feature information in the first one-dimensional array as the value of each point on the horizontal axis, and taking each second feature information in the second one-dimensional array as the value of each point on the vertical axis; in a rectangular coordinate system, according to the similarities and differences between the first feature information in the first one-dimensional array and the second feature information in the second one-dimensional array, determining multiple candidate paths from the origin to the target path point; calculating the number of target sections in each candidate path, and determining the candidate path with the least target sections as the target path; generating a first data comparison result according to the change of the second one-dimensional array represented by the positional relationship between any two adjacent first path points and the second path points on the target path compared to the first one-dimensional array. Through this method, the accuracy of the data comparison result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data comparison method, device, electronic device and computer-readable storage medium. Background Art

[0002] After modifying the structured data, the structured data before and after the modification are usually stored separately so that users can trace the modified content. When there are many modified contents, if the modified content is found by manual comparison, the comparison efficiency will be low.

[0003] In the prior art, a hash comparison method can be used to automatically compare structured data before modification and structured data after modification. However, this method usually uses the MD5 hash function to respectively calculate the hash values ​​of the structured data before modification and the structured data after modification, and determines whether the hash values ​​are consistent to determine whether there is a difference between the structured data before modification and the structured data after modification. However, this method can only determine whether there is a difference between the structured data before modification and the structured data after modification, but cannot determine the specific content of the modification, so that the generated comparison result is not accurate enough. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a data comparison method, device, electronic device and computer-readable storage medium to improve the accuracy of data comparison results.

[0005] In a first aspect, an embodiment of the present application provides a data comparison method, comprising:

[0006] According to the preset feature, first feature information corresponding to the preset feature is extracted from each piece of sub-data included in the first structured data, and second feature information corresponding to the preset feature is extracted from each piece of sub-data included in the second structured data;

[0007] sorting the first feature information according to the order of the sub-data corresponding to the first feature information in the first structured data to generate a first one-dimensional array; and sorting the second feature information according to the order of the sub-data corresponding to the second feature information in the second structured data to generate a second one-dimensional array;

[0008] A rectangular coordinate system is constructed according to the first one-dimensional array and the second one-dimensional array; in the rectangular coordinate system, starting from the origin along the positive direction of the horizontal axis, each first feature information in the first one-dimensional array is sequentially used as the value of each point on the horizontal axis, and starting from the origin along the positive direction of the vertical axis, each second feature information in the second one-dimensional array is sequentially used as the value of each point on the vertical axis;

[0009] In the rectangular coordinate system, a plurality of candidate paths from the origin to the target path point are determined based on the similarities and differences between the first feature information in the first one-dimensional array and the second feature information in the second one-dimensional array; wherein the value of the horizontal coordinate of the target path point is the last first feature information in the first one-dimensional array, and the value of the vertical coordinate of the target path point is the last second feature information in the second feature information; each path point on the candidate path corresponds to its own first feature information and second feature information respectively; for the positional relationship between any two adjacent first path points and second path points in the candidate path, if the second path point is only located in the positive direction of the horizontal axis of the first path point, it means that the second one-dimensional array is larger than the first one-dimensional array. The change of the one-dimensional array is that the first characteristic information corresponding to the second path point is used as the deleted characteristic information in the second one-dimensional array; if the second path point is only located in the positive direction of the longitudinal axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the second characteristic information corresponding to the second path point is used as the newly added characteristic information in the second one-dimensional array; if the second path point is simultaneously located in the positive direction of the horizontal axis of the first path point and in the positive direction of the longitudinal axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the first characteristic information corresponding to the second path point is not changed in the second one-dimensional array; wherein, in the candidate path, the second path point is the next path point of the first path point;

[0010] For each candidate path, the number of target road segments in the candidate path is calculated, so as to determine the candidate path with the least target road segments as the target path; wherein the target road segment is a road segment between a third path point and a fourth path point, and the fourth path point is a path point next to the third path point; and the fourth path point is located in a positive direction of a horizontal axis or a positive direction of a vertical axis of the third path point;

[0011] On the basis of the first one-dimensional array, a first data comparison result of the second one-dimensional array compared to the first one-dimensional array is generated according to the change of the second one-dimensional array compared to the first one-dimensional array represented by the positional relationship between any two adjacent first path points and second path points on the target path; the first data comparison result includes the deleted feature information and / or the newly added feature information marked using a specified marking method, and the first feature information that is unchanged in the second one-dimensional array.

[0012] In combination with the first aspect, an embodiment of the present application provides a first possible implementation of the first aspect, wherein, before extracting, according to the preset feature, first feature information corresponding to the preset feature from each piece of sub-data included in the first structured data, and extracting second feature information corresponding to the preset feature from each piece of sub-data included in the second structured data, the method further includes:

[0013] Receive first original data and second original data, parse the first original data into first structured data, and parse the second original data into second structured data; the data formats of the first original data and the second original data are both data formats that can be converted into json data format.

[0014] In combination with the first aspect, an embodiment of the present application provides a second possible implementation of the first aspect, wherein, after generating a first data comparison result of the second one-dimensional array compared with the first one-dimensional array, the method further includes:

[0015] Filter out the first feature information that is unchanged in the second one-dimensional array from the first data comparison result, and use the filtered out first feature information as target feature information;

[0016] For each of the target feature information, determine the sub-data containing the target feature information from the first structured data to determine the sub-data as the first sub-data, and determine the sub-data containing the target feature information from the second structured data to determine the sub-data as the second sub-data;

[0017] For each feature in the first sub-data, comparing first feature information corresponding to the feature in the first sub-data with second feature information corresponding to the feature in the second sub-data to see whether they are the same;

[0018] When the first feature information corresponding to the feature in the first sub-data is different from the second feature information corresponding to the feature in the second sub-data, marking the first feature information corresponding to the feature using a preset marking method to obtain a feature comparison result corresponding to the feature;

[0019] According to the feature comparison result corresponding to each feature in the first sub-data, a second data comparison result between the first sub-data and the second sub-data corresponding to the target feature information is generated.

[0020] In combination with the first aspect, an embodiment of the present application provides a third possible implementation of the first aspect, wherein, after generating a first data comparison result between the second one-dimensional array and the first one-dimensional array, the method further includes:

[0021] The first data comparison result is sent to a user terminal, so that the first data comparison result is displayed to a user of the user terminal through a display screen of the user terminal.

[0022] In a second aspect, an embodiment of the present application further provides a data comparison device, comprising:

[0023] An extraction module, configured to extract, according to a preset feature, first feature information corresponding to the preset feature from each piece of sub-data included in the first structured data, and to extract second feature information corresponding to the preset feature from each piece of sub-data included in the second structured data;

[0024] a sorting module, configured to sort each of the first feature information according to the order of the sub-data corresponding to each of the first feature information in the first structured data, so as to generate a first one-dimensional array; and to sort each of the second feature information according to the order of the sub-data corresponding to each of the second feature information in the second structured data, so as to generate a second one-dimensional array;

[0025] A construction module, configured to construct a rectangular coordinate system according to the first one-dimensional array and the second one-dimensional array; in the rectangular coordinate system, starting from the origin along the positive direction of the horizontal axis, each first feature information in the first one-dimensional array is sequentially used as the value of each point on the horizontal axis, and starting from the origin along the positive direction of the vertical axis, each second feature information in the second one-dimensional array is sequentially used as the value of each point on the vertical axis;

[0026] A first determination module is used to determine, in the rectangular coordinate system, a plurality of candidate paths from the origin to the target path point according to the similarities and differences between the first feature information in the first one-dimensional array and the second feature information in the second one-dimensional array; wherein the value of the horizontal coordinate of the target path point is the last first feature information in the first one-dimensional array, and the value of the vertical coordinate of the target path point is the last second feature information in the second feature information; each path point on the candidate path corresponds to its own first feature information and second feature information respectively; for the positional relationship between any two adjacent first path points and second path points in the candidate path, if the second path point is only located in the positive direction of the horizontal axis of the first path point, it means that the second one-dimensional array is opposite to the first path point. The change compared to the first one-dimensional array is that the first characteristic information corresponding to the second path point is used as the deleted characteristic information in the second one-dimensional array; if the second path point is only located in the positive direction of the longitudinal axis of the first path point, it means that the change compared to the first one-dimensional array of the second one-dimensional array is that the second characteristic information corresponding to the second path point is used as the newly added characteristic information in the second one-dimensional array; if the second path point is simultaneously located in the positive direction of the horizontal axis of the first path point and in the positive direction of the longitudinal axis of the first path point, it means that the change compared to the first one-dimensional array of the second one-dimensional array is that the first characteristic information corresponding to the second path point is not changed in the second one-dimensional array; wherein, in the candidate path, the second path point is the next path point of the first path point;

[0027] A calculation module, for calculating the number of target sections in each candidate path, so as to determine the candidate path with the least target sections as the target path; wherein the target section is a section between a third path point and a fourth path point, and the fourth path point is a path point next to the third path point; and the fourth path point is located in a positive direction of a horizontal axis or a positive direction of a vertical axis of the third path point;

[0028] A first generating module is used to generate a first data comparison result of the second one-dimensional array compared with the first one-dimensional array based on the first one-dimensional array and according to the change of the second one-dimensional array compared with the first one-dimensional array represented by the positional relationship between any two adjacent first path points and second path points on the target path; the first data comparison result includes the deleted feature information and / or the newly added feature information marked using a specified marking method, and the first feature information that is unchanged in the second one-dimensional array.

[0029] In combination with the second aspect, the embodiment of the present application provides a first possible implementation of the second aspect, which further includes:

[0030] A parsing module is used to receive first original data and second original data, parse the first original data into first structured data, and parse the second original data into second structured data, before the extraction module extracts first feature information corresponding to the preset feature from each sub-data included in the first structured data according to the preset feature, and extracts second feature information corresponding to the preset feature from each sub-data included in the second structured data; the data formats of the first original data and the second original data are both data formats that can be converted into json data format.

[0031] In combination with the second aspect, the embodiment of the present application provides a second possible implementation of the second aspect, which further includes:

[0032] a screening module, configured to screen out the first feature information that is unchanged in the second one-dimensional array from the first data comparison result, and use the screened out first feature information as target feature information;

[0033] a second determining module, configured to determine, for each of the target feature information, sub-data containing the target feature information from the first structured data, so as to determine the sub-data as first sub-data, and to determine sub-data containing the target feature information from the second structured data, so as to determine the sub-data as second sub-data;

[0034] a comparison module, configured to compare, for each feature in the first sub-data, first feature information corresponding to the feature in the first sub-data with second feature information corresponding to the feature in the second sub-data to determine whether they are the same;

[0035] a marking module, configured to mark the first feature information corresponding to the feature in the first sub-data using a preset marking method when the first feature information corresponding to the feature in the first sub-data is different from the second feature information corresponding to the feature in the second sub-data, so as to obtain a feature comparison result corresponding to the feature;

[0036] The second generating module is used to generate a second data comparison result between the first sub-data and the second sub-data corresponding to the target feature information according to the feature comparison result corresponding to each feature in the first sub-data.

[0037] In combination with the second aspect, the embodiment of the present application provides a third possible implementation of the second aspect, which further includes:

[0038] The sending module is used to send the first data comparison result to the user terminal, so as to display the first data comparison result to the user of the user terminal through the display screen of the user terminal.

[0039] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps in any possible implementation of the first aspect above are performed.

[0040] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in any possible implementation of the first aspect described above are executed.

[0041] The embodiments of the present application provide a data comparison method, device, electronic device, and computer-readable storage medium, wherein the first feature information corresponding to the preset feature in each sub-data included in the first structured data is extracted to generate a first one-dimensional array according to the first feature information, and the second feature information corresponding to the preset feature in each sub-data included in the second structured data is extracted to generate a second one-dimensional array according to the second feature information. By comparing the first one-dimensional array with the second one-dimensional array, the complexity of data comparison is reduced, which is conducive to improving the comparison efficiency. Moreover, by projecting the first feature information in the first one-dimensional array and the second feature information in the second one-dimensional array to a rectangular coordinate system in this embodiment, and then comparing the first one-dimensional array with the second one-dimensional array, the specific modification content can be determined, which is conducive to improving the accuracy of data comparison.

[0042] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 A flow chart of a data comparison method provided in an embodiment of the present application is shown;

[0045] Figure 2 A schematic diagram of a rectangular coordinate system provided in an embodiment of the present application is shown;

[0046] Figure 3 A schematic diagram showing another candidate path provided in an embodiment of the present application is shown;

[0047] Figure 4 A schematic diagram of the structure of a data comparison device provided in an embodiment of the present application is shown;

[0048] Figure 5 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0049] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0050] At present, the data comparison methods mainly include hash comparison method, sorted tree comparison method and tree structure comparison method.

[0051] When using the hash comparison method to automatically compare the structured data before modification and the structured data after modification, the MD5 hash function is usually used to calculate the hash values ​​of the structured data before modification and the structured data after modification, and whether the hash values ​​are consistent is judged to determine whether there is a difference between the structured data before modification and the structured data after modification. However, this method can only determine whether there is a difference between the structured data before modification and the structured data after modification, but cannot determine the specific content of the modification, so that the generated comparison result is not accurate enough.

[0052] When using the sorting tree comparison method to automatically compare the structured data before modification and the structured data after modification, each piece of data in the structured data before modification is usually reordered, and each piece of data in the structured data after modification is also reordered, and then each piece of data in the two reordered structured data is compared one by one. When the structured data before modification contains feature information of two identical names (for example, two identical names "Zhang San"), and the structured data after modification also contains feature information of two identical names, it is impossible to determine which Zhang San in the structured data before modification is compared with which Zhang San in the structured data after modification, which can easily lead to inaccurate comparison results.

[0053] When using the tree structure comparison method to automatically compare the structured data before modification and the structured data after modification, each piece of data in the structured data before modification needs to be compared one by one with each piece of data in the structured data after modification. When there are many pieces of data in the structured data, the comparison efficiency is easily affected.

[0054] In view of the above problems, based on this, the embodiments of the present application provide a data comparison method, device, electronic device and computer-readable storage medium to improve the accuracy of data comparison results and improve the comparison efficiency, which is described below through embodiments.

[0055] Embodiment 1:

[0056] To facilitate understanding of this embodiment, a data comparison method disclosed in an embodiment of the present application is first introduced in detail. Figure 1 A flow chart of a data comparison method provided in an embodiment of the present application is shown. Figure 1 As shown, the following steps S101-S106 are included:

[0057] S101: According to a preset feature, first feature information corresponding to the preset feature is extracted from each piece of sub-data included in the first structured data, and second feature information corresponding to the preset feature is extracted from each piece of sub-data included in the second structured data.

[0058] In this embodiment, the first structured data may be structured data before modification, and the second structured data may be structured data after modification.

[0059] The first structured data includes multiple sub-data, each of which includes first feature information corresponding to each feature; the second structured data includes multiple sub-data, each of which includes second feature information corresponding to each feature.

[0060] Each piece of sub-data may refer to data corresponding to each user, and one user corresponds to one piece of sub-data. A feature refers to a data item included in each piece of sub-data, and the features included in each piece of sub-data are the same, and each piece of sub-data contains at least one feature.

[0061] Exemplarily, Table 1 shows a schematic table of the first structured data. For example, the first structured data may be the statistical data of students in a class before modification, as shown in Table 1:

[0062] Name ID number gender address Zhang San X1 male A1 Li Si X2 male A2 Wang Wu X3 male A3 Chen Liu X4 female A4

[0063] Table 1

[0064] Table 2 shows a schematic table of the second structured data. For example, the second structured data may be modified class student statistics, as shown in Table 2:

[0065]

[0066]

[0067] Table 2

[0068] Among them, {Zhang San, X1, male, A1} is used as a piece of sub - data. Name, ID number, gender, and address are used as respective features.

[0069] It should be noted that the first structured data shown in Table 1 and the second structured data shown in Table 2 are only illustrative, and the specific content in the first structured data and the second structured data is not limited in this embodiment.

[0070] Exemplarily, when the preset feature is the ID number, the first feature information includes: X1, X2, X3, X4; the second feature information includes: X1, X2, X4.

[0071] S102: Sort each piece of first feature information according to the order of the sub - data corresponding to each first feature information in the first structured data to generate a first one - dimensional array; and sort each piece of second feature information according to the order of the sub - data corresponding to each second feature information in the second structured data to generate a second one - dimensional array.

[0072] Exemplarily, the sub - data {Zhang San, X1, male, A1} corresponding to the first feature information X1 is the first in the first structured data. Therefore, in the first one - dimensional array, the first feature information X1 is ranked first. By analogy, the first one - dimensional array can be obtained as: {X1, X2, X3, X4}. Similarly, the second one - dimensional array can be obtained as: {X1, X2, X4}.

[0073] S103: Construct a rectangular coordinate system according to the first one - dimensional array and the second one - dimensional array; in the rectangular coordinate system, starting from the origin along the positive x - axis direction, sequentially use each piece of first feature information in the first one - dimensional array as the value of each point on the x - axis, and starting from the origin along the positive y - axis direction, sequentially use each piece of second feature information in the second one - dimensional array as the value of each point on the y - axis.

[0074] In this embodiment, the comparison between the first one - dimensional array and the second one - dimensional array is essentially to find the minimum number of steps required to change the first one - dimensional array (the array before modification) into the second one - dimensional array (the array after modification). For example, in the above - mentioned embodiment, the minimum number of operation steps to change the first one - dimensional array {X1, X2, X3, X4} before modification into the second one - dimensional array {X1, X2, X4} after modification is 1, that is, deleting X3 is enough.

[0075] However, for a one-dimensional array containing more characteristic information, it cannot be seen at a glance by the naked eye, and we need to calculate to get the result. In this embodiment, the calculation method of the graph is used to get the difference result.

[0076] Graph processing is to model data in the form of graphs to obtain results that were previously difficult to obtain using a flat perspective.

[0077] The first one-dimensional array before modification and the second one-dimensional array after modification obtained in this embodiment are used as the horizontal coordinate and the vertical coordinate of the graph respectively, and the process of finding the difference can be transformed into a graph search. Figure 2 A schematic diagram of a rectangular coordinate system provided in an embodiment of the present application is shown, such as Figure 2 As shown, the horizontal axis is the x-axis, the vertical axis is the y-axis, and the direction indicated by the arrow is the positive direction.

[0078] S104: In a rectangular coordinate system, a plurality of candidate paths from the origin to the target path point are determined according to the similarities and differences between the first feature information in the first one-dimensional array and the second feature information in the second one-dimensional array.

[0079] The value of the horizontal coordinate of the target path point is the last first feature information of the first one-dimensional array, and the value of the vertical coordinate of the target path point is the last second feature information of the second feature information; each path point on the candidate path corresponds to its own first feature information and second feature information respectively; for the positional relationship between any two adjacent first path points and second path points in the candidate path, if the second path point is only located in the positive direction of the horizontal axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the first feature information corresponding to the second path point is used as the deleted feature information in the second one-dimensional array; if the second path point is only located in the positive direction of the vertical axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the second feature information corresponding to the second path point is used as the newly added feature information in the second one-dimensional array; if the second path point is simultaneously located in the positive direction of the horizontal axis of the first path point and in the positive direction of the vertical axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the first feature information corresponding to the second path point is not changed in the second one-dimensional array; wherein, in the candidate path, the second path point is the next path point of the first path point.

[0080] In this embodiment, the origin is the starting path point on the candidate path, and the target path point is the last path point on the candidate path.

[0081] For example, Figure 2As shown, when generating candidate paths, move from the origin to the positive direction of the x-axis and the positive direction of the y-axis. Therefore, any candidate path from the origin (i.e., the starting path point) to the target path point represents a method of changing the first one-dimensional array to a second one-dimensional array. Figure 2 A candidate path is shown. Figure 3 A schematic diagram of another candidate path provided in an embodiment of the present application is shown.

[0082] by Figure 2 The corresponding candidate path is used as an example for specific description, and the coordinates of the target path point are (X4, X4). When the first path point is the origin (0, 0) and the second path point is the point (X1, 0), the second path point (X1, 0) is only located in the positive direction of the horizontal axis of the first path point (0, 0). At this time, it means that the change of the second one-dimensional array compared to the first one-dimensional array is that the first feature information X1 corresponding to the second path point (X1, 0) is used as the deleted feature information in the second one-dimensional array, that is, the first feature information X1 is deleted in the second one-dimensional array.

[0083] When the first path point is (X1, 0) and the second path point is (X2, 0), the second path point (X2, 0) is only located in the positive direction of the horizontal axis of the first path point (X1, 0). At this time, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the first feature information X2 corresponding to the second path point (X2, 0) is used as the deleted feature information in the second one-dimensional array, that is, the first feature information X2 is deleted in the second one-dimensional array.

[0084] When the first path point is (X2, 0) and the second path point is (X3, 0), the second path point (X3, 0) is only located in the positive direction of the horizontal axis of the first path point (X2, 0). At this time, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the first feature information X3 corresponding to the second path point (X3, 0) is used as the deleted feature information in the second one-dimensional array, that is, the first feature information X3 is deleted in the second one-dimensional array.

[0085] When the first path point is (X3, 0) and the second path point is (X3, X1), the second path point (X3, X1) is only located in the positive direction of the longitudinal axis of the first path point (X3, 0). At this time, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that only the second feature information X1 corresponding to the second path point (X3, X1) is used as the newly added feature information in the second one-dimensional array, that is, the second feature information X1 is newly added to the second one-dimensional array.

[0086] When the first path point is (X3, X1) and the second path point is (X3, X2), the second path point (X3, X2) is only located in the positive direction of the longitudinal axis of the first path point (X3, X1). At this time, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that only the second characteristic information X2 corresponding to the second path point (X3, X2) is used as the newly added characteristic information in the second one-dimensional array, that is, the second characteristic information X2 is newly added to the second one-dimensional array.

[0087] When the first path point is (X3, X2) and the second path point is (X4, X4), the second path point (X4, X4) is located in the positive direction of the horizontal axis of the first path point and in the positive direction of the vertical axis of the first path point (X3, X2), that is, when the second path point is located on the diagonal of the first path point, it means that the change of the second one-dimensional array compared to the first one-dimensional array is that the first characteristic information X4 corresponding to the second path point (X4, X4) has not changed in the second one-dimensional array, that is, the second characteristic information X4 in the second one-dimensional array has not changed.

[0088] From the above, we can know that Figure 2 The process of changing from the first one-dimensional array to the second one-dimensional array represented by the corresponding candidate path is: based on the first one-dimensional array, delete X1, delete X2, delete X3, add X1, add X2, and X4 remains unchanged. The operation step is 5.

[0089] Similarly, Figure 3 The process of changing from the first one-dimensional array to the second one-dimensional array represented by the corresponding candidate path is: X1 remains unchanged, X2 remains unchanged, X3 is deleted, X4 remains unchanged, and the operation step is 1.

[0090] S105: For each candidate path, calculate the number of target sections in the candidate path to determine the candidate path with the least target sections as the target path; wherein the target section is the section between the third path point and the fourth path point, and the fourth path point is the next path point of the third path point; the fourth path point is located in the positive direction of the horizontal axis or the positive direction of the vertical axis of the third path point.

[0091] In this embodiment, the number of target road segments represents the number of operation steps in the process of changing the candidate path from the first one-dimensional array to the second one-dimensional array. Figure 2 The number of target road segments of the corresponding candidate path is 5, as shown in Figure 3 The number of target sections of the candidate path corresponding to the above is 1. Similarly, you can try other candidate routes. If the operation steps (target sections) are not as Figure 3 The corresponding candidate path shown in FIG. has fewer operation steps (target section), so the optimal target path can be determined as follows: Figure 3 The corresponding candidate paths are shown.

[0092] S106: Based on the first one-dimensional array, generate a first data comparison result of the second one-dimensional array compared to the first one-dimensional array according to the change of the second one-dimensional array represented by the positional relationship between any two adjacent first path points and second path points on the target path compared to the first one-dimensional array; the first data comparison result includes deleted feature information and / or newly added feature information marked using a specified marking method, and the first feature information that is unchanged in the second one-dimensional array.

[0093] Exemplarily, following the above embodiment, the first data comparison result is {X1, X2, -X3, X4}, wherein -X3 represents the deletion feature information marked with the specified marking method "-"; X1, X2 and X4 are the first feature information that has not been changed in the second one-dimensional array.

[0094] In this embodiment, the designated marking method includes "-" and "+", "-" indicates deletion, "+" indicates addition, and no sign indicates unchanged.

[0095] In a possible implementation manner, before executing step S101, the following steps may also be performed:

[0096] The first original data and the second original data are received, the first original data is parsed into the first structured data, and the second original data is parsed into the second structured data; the data formats of the first original data and the second original data are both data formats that can be converted into the json data format.

[0097] The first original data and the second original data are data that can be converted into a json data format, for example, json data, xml data, txt data, csv data, yml data, yaml data, etc.

[0098] In a possible implementation manner, after executing step S106, the following steps S1071-S1076 may be further performed:

[0099] S1071: Filter out the first feature information that is unchanged in the second one-dimensional array from the first data comparison result, and use the filtered out first feature information as target feature information.

[0100] Exemplarily, when the first data comparison result is {X1, X2, -X3, X4}, the first feature information that remains unchanged in the second one-dimensional array is X1, X2, and X4, and the screened first feature information X1, X2, and X4 are used as target feature information.

[0101] S1072: For each piece of target feature information, determine the sub-data containing the target feature information from the first structured data to determine the sub-data as the first sub-data, and determine the sub-data containing the target feature information from the second structured data to determine the sub-data as the second sub-data.

[0102] Next, taking the target feature information X4 as an example for illustration, the first sub-data corresponding to the target feature information X4 determined from the first structured data is: {Chen Liu, X4, female, A4}; the second sub-data corresponding to the target feature information X1 determined from the second structured data is: {Chen Liu, X4, female, A5}.

[0103] S1073: For each feature in the first sub-data, compare whether the first feature information corresponding to the feature in the first sub-data is the same as the second feature information corresponding to the feature in the second sub-data.

[0104] Continuing with the above example, compare whether the first sub-data {Chen Liu, X4, female, A4} is the same as the second sub-data {Chen Liu, X4, female, A5}.

[0105] S1074: When the first feature information corresponding to the feature in the first sub-data is different from the second feature information corresponding to the feature in the second sub-data, use a preset marking method to mark the first feature information corresponding to the feature to obtain the feature comparison result corresponding to the feature.

[0106] In this example, the preset marking method can be used to mark A4 in the first sub-data {Chen Liu, X4, female, A4}, and the obtained feature comparison result corresponding to A4 can be {-A4, +A5}.

[0107] S1075: According to the feature comparison results corresponding to each feature in the first sub-data, generate the second data comparison result between the first sub-data and the second sub-data corresponding to the target feature information.

[0108] Exemplarily, the second data comparison result can be {Chen Liu, X4, female, -A4, +A5}.

[0109] In a possible implementation manner, after executing step S106, the following steps can also be executed:

[0110] Send the first data comparison result to the user terminal to display the first data comparison result to the user of the user terminal through the display screen of the user terminal.

[0111] In this example, the first data comparison result and the second data comparison result can also be sent to the user terminal to display the first data comparison result and the second data comparison result to the user of the user terminal through the display screen of the user terminal.

[0112] Embodiment 2:

[0113] Based on the same technical concept, the present application also provides a data comparison device. Figure 4 A schematic diagram of the structure of a data comparison device provided in an embodiment of the present application is shown. Figure 4 As shown, the device comprises:

[0114] The extraction module 401 is used to extract, according to the preset feature, first feature information corresponding to the preset feature from each piece of sub-data included in the first structured data, and to extract second feature information corresponding to the preset feature from each piece of sub-data included in the second structured data;

[0115] A sorting module 402 is used to sort each of the first feature information according to the order of the sub-data corresponding to each of the first feature information in the first structured data to generate a first one-dimensional array; and sort each of the second feature information according to the order of the sub-data corresponding to each of the second feature information in the second structured data to generate a second one-dimensional array;

[0116] A construction module 403 is used to construct a rectangular coordinate system according to the first one-dimensional array and the second one-dimensional array; in the rectangular coordinate system, starting from the origin along the positive direction of the horizontal axis, each first feature information in the first one-dimensional array is used as the value of each point on the horizontal axis, and starting from the origin along the positive direction of the vertical axis, each second feature information in the second one-dimensional array is used as the value of each point on the vertical axis;

[0117] The first determination module 404 is used to determine multiple candidate paths from the origin to the target path point in the rectangular coordinate system according to the similarities and differences between the first feature information in the first one-dimensional array and the second feature information in the second one-dimensional array; wherein the value of the horizontal coordinate of the target path point is the last first feature information in the first one-dimensional array, and / or the value of the vertical coordinate of the target path point is the last second feature information in the second feature information; each path point on the candidate path corresponds to its own first feature information and second feature information respectively; for the positional relationship between any two adjacent first path points and second path points in the candidate path, if the second path point is only located in the positive direction of the horizontal axis of the first path point, it means that the second one-dimensional array The change of the array compared with the first one-dimensional array is that the first feature information corresponding to the second path point is used as the deleted feature information in the second one-dimensional array; if the second path point is only located in the positive direction of the longitudinal axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the second feature information corresponding to the second path point is used as the newly added feature information in the second one-dimensional array; if the second path point is simultaneously located in the positive direction of the horizontal axis of the first path point and in the positive direction of the longitudinal axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the first feature information corresponding to the second path point is not changed in the second one-dimensional array; wherein, in the candidate path, the second path point is the next path point of the first path point;

[0118] The calculation module 405 is used to calculate the number of target sections in each candidate path, so as to determine the candidate path with the least target sections as the target path; wherein the target section is the section between the third path point and the fourth path point, and the fourth path point is the next path point of the third path point; and the fourth path point is located in the positive direction of the horizontal axis or the positive direction of the vertical axis of the third path point;

[0119] The first generating module 406 is used to generate a first data comparison result of the second one-dimensional array compared with the first one-dimensional array based on the first one-dimensional array and according to the change of the second one-dimensional array compared with the first one-dimensional array represented by the positional relationship between any two adjacent first path points and second path points on the target path; the first data comparison result includes the deleted feature information and / or the newly added feature information marked using a specified marking method, and the first feature information that is unchanged in the second one-dimensional array.

[0120] Optionally, also include:

[0121] A parsing module is used to receive first original data and second original data, parse the first original data into first structured data, and parse the second original data into second structured data before the extraction module 401 extracts first feature information corresponding to the preset feature from each sub-data included in the first structured data according to the preset feature, and extracts second feature information corresponding to the preset feature from each sub-data included in the second structured data; the data formats of the first original data and the second original data are both data formats that can be converted into json data format.

[0122] Optionally, also include:

[0123] a screening module, configured to screen out the first characteristic information that is unchanged in the second one-dimensional array from the first data comparison result, and use the screened out first characteristic information as target characteristic information;

[0124] a second determining module, configured to determine, for each of the target feature information, sub-data containing the target feature information from the first structured data, so as to determine the sub-data as first sub-data, and to determine sub-data containing the target feature information from the second structured data, so as to determine the sub-data as second sub-data;

[0125] a comparison module, configured to compare, for each feature in the first sub-data, first feature information corresponding to the feature in the first sub-data with second feature information corresponding to the feature in the second sub-data to determine whether they are the same;

[0126] a marking module, configured to mark the first feature information corresponding to the feature in the first sub-data using a preset marking method when the first feature information corresponding to the feature in the first sub-data is different from the second feature information corresponding to the feature in the second sub-data, so as to obtain a feature comparison result corresponding to the feature;

[0127] The second generating module is used to generate a second data comparison result between the first sub-data and the second sub-data corresponding to the target feature information according to the feature comparison result corresponding to each feature in the first sub-data.

[0128] Optionally, also include

[0129] The sending module is used to send the first data comparison result to the user terminal, so as to display the first data comparison result to the user of the user terminal through the display screen of the user terminal.

[0130] Embodiment three:

[0131] Figure 5A structural diagram of an electronic device provided for an embodiment of the present application includes: a processor 501, a memory 502 and a bus 503, wherein the memory 502 stores machine-readable instructions executable by the processor 501. When the electronic device runs the above-mentioned information processing method, the processor 501 communicates with the memory 502 through the bus 503, and the processor 501 executes the machine-readable instructions to perform the method steps described in Example 1.

[0132] Embodiment 4:

[0133] Embodiment 4 of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method steps described in Embodiment 1 are executed.

[0134] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, electronic devices, and computer-readable storage media can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0135] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some communication interface, device or unit, which can be electrical, mechanical or other forms.

[0136] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0137] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0138] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0139] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A data comparison method, characterized in that: include: According to the preset feature, first feature information corresponding to the preset feature is extracted from each piece of sub-data included in the first structured data, and second feature information corresponding to the preset feature is extracted from each piece of sub-data included in the second structured data; sorting the first feature information according to the order of the sub-data corresponding to the first feature information in the first structured data to generate a first one-dimensional array; and sorting the second feature information according to the order of the sub-data corresponding to the second feature information in the second structured data to generate a second one-dimensional array; A rectangular coordinate system is constructed according to the first one-dimensional array and the second one-dimensional array; in the rectangular coordinate system, starting from the origin along the positive direction of the horizontal axis, each first feature information in the first one-dimensional array is sequentially used as the value of each point on the horizontal axis, and starting from the origin along the positive direction of the vertical axis, each second feature information in the second one-dimensional array is sequentially used as the value of each point on the vertical axis; In the rectangular coordinate system, a plurality of candidate paths from the origin to the target path point are determined based on the similarities and differences between the first feature information in the first one-dimensional array and the second feature information in the second one-dimensional array; wherein the value of the horizontal coordinate of the target path point is the last first feature information in the first one-dimensional array, and the value of the vertical coordinate of the target path point is the last second feature information in the second feature information; each path point on the candidate path corresponds to its own first feature information and second feature information respectively; for the positional relationship between any two adjacent first path points and second path points in the candidate path, if the second path point is only located in the positive direction of the horizontal axis of the first path point, it means that the second one-dimensional array is larger than the first one-dimensional array. The change of the one-dimensional array is that the first characteristic information corresponding to the second path point is used as the deleted characteristic information in the second one-dimensional array; if the second path point is only located in the positive direction of the longitudinal axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the second characteristic information corresponding to the second path point is used as the newly added characteristic information in the second one-dimensional array; if the second path point is simultaneously located in the positive direction of the horizontal axis of the first path point and in the positive direction of the longitudinal axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the first characteristic information corresponding to the second path point is not changed in the second one-dimensional array; wherein, in the candidate path, the second path point is the next path point of the first path point; For each candidate path, the number of target road segments in the candidate path is calculated, so as to determine the candidate path with the least target road segments as the target path; wherein the target road segment is a road segment between a third path point and a fourth path point, and the fourth path point is a path point next to the third path point; and the fourth path point is located in a positive direction of a horizontal axis or a positive direction of a vertical axis of the third path point; On the basis of the first one-dimensional array, a first data comparison result of the second one-dimensional array compared to the first one-dimensional array is generated according to the change of the second one-dimensional array compared to the first one-dimensional array represented by the positional relationship between any two adjacent first path points and second path points on the target path; the first data comparison result includes the deleted feature information and / or the newly added feature information marked using a specified marking method, and the first feature information that is unchanged in the second one-dimensional array.

2. The method according to claim 1, characterized in that: Before extracting first feature information corresponding to the preset feature from each piece of sub-data included in the first structured data according to the preset feature, and extracting second feature information corresponding to the preset feature from each piece of sub-data included in the second structured data, the method further includes: Receive first original data and second original data, parse the first original data into first structured data, and parse the second original data into second structured data; the data formats of the first original data and the second original data are both data formats that can be converted into json data format.

3. The method according to claim 1, characterized in that: After generating a first data comparison result between the second one-dimensional array and the first one-dimensional array, the method further includes: Filter out the first feature information that is unchanged in the second one-dimensional array from the first data comparison result, and use the filtered out first feature information as target feature information; For each of the target feature information, determine the sub-data containing the target feature information from the first structured data to determine the sub-data as the first sub-data, and determine the sub-data containing the target feature information from the second structured data to determine the sub-data as the second sub-data; For each feature in the first sub-data, comparing first feature information corresponding to the feature in the first sub-data with second feature information corresponding to the feature in the second sub-data to see whether they are the same; When the first feature information corresponding to the feature in the first sub-data is different from the second feature information corresponding to the feature in the second sub-data, marking the first feature information corresponding to the feature using a preset marking method to obtain a feature comparison result corresponding to the feature; According to the feature comparison result corresponding to each feature in the first sub-data, a second data comparison result between the first sub-data and the second sub-data corresponding to the target feature information is generated.

4. The method according to claim 1, characterized in that: After generating a first data comparison result between the second one-dimensional array and the first one-dimensional array, the method further includes: The first data comparison result is sent to a user terminal, so that the first data comparison result is displayed to a user of the user terminal through a display screen of the user terminal.

5. A data comparison device, characterized in that: include: An extraction module, configured to extract, according to a preset feature, first feature information corresponding to the preset feature from each piece of sub-data included in the first structured data, and to extract second feature information corresponding to the preset feature from each piece of sub-data included in the second structured data; a sorting module, configured to sort each of the first feature information according to the order of the sub-data corresponding to each of the first feature information in the first structured data, so as to generate a first one-dimensional array; and to sort each of the second feature information according to the order of the sub-data corresponding to each of the second feature information in the second structured data, so as to generate a second one-dimensional array; A construction module, configured to construct a rectangular coordinate system according to the first one-dimensional array and the second one-dimensional array; in the rectangular coordinate system, starting from the origin along the positive direction of the horizontal axis, each first feature information in the first one-dimensional array is sequentially used as the value of each point on the horizontal axis, and starting from the origin along the positive direction of the vertical axis, each second feature information in the second one-dimensional array is sequentially used as the value of each point on the vertical axis; A first determination module is used to determine, in the rectangular coordinate system, a plurality of candidate paths from the origin to the target path point according to the similarities and differences between the first feature information in the first one-dimensional array and the second feature information in the second one-dimensional array; wherein the value of the horizontal coordinate of the target path point is the last first feature information in the first one-dimensional array, and / or the value of the vertical coordinate of the target path point is the last second feature information in the second feature information; each path point on the candidate path corresponds to its own first feature information and second feature information respectively; for the positional relationship between any two adjacent first path points and second path points in the candidate path, if the second path point is only located in the positive direction of the horizontal axis of the first path point, it means that the second one-dimensional array The change of the second path point compared with the first one-dimensional array is that the first feature information corresponding to the second path point is used as the deleted feature information in the second one-dimensional array; if the second path point is only located in the positive direction of the longitudinal axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the second feature information corresponding to the second path point is used as the newly added feature information in the second one-dimensional array; if the second path point is simultaneously located in the positive direction of the horizontal axis of the first path point and in the positive direction of the longitudinal axis of the first path point, it means that the change of the second one-dimensional array compared with the first one-dimensional array is that the first feature information corresponding to the second path point is not changed in the second one-dimensional array; wherein, in the candidate path, the second path point is the next path point of the first path point; A calculation module, for calculating the number of target sections in each candidate path, so as to determine the candidate path with the least target sections as the target path; wherein the target section is a section between a third path point and a fourth path point, and the fourth path point is a path point next to the third path point; and the fourth path point is located in a positive direction of a horizontal axis or a positive direction of a vertical axis of the third path point; A first generating module is used to generate a first data comparison result of the second one-dimensional array compared with the first one-dimensional array based on the first one-dimensional array and according to the change of the second one-dimensional array compared with the first one-dimensional array represented by the positional relationship between any two adjacent first path points and second path points on the target path; the first data comparison result includes the deleted feature information and / or the newly added feature information marked using a specified marking method, and the first feature information that is unchanged in the second one-dimensional array.

6. The device according to claim 5, characterized in that: Also includes: A parsing module is used to receive first original data and second original data, parse the first original data into first structured data, and parse the second original data into second structured data, before the extraction module extracts first feature information corresponding to the preset feature from each sub-data included in the first structured data according to the preset feature, and extracts second feature information corresponding to the preset feature from each sub-data included in the second structured data; the data formats of the first original data and the second original data are both data formats that can be converted into json data format.

7. The device according to claim 5, characterized in that: Also includes: a screening module, configured to screen out the first feature information that is unchanged in the second one-dimensional array from the first data comparison result, and use the screened out first feature information as target feature information; a second determining module, configured to determine, for each of the target feature information, sub-data containing the target feature information from the first structured data, so as to determine the sub-data as first sub-data, and to determine sub-data containing the target feature information from the second structured data, so as to determine the sub-data as second sub-data; a comparison module, configured to compare, for each feature in the first sub-data, first feature information corresponding to the feature in the first sub-data with second feature information corresponding to the feature in the second sub-data to determine whether they are the same; a marking module, configured to mark the first feature information corresponding to the feature in the first sub-data using a preset marking method when the first feature information corresponding to the feature in the first sub-data is different from the second feature information corresponding to the feature in the second sub-data, so as to obtain a feature comparison result corresponding to the feature; The second generating module is used to generate a second data comparison result between the first sub-data and the second sub-data corresponding to the target feature information according to the feature comparison result corresponding to each feature in the first sub-data.

8. The device according to claim 5, characterized in that: Also includes: The sending module is used to send the first data comparison result to the user terminal, so as to display the first data comparison result to the user of the user terminal through the display screen of the user terminal.

9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method as claimed in any one of claims 1 to 4 are performed.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are executed.