![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Build in-memory circuits from the mmap-backed persistent store. More...


Go to the source code of this file.
Functions | |
| BooleanCircuit | getBooleanCircuit (pg_uuid_t token, gate_t &gate) |
Build a BooleanCircuit from the mmap store rooted at token. | |
| 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. | |
| GenericCircuit | getGenericCircuit (pg_uuid_t token) |
Build a GenericCircuit from the mmap store rooted at token. | |
| void | propagateDNNFCertificate (const GenericCircuit &gc, const std::unordered_map< gate_t, gate_t > &gc_to_bc, BooleanCircuit &c) |
Propagate the per-gate d-DNNF certificate from gc to c. | |
| dDNNF | buildInversionFreeDDNNF (pg_uuid_t token) |
| Compile a query certified inversion-free to its structured d-DNNF. | |
| GenericCircuit | getJointCircuit (pg_uuid_t root_token, pg_uuid_t event_token, gate_t &root_gate, gate_t &event_gate) |
Build a GenericCircuit containing the closures of two roots, with shared subgraphs unified. | |
Build in-memory circuits from the mmap-backed persistent store.
Declares two free functions that traverse the memory-mapped circuit storage starting from a given root UUID and construct the corresponding in-memory circuit representation. These functions are the primary bridge between the persistent MMappedCircuit and the evaluation algorithms that operate on BooleanCircuit or GenericCircuit.
Definition in file CircuitFromMMap.h.
Compile a query certified inversion-free to its structured d-DNNF.
Builds the same structured d-DNNF the 'inversion-free' probability method uses (over the query-derived Prop. 4.5 order carried on the circuit's annotation markers), for the knowledge-compilation surface (DOT / NNF / stats). Throws CircuitException if token's root carries no inversion-free certificate. Defined in probability_evaluate.cpp.
Definition at line 755 of file probability_evaluate.cpp.


| 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.
Variant of getBooleanCircuit() that reuses an existing GenericCircuit (typically obtained via getGenericCircuit()) and additionally exposes the GenericCircuit-to- mapping, so that callers can translate input-side annotations (e.g., user-supplied leaf labels) from BooleanCircuit gategc to the constructed BooleanCircuit.
| gc | Source generic circuit (mutated through HAVING evaluation). |
| token | UUID of the root gate. |
| gate | Output: gate_t of the root within the returned circuit. |
| gc_to_bc | Output: mapping from gc input/mulinput gates to the corresponding gates in the returned BooleanCircuit. |
BooleanCircuit. Definition at line 79 of file CircuitFromMMap.cpp.


| BooleanCircuit getBooleanCircuit | ( | pg_uuid_t | token, |
| gate_t & | gate ) |
Build a BooleanCircuit from the mmap store rooted at token.
Performs a depth-first traversal of the persistent circuit starting at token, translating each gate_type to the corresponding BooleanGate and copying probabilities and info integers.
On return, gate is set to the gate_t identifier within the returned circuit that corresponds to token.
| token | UUID of the root gate. |
| gate | Output: gate_t of the root within the returned circuit. |
BooleanCircuit. Definition at line 125 of file CircuitFromMMap.cpp.

| GenericCircuit getGenericCircuit | ( | pg_uuid_t | token | ) |
Build a GenericCircuit from the mmap store rooted at token.
Equivalent to createGenericCircuit() declared in MMappedCircuit.h. Performs a depth-first traversal and copies all gate metadata (type, info1/info2, extra strings, probabilities) into the returned GenericCircuit.
| token | UUID of the root gate. |
GenericCircuit. Definition at line 172 of file CircuitFromMMap.cpp.


| GenericCircuit getJointCircuit | ( | pg_uuid_t | root_token, |
| pg_uuid_t | event_token, | ||
| gate_t & | root_gate, | ||
| gate_t & | event_gate ) |
Build a GenericCircuit containing the closures of two roots, with shared subgraphs unified.
Loads the union of every gate reachable from root_token and every gate reachable from event_token in a single in-memory GenericCircuit. Because GenericCircuit's UUID-to-gate mapping is idempotent, a gate_rv (or any other gate) reachable from both roots gets exactly one gate_t – the property the conditional MC sampler needs to couple the indicator's draw with the value's draw through Sampler's per-iteration cache.
The on-load simplification passes that getGenericCircuit runs (runRangeCheck and foldSemiringIdentities, gated by provsql.simplify_on_load) are applied to the joint circuit too. Both passes are in-place: gate types may change, but UUID-to-gate_t mappings stay valid, so callers can resolve their two roots via getGate after the call returns.
Output parameters root_gate and event_gate are the resolved gate_t for the two input UUIDs.
| root_token | First root UUID (e.g. an RV's gate). |
| event_token | Second root UUID (e.g. the conditioning gate). |
| root_gate | Output: gate_t for root_token in the returned circuit. |
| event_gate | Output: gate_t for event_token in the returned circuit. |
GenericCircuit. Definition at line 248 of file CircuitFromMMap.cpp.


| void propagateDNNFCertificate | ( | const GenericCircuit & | gc, |
| const std::unordered_map< gate_t, gate_t > & | gc_to_bc, | ||
| BooleanCircuit & | c ) |
Propagate the per-gate d-DNNF certificate from gc to c.
For every gate_plus / gate_times of gc carrying the DNNF_CERT_INFO mark whose BoolExpr image in c is an OR / AND gate (the zero/one shortcuts of GenericCircuit::evaluate may map a gate to a constant instead, in which case the mark is moot), set the mark on the image, so independentEvaluation() and interpretAsDD() can exploit determinism / decomposability. Requires gc_to_bc to cover internal gates, which GenericCircuit::evaluate guarantees (it memoises every visited gate).
| gc | Source generic circuit. |
| gc_to_bc | Gate mapping produced by the BoolExpr evaluation. |
| c | Target Boolean circuit. |
Definition at line 108 of file CircuitFromMMap.cpp.

