Record Class ProvenanceVariable
- Record Components:
name- the variable's label; nevernullor blanksource- the structured source identity, orOptional.empty()when minted from a bare label; nevernull
- All Implemented Interfaces:
Comparable<ProvenanceVariable>
ℕ[X] (after Green,
Karvounarakis & Tannen, PODS 2007).
Each occurrence of a tuple in a base relation is lifted to its own distinct
variable (so two structurally-equal source rows still receive different
variables, and the merged tuple's annotation becomes x₁ ⊕ x₂). The
name is a human-readable label for that occurrence — by convention
<relation>#<ordinal>, e.g. Orders#1 — chosen at lift time, not by
the algebra.
A variable may additionally carry a structured source: the
producing leaf, occurrence ordinal, and the base tuple's captured column values.
This is what makes lineage machine-actionable — a consuming tool can use
source() to locate the exact source row a variable stands for, rather
than parsing the bare name. Variables minted from a raw label (e.g. in
tests, or the cheap weighted-closure path) simply have an
empty source.
Variables are compared, and considered equal, by name alone,
so two variables with the same label are the same variable regardless of their
captured source — the canonical name is the identity that the ⊕/⊗
algebra keys on.
-
Constructor Summary
ConstructorsConstructorDescriptionProvenanceVariable(String name) Creates a bare provenance variable from a label, with no structured source.ProvenanceVariable(String name, Optional<SourceRef> source) Creates a provenance variable, validating its label and source. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ProvenanceVariable other) Orders variables byname— the canonical order used to render monomials.booleanTwo variables are equal iff theirnames are equal (source is not part of identity).inthashCode()Returns a hash code value for this object.label(boolean detailed) Returns this variable's label, optionally enriched with its captured source columns.name()Returns the value of thenamerecord component.static ProvenanceVariableReturns a provenance variable carrying the structuredref.source()Returns the value of thesourcerecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
ProvenanceVariable
Creates a provenance variable, validating its label and source.- Parameters:
name- the variable's label; nevernullor blanksource- the structured source identity; nevernull(may be empty)
-
ProvenanceVariable
Creates a bare provenance variable from a label, with no structured source.- Parameters:
name- the variable's label; nevernullor blank
-
-
Method Details
-
of
Returns a provenance variable carrying the structuredref. The variable'snameis the reference'scanonical name, so its identity is unchanged from a bare<source>#<ordinal>variable while it now carries the captured columns.- Parameters:
ref- the structured source identity; nevernull- Returns:
- a provenance variable carrying the structured
ref
-
label
Returns this variable's label, optionally enriched with its captured source columns. Whendetailedand asourcewith columns is present, returns e.g.Orders#1{id: 42}; otherwise the barename.- Parameters:
detailed- whether to append the captured source columns when available- Returns:
- this variable's label, optionally enriched with its captured source columns
-
compareTo
Orders variables byname— the canonical order used to render monomials.- Specified by:
compareToin interfaceComparable<ProvenanceVariable>
-
equals
Two variables are equal iff theirnames are equal (source is not part of identity). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
source
Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-