![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Circuit encoding where-provenance (column-level data origin). More...
#include "WhereCircuit.h"


Classes | |
| struct | Locator |
| Describes the origin of a single attribute value. More... | |
Public Member Functions | |
| gate_t | setGate (const uuid &u, WhereGate type) override |
Create or update the gate associated with UUID u. | |
| gate_t | setGateInput (const uuid &u, std::string table, int nb_columns) |
| Create an input gate for a specific table row. | |
| gate_t | setGateProjection (const uuid &u, std::vector< int > &&infos) |
| Create a projection gate with column mapping. | |
| gate_t | setGateEquality (const uuid &u, int pos1, int pos2) |
| Create an equality (equijoin) gate for two attribute positions. | |
| std::string | toString (gate_t g) const override |
Return a textual description of gate g for debugging. | |
| std::vector< std::set< Locator > > | evaluate (gate_t g) const |
Evaluate the where-provenance circuit at gate g. | |
Public Member Functions inherited from Circuit< WhereGate > | |
| virtual | ~Circuit () |
| std::vector< gate_t >::size_type | getNbGates () const |
| Return the total number of gates in the circuit. | |
| gate_t | getGate (const uuid &u) |
Return (or create) the gate associated with UUID u. | |
| uuid | getUUID (gate_t g) const |
Return the UUID string associated with gate g. | |
| WhereGate | getGateType (gate_t g) const |
Return the type of gate g. | |
| std::vector< gate_t > & | getWires (gate_t g) |
Return a mutable reference to the child-wire list of gate g. | |
| const std::vector< gate_t > & | getWires (gate_t g) const |
Return a const reference to the child-wire list of gate g. | |
| virtual gate_t | setGate (const uuid &u, WhereGate type) |
Create or update the gate associated with UUID u. | |
| virtual gate_t | setGate (WhereGate type) |
Allocate a new gate with type type and no UUID. | |
| bool | hasGate (const uuid &u) const |
Test whether a gate with UUID u exists. | |
| void | addWire (gate_t f, gate_t t) |
Add a directed wire from gate f (parent) to gate t (child). | |
Private Attributes | |
| std::unordered_map< gate_t, uuid > | input_token |
| UUID of the source tuple for each IN gate. | |
| std::unordered_map< gate_t, std::pair< std::string, int > > | input_info |
| (table name, nb_columns) for each IN gate | |
| std::unordered_map< gate_t, std::vector< int > > | projection_info |
| Projected attribute positions for PROJECT gates. | |
| std::unordered_map< gate_t, std::pair< int, int > > | equality_info |
| Joined attribute pair (pos1, pos2) for EQ gates. | |
Additional Inherited Members | |
Public Types inherited from Circuit< WhereGate > | |
| using | uuid = std::string |
UUID type used in this circuit (always std::string). | |
Protected Member Functions inherited from Circuit< WhereGate > | |
| void | setGateType (gate_t g, WhereGate t) |
| Update the type of an existing gate. | |
| virtual gate_t | addGate () |
| Allocate a new gate with a default-initialised type. | |
Protected Attributes inherited from Circuit< WhereGate > | |
| std::unordered_map< uuid, gate_t > | uuid2id |
| UUID string → gate index. | |
| std::unordered_map< gate_t, uuid > | id2uuid |
| Gate index → UUID string. | |
| std::vector< WhereGate > | gates |
| Gate type for each gate. | |
| std::vector< std::vector< gate_t > > | wires |
| Child wire lists for each gate. | |
Circuit encoding where-provenance (column-level data origin).
Stores extra per-gate metadata that relates each gate to its position in the original query plan (table name, row UUID, column index).
Definition at line 53 of file WhereCircuit.h.
| vector< set< WhereCircuit::Locator > > WhereCircuit::evaluate | ( | gate_t | g | ) | const |
Evaluate the where-provenance circuit at gate g.
Returns one set of Locator values per output column position. Each Locator in the set identifies a base-relation cell that contributed the value at that output position.
| g | Root gate to evaluate. |
Locator values. Definition at line 102 of file WhereCircuit.cpp.


Create or update the gate associated with UUID u.
If the UUID is already mapped the existing gate's type is updated. Otherwise a new gate is allocated.
| u | UUID string to associate with the gate. |
| type | Gate type. |
Definition at line 30 of file WhereCircuit.cpp.


Create an equality (equijoin) gate for two attribute positions.
| u | UUID to associate with this gate. |
| pos1 | Left-side attribute position. |
| pos2 | Right-side attribute position. |
Definition at line 42 of file WhereCircuit.cpp.


Create an input gate for a specific table row.
| u | UUID of the source tuple (row token). |
| table | Name of the source relation. |
| nb_columns | Number of columns in the source tuple. |
Definition at line 49 of file WhereCircuit.cpp.


Create a projection gate with column mapping.
| u | UUID to associate with this gate. |
| infos | List of attribute positions surviving the projection. |
Definition at line 35 of file WhereCircuit.cpp.


|
overridevirtual |
Return a textual description of gate g for debugging.
Pure virtual; each concrete circuit class provides its own formatting.
| g | Gate to describe. |
Implements Circuit< WhereGate >.
Definition at line 57 of file WhereCircuit.cpp.


|
private |
Joined attribute pair (pos1, pos2) for EQ gates.
Definition at line 58 of file WhereCircuit.h.
|
private |
(table name, nb_columns) for each IN gate
Definition at line 56 of file WhereCircuit.h.
UUID of the source tuple for each IN gate.
Definition at line 55 of file WhereCircuit.h.
|
private |
Projected attribute positions for PROJECT gates.
Definition at line 57 of file WhereCircuit.h.