![]() |
ProvSQL SQL API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Functions for evaluating provenance circuits over semirings, both user-defined (via function references) and compiled (built-in). More...
Functions | |
| ANYELEMENT | provsql.provenance_evaluate_compiled (UUID token, REGCLASS token2value, TEXT semiring, ANYELEMENT element_one) |
| Evaluate provenance using a compiled (built-in) semiring. | |
| ANYELEMENT | provsql.provenance_evaluate (UUID token, REGCLASS token2value, ANYELEMENT element_one, REGTYPE value_type, REGPROC plus_function, REGPROC times_function, REGPROC monus_function, REGPROC delta_function) |
| Evaluate provenance over a user-defined semiring (PL/pgSQL version) | |
| ANYELEMENT | provsql.aggregation_evaluate (UUID token, REGCLASS token2value, REGPROC agg_function_final, REGPROC agg_function, REGPROC semimod_function, ANYELEMENT element_one, REGTYPE value_type, REGPROC plus_function, REGPROC times_function, REGPROC monus_function, REGPROC delta_function) |
| Evaluate aggregate provenance over a user-defined semiring (PL/pgSQL version) | |
| ANYELEMENT | provsql.provenance_evaluate (UUID token, REGCLASS token2value, ANYELEMENT element_one, REGPROC plus_function, REGPROC times_function, REGPROC monus_function=NULL, REGPROC delta_function=NULL) |
| Evaluate provenance over a user-defined semiring (C version) | |
| ANYELEMENT | provsql.aggregation_evaluate (UUID token, REGCLASS token2value, REGPROC agg_function_final, REGPROC agg_function, REGPROC semimod_function, ANYELEMENT element_one, REGPROC plus_function, REGPROC times_function, REGPROC monus_function=NULL, REGPROC delta_function=NULL) |
| Evaluate aggregate provenance over a user-defined semiring (C version) | |
Functions for evaluating provenance circuits over semirings, both user-defined (via function references) and compiled (built-in).
| ANYELEMENT provsql.aggregation_evaluate | ( | UUID | token, |
| REGCLASS | token2value, | ||
| REGPROC | agg_function_final, | ||
| REGPROC | agg_function, | ||
| REGPROC | semimod_function, | ||
| ANYELEMENT | element_one, | ||
| REGPROC | plus_function, | ||
| REGPROC | times_function, | ||
| REGPROC | monus_function = NULL, |
||
| REGPROC | delta_function = NULL |
||
| ) |
Evaluate aggregate provenance over a user-defined semiring (C version)
| ANYELEMENT provsql.aggregation_evaluate | ( | UUID | token, |
| REGCLASS | token2value, | ||
| REGPROC | agg_function_final, | ||
| REGPROC | agg_function, | ||
| REGPROC | semimod_function, | ||
| ANYELEMENT | element_one, | ||
| REGTYPE | value_type, | ||
| REGPROC | plus_function, | ||
| REGPROC | times_function, | ||
| REGPROC | monus_function, | ||
| REGPROC | delta_function | ||
| ) |
Evaluate aggregate provenance over a user-defined semiring (PL/pgSQL version)
Handles agg and semimod gates produced by GROUP BY queries.
| token | provenance token to evaluate |
| token2value | mapping table from tokens to semiring values |
| agg_function_final | finalization function for the aggregate |
| agg_function | aggregate combination function |
| semimod_function | semimodule scalar multiplication function |
| element_one | identity element of the semiring |
| value_type | OID of the semiring value type |
| plus_function | semiring addition |
| times_function | semiring multiplication |
| monus_function | semiring monus, or NULL |
| delta_function | δ-semiring operator, or NULL |
| ANYELEMENT provsql.provenance_evaluate | ( | UUID | token, |
| REGCLASS | token2value, | ||
| ANYELEMENT | element_one, | ||
| REGPROC | plus_function, | ||
| REGPROC | times_function, | ||
| REGPROC | monus_function = NULL, |
||
| REGPROC | delta_function = NULL |
||
| ) |
Evaluate provenance over a user-defined semiring (C version)
Optimized C implementation of provenance_evaluate. Infers the value type from element_one. Monus and delta functions are optional.
| token | provenance token to evaluate |
| token2value | mapping table from tokens to semiring values |
| element_one | identity element of the semiring |
| plus_function | semiring addition (aggregate) |
| times_function | semiring multiplication (aggregate) |
| monus_function | semiring monus, or NULL if not needed |
| delta_function | δ-semiring operator, or NULL if not needed |
| ANYELEMENT provsql.provenance_evaluate | ( | UUID | token, |
| REGCLASS | token2value, | ||
| ANYELEMENT | element_one, | ||
| REGTYPE | value_type, | ||
| REGPROC | plus_function, | ||
| REGPROC | times_function, | ||
| REGPROC | monus_function, | ||
| REGPROC | delta_function | ||
| ) |
Evaluate provenance over a user-defined semiring (PL/pgSQL version)
Recursively walks the provenance circuit and evaluates each gate using the provided semiring operations. This is the generic version that accepts semiring operations as function references.
| token | provenance token to evaluate |
| token2value | mapping table from tokens to semiring values |
| element_one | identity element of the semiring |
| value_type | OID of the semiring value type |
| plus_function | semiring addition (aggregate) |
| times_function | semiring multiplication (aggregate) |
| monus_function | semiring monus (binary), or NULL |
| delta_function | δ-semiring operator, or NULL |
| ANYELEMENT provsql.provenance_evaluate_compiled | ( | UUID | token, |
| REGCLASS | token2value, | ||
| TEXT | semiring, | ||
| ANYELEMENT | element_one | ||
| ) |
Evaluate provenance using a compiled (built-in) semiring.
This C function handles semiring evaluation entirely in C++ for better performance. The semiring is specified by name.
| token | provenance token to evaluate |
| token2value | mapping table from tokens to semiring values |
| semiring | name of the compiled semiring (e.g., "formula", "counting") |
| element_one | identity element of the semiring |