15#if PG_VERSION_NUM >= 160000
18#include "catalog/pg_type.h"
19#include "utils/uuid.h"
47 pg_uuid_t *token = DatumGetUUIDP(PG_GETARG_DATUM(0));
67 string inputs_line =
"// inputs:";
69 const string &uuid = c.
getUUID(in);
70 if (uuid.empty())
continue;
71 inputs_line +=
" " +
to_string(in) +
"=" + uuid;
78 text *result = (text *) palloc(VARHDRSZ + dot.size());
79 SET_VARSIZE(result, VARHDRSZ + dot.size());
80 memcpy((
void *) VARDATA(result), dot.c_str(), dot.size());
81 PG_RETURN_TEXT_P(result);
84 "circuit treewidth exceeds the supported limit (MAX_TREEWIDTH)");
86 }
catch(
const std::exception &e) {
Boolean provenance circuit with support for knowledge compilation.
BooleanCircuit getBooleanCircuit(GenericCircuit &gc, pg_uuid_t token, gate_t &gate, std::unordered_map< gate_t, gate_t > &gc_to_bc)
Build a BooleanCircuit from an already-loaded GenericCircuit.
Build in-memory circuits from the mmap-backed persistent store.
gate_t
Strongly-typed gate identifier.
std::string to_string(gate_t g)
Convert a gate_t to its decimal string representation.
Tree decomposition of a Boolean circuit for knowledge compilation.
Fix gettext macro conflicts between PostgreSQL and the C++ STL.
Boolean circuit for provenance formula evaluation.
const std::set< gate_t > & getInputs() const
Return the set of input (IN) gate IDs.
void rewriteMultivaluedGates()
Rewrite all MULVAR/MULIN gate clusters into standard AND/OR/NOT circuits.
uuid getUUID(gate_t g) const
Return the UUID string associated with gate g.
Exception thrown when a tree decomposition cannot be constructed.
Tree decomposition of a Boolean circuit's primal graph.
unsigned getTreewidth() const
Return the treewidth of this decomposition.
std::string toDot() const
Render the tree decomposition as a GraphViz DOT string.
#define provsql_error(fmt,...)
Report a fatal ProvSQL error and abort the current transaction.
Shared-memory segment and inter-process pipe management.
Core types, constants, and utilities shared across ProvSQL.
C++ utility functions for UUID manipulation.
Datum tree_decomposition_dot(PG_FUNCTION_ARGS)
PostgreSQL-callable entry point.