![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
HAVING-clause provenance evaluation for all built-in semirings. More...
#include "postgres.h"#include "utils/lsyscache.h"#include <vector>#include <string>#include <unordered_map>#include <unordered_set>#include "having_semantics.hpp"#include "provsql_utils_cpp.h"#include "subset.hpp"#include "semiring/Boolean.h"#include "semiring/BoolExpr.h"#include "semiring/Counting.h"#include "semiring/Formula.h"#include "semiring/Why.h"
Go to the source code of this file.
Functions | |
| template<typename SemiringT , typename MapT > | |
| static void | try_having_impl (GenericCircuit &c, gate_t g, MapT &mapping, SemiringT S) |
| Rewrite HAVING comparison gates in the circuit by enumerating possible worlds. | |
| void | provsql_try_having_formula (GenericCircuit &c, gate_t g, std::unordered_map< gate_t, std::string > &mapping) |
Evaluate the HAVING sub-circuit at g over the Formula semiring. | |
| void | provsql_try_having_counting (GenericCircuit &c, gate_t g, std::unordered_map< gate_t, unsigned > &mapping) |
Evaluate the HAVING sub-circuit at g over the Counting semiring. | |
| void | provsql_try_having_why (GenericCircuit &c, gate_t g, std::unordered_map< gate_t, semiring::why_provenance_t > &mapping) |
Evaluate the HAVING sub-circuit at g over the Why-provenance semiring. | |
| void | provsql_try_having_boolexpr (GenericCircuit &c, semiring::BoolExpr &be, gate_t g, std::unordered_map< gate_t, gate_t > &mapping) |
Evaluate the HAVING sub-circuit at g over the BoolExpr semiring. | |
| void | provsql_try_having_boolean (GenericCircuit &c, gate_t g, std::unordered_map< gate_t, bool > &mapping) |
Evaluate the HAVING sub-circuit at g over the Boolean semiring. | |
HAVING-clause provenance evaluation for all built-in semirings.
Implements the five provsql_try_having_*() functions declared in having_semantics.hpp, one per supported semiring:
provsql_try_having_formula() provsql_try_having_counting() provsql_try_having_why() provsql_try_having_boolexpr() provsql_try_having_boolean() Each function evaluates the sub-circuit rooted at the given gate_agg / gate_semimod gate using enumerate_valid_worlds() (for exact predicate testing) and populates the provenance mapping.
An anonymous-namespace helper provsql_try_having_internal() provides the shared logic; the five public functions are thin wrappers that instantiate it for the appropriate semiring type.
Definition in file having_semantics.cpp.
| void provsql_try_having_boolean | ( | GenericCircuit & | c, |
| gate_t | g, | ||
| std::unordered_map< gate_t, bool > & | mapping | ||
| ) |
Evaluate the HAVING sub-circuit at g over the Boolean semiring.
| c | The generic circuit containing gate g. |
| g | Root gate of the HAVING sub-circuit. |
| mapping | Map from input gates to their Boolean values; populated on successful evaluation. |
Definition at line 363 of file having_semantics.cpp.

| void provsql_try_having_boolexpr | ( | GenericCircuit & | c, |
| semiring::BoolExpr & | be, | ||
| gate_t | g, | ||
| std::unordered_map< gate_t, gate_t > & | mapping | ||
| ) |
Evaluate the HAVING sub-circuit at g over the BoolExpr semiring.
| c | The generic circuit containing gate g. |
| be | The BoolExpr semiring instance (shared circuit). |
| g | Root gate of the HAVING sub-circuit. |
| mapping | Map from input gates to their gate_t values in be; populated on successful evaluation. |
Definition at line 354 of file having_semantics.cpp.

| void provsql_try_having_counting | ( | GenericCircuit & | c, |
| gate_t | g, | ||
| std::unordered_map< gate_t, unsigned > & | mapping | ||
| ) |
Evaluate the HAVING sub-circuit at g over the Counting semiring.
| c | The generic circuit containing gate g. |
| g | Root gate of the HAVING sub-circuit. |
| mapping | Map from input gates to their count values; populated on successful evaluation. |
Definition at line 338 of file having_semantics.cpp.

| void provsql_try_having_formula | ( | GenericCircuit & | c, |
| gate_t | g, | ||
| std::unordered_map< gate_t, std::string > & | mapping | ||
| ) |
Evaluate the HAVING sub-circuit at g over the Formula semiring.
| c | The generic circuit containing gate g. |
| g | Root gate of the HAVING sub-circuit. |
| mapping | Map from input gates to their formula string values; populated on successful evaluation. |
Definition at line 330 of file having_semantics.cpp.

| void provsql_try_having_why | ( | GenericCircuit & | c, |
| gate_t | g, | ||
| std::unordered_map< gate_t, semiring::why_provenance_t > & | mapping | ||
| ) |
Evaluate the HAVING sub-circuit at g over the Why-provenance semiring.
| c | The generic circuit containing gate g. |
| g | Root gate of the HAVING sub-circuit. |
| mapping | Map from input gates to their why-provenance values; populated on successful evaluation. |
Definition at line 346 of file having_semantics.cpp.

|
static |
Rewrite HAVING comparison gates in the circuit by enumerating possible worlds.
| SemiringT | The semiring type used for evaluation. |
| MapT | The provenance mapping type (gate_t → semiring value). |
| c | Circuit to rewrite. |
| g | Root gate of the sub-circuit to inspect. |
| mapping | Provenance mapping updated in place. |
| S | Semiring instance. |
Definition at line 192 of file having_semantics.cpp.
