![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
The joint encoding of an instance: facts, world events, and the joint graph the screen and the DP run over. More...
#include "JointEncoding.h"
Public Member Functions | |
| Graph | buildGraph () const |
| Construct the joint graph for the screen and the DP. | |
Static Public Member Functions | |
| static JointEncoding | fromFacts (const std::vector< FactRow > &rows) |
| Build the data-graph (§3.5 fast path) encoding from raw rows. | |
| static JointEncoding | fromCorrelated (std::vector< Fact > facts, std::vector< SliceGate > slice, unsigned long n_elements) |
| Construct the correlated-regime encoding from facts and an already-extracted circuit slice. | |
Public Attributes | |
| std::vector< Fact > | facts |
| Deduplicated facts. | |
| std::vector< Event > | events |
| Independent world variables (data-graph regime). | |
| std::vector< SliceGate > | slice |
Circuit slice (correlated regime); gate vertex = n_elements + index. | |
| bool | correlated = false |
true when the slice is present (correlated regime). | |
| unsigned long | n_elements = 0 |
One past the largest domain element id (vertex ids [0,n_elements)). | |
| unsigned | data_treewidth_lb = 0 |
| Degeneracy lower bound of the data-only graph (diagnostics). | |
| unsigned | circuit_treewidth_lb = 0 |
| Degeneracy lower bound of the slice-only graph (0 in the data-graph regime). | |
The joint encoding of an instance: facts, world events, and the joint graph the screen and the DP run over.
Definition at line 135 of file JointEncoding.h.
| Graph JointEncoding::buildGraph | ( | ) | const |
Construct the joint graph for the screen and the DP.
Data-graph regime: the Gaifman graph of the facts – per-fact cliques over domain elements, isolated nodes for unary facts. Correlated regime: additionally the gate vertices [n_elements, n_elements + |slice|), with a clique over {elements} ∪ {fact gate} per fact (thesis Def. 4.2.5, rule 1) and a clique over {gate} ∪ {children} per internal slice gate (the stronger ternary co-occurrence of arXiv:1511.08723, rule 2).
Definition at line 144 of file JointEncoding.cpp.


|
static |
Construct the correlated-regime encoding from facts and an already-extracted circuit slice.
The caller (the SQL glue) walks the mmap circuit from the distinct fact tokens down to gate_input leaves and normalises the slice to arity ≤ 2, filling slice and, per fact, the index of its slice gate (or marking it certain for an untracked / constant-true token). This factory assembles the joint graph (element vertices, gate vertices, fact-to-gate and gate-wire cliques) and the diagnostics.
| facts | Deduplicated facts (kind GATE carry a slice index in Fact::gate; kind CERTAIN are always present). |
| slice | The circuit slice (arity ≤ 2). |
| n_elements | One past the largest element id used. |
Definition at line 87 of file JointEncoding.cpp.

|
static |
Build the data-graph (§3.5 fast path) encoding from raw rows.
Dedups facts by token (a token over identical element tuples serves many atoms; a gate_input token shared across different element tuples is rejected with JointCompilerException, routing the caller to the general path). Each independent fact becomes one Bernoulli event; certain facts (empty token) are always present. The joint graph is the Gaifman graph of the facts (one clique per fact over its elements).
| rows | Per-atom relation rows (already dense-encoded). |
Definition at line 17 of file JointEncoding.cpp.

| unsigned JointEncoding::circuit_treewidth_lb = 0 |
Degeneracy lower bound of the slice-only graph (0 in the data-graph regime).
Definition at line 144 of file JointEncoding.h.
| bool JointEncoding::correlated = false |
true when the slice is present (correlated regime).
Definition at line 140 of file JointEncoding.h.
| unsigned JointEncoding::data_treewidth_lb = 0 |
Degeneracy lower bound of the data-only graph (diagnostics).
Definition at line 143 of file JointEncoding.h.
| std::vector<Event> JointEncoding::events |
Independent world variables (data-graph regime).
Definition at line 138 of file JointEncoding.h.
| std::vector<Fact> JointEncoding::facts |
Deduplicated facts.
Definition at line 137 of file JointEncoding.h.
| unsigned long JointEncoding::n_elements = 0 |
One past the largest domain element id (vertex ids [0,n_elements)).
Definition at line 141 of file JointEncoding.h.
| std::vector<SliceGate> JointEncoding::slice |
Circuit slice (correlated regime); gate vertex = n_elements + index.
Definition at line 139 of file JointEncoding.h.