ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
having_semantics.hpp File Reference

Provenance evaluation helpers for HAVING-clause circuits. More...

#include <string>
#include <unordered_map>
#include "GenericCircuit.hpp"
#include "BooleanCircuit.h"
#include "semiring/BoolExpr.h"
#include "semiring/Why.h"
Include dependency graph for having_semantics.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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.
 

Detailed Description

Provenance evaluation helpers for HAVING-clause circuits.

When a query includes a HAVING clause, ProvSQL creates a special sub-circuit that encodes the aggregate predicate. Before the main provenance circuit can be evaluated over a semiring, these HAVING sub-circuits must first be evaluated to determine which groups pass the filter.

This header declares one evaluation helper per semiring variant. Each function evaluates the HAVING sub-circuit rooted at gate g over the appropriate semiring, writing results into mapping. On successful evaluation, mapping is populated with entries for input gates reachable from g. If the HAVING gate type is incompatible with the requested semiring the function is a no-op.

Definition in file having_semantics.hpp.

Function Documentation

◆ provsql_try_having_boolean()

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.

Parameters
cThe generic circuit containing gate g.
gRoot gate of the HAVING sub-circuit.
mappingMap from input gates to their Boolean values; populated on successful evaluation.

Definition at line 363 of file having_semantics.cpp.

Here is the caller graph for this function:

◆ provsql_try_having_boolexpr()

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.

Parameters
cThe generic circuit containing gate g.
beThe BoolExpr semiring instance (shared circuit).
gRoot gate of the HAVING sub-circuit.
mappingMap from input gates to their gate_t values in be; populated on successful evaluation.

Definition at line 354 of file having_semantics.cpp.

Here is the caller graph for this function:

◆ provsql_try_having_counting()

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.

Parameters
cThe generic circuit containing gate g.
gRoot gate of the HAVING sub-circuit.
mappingMap from input gates to their count values; populated on successful evaluation.

Definition at line 338 of file having_semantics.cpp.

Here is the caller graph for this function:

◆ provsql_try_having_formula()

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.

Parameters
cThe generic circuit containing gate g.
gRoot gate of the HAVING sub-circuit.
mappingMap from input gates to their formula string values; populated on successful evaluation.

Definition at line 330 of file having_semantics.cpp.

Here is the caller graph for this function:

◆ provsql_try_having_why()

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.

Parameters
cThe generic circuit containing gate g.
gRoot gate of the HAVING sub-circuit.
mappingMap from input gates to their why-provenance values; populated on successful evaluation.

Definition at line 346 of file having_semantics.cpp.

Here is the caller graph for this function: