ProvSQL SQL API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches

Evaluate provenance as a symbolic formula (e.g., "a ⊗ b ⊕ c"). More...

Functions

ANYELEMENT choose_function (ANYELEMENT state, ANYELEMENT data)
 Transition function for the choose aggregate (keeps first non-NULL value).
VOID choose (ANYELEMENT)
 Aggregate that returns an arbitrary non-NULL value from a group.
VOID explode_table (TEXT _tbl, TEXT AGG_TOKEN)
 Explodes a table column containing aggregated provenance into multiple rows.

Detailed Description

Evaluate provenance as a symbolic formula (e.g., "a ⊗ b ⊕ c").

Choose one value among many, used in particular to code a mutually exclusive choice as an aggregate.

Source code
provsql.sql line 6959

Evaluate provenance over the counting semiring (ℕ)

Source code
provsql.sql line 6973

Evaluate provenance as why-provenance (set of witness sets)

Source code
provsql.sql line 6987

Evaluate provenance as how-provenance (canonical polynomial provenance ℕ[X], universal commutative-semiring provenance)

Source code
provsql.sql line 7001

Evaluate provenance as which-provenance (lineage: a single set of contributing labels)

Source code
provsql.sql line 7015

Evaluate provenance as a Boolean expression

The optional token2value mapping labels the leaves of the formula: when omitted, leaves are rendered as bare x<id> placeholders.

Source code
provsql.sql line 7034

Evaluate provenance over the Boolean semiring (true/false)

Source code
provsql.sql line 7051

Evaluate provenance over the tropical (min-plus) m-semiring

Inputs are read as float8 cost values; the additive identity is 'Infinity'::float8 and the multiplicative identity is 0. Returns the cost of the cheapest derivation.

With nonnegative, input costs are checked nonnegative and the semiring is absorptive: evaluation then also accepts circuits carrying the 'absorptive' assumption marker – notably cyclic recursive queries truncated at the absorptive value fixpoint, giving exact min-cost reachability on cyclic data.

Source code
provsql.sql line 7076

Evaluate provenance over the Viterbi (max-times) m-semiring

Inputs are read as float8 probability values in \([0,1]\). Returns the probability of the most likely derivation.

Source code
provsql.sql line 7095

Evaluate provenance over the Łukasiewicz fuzzy m-semiring

Inputs are read as float8 graded-truth values in \([0,1]\). Addition is \(\max\); multiplication is the Łukasiewicz t-norm \(\max(a + b - 1, 0)\), which preserves crisp truth and avoids the near-zero collapse of long product chains.

Source code
provsql.sql line 7115

Evaluate provenance over the min-max m-semiring on a user ENUM

Inputs are read as values of a user-defined ENUM carrier; addition is ENUM-min, multiplication is ENUM-max. Bottom and top of the ENUM are derived from pg_enum.enumsortorder. The third argument is a sample value of the carrier ENUM, used only for type inference; its value is ignored.

The security shape: alternative derivations combine to the least sensitive label, joins combine to the most sensitive label.

Parameters
tokenProvenance token to evaluate.
token2valueMapping from input gates to ENUM values.
element_oneSample value of the carrier ENUM (any value works).
Source code
provsql.sql line 7143

Evaluate provenance over the max-min m-semiring on a user ENUM

Dual of :sqlfunc:sr_minmax: addition is ENUM-max, multiplication is ENUM-min. The fuzzy / availability / trust shape: alternatives combine to the most permissive label, joins combine to the strictest label. The third argument is a sample value of the carrier ENUM, used only for type inference; its value is ignored.

Parameters
tokenProvenance token to evaluate.
token2valueMapping from input gates to ENUM values.
element_oneSample value of the carrier ENUM (any value works).
Source code
provsql.sql line 7168

Choose one value among many, used in particular to code a mutually exclusive choice as an aggregate.

Function Documentation

◆ choose()

VOID update_provenance::choose ( ANYELEMENT )

Aggregate that returns an arbitrary non-NULL value from a group.

Source code
provsql.sql line 7203

◆ choose_function()

ANYELEMENT update_provenance::choose_function ( ANYELEMENT state,
ANYELEMENT data )

Transition function for the choose aggregate (keeps first non-NULL value).

Source code
provsql.sql line 7190

◆ explode_table()

VOID update_provenance::explode_table ( TEXT _tbl,
TEXT AGG_TOKEN )

Explodes a table column containing aggregated provenance into multiple rows.

For each row in the input table, this function unnests the children of the specified aggregate token column and produces one output row per child. It reconstructs the corresponding value and provenance (provsql) for each resulting row.

The original table is replaced by the transformed table.

Parameters
_tblName of the table to transform.
AGG_TOKENName of the column containing the aggregate to explode.
Source code
provsql.sql line 7220