Database repair counting method based on function dependence and interactive visualization system
Through the database repair counting method and interactive visualization system based on function dependency, the calculation complexity and user interaction of database repair counting are optimized, and the problems of high computational complexity and poor dynamic adaptability in the existing technology are solved, and efficient database repair and dynamic visualization display are realized.
Patent Information
- Application Number
- CN202510414532.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-18
AI Technical Summary
The prior art has high computational complexity, poor dynamic adaptability and insufficient interactiveness in database repair counting, making it difficult to effectively dynamically repair and continuously evaluate inconsistencies in big data environments, and lacks user preference for interactive integration mechanisms.
The database repair counting method based on function dependency is adopted to optimize the calculation complexity through the Blocktree structure, and the repair count is reduced from exponential level to polynomial level. It is combined with an interactive visualization system, including inconsistent visualization generation module, inconsistent detection module, function dependency mining module and repair calculation module, providing dynamic repair progress indication.
It significantly improves computing efficiency, increases computing time by 4 times, enhances user interactivity, provides intuitive repair progress display and repair quantity display, and improves user experience.
Smart Images

Figure CN120336303A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of database repair, and relates to an efficient counting method for database inconsistency repair, in particular to a repair counting method and an interactive visualization system based on functional dependency relationships. Background Art
[0002] In real life, there are quite serious problems in the availability of data. The availability of data in many databases is very poor, and there are quite a lot of low-quality data or so-called dirty data, which are manifested as inconsistent, inaccurate, and incomplete, etc. These quality problems significantly reduce the availability of data in practical applications, making the value of data unable to be fully exerted.
[0003] Inconsistent data, as one of the most typical types of low-quality data, has been widely concerned. Whether in the field of computer science or in the fields of management science and engineering, the management of inconsistent data has always been a long-term and important issue. The inconsistency of data in an inconsistent database often occurs due to different reasons and different applications. For example, in some common big data applications, information is usually obtained from inaccurate sources (such as sensors and social networks at the source), or transmitted through inaccurate program processes (such as natural language and signal processing). Similarly, this kind of inconsistency also occurs in the process of integrating conflicting data from different sources. For example, when the terminal of an information system integrates today's data, it obtains two sets of data from two different sensors: (Alan, 11:30, Canteen), (Alan, 11:30, Playground). Without considering the same name, obviously a person cannot be in different places at the same time, so these two sets of data are conflicting data, and the database is in an inconsistent state.
[0004] The repair of database inconsistency is a long-existing and complex technical problem. Especially in the big data environment, with the diversification of information sources and errors in the transmission process, the problem of data inconsistency becomes more prominent. To handle inconsistent data, researchers have proposed various methods, including the use of functional dependencies and conflict graphs, etc.
[0005] In the field of database inconsistency repair, the theory of repair and consistent query answering proposed by Arenas, Bertossi, and Chomicki (Pontifical Catholic University of Chile, Monmouth University) has laid the core framework. In addition, Ester Livshits, Rina Kochirgan, Segev Tsur, etc. from the Technion - Israel Institute of Technology, University of Waterloo, Duke University have conducted detailed research on the nature of database evaluation. They not only pointed out the applications of evaluation in areas such as credible estimation of databases, progress indication in human - computer interaction, and selection of repair priorities, but also defined the evaluation of database consistency based on the number of different repair methods (including the subset repair we studied), and proposed four principles for inconsistency measurement: Positivity, Monotonicity, Continuity, and Progression, which are the properties that an evaluation should have. Dyer, Goldberg, etc. proposed the concept of Approximation - Preserve reduction (hereinafter referred to as AP reduction) based on the approximate counting problem to classify approximate counting from the perspective of complexity.
[0006] Through the above analysis of the research status at home and abroad, we find that there have been some studies on variants in the field of counting for database repair. For example, some studies have examined the counting problems of repairs under different integrity constraints, such as primary key constraints; other studies have focused on counting under query constraints, such as approximate counting for query answering with inequalities and negative quantifiers, and have achieved a series of results on complexity classification. This indicates that the study of approximate counting and its complexity classification has always been a hot topic in the field of repair counting and is also one of the important methods to solve the repair counting problem. In addition, some literature has also explored the evaluation problem of inconsistent databases and directly pointed out the importance of subset repair: subset repair is an important database measurement method that can satisfy the four excellent evaluation properties mentioned above, thus effectively evaluating the degree of database inconsistency. At the same time, this measurement also has important application value in the field of human - computer interaction, such as for progress indication. Furthermore, the number of subset repairs is also related to the Shapley value in cooperative game theory.
[0007] Although the above work has promoted the theoretical system of inconsistency repair, there are still significant deficiencies:
[0008] 1. Computational infeasibility: Traditional methods have not made a theoretical complexity classification for subset repair, that is, the limit of approximate calculation has not been given; in addition, minimizing the symmetric difference and subset repair enumeration are difficult to be practical in ultra - large - scale data scenarios;
[0009] 2. Lack of evaluation dynamics: Only the evaluation indicators are given, and dynamic repair and continuous evaluation are not carried out;
[0010] 3. Insufficient human - machine collaboration: Lack of an interactive integration mechanism for user preferences, making it difficult to adjust in combination with business requirements. Summary of the Invention
[0011] To solve the problems of high computational complexity, poor dynamic adaptability, and insufficient interactivity in database repair count calculation in the prior art, the present invention provides a database repair count method based on functional dependencies, and realizes dynamic visualization and user collaboration through an interactive system.
[0012] The object of the present invention is achieved through the following technical solutions:
[0013] A database repair count method based on functional dependencies, comprising the following steps:
[0014] Step 1. Determine functional dependencies:
[0015] Step 11. Left - hand - side functional dependencies:
[0016] (1) Define the left - hand - side chain: A functional - dependency pattern (S, Δ) has the form of a left - hand - side chain if and only if for any two functional dependencies X1 → Y1 and X2 → Y2 in Δ, either or
[0017] (2) If (S, Δ) has the form of a left - hand - side chain, then the functional dependencies in Δ can be written in the following ordered form: X1 → Y1, X2 → Y2,..., X n → Y n , where for any 1 ≤ i < j ≤ n, there is
[0018] (3) If the functional - dependency set F satisfies the following conditions, then F is called a minimal dependency set:
[0019] (a) The right - hand side of any functional dependency in F contains only one attribute;
[0020] (b) There does not exist such a functional dependency X → A in F that makes F equivalent to F - {X → A}, that is, no functional dependency in F can be derived from other functional dependencies in F;
[0021] (c) There does not exist such a functional dependency X → A in F, where X has a proper subset Y such that F - {X → A} ∪ {Y → A} is equivalent to F, that is, the left - hand side of each functional dependency in F is the smallest set of attributes;
[0022] (4) If the minimal functional dependencies Δ m of the functional - dependency set are in the form of a left - hand - side chain, then the set of functional dependencies Δ that is in the form of a left - hand - side chain of minimal functional dependencies is also called the left - hand - side chain;
[0023] (5) If (S, Δ) is equivalent to a function - dependency pattern in left - chain form, then for each relation r, the corresponding conflict graph must be P4 - free; if the conflict graph is P4 - free, then the set of functional dependencies of the corresponding (S, Δ) is in left - chain form;
[0024] Step 12. For non - left - hand functional dependencies, #MIS≡ AP #SAT;
[0025] Step 2. Output the inconsistent visualization situation in the data;
[0026] Step 21. Process the input data and construct nodes: Convert each row of the input data into a node. If there are duplicates, add a count after the node name. At the same time, assign colors according to the original attributes of the nodes, and dynamically adjust the node size to reflect the name length;
[0027] Step 22. Traverse all pairs of nodes, check whether the functional dependencies are violated, and establish conflict edges when two nodes violate the functional dependencies:
[0028] Step 23. Visualize the conflict relationships: Generate a visualization image. Nodes with the same color are clustered and displayed. The nodes in the graph represent data instances, and the edges connect the nodes with conflicts. Finally, output a visualization image with color coding and size differences;
[0029] Step 3. Inconsistency detection: For the data input, use Step 2 to check whether there are conflicts, that is, whether there are conflict edges;
[0030] Step 4. Output the number of repairs:
[0031] Step 41. Define Blocktree: Consider a database D on S and a set of functional dependencies Δ in left - chain form. Let be the set of functional dependencies in Δ related to R, where R ∈ S, denoted by D R ; Denote the (R, Λ) - Blocktree as a labeled tree T(V, E, σ) of height 2n, where is the label of each node, such that:
[0032] If the node v is the root node, then σ(v) = D R ;
[0033] For the nodes {v1, v2,..., v k} on the (2i + 1) - th layer, where i ∈ {0, 1,..., n - 1}, k > 0, and a parent node u, then and
[0034] For the nodes {v1, v2,..., vk}, where \(i\in\{0,1,\ldots,n - 1\}\), \(k\gt0\), and a parent node \(u\), then and
[0035] Step 42: Given a database \(D\) and a set of functional dependencies \(\Delta\) of the left - hand chain, its corresponding Blocktree can be computed in polynomial time of \(|D|\);
[0036] Step 43: Construct the Blocktree structure: Based on \(\Delta\), partition \(D\) into layers. The odd - numbered layers are conflict blocks, and the even - numbered layers are independent blocks;
[0037] Step 44: Select the root node;
[0038] Step 45: For the nodes in the even - numbered layers, select all their children;
[0039] Step 46: For the nodes in the odd - numbered layers, select only one of their children;
[0040] Step 47: Calculate the union of the labels of all the selected leaf nodes, and a repair is obtained;
[0041] Step 5: Generate the repair progress using the number of repairs:
[0042] Step 51: Initialize the repair benchmark initial_repair_count, and use the initial repair quantity value as the progress benchmark;
[0043] Step 52: Dynamically calculate the current progress. Denote the current repair quantity as current_repair, then the progress value is \(1.0-(current_repair / initial_repair_count)\);
[0044] Step 53: Generate a smooth visual progress bar.
[0045] A repair counting and interactive visualization system based on functional dependency relationships, including an inconsistent visualization generation module, an inconsistency detection module, a functional dependency mining module, a repair calculation module, and a progress indication module, where:
[0046] The inconsistent visualization generation module is responsible for outputting the inconsistent visualization situation in the data. Through node definition: adopting the "attribute_value" cascading naming rule; conflict expression: connecting the fact nodes with conflicts through edges; layout optimization: applying a clustering algorithm to achieve the spatial aggregation layout of color grouping, and the generation of the visualization image is completed through three processes;
[0047] The inconsistency detection module is responsible for supporting text / table dual-mode input for data input, using the inconsistency visualization module to check for conflicts, that is, whether there are conflict edges, and outputting whether there are conflicts;
[0048] The function dependency mining module is responsible for determining function dependencies. For non-left-chain function dependencies, it uses the TANE algorithm to mine function dependencies from the input data and generate minimal function dependencies for the user to select and provide guidance to the user;
[0049] The repair calculation module is responsible for outputting the number of repairs. For function dependencies that conform to the left-chain structure, it directly calculates the number of repairs and gives a possible repair;
[0050] The progress indication module is responsible for dynamically displaying the repair process in the form of a progress bar / percentage, etc., and generating and displaying the repair progress using the number of repairs.
[0051] Compared with the prior art, the present invention has the following advantages:
[0052] 1. Improved calculation efficiency: Through the optimization of the Blocktree structure, the repair counting complexity is reduced from exponential level to polynomial level, and experimental comparison shows that the calculation time is increased by 4 times;
[0053] 2. Enhanced dynamic adaptability and optimized user interaction: The interactive Web application provides visual display of repair progress and the number of repairs, enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 Schematic diagrams of the maximum independent set and the maximal independent set.
[0055] Figure 2 Examples of P4-free graphs and non-P4-free graphs, where a is a P4-free graph and b is not a P4-free graph.
[0056] Figure 3 For D R 's Blocktree.
[0057] Figure 4 The conflict graph under FD1.
[0058] Figure 5 Is the conflict graph under FD1 and FD2.
[0059] Figure 6 Is the conflict graph of Li Si's part.
[0060] Figure 7 Is the conflict graph corresponding to the partition of the second FD2.
[0061] Figure 8It is a schematic diagram of reduction, where n = 4. The dashed lines indicate consistency with the vertices we constructed and are omitted for clarity of the figure. t represents t identical structures, which is what we call thickening.
[0062] Figure 9 It is the overall system architecture diagram.
[0063] Figure 10 It is a graphical visualization of 4 consistent facts.
[0064] Figure 11 It is a graphical visualization of 5 inconsistent facts.
[0065] Figure 12 It is the system prototype diagram.
[0066] Figure 13 It is the data input in tabular form.
[0067] Figure 14 It is the data input in text form.
[0068] Figure 15 It is a graph showing the improvement in the running time effect of the algorithm under three data sets.
[0069] Figure 16 It is a graphical visualization of the functional dependency A → B of the left chain.
[0070] Figure 17 It is a graphical visualization of the functional dependencies A → B and AC → D of the left chain.
[0071] Figure 18 It is a graphical visualization of the non - left - chain functional dependencies A → B and C → D.
[0072] Figure 19 It is the alternative functional dependencies mined by the TANE algorithm.
[0073] Figure 20 It is a graphical visualization of the non - left - chain functional dependencies A → B and C → D.
[0074] Figure 21 It is a repaired subset output under FAO data and the repair progress.
[0075] Figure 22 It is the number of repairs after one repair.
[0076] Figure 23 It is the remaining data and progress indication after one repair.
[0077] Figure 24 It is the result after multiple repairs.
[0078] Figure 25 It is the final repair result and progress display. Detailed implementation manners
[0079] The technical solutions of the present invention will be further described below in conjunction with the accompanying drawings, but are not limited thereto. Any modification or equivalent replacement of the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention shall be covered by the protection scope of the present invention.
[0080] For the convenience of the following text, the method used in the present invention and the definition of the problem are stated here: Usually, the reason for the generation of an inconsistent database is the violation of integrity constraints. Therefore, the present invention abstracts in the form of a conflict graph to represent the inconsistencies under different integrity constraints (including the function dependencies discussed in detail). It should also be pointed out that even under combined complexity, for function dependencies, the conversion from logical constraints to a conflict graph can be completed in polynomial time.
[0081] Denote the vertex set in graph G as N(G), and the edge set as E(G); each edge e ∈ E(G) is actually a pair of different vertices {u, v}; an independent set of a graph is a vertex set U that does not contain edges; a maximal independent set (denoted as MIS) is a subset of vertices in the graph that satisfies two key properties: the vertices are not adjacent to each other, and the set cannot be extended by adding any additional vertices from the graph without violating the maximality condition.
[0082] For a graph G = (V, E), an independent set S is called a maximal independent set if and only if for v ∈ V, one of the following is true:
[0083] (1) v ∈ S
[0084] (2) where N(·) refers to the neighbor nodes of v.
[0085] MIS is a basic concept in graph theory, and the study of the problem of counting maximal independent sets also has its profound significance; the #MIS problem is defined as follows:
[0086] Name: #MIS.
[0087] Instance: Graph G.
[0088] Output: The number of maximal independent sets in graph G.
[0089] It is important to distinguish between maximal independent sets and maximum independent sets. Figure 1Shows the difference between the two. Given a graph with 5 vertices, the green vertices belong to the set of independent sets. Part a has an independent set, part b has a maximal independent set but not a maximum independent set. Parts c and d have maximal independent sets and they are also maximum independent sets. For the functional dependency schema (S, Δ) and a relation r on S, where Δ is a set of functional dependencies, denote the conflict graph of this relation as where each vertex in the graph represents each fact in the relation, and the edge between two vertices (facts) indicates that these two facts violate one or more functional dependencies in Δ.
[0090] After the above analysis, when using the conflict graph to solve database repair, a repair of the database corresponds to a maximal independent set on the conflict graph. Therefore, the maximal independent set on the conflict graph is also called a subset repair, and use to represent the conflict graph the set of all subset repairs corresponding to it.
[0091] The present invention provides a repair counting and interactive visualization system based on functional dependencies. The system aims to provide a user-friendly and fully functional platform that enables users to deeply understand the current data inconsistency (conflict) situation in an intuitive and convenient way. Specifically, the system has the following key functions and design considerations: Visualization of data inconsistency: The system can present the data inconsistency in a clear graphical visualization form, enabling users to quickly identify data quality problems, rather than just staying at the abstract numerical level. This visualization method helps users more intuitively understand the distribution and characteristics of data inconsistency; Display of repair counting: The system can display the corresponding repair counting results, enabling users to immediately observe the change in the number of repairs, thereby deeply understanding the meaning of subset repair counting. This interactivity enhances users' understanding of the theory and enables them to more effectively evaluate the advantages and disadvantages of various repair strategies; Bridge between theory and practice: The core goal of this system is to combine the theoretical framework with the actual application scenario. Through the visual interface and interactive operations, the abstract mathematical concepts are transformed into specific actionable steps. Through this system, not only can the actual effect of the theory be verified, but also the advantages of the functional dependency subset repair counting framework in solving data inconsistency problems can be more deeply understood, and a good user experience can be obtained. The detailed explanation and process are as follows:
[0092] Step 1: The left-chain functional dependency and others are unsolvable.
[0093] Cograph, a complement-reducible graph, is also called a P4-free graph. A graph G is said to be P4-free if and only if G does not contain an induced P4 subgraph, where P4 is a path of four vertices. In Figure 2In it, a is a P4-free graph. For example, the induced subgraph {v1, v2, v3, v4} has no path of length 4; while b is a non-P4-free graph because there is an induced subgraph of {v1, v2, v3, v5} (the gray part in the figure), which is a path of length 4, so it is not a P4-free graph.
[0094] Before presenting the results, it is necessary to first know the definition of the left chain.
[0095] Definition: A functional dependency schema (S, Δ) has the form of a left chain if and only if for any two functional dependencies X1 → Y1 and X2 → Y2 in Δ, either or
[0096] It can be noted that if (S, Δ) has the form of a left chain, then the functional dependencies in Δ can be written in the following ordered form: X1 → Y1, X2 → Y2,..., X n → Y n where for any 1 ≤ i < j ≤ n, there is From a relational perspective, this inclusion relationship is a total order relationship. The following is an example to illustrate this left-chain functional dependency. As shown in Table 1, a simple left-chain functional dependency is that Δ has only one functional dependency, as in the first row of Table 1, which is trivial; the functional dependencies in the second row of Table 1 are of the left-chain form; but the third row of Table 1 does not have the left-chain form because {A} and {B} have no inclusion relationship.
[0097] Table 1 Examples of Functional Dependencies
[0098]
[0099] In functional dependencies, in addition to considering those "representative" left chains, that is, those that can be directly seen as having the form of a left chain, such as the previously mentioned set of functional dependencies: A → B, AC → D, of course, we also need to consider those functional dependencies that do not seem to be left chains in "representation" but are "essentially" left chains, and that is the minimal functional dependencies (also called the minimal cover).
[0100] The minimal functional dependencies Δ m of a set of functional dependencies Δ are equivalent, and there is an efficient algorithm known to calculate the minimal functional dependencies; therefore, if the minimal functional dependencies Δ mIf it is in the form of a left chain, the result of the original functional dependency problem is the same as its corresponding minimal functional dependency result (because they are equivalent), and the corresponding conflict graph is also the same; so the set of functional dependencies Δ whose minimal functional dependencies are in the form of a left chain is also called a left chain (equivalent form). Therefore, without loss of generality, unless otherwise specified, the functional dependencies discussed below will be regarded as minimal functional dependencies.
[0101] The set of left-chain functional dependencies implies a P4-free conflict graph:
[0102] First, it is proved that if (S, Δ) is equivalent to some functional dependency patterns in the form of a left chain, then for each relation r, the corresponding conflict graph must be P4-free. According to the above analysis and conclusion, the minimal functional dependencies Δ corresponding to the set of functional dependencies Δ m must have the form of a left chain. Let r be a relation on the schema S, then and are the same graph; therefore, it is only necessary to prove that is P4-free. To prove this property, the method of contradiction is used, that is, it is assumed that is not P4-free, which leads to a contradiction, and then the above conclusion is proved.
[0103] Proof: Assume that is not P4-free, then there must exist 4 vertices v1, v2, v3, v4 in a graph, and {v1, v2}, {v2, v3}, but {v1, v3}, {v1, v4}, Therefore, in r, there are 4 facts f1, f2, f3, f4, among which {f1, f2}, {f2, f3} and {f3, f4} violate Δ m , while {f1, f3}, {f1, f4} and {f2, f4} do not violate Δ m .
[0104] Let {f1, f2} violate the functional dependency FD: X → A, {f2, f3} violate the functional dependency FD: X' → A', and {f3, f4} violate the functional dependency FD: X” → A”. Since Δ m is in the form of a left chain, for X, X' and X”, one of their attributes must be included by the other two attributes, which leads to three possibilities:
[0105] 1. and In this case, either {f1, f4} or {f2, f4} violates the functional dependency X → A.
[0106] 2. and In this case, f1 and f3 are consistent on attribute A'; f2 and f4 are also consistent on attribute A'; so f1 and f4 cannot be consistent on A', thus {f1, f4} violates the functional dependency FD: X' → A'.
[0107] 3. and This situation is symmetric to the first case, and the same as above.
[0108] From the above discussion, it can be found that contradictions are obtained in all three cases, that is, the four nodes v1, v2, v3, v4 cannot derive a path of length 4, which completes the proof.
[0109] The P4-free conflict graph implies the left-chain functional dependency set:
[0110] Next, prove that if the conflict graph is P4-free, the functional dependency set of the corresponding (S, Δ) should be in left-chain form. To prove the above direction, it will be shown that if the functional dependencies in a functional dependency schema (S, Δ) do not have the left-chain form, then there exists a relation r whose corresponding conflict graph must be non-P4-free (that is, prove its contrapositive, and the correctness of the contrapositive of a proposition is the same as that of the original proposition).
[0111] Since (S, Δ) does not have the left-chain form, the minimal functional dependency set Δ m of Δ also does not have the left-chain form. Therefore, focus on Δ m . Since and are the same graph, it only needs to be proved that is not P4-free.
[0112] Proof: Because Δ (after the above analysis, without loss of generality, assume Δ is the minimal functional dependency) does not have the left-chain form, so in Δ there exist two functional dependencies: X → B and X' → B', where and Construct a relation r on S such that is not P4-free. The method is as follows, where r will contain four facts {f1, f2, f3, f4} and use eight constants: α, β, γ, δ, ε, ζ, η, ι.
[0113] For A ∈ X \ (X ∩ X') +,Δ , f1[A] = α; for A ∈ (X ∩ X') +,Δ , f1[A] = β; in other cases f1[A] = γ. For A ∈ X \ (X ∩ X')+,Δ , there is f2[A] = α; for A ∈ (X ∩ X') +,Δ , there is f2[A] = β; for A ∈ X'\(X ∩ X') +,Δ , there is f2[A] = δ, and in other cases f1[A] = ε. For A ∈ X\(X ∩ X') +,Δ , there is f3[A] = ζ; for A ∈ (X ∩ X') +,Δ , there is f3[A] = β; for A ∈ X'\(X ∩ X') +,Δ , there is f3[A] = δ, and in other cases f3[A] = η. For A ∈ X\(X ∩ X') +,Δ , there is f4[A] = ζ; for A ∈ (X ∩ X') +,Δ , there is f1[A] = β; and in other cases f4[A] = l.
[0114] Since Δ is a minimal functional dependency, therefore Also, since So Since Δ is minimal, it ensures that X ∩ X' → B is not derivable in Δ; thus, it can be obtained that So, it can be known that {f1, f2} does not satisfy the functional dependency X → B. Similarly, {f3, f4} does not satisfy the functional dependency X → B; due to symmetry, a similar conclusion can be obtained, that is and {f2, f3} does not satisfy the functional dependency X' → B'.
[0115] So, as described above, f1 and f3 are only consistent on the attribute set (X ∩ X') +,Δ ; assume that f1 and f3 violate the functional dependency FD: Y → C in Δ (a contradiction is derived by reductio ad absurdum), then Y must belong to (X ∩ X') +,Δ (because f1 and f3 are only consistent on this attribute set, or in other words, the same), but in, then, now there is (X ∩ X') +,Δ → Y, Y → C, so this implies that (X ∩ X') +,Δ → C, and thus it is obtained that C ∈ (X ∩ X') +,Δ , which is an obvious contradiction. So it is obtained that {f1, f3} does not violate any functional dependency in Δ. Similarly, by the same method, it can be shown that {f1, f4} and {f2, f4} also do not violate any functional dependency in Δ. In this way, a conflict graph with P4 is obtained. Therefore, if the conflict graph is P4-free, the functional dependency set of the corresponding (S, Δ) should be in the form of a left chain.
[0116] Definition of subset repair Blocktree:
[0117] When looking at functional dependencies and left-chain structures, an efficient structure, called Blocktree, is given to construct a subset repair of the database; and it will be shown that this construction can obviously be done in polynomial time.
[0118] Given a database D and a functional dependency FD: In the form of: X → Y, it is said that D with respect to A block with respect to is a maximal subset D' of D such that for any facts f, g ∈ D' and any attribute A ∈ X, f[A] = g[A]; similarly, a subblock with respect to is a maximal subset D' of D such that for any facts f, g ∈ D' and any attribute A ∈ X ∪ Y, f[A] = g[A]. Simply put, a block with respect to refers to the set of all facts in D, where the facts in the set are consistent on the left-hand side attributes, i.e., the X attributes; similarly, a subblock with respect to is the set of all facts that are consistent on the attributes X and Y. Denote all the blocks and subblocks of D with respect to as and
[0119] If the set of functional dependencies Δ is in left-chain form, the above-described blocks and subblocks can be constructed into a rooted tree, called Blocktree:
[0120] Definition: Consider a database D on S and a set of functional dependencies Δ in left-chain form. Let be the set of functional dependencies in Δ related to R, where R ∈ S, denoted as DR; denote (R, Λ)-Blocktree as a labeled tree T(V, E, σ) of height 2n (counting from the root, the root is at level 0), where is the label (assignment) of each node, such that:
[0121] If the node v is the root node, then σ(v) = D R ;
[0122] For the nodes {v1, v2,..., v k} on the (2i + 1)-th level, where i ∈ {0, 1,..., n - 1}, k > 0, and a parent node u, then and
[0123] For the nodes {v1, v2,..., v k}, where \(i\in\{0,1,\ldots,n - 1\}\), \(k\gt0\), and a parent node \(u\), then and
[0124] Briefly speaking, all non-root nodes of this Blocktree \(T\) represent a subset of \(D\) (the root is \(D\) R itself); for the nodes on the \((2i + 1)\)-th layer, they are all blocks with respect to R their parent nodes; similarly, for the nodes on the \((2i + 2)\)-th layer, they are all subblocks with respect to their parent nodes. Here is a simple example to observe the definition of Blocktree:
[0125] Given a single-relation database \(D\) R , where the relation is \(R(X,Y)\) and the functional dependency is \(X\rightarrow Y\), as shown in Table 2:
[0126] Table 2 A relation table \(R\) with a single functional dependency
[0127]
[0128] where the blocks of \(D\) R are block_A: \(\{f1,f2,f3,f4\}\) and block_B: \(\{f5,f6,f7\}\); for block_A, it has three subblocks, namely subblock_A_1: \(\{f1,f2\}\), subblock_A_2: \(\{f3\}\), subblock_A_3: \(\{f4\}\); similarly, for block_B, it has two subblocks, namely subblock_B_4: \(\{f5\}\), subblock_B_5: \(\{f6,f7\}\); the corresponding tree is as Figure 3 shown.
[0129] From the above discussion, it can be known that for a database \(D\) on \(S\) and a node \(u\) (parent node) of the \((R,\Lambda)\)-Blocktree \(=T(V,E,\sigma)\) under a set \(\Delta\) of functional dependencies in left-chain form, and any two different child nodes \(u1\), \(u2\) of it, the following properties will hold:
[0130] If \(u\) is a node on an even layer, then for any \(f\in\sigma(u1)\) and \(g\in\sigma(u2)\), \(f\) and \(g\) will not conflict;
[0131] If \(u\) is a node on an odd layer, then for any \(f\in\sigma(u1)\) and \(g\in\sigma(u2)\), \(f\) and \(g\) will conflict;
[0132] Such a property can be used to construct a simple procedure (program) to calculate D R Repair of
[0133] 1. Select the root node;
[0134] 2. For the nodes at even levels, select all their children; (since they will not conflict)
[0135] 3. For the nodes at odd levels, select only one of their children;
[0136] 4. Finally, calculate the union of the labels of all the selected leaf nodes, which is a repair.
[0137] From the above analysis, the repair can be clearly obtained, and thus a recursive program can be easily constructed to count the subset repairs of the database, which will be used below. Therefore, there is:
[0138] Proposition 1: Given a database D and a set of functional dependencies Δ in left-chain (equivalent form), its corresponding Blocktree can be calculated in polynomial time of |D|.
[0139] Computability of subset repair under left-chain functional dependencies:
[0140] Based on the above analysis and conclusions, it is stated that given a set of functional dependencies Δ in left-chain form and a database D, #rep Δ (D) can be calculated in polynomial time with respect to |D|.
[0141] In the above analysis process, it has been known that, first, the subset repair of the database corresponds to the maximum independent set on the conflict graph, and at the same time, when the functional dependencies are in left-chain form, the conflict graph will satisfy the P4-free property. Therefore, for counting the subset repairs of the database under left-chain functional dependencies, it is equivalent to counting the maximum independent sets on the P4-free conflict graph. The present invention elaborates on the conclusion relationship between the database and the conflict graph from the perspective of the database.
[0142] Look at a simple example. Consider such a database of personal information, where the attributes include name and age. Without loss of generality, without considering the case of the same name, as shown in Table 3:
[0143] Table 3 Personal Information Table
[0144]
[0145]
[0146] Consider the functional dependency FD1: Name → Age. The age of a person (ignoring people with the same name) is unique. At this time, observe the conflict graph, as Figure 4 shown, where the left side is the fact that the name is Zhang San, and the right side is the fact that the name is Li Si; through Figure 4 it can be intuitively obtained that a property is that the functional dependency FD1 actually divides all the facts according to the attributes on the left side (in this example, the name). The final corresponding conflict graph is a complete multipartite graph.
[0147] On the above basis, consider an additional functional dependency FD2: Department → Minister. A department can only have one unique leader (minister). The database information is shown in Table 4:
[0148] Table 4 Department Personnel Relationship Table
[0149]
[0150] At this time, it can be found that in Table 4, there is a conflict in the minister of the Propaganda Department: A or B. Therefore, the corresponding conflict graph is as Figure 5 shown. The completely connected part is indicated by the red line. Therefore, under the functional dependencies FD1 and FD2, the property of the complete multipartite graph is violated. The reader can easily verify that this conflict graph does not satisfy the P4-free property.
[0151] The above form of functional dependency is like: A → B, C → D, and it can be further generalized to multiple functional dependencies; but when considering the functional dependency in the form of a left-side chain, that is, FD1 is the same as before, Name → Age, but FD2 is rewritten as: Name, Degree → Salary. The salary is not only determined by the degree but also depends on personal character. The database information is shown in Table 5:
[0152] Table 5 Education and Salary Table
[0153]
[0154] When only considering FD1, the conflict graph is the same as Figure 4 However, when considering FD2, due to the form of the left-side chain, it will be found that its influence (adding edges to the conflict graph) is only limited to each individual conflict graph and will not "cross" the graph connection. For example, in the part of the graph with the name Li Si ( Figure 6 ): The right side is the fact of Li Si, 29 (the last 3 rows of Table 5). When considering the functional dependency FD2, it only divides within the yellow part, and the division result is as Figure 7 shown.
[0155] The same applies to other cases. Therefore, it can be concluded that a functional dependency actually partitions all facts. From the perspective of the conflict graph, it is several disjoint complete multipartite graphs. When the set of functional dependencies satisfies the left-chain form, the subsequent partitions of multiple functional dependencies are only limited to each part. Just like the above Figure 7 example, recursively partitioning within each part layer by layer. Thus, each layer of recursion retains the P4-free property and is obviously solvable in polynomial time (the method is to select one part of the complete multipartite graph each time). This is exactly the property of Blocktree discussed above. Therefore, the following (pseudo-code) can be obtained:
[0156] Algorithm 1: Blocktree Repair Counting Algorithm
[0157] Input: The root node root of the Blocktree
[0158] Output: The total repair count count
[0159]
[0160]
[0161] Algorithm Description:
[0162] 1. Recursive Structure: Start depth-first traversal from the root node, and count the layers starting from 0.
[0163] 2. Odd and Even Layer Logic:
[0164] Odd Layers: Sum the repair counts of child nodes total = Σchild_count;
[0165] Even Layers: Multiply the repair counts of child nodes total = Πchild_count.
[0166] 3. Complexity: The time complexity is O(n), where n is the number of Blocktree nodes, and the space complexity is O(h), where h is the tree height.
[0167] Thus, there is the following key theorem:
[0168] Theorem 2: Given a set of functional dependencies Δ in left-chain form and a database D, #rep Δ (D) can be computed in polynomial time with respect to |D|.
[0169] At this point, the first task is completed, that is, the efficient approximate counting of subset repair under left-chain functional dependencies is in FP.
[0170] Regarding the other side, the non-computable part:
[0171] For other types of functional dependencies, there is the following argument: for non-left-side functional dependencies, there is no efficient or approximate counting scheme. (Unless NP = P)
[0172] Due to the equivalence between subset repair and maximum independent set, below, Theorem 3 will be proven: #MIS ≡ AP #SAT.
[0173] Proof: In two directions, namely (1) #MIS ≤ AP #SAT and (2) #SAT ≤ AP #MIS.
[0174] Regarding (1), as discussed before, from Cook's theorem and Theorem 1, it is already known that since #MIS ∈ #P, then #MIS ≤ AP #SAT, that is, (1) is clearly proven;
[0175] Regarding (2), from Theorem 2, it is known that #IS ≡ AP #SAT. Therefore, to obtain the other direction, it only needs to be proven that #IS ≤ AP #MIS; Let G = (V, E) be an instance of #IS. Without loss of generality, let V = [n], Let m = |E|, let t = n + 2, and construct an instance G' of #MIS such that #IS(G) ≤ #MIS(G') / 2 tm ≤ #IS(G) + 1 / 4, which will complete the effective reduction, as shown in the example Figure 8 as shown.
[0176] Informally speaking, the present invention obtains the graph G' (an instance of #MIS) from the graph G as follows: First, "thicken" each edge of G by t times, and make an expansion of a "special structure". Finally, add a "tail" to each node of G.
[0177] Formally speaking, define the graph G' as follows: For each edge e ∈ E, let X e , Y e , Z e , A e and B e be sets of t nodes, requiring that these sets of nodes are disjoint from each other and also disjoint from [n]; Denote these sets as: and At the same time, let W = U e∈E X e ∪ Y e ∪ Z e ∪ A e ∪ B e Let V *= {v1, v2, …, v n} are n distinct nodes that are disjoint from both [n] and W, and are defined as follows:
[0178] V(G′) = [n] ∪ W ∪ V *
[0179]
[0180] Let be an arbitrary set, and denote #MIS S (G') as a maximum independent set and T ∩ [n] = S. First, note that for each set if T is a maximum independent set of G' and T ∩ [n] = S, then that is, for each unselected node in S, there will be a selected neighbor in V * , which ensures maximality.
[0181] Consider an edge e = {i, j} ∈ E, where i < j (without loss of generality, in one direction), and a value k ∈ [t]. If T is a set of maximum independent sets in G' and T contains both nodes i and j, then if T contains i but not j, then either or if T contains neither i nor j, then either or
[0182] Given Let μ(S) denote the number of edges in G whose two endpoints (nodes) are both in S. From the above observations, we can obtain #MIS S (G') = 2 (m-μ(S))t , so Since for each independent set S in G, μ(S) = 0, so #MIS(G') ≥ #IS(G)2 mt ; furthermore, since there are at most 2 n sets that are not independent sets of G and satisfy μ(S) ≥ 1, thus we have:
[0183]
[0184] According to the above inequality, we have
[0185]
[0186] Equation (1) implies an AP reduction from #IS to #MIS: approximately compute #IS using the oracle of #MIS and divide the oracle of #MIS by 2 mt That's all.
[0187] Since the counting of functional dependency subset repair is equivalent to the counting of the maximum independent set on its corresponding conflict graph, based on the proof of Theorem 3, it can be concluded that in the general case (i.e., without constrained functional dependencies), the approximate counting of subset repair under functional dependencies is as difficult as #SAT, that is, it is difficult to approximate.
[0188] Analysis of the AP reduction for approximate counting:
[0189] Let Q = #MIS(G') / 2 tm , rounding down Equation (2) for Q is equivalent to finding the nearest integer value for Q. The reduction actually uses the oracle of #MIS to approximately compute #MIS(G'), divides by 2 tm and finds the nearest integer value to complete the computation of #IS. Just as defined in the AP reduction, discuss the selection of the following parameters. If there is no rounding-down operation, then δ = ε can be directly and simply set because dividing by a constant (i.e., 2 tm ) preserves the error rate; however, since when the situation being discussed is very small, this discontinuous rounding-down function will disrupt the approximation (the original error rate is ε, and rounding down generates an error again), yet, the rounding-down function is only applied within the range [N, N + 1 / 4] for some N (in fact, we have already done this, N = #IS(G)). This avoids this technical problem.
[0190] Generally, assume that the required result N is obtained by rounding an integer Q, satisfying |Q - N| ≤ 1 / 4; further assume that the oracle of the oracle machine provides an approximation (related to Q), satisfying Let δ = ε / 21, where ε is a precision parameter (error rate) of the required problem result. In this case, there are two situations:
[0191] If then through simple calculations (substitution), it can be obtained that the result returned at this time is accurate;
[0192] If then the result returned is in the range For the selected δ, the range is always included in [Ne -δ , Ne δ .
[0193] Back to the actual proof, for in the range In it, setting δ = ε / 21 as the precision parameter (error rate) is effective, so the above reduction is correct.
[0194] Step 2: Blocktree Structure Construction and Repair Counting
[0195] Construct the Blocktree: Based on Δ, divide D into hierarchical partitions. The odd layers are conflict blocks, and the even layers are independent blocks.
[0196] Recursive calculation: Select a single block (addition operation) for the odd layers and all child blocks (multiplication operation) for the even layers, and finally calculate the repair quantity.
[0197] Using the Blocktree structure can quickly count. First, from Proposition 1, obtain the Blocktree. Based on the Blocktree, to calculate the total possible number of repairs, for the odd layers, "select each child node separately" and then add the results; for the even layers, "must select all child nodes", then multiply the results of the child nodes.
[0198] Thus, a method for quickly calculating the number of subset repairs is obtained, as described above: First, construct the Blocktree according to the above process, and then calculate the repair of D R :
[0199] 1. Select the root node;
[0200] 2. For the nodes in the even layers, select all their children; (because they will not conflict)
[0201] 3. For the nodes in the odd layers, only select one of their children;
[0202] 4. Finally, calculate the union of the labels of all selected leaf nodes, and a repair is obtained.
[0203] Step 3: Interactive Web Application Design
[0204] System Overall Function Design:
[0205] The interactive Web application for data inconsistency facing function dependencies adopts a front-back separation architecture, which is convenient for users to upload their own data, detect inconsistencies and visually display the results at the same time. The system adopts an architecture that integrates interface interaction and data processing in Python code. Its overall system architecture is as Figure 9 shown. The application front-end mainly uses HTML and CSS to implement business interaction display, and AJAX in the communication process uses HTTP requests to communicate with the back-end for data communication. The prototype system back-end uses the Python language and the Gradio framework to implement the processing of business logic.
[0206] The main functions of the application are divided into inconsistency detection, inconsistency visualization generation, functional dependency mining, repair calculation, and progress indication. The following is a specific introduction:
[0207] 1. Determine functional dependencies: Before inputting data, it is necessary to first determine functional dependencies.
[0208] 2. Inconsistency detection: For data input, it will output whether there are conflicts, which will be visually displayed in a graph.
[0209] 3. Output the inconsistency visualization in the data: It is displayed in the form of a node-edge graph; specifically, each node represents a fact (a row of data), and the naming rule of the node is as follows: from the attribute + "_" + the next set of attributes and so on. As Figure 10 shown, where the names are all attribute + "_" + the next set of attributes. For example, if attribute A is y and attribute B is 2, then this fact is represented as the node y_2 in the graph, and so on for others. If there are several duplicate facts in the data, they will be colored the same color. At the same time, for distinction, (2),..., (n) will be added after the name to show the distinction. As Figure 11 shown, it can be seen that if there are duplicate facts, the name will automatically add (n) at the back for distinction, such as the node x_2(2) in the lower right corner, and so on for others. In addition, for conflicting facts, edges are used to represent conflicts in the graph. Specifically, that is: connect the nodes corresponding to the conflicting facts with edges; finally, in order to make the visual visualization clearer, the clustering algorithm is used to determine the clustering center and cluster the nodes with the same color together to make the visualization effect better
[0210] 4. Output the number of repairs. Use the algorithm in step two to output the number of repairs. At this time, there are two cases. One is the functional dependency that conforms to the left-chain structure. At this time, the number of repairs can be directly calculated, and a possible repair will also be given. For non-left-chain functional dependencies, use the TANE algorithm to mine some functional dependencies from the input data and generate minimal functional dependencies for the user to choose from, giving the user some guidance.
[0211] 5. Output the repair progress. Progress indication is one of the important research directions in the field of HCI and also one of the important applications of subset repair counting. Use the number of repairs to generate the repair progress for display, so that the system has better human-computer interaction characteristics, is more user-friendly and intuitive.
[0212] The system prototype diagram is as Figure 12 shown, and its operation process is as follows:
[0213] 1. Determine functional dependencies.
[0214] 2. Select the input mode and input the data that needs to be visualized and detected. Multiple input methods are supported. Users can either input each record in text format, separating attributes with commas and each line representing a record, or use the table filling method. For example Figure 13 , Figure 14 as shown.
[0215] 3. Click Submit: After completing the previous operations, you can click the Submit button. At this time, an HTTP request will be sent to the backend, waiting for the backend processing result. Meanwhile, the calculation time and estimated time will also be displayed on the frontend.
[0216] 4. View the visualization results: The current results include visual display of pictures (such as the node-edge graph visualized in the upper right corner in Figure 12 ), text results ( Figure 12 the number of repairs in
[0217] : 3), progress indication results, and JSON results. Among them, the picture visualization can be individually enlarged, downloaded, pasted, and copied, and the JSON results can also be used for other tasks. For non-left-chain function dependencies, the mined function dependencies and minimal function dependencies will also be displayed.
[0218] This prototype system demonstrates the process of visualizing data inconsistency under function dependencies in a concise manner. This system supports multiple input methods and has completed functions such as inconsistency detection, inconsistent visualization generation, function dependency generation, repair calculation, and progress indication. This system shows a friendly user experience for inconsistent data under function dependencies and fully meets the user's needs for conflict visualization and repair.
[0219] Compared with the existing technologies, the technical solution of the present invention has the following significant advantages:
[0220] 1. Improved calculation efficiency: Through the optimization of the Blocktree structure, the repair counting complexity is reduced from exponential level to polynomial level. Experimental comparison shows that the calculation time is increased by 4 times.
[0221] Use publicly available, commonly used or valuable datasets in the real world to actually demonstrate the effect of the present invention. The datasets are respectively the FAO food production area data of each country of the Food and Agriculture Organization of the United Nations, the UPC conflict dataset of various countries in the world, and the TMDB evaluation of the global movie database. The situations of each dataset are shown in Table 7.
[0222] Table 7
[0223]
[0224] Since the datasets on the official website are all consistent data, in order to obtain dirty data, the RNoise (RandomNoise) algorithm is used to generate noise for the datasets. Initially, all datasets are consistent under constraints. The RNoise algorithm is used to generate an inconsistent data to complete the experiment. The RNoise algorithm process is as follows:
[0225] 1. Randomly select a tuple in a dataset;
[0226] 2. Select the right - hand attribute value in the constraint, change it to another value and add it to the dataset.
[0227] In addition, the RNoise algorithm has a parameter α to control the noise level: that is, modify the data accounting for α proportion in the dataset.
[0228] All experiments are conducted on the Windows 10 platform with Intel(R) Core(TM) i5 CPUs (2.30GHz, 8 cores) and 16GB of memory. The RNoise parameter is set as α = 0.1, and each experiment is repeated 10 times, and the running time and results are recorded. The results regarding the number of repairs are shown in Table 8. After performing the repair count on the dataset after executing RNoise and comparing the obtained results with the true values, it can be seen that the algorithm can correctly give the number of subset repairs, that is, the correctness of the algorithm is guaranteed.
[0229] Table 8
[0230]
[0231] In addition, when comparing the running time of the algorithm with that of a common traversal and enumeration algorithm, it should be noted that to show the superiority of the algorithm's running time, the algorithm speed - up multiple is calculated as: the running time of the common algorithm / the running time of the algorithm of the present invention. Among them, when the data volume is too large, the traversal algorithm may run out of memory and cannot obtain the correct result. At this time, the termination time is used for calculation. From Figure 15 it can be seen that the running time effect of the algorithm is improved. The ordinate in the figure is the time improvement ratio. It can be seen from the figure that when the data volume is getting larger and larger, the counting time of the algorithm under the Blocktree structure is getting better and better, which verifies the effectiveness and efficiency of the algorithm.
[0232] 2. Enhanced dynamic adaptability and optimized user interaction: The interactive Web application provides visual display of the repair progress and the number of repairs, enhancing the user experience.
[0233] 1. Visual display under the left - hand side chain functional dependency:
[0234] 1) A left - hand side chain functional dependency A → B
[0235] Such asFigure 16 As shown, it can be intuitively seen from the visualization result that under the functional dependency constraint of A→B, the graph presents the structure of a complete multipartite graph, so the number of repairs that can be intuitively and quickly output is 4.
[0236] 2) Another functional dependency of the left chain is A→B, AC→D
[0237] As Figure 17 shown, even for relatively complex functional dependencies, it can be intuitively seen from the visualization result that under the functional dependency constraints of A→B and AC→D, the graph still presents the structure of a complete multipartite graph, and each part is also a complete multipartite graph. So it returns to the situation of 1, and the number of repairs that can be intuitively and quickly output is 3.
[0238] 2. Visualization under non-left-chain functional dependencies
[0239] As Figure 18 , Figure 19 shown, it can also be intuitively (intuitively complex) seen from the visualization result that under the constraints of non-left-chain functional dependencies A→B and C→D, the graph no longer shows special features. It presents the characteristics of a complex graph like patterns in social networks in real life, so it is difficult to output an appropriate number of repairs. At this time, the system will use the data input from the front end for functional dependency mining and output minimal functional dependencies for the user to select appropriate (semantics need to be combined) left-chain functional dependencies, so as to better guide the repair.
[0240] Example: FAO food production data repair
[0241] 1. Data input: Upload the FAO dataset (660 records), and the functional dependency is {Area,Item→Value};
[0242] 2. Conflict detection: The system generates a conflict graph ( Figure 20 ), and 32 conflict records are detected;
[0243] 3. Repair calculation: Calculate that the number of repairs is 65536, and the time consumption is 2.1 seconds (including all times for calculation, front end, etc.);
[0244] 4. Dynamic adjustment: The user deletes the conflict record "Afghanistan,Apples,30163", and the system recalculates that the number of repairs is 32768, and the progress bar is updated to 50% until 0%;
[0245] 5. Result export: Support saving the repair results and visualization charts in JSON format.
[0246] The effect is as follows:
[0247] The data source uses the statistical data of the Food and Agriculture Organization of the United Nations (FAO of UN). Since the data comes from different institutions, regions, and countries, it is difficult to ensure that the data in every link is accurately reported and consistent under such a large base. Therefore, repair counting is a useful technique. Using the regional food harvest area - fruit main catalog data of FAO from 2022 to 2023 as the benchmark, some 2022 data is added to it to represent dirty data. The dataset contains the following attributes: Area, Element, Item Code, Item, Unit, Value, which represent region, type, item code, item, unit, and value respectively. Among them, the type is fixed as regional food harvest, and the unit is ha (hectare). This dataset has 660 records, recording the global fruit food harvest area. For convenience, the Element, ItemCode, and Unit attributes are temporarily hidden (because the values of these three attributes are the same). This dataset has the following functional dependency: Area, Item -> Value.
[0248] It can be seen from Figure 20 that each inconsistent part is a simple complete bipartite graph. The system calculates the repair quantity result as 65536, and this result is also the degree of inconsistency. In addition, the repair progress indication can also be seen. Since this is the first input at this time, the progress is set to 0. In addition, the system can also select a repair to attempt and display according to the repair quantity. Under the FAO data, the system will select the conflict data of Afghanistan, Apples output value for repair processing.
[0249] From Figure 21 it can be seen that the tuple Afghanistan, Apples, 30163 is removed. At this time, the data repaired once is input into the system for calculation again, and the repair quantity is obtained as 32768, indicating that the inconsistency situation under this database is decreasing, which also verifies the correctness of the repair. And it can also be seen from the progress indicator bar that the repair progress is 50%, which conforms to the user-friendly feature, as Figure 22 , Figure 23 shown. Repeating this process can obtain a final clean database. At this time, the repair should also stop. At this time, the database has been converted from an inconsistent database to a consistent database, and the repair progress indication also shows as completed, as Figure 24 , Figure 25 shown.
[0250] At this point, the importance of the number of subset repairs becomes prominent. First of all, it constitutes an evaluation criterion that satisfies four key properties: Positivity, Monotonicity, Continuity, and Progression, providing us with an effective means to directly measure the database inconsistency. This measurement criterion can not only quantify the degree of inconsistency but also help us better understand the nature of data corruption. Secondly, the number of data repairs directly guides the repair strategy. Our goal is to minimize the amount of data that needs to be repaired, which means restoring the database consistency at the smallest possible cost. Therefore, the number of repairs also indicates the direction of the repair process. Finally, considering the number of repairs as a progress indicator, it also constitutes a direct application criterion in the field of Human-Computer Interaction (HCI). By monitoring the change in the number of repairs in real-time, we can intuitively understand the progress of the repair process. This intuitive progress feedback is crucial for users as it can enhance their trust and satisfaction in the repair process. In addition, using the number of repairs as an application criterion in HCI also provides us with an indicator to quantitatively evaluate the effectiveness of human-computer interaction, which helps in designing more user-friendly and efficient database repair tools. Therefore, the counting of subset repairs has good practical significance and value, not only affecting the quality of the data itself but also being closely related to the decisions of high-end institutions and think tanks, with great practical significance.
Claims
1. A database repair counting method based on functional dependencies, characterized in that The method includes the following steps: Step 1. Determine functional dependencies: Step 11. Left-side functional dependencies: (1) Define the left chain: A functional dependency pattern (S, Δ) has the form of a left chain, where S is an independent set and Δ is a set of functional dependencies, if and only if for any two functional dependencies X1 → Y1 and X2 → Y2 in Δ, either or (2) If (S, Δ) has the form of a left chain, then the functional dependencies in Δ can be written in the following ordered form: X1 → Y1, X2 → Y2, …, X n → Y n , where for any 1 ≤ i < j ≤ n, there is (3) If the functional dependency set F satisfies the following conditions, then F is called a minimal dependency set: (a) The right side of any functional dependency in F contains only one attribute; (b) There does not exist a functional dependency X → A in F such that F is equivalent to F - {X → A}, that is, no functional dependency in F can be derived from other functional dependencies in F; (c) There does not exist a functional dependency X → A in F, where X has a proper subset Y such that F - {X → A} ∪ {Y → A} is equivalent to F, that is, the left part of each functional dependency in F is the smallest attribute set; (4) If the minimal functional dependency set of a functional dependency is Δ m is in the form of a left chain, then the functional dependency set Δ with minimal functional dependencies in the form of a left chain is also called a left chain; (5) If (S, Δ) is equivalent to a function dependency pattern in left-chain form, then for each relation r, the corresponding conflict graph must be P4-free; if the conflict graph is P4-free, then the set of function dependencies of the corresponding (S, Δ) is in left-chain form; Step 12. For non-left-hand function dependencies, #MIS ≡ AP #SAT; Step 2. Output the inconsistent visualization situation in the data; Step 3. Inconsistency detection: For the data input, use Step 2 to check whether there are conflicts, that is, whether there are conflict edges; Step 4. Output the number of repairs: Step 41. Define Blocktree: Consider a database D on S and a set of functional dependencies Δ in the form of a left-chain. Let be the set of functional dependencies in Δ related to R, where R ∈ S, denoted by D R ; Denote (R, Λ)-Blocktree as a labeled tree T(V, E, σ) with height 2n, where is the label of each node, such that: If node v is the root node, then σ(v) = D R ; For the nodes {v1, v2,..., v k} on the 2i + 1 layer, where i ∈ {0, 1,..., n - 1}, k > 0, and a parent node u, then and For nodes {v1, v2,..., v k} on the 2i + 2 layer, where i ∈ {0, 1,..., n - 1}, k > 0, and a parent node u, then and Step 42. Given a database D and the functional dependencies Δ of the left chain, its corresponding Blocktree can be calculated in polynomial time of |D|; Step 43. Construct the Blocktree structure: Based on Δ, partition D into layers. The odd layers are conflict blocks, and the even layers are independent blocks; Step 44. Select the root node; Step 45. For the nodes in the even layers, select all their children; Step 46. For the nodes in the odd layers, only select one of their children; Step 47. Calculate the union of the labels of all the selected leaf nodes, that is, obtain a repair; Step 5. Generate the repair progress using the number of repairs.
2. The method for counting database repair based on functional dependency according to claim 1, wherein The specific steps of Step 2 are as follows: Step 21. Process the input data and construct nodes: Convert each row of the input data into a node. If there are duplicates, add a count after the node name. At the same time, assign colors according to the original attributes of the nodes and dynamically adjust the node size to reflect the name length; Step 22. Traverse all node pairs, check whether the functional dependencies are violated, and establish conflict edges when two nodes violate the functional dependencies; Step 23. Visualize the conflict relationships: Generate a visualization image. Nodes of the same color are clustered and displayed. The nodes in the figure represent data instances, and the edges connect the nodes with conflicts. Finally, output a visualization image with color coding and size differences.
3. The method for counting database repair based on functional dependency according to claim 1, characterized in that The specific steps of Step 5 are as follows: Step 51: Initialize the repair benchmark initial_repair_count, and use the initial repair quantity value as the progress benchmark; Step 52: Dynamically calculate the current progress. Denote the current repair quantity as current_repair, then the progress value is 1.0 - (current_repair / initial_repair_count); Step 53: Generate a smooth visualization progress bar.
4. A repair counting and interactive visualization system based on functional dependency relationships, characterized in that The system includes an inconsistent visualization generation module, an inconsistent detection module, a functional dependency mining module, a repair calculation module, and a progress indication module, where: The inconsistent visualization generation module is responsible for outputting the inconsistent visualization situation in the data and generating the visualization image through node definition, conflict expression, and layout optimization; The inconsistency detection module is responsible for checking for conflicts, i.e., the existence of conflict edges, against the data input using the inconsistency visualization module, and outputting whether there are conflicts; The functional dependency mining module is responsible for determining functional dependencies. For non-left-chain functional dependencies, it uses the TANE algorithm to mine functional dependencies from the input data and generates minimal functional dependencies for the user to select and provide guidance to the user; The repair calculation module is responsible for outputting the number of repairs. For functional dependencies that conform to the left-chain structure, it directly calculates the number of repairs and gives a possible repair; The progress indication module is responsible for dynamically displaying the repair process, generating and displaying the repair progress using the number of repairs.
5. The repair count and interactive visualization system based on functional dependencies according to claim 4, characterized in that The system adopts an architecture that integrates interface interaction and data processing in Python code. The application front-end uses HTML and CSS to implement business interaction display. The communication process AJAX uses HTTP requests for data communication with the back-end. The back-end uses the Python language and the Gradio framework to implement the processing of business logic.
Citation Information
Patent Citations
Holistic Database Record Repair
US20130054541A1