![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Symbolic representation of provenance as a human-readable formula. More...
#include <numeric>#include <vector>#include <string>#include <sstream>#include <iterator>#include "Semiring.h"

Go to the source code of this file.
Classes | |
| class | semiring::Formula |
Symbolic provenance representation over std::string. More... | |
Namespaces | |
| namespace | semiring |
Functions | |
| template<typename Range, typename Value = typename Range::value_type> | |
| static std::string | join (Range const &elements, const char *const delimiter) |
| Concatenate elements of a range with a delimiter. | |
| static std::string | strip_wrap_if_op (const std::string &s, const std::string &op) |
If s is wrapped in a single matched outer paren pair AND its top-level operator (depth 1, inside that pair) is op, return the inner content; otherwise return s unchanged. | |
Symbolic representation of provenance as a human-readable formula.
The Formula pseudo-semiring (std::string, \(\oplus\), \(\otimes\), "ð", "ð") produces a symbolic representation of provenance using Unicode semiring symbols. It is primarily used for debugging and testing.
Each gate evaluates to a string:
zero() â "ð"one() â "ð"plus() â "(a â b â âŠ)" or just "a" for singletonstimes() â "(a â b â âŠ)" or just "a" for singletonsmonus() â "(a â b)"delta() â "ÎŽ(a)" or "ÎŽa" if a starts with (cmp() â "[s1 op s2]"semimod()â "x*s"agg() â operator-specific notation (e.g., "min(a,b)")value() â the literal string itself Definition in file Formula.h.
|
static |
Concatenate elements of a range with a delimiter.
Used internally by Formula::plus(), Formula::times(), and Formula::agg() to build operator-separated strings.
| Range | Any range type with a value_type typedef. |
| Value | Element type (defaults to Range::value_type). |
| elements | The range to join. |
| delimiter | String to insert between adjacent elements. |
delimiter between them. Definition at line 46 of file Formula.h.

|
static |
If s is wrapped in a single matched outer paren pair AND its top-level operator (depth 1, inside that pair) is op, return the inner content; otherwise return s unchanged.
Used by Formula::plus() and Formula::times() to flatten same-op nested gates by associativity: a child "(a â b)" feeding into a parent plus is unwrapped to "a â b" so the join produces "a â b â c" instead of "(a â b) â c". A different top-level op (e.g., a times child) keeps its parens.
Definition at line 72 of file Formula.h.
