Algorithm Search⌘K

Definitionadvanced

Why-provenance and where-provenance

Also called why-provenance, where-provenance, witness basis.

The sets of input tuples that witness an output tuple, and the input locations from which each output value was copied.

Why-provenance and where-provenance are two ways to explain an answer of a query by the input data. The why-provenance of an output tuple is a set of witnesses: sets of input tuples that are enough to produce it, one for each way the query derives it. The where-provenance of a value in an output tuple is the set of input locations, a relation, a tuple and an attribute, from which the query copied that value. Buneman, Khanna and Tan defined both in 2001, and showed that the minimal witnesses depend only on the meaning of the query, while where-provenance depends on how the query is written.

Definition

The setting is the positive relational algebra (selection, projection, natural join, union and renaming) under set semantics, as on the relational algebra page. Each input tuple has an identifier, written r1,r2,…r_1, r_2, \ldots, so that a set of tuples is a set of identifiers. II is the input instance and QQ a query; all queries here are monotone, so J⊆IJ \subseteq I implies Q(J)⊆Q(I)Q(J) \subseteq Q(I).

Witnesses. For t∈Q(I)t \in Q(I), a witness for tt is a set J⊆IJ \subseteq I with t∈Q(J)t \in Q(J). The set of all witnesses is upward closed: a superset of a witness, inside II, is a witness. A witness is minimal if no proper subset is a witness.

Witness basis (why-provenance). The witness basis Why(Q,I,t)\mathrm{Why}(Q, I, t) is a set of witnesses defined by induction on the expression QQ, one witness for each derivation of tt:

  • Why(R,I,t)={{t}}\mathrm{Why}(R, I, t) = \{\{t\}\} for t∈I(R)t \in I(R);
  • Why(σθ(E),I,t)=Why(E,I,t)\mathrm{Why}(\sigma_{\theta}(E), I, t) = \mathrm{Why}(E, I, t);
  • Why(πX(E),I,t)=⋃{ Why(E,I,s)∣s∈E(I), s[X]=t }\mathrm{Why}(\pi_{X}(E), I, t) = \bigcup \{\, \mathrm{Why}(E, I, s) \mid s \in E(I),\ s[X] = t \,\};
  • Why(E1⋈E2,I,t)={ J1∪J2∣Ji∈Why(Ei,I,ti) }\mathrm{Why}(E_1 \bowtie E_2, I, t) = \{\, J_1 \cup J_2 \mid J_i \in \mathrm{Why}(E_i, I, t_i) \,\}, where t1t_1 and t2t_2 are the two parts of tt;
  • Why(E1∪E2,I,t)=Why(E1,I,t)∪Why(E2,I,t)\mathrm{Why}(E_1 \cup E_2, I, t) = \mathrm{Why}(E_1, I, t) \cup \mathrm{Why}(E_2, I, t), where a part is empty when tt is not in that side.

Each member of the witness basis is a witness, by induction on QQ. The minimal witness basis MWhy(Q,I,t)\mathrm{MWhy}(Q, I, t) is the set of minimal members of Why(Q,I,t)\mathrm{Why}(Q, I, t).

Where-provenance. A location is a triple (R,s,A)(R, s, A): relation RR, tuple s∈I(R)s \in I(R) and attribute AA. For an output tuple tt and an attribute AA of QQ, the where-provenance Where(Q,I,t,A)\mathrm{Where}(Q, I, t, A) is a set of locations, by induction:

  • Where(R,I,t,A)={(R,t,A)}\mathrm{Where}(R, I, t, A) = \{(R, t, A)\};
  • selection keeps the where-provenance of its input;
  • projection takes the union over the input tuples ss with s[X]=ts[X] = t;
  • a natural join copies the value of a join attribute from both sides, so for a shared attribute AA it takes the union of the two sides, and for any other attribute it takes the side that has AA;
  • union takes the union of the two sides;
  • a value that the query writes as a constant, such as 55 in {(x,5)∣R(x,5)}\{(x, 5) \mid R(x, 5)\}, has empty where-provenance.

The why-provenance is about tuples, and the where-provenance is about single values in them.

Two facts (Buneman, Khanna and Tan 2001).

  1. The minimal witness basis is the set of minimal witnesses. Every witness contains a member of the witness basis: if t∈Q(J)t \in Q(J), some derivation of tt uses only tuples of JJ, and the member of Why(Q,I,t)\mathrm{Why}(Q, I, t) that it gives is a subset of JJ. So the minimal members of Why\mathrm{Why} are exactly the minimal witnesses, and equivalent queries have the same minimal witness basis, since they have the same witnesses.
  2. Where-provenance is not invariant. Two equivalent queries can give different where-provenance, as the second example below shows.

From fact 1 and monotonicity: for every set D⊆ID \subseteq I of deleted tuples, t∈Q(I∖D)t \in Q(I \setminus D) if and only if some minimal witness of tt is disjoint from DD. So the minimal witness basis answers every question of the form "does tt survive the deletion of DD?".

Examples and non-examples

Take R(emp,dept)R(\mathit{emp}, \mathit{dept}) with r1=(ann,db)r_1 = (\mathit{ann}, \mathit{db}), r2=(bob,db)r_2 = (\mathit{bob}, \mathit{db}), r3=(cal,os)r_3 = (\mathit{cal}, \mathit{os}), and S(dept,floor)S(\mathit{dept}, \mathit{floor}) with s1=(db,2)s_1 = (\mathit{db}, 2), s2=(os,3)s_2 = (\mathit{os}, 3), s3=(db,4)s_3 = (\mathit{db}, 4). Let Q=πfloor(R⋈S)Q = \pi_{\mathit{floor}}(R \bowtie S), the floors on which someone works. Then Q(I)={(2),(3),(4)}Q(I) = \{(2), (3), (4)\}.

  • Why-provenance. The output (2)(2) has two derivations, through r1⋈s1r_1 \bowtie s_1 and r2⋈s1r_2 \bowtie s_1, so Why(Q,I,(2))={{r1,s1},{r2,s1}}\mathrm{Why}(Q, I, (2)) = \{\{r_1, s_1\}, \{r_2, s_1\}\}; both are minimal. Similarly Why(Q,I,(4))={{r1,s3},{r2,s3}}\mathrm{Why}(Q, I, (4)) = \{\{r_1, s_3\}, \{r_2, s_3\}\} and Why(Q,I,(3))={{r3,s2}}\mathrm{Why}(Q, I, (3)) = \{\{r_3, s_2\}\}. Check by deletion: removing r1r_1 keeps all three answers, since {r2,s1}\{r_2, s_1\} and {r2,s3}\{r_2, s_3\} survive. Removing s1s_1 removes (2)(2) only, since s1s_1 is in both witnesses of (2)(2). Removing r1r_1 and r2r_2 leaves only (3)(3).
  • Where-provenance. Where(Q,I,(2),floor)={(S,s1,floor)}\mathrm{Where}(Q, I, (2), \mathit{floor}) = \{(S, s_1, \mathit{floor})\}: the value 2 was copied from s1s_1 only, although r1r_1 and r2r_2 are needed to produce it. For Q′=πdept(R⋈S)Q' = \pi_{\mathit{dept}}(R \bowtie S), the value db\mathit{db} comes from both sides of the join, and Where(Q′,I,(db),dept)\mathrm{Where}(Q', I, (\mathit{db}), \mathit{dept}) is the four locations (R,r1,dept)(R, r_1, \mathit{dept}), (R,r2,dept)(R, r_2, \mathit{dept}), (S,s1,dept)(S, s_1, \mathit{dept}), (S,s3,dept)(S, s_3, \mathit{dept}).
  • Equivalent queries, same minimal witnesses. Let Q1=RQ_1 = R and Q2=R∪πemp,dept(R⋈S)Q_2 = R \cup \pi_{\mathit{emp}, \mathit{dept}}(R \bowtie S). They are equivalent under set semantics, since the second part is contained in RR. For the output r1r_1, Why(Q1)={{r1}}\mathrm{Why}(Q_1) = \{\{r_1\}\}, while Why(Q2)={{r1},{r1,s1},{r1,s3}}\mathrm{Why}(Q_2) = \{\{r_1\}, \{r_1, s_1\}, \{r_1, s_3\}\}. The witness bases differ, but the minimal witness basis is {{r1}}\{\{r_1\}\} for both.
  • Non-example: where-provenance of equivalent queries. On a relation T(A,B)T(A, B) with the tuple u=(a,5)u = (a, 5), the queries σB=5(T)\sigma_{B = 5}(T) and {(x,5)∣T(x,5)}\{(x, 5) \mid T(x, 5)\} are equivalent. For the output (a,5)(a, 5) and attribute BB, the first gives {(T,u,B)}\{(T, u, B)\}, because selection copies the value, and the second gives ∅\emptyset, because the value is a constant of the query.
  • Non-example: queries with difference. For Q=R−SQ = R - S, the output depends on the absence of tuples, so a set of present tuples is not enough to explain it, and the witness definitions above do not apply. Removing a tuple can add an output. Provenance for queries with negation needs other models.
  • Lineage. Cui, Widom and Wiener (2000) defined the lineage of a view tuple as the source tuples that contribute to it, for select-project-join views with aggregation and set operations. For a positive query, the lineage of tt is the union of the members of its witness basis: {r1,r2,s1}\{r_1, r_2, s_1\} for the output (2)(2) above. Lineage loses the information of which tuples work together.
  • Provenance semirings. Green, Karvounarakis and Tannen (2007) showed that lineage, why-provenance and the minimal witness basis are each the annotations of a commutative semiring, and that each is a homomorphic image of the provenance polynomials N[X]\mathbb{N}[X]; see provenance semirings. For the example, the provenance polynomial of (2)(2) is r1s1+r2s1r_1 s_1 + r_2 s_1; forgetting the coefficients and exponents gives the why-provenance. Where-provenance is about locations, not about tuples, and is not a semiring annotation of this kind.
  • Probabilistic databases. The probability of an output tuple on a probabilistic database with independent tuples is the probability that some minimal witness is fully present, so it depends only on the minimal witness basis and the tuple probabilities.
  • Deletion propagation and view maintenance. The deletion criterion above is the basis of propagating deletions to a materialized view; incremental view maintenance keeps the counts of derivations for the same purpose.
  • Recursive queries. For Datalog, a tuple can have infinitely many derivations, but it has only finitely many witnesses, since each is a subset of the finite instance. The minimal witnesses are defined as before and still answer the deletion question.

References

  1. Peter Buneman, Sanjeev Khanna and Wang-Chiew Tan, Why and where, a characterization of data provenance, Proceedings of the 8th International Conference on Database Theory (ICDT), LNCS 1973, 316 to 330 (2001), the definitions of witnesses, the witness basis and the minimal witness basis (why-provenance) and of where-provenance; the minimal witness basis is invariant under query equivalence and where-provenance is not
  2. Yingwei Cui, Jennifer Widom and Janet L. Wiener, Tracing the lineage of view data in a warehousing environment, ACM Transactions on Database Systems 25(2), 179 to 227 (2000), the lineage of a view tuple, the source tuples that contribute to it, for select-project-join views with aggregation and set operations
  3. Todd J. Green, Grigoris Karvounarakis and Val Tannen, Provenance semirings, Proceedings of the 26th ACM Symposium on Principles of Database Systems (PODS), 31 to 40 (2007), why-provenance, lineage and the minimal witness basis as semirings of annotations, and their relation to provenance polynomials
  4. James Cheney, Laura Chiticariu and Wang-Chiew Tan, Provenance in databases, why, how, and where, Foundations and Trends in Databases 1(4), 379 to 474 (2009), survey of lineage, why-provenance, how-provenance and where-provenance, with their definitions for the positive relational algebra

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/XWZGP9/text.yaml