Functions for visualizing and exporting provenance circuits in various formats.
More...
|
| TEXT | provsql.view_circuit (UUID token, REGCLASS token2desc, INT dbg=0) |
| | Return a DOT or TEXT visualization of the provenance circuit.
|
| TEXT | provsql.compile_to_ddnnf_dot (UUID token, TEXT compiler='') |
| | Return a DOT visualisation of the d-DNNF compiled from the provenance circuit.
|
| TEXT | provsql.compile_to_ddnnf (UUID token, TEXT compiler='') |
| | Return the compiled d-DNNF of a provenance circuit in the c2d / d4 ".nnf" TEXT interchange format.
|
| jsonb | provsql.ddnnf_stats (UUID token, TEXT compiler='') |
| | Structural statistics of the d-DNNF a compiler produces for a provenance circuit.
|
| TEXT | provsql.tseytin_cnf (UUID token, BOOLEAN weighted=TRUE, BOOLEAN mapping=TRUE) |
| | Return the DIMACS CNF (Tseytin transformation) of the provenance circuit.
|
| jsonb | provsql.tseytin_cnf_mapping_json (UUID token) |
| | Map each DIMACS variable of tseytin_cnf back to its provenance input.
|
| TABLE | provsql.tseytin_cnf_mapping (UUID token) |
| TEXT | provsql.tree_decomposition_dot (UUID token) |
| | Return a DOT visualisation of the tree decomposition of the provenance circuit.
|
| BOOLEAN | provsql.tool_available (TEXT name) |
| | Report whether an external tool is on the backend's resolved PATH.
|
| CREATE TABLE IF NOT EXISTS | provsql.tool_overrides (name TEXT PRIMARY KEY, removed BOOLEAN NOT NULL DEFAULT false, kind TEXT, executable TEXT, operations TEXT[], input_formats TEXT[], output_format TEXT, parser TEXT, preference INT, enabled BOOLEAN, dependencies TEXT[], argtpl TEXT, argtpl_circuit TEXT, endpoint TEXT) |
| | Persistent overrides overlaid on the compiled-in tool seed.
|
| TABLE | provsql.tool_registry_list () |
| | Set-returning listing backing the provsql.tools view.
|
| VOID | provsql.register_tool (TEXT name, TEXT executable=NULL, TEXT kind='cli', TEXT[] operations=NULL, TEXT[] input_formats=NULL, TEXT output_format=NULL, TEXT parser=NULL, TEXT argtpl=NULL, TEXT argtpl_circuit=NULL, INT preference=0, BOOLEAN enabled=true, TEXT endpoint=NULL) |
| | Register a tool, or replace the RECORD with the same logical name.
|
| VOID | provsql.unregister_tool (TEXT name) |
| | Unregister a tool; errors on an unknown tool name.
|
| VOID | provsql.set_tool_enabled (TEXT name, BOOLEAN enabled) |
| | Enable/disable a tool; errors on an unknown tool name.
|
| VOID | provsql.set_tool_preference (TEXT name, INT preference) |
| | Set a tool's preference; errors on an unknown tool name.
|
| TABLE | provsql._probability_benchmark_one (UUID in_token, TEXT in_method, TEXT in_args=NULL) |
| | Time a single probability_evaluate call and return one row.
|
| TABLE | provsql.probability_benchmark (UUID token, INT monte_carlo_samples=10000, TEXT weightmc_args='0.8;0.2') |
| | Time every probability-evaluation method on a single circuit token.
|
| TEXT | provsql.to_provxml (UUID token, REGCLASS token2desc=NULL) |
| | Return an XML representation of the provenance circuit.
|
| UUID | provsql.provenance () |
| | Return the provenance token of the current query result tuple.
|
| TEXT | provsql.where_provenance (UUID token) |
| | Compute where-provenance for a result tuple.
|
Functions for visualizing and exporting provenance circuits in various formats.
| jsonb provsql.ddnnf_stats |
( |
UUID | token, |
|
|
TEXT | compiler = '' ) |
Structural statistics of the d-DNNF a compiler produces for a provenance circuit.
Compiles the circuit with the given compiler / meta-route (same names as compile_to_ddnnf_dot: d4, d4v2, c2d, minic2d, dsharp, panini-*, tree-decomposition, interpret-as-dd, default) and returns a jsonb object: nodes, edges, and / or / not / inputs counts, smooth, depth (longest path), treewidth (null when not computable), and compile_ms. Lets clients compare what each compiler produces on the same circuit.
- Parameters
-
| token | root provenance token |
| compiler | compiler or in-process meta-route to use; empty (the default) picks the highest-preference available compiler |
- Source code
- provsql.sql line 3985
| TABLE provsql.probability_benchmark |
( |
UUID | token, |
|
|
INT | monte_carlo_samples = 10000, |
|
|
TEXT | weightmc_args = '0.8;0.2' ) |
Time every probability-evaluation method on a single circuit token.
Runs probability_evaluate against every method ProvSQL exposes: independent, possible-worlds, tree-decomposition, monte-carlo (with monte_carlo_samples samples), each of the four external compilers (d4 / c2d / minic2d / dsharp) via the compilation method, and weightmc with weightmc_args. Errors (uninstalled compiler, non-independent circuit, treewidth blowup, ...) are captured per row through the _probability_benchmark_one helper so the comparison table is always complete and the caller never has to surround the call with BEGIN / EXCEPTION.
- Parameters
-
| token | root provenance token |
| monte_carlo_samples | Monte-Carlo sample count |
| weightmc_args | epsilon;delta forwarded to weightmc |
- Source code
- provsql.sql line 4270
| REVOKE ALL ON FUNCTION provsql.register_tool |
( |
TEXT | name, |
|
|
TEXT | executable = NULL, |
|
|
TEXT | kind = 'cli', |
|
|
TEXT[] | operations = NULL, |
|
|
TEXT[] | input_formats = NULL, |
|
|
TEXT | output_format = NULL, |
|
|
TEXT | parser = NULL, |
|
|
TEXT | argtpl = NULL, |
|
|
TEXT | argtpl_circuit = NULL, |
|
|
INT | preference = 0, |
|
|
BOOLEAN | enabled = true, |
|
|
TEXT | endpoint = NULL ) |
Register a tool, or replace the RECORD with the same logical name.
The mutators guard at the C level too, but revoke from PUBLIC so the superuser requirement is visible in the catalog.
- Parameters
-
| name | logical id (e.g. 'd4-jm62300'); also the value provsql.fallback_compiler / the wmc tool selector use |
| executable | executable to resolve on PATH (defaults to name) |
| kind | 'cli' (spawn executable) or 'kcmcp' (talk to the KCMCP server at endpoint) |
| operations | capabilities (KCMCP names): 'compile' / 'wmc' (and ProvSQL-local 'render') |
| input_formats | accepted inputs (KCMCP names): 'dimacs-cnf', 'circuit-bcs12' (listing 'circuit-bcs12' enables the native-circuit fast path) |
| output_format | result encoding (KCMCP names): 'ddnnf-nnf', 'decimal', 'rational', ... (local 'panini-dd' / 'ascii' where KCMCP has no code) |
| parser | CLI-only decode tag: 'nnf' (the tolerant d4 / c2d NNF reader), 'panini-dd', 'wmc-line', 'weightmc', 'ascii' |
| argtpl | command template; placeholders {in} / {out} (and {binary} / {tmpdir} / {pivotAC}). When it omits {binary}, the executable is prepended. |
| argtpl_circuit | command used when the 'circuit-bcs12' input is selected (a BC-S1.2 circuit rather than a CNF); only a tool accepting that input needs it |
| preference | ordering within an operation (higher first) |
| enabled | whether the dispatchers may select it |
| endpoint | for a 'kcmcp' RECORD, the server address: 'unix:/path' or 'host:port' |
Superuser-only: a CLI RECORD runs an arbitrary command as the PostgreSQL OS user, and a kcmcp RECORD names a socket the server connects to.
- Source code
- provsql.sql line 4176
| BOOLEAN provsql.tool_available |
( |
TEXT | name | ) |
|
Report whether an external tool is on the backend's resolved PATH.
Uses the same find_external_tool() helper that the compilers (d4 / c2d / minic2d / dsharp / panini), model counters (ganak / sharpsat-td / dpmc via htb+dmc / weightmc), and visualisation wrappers (graph-easy, dot) themselves consult, so the result reflects exactly what a subsequent probability_evaluate or view_circuit call would see, including the provsql.tool_search_path GUC prepended to $PATH.
Names with a slash are treated as paths and tested directly via access(X_OK); bare names are resolved through /bin/sh's command -v under the backend's PATH.
- Parameters
-
| name | bare executable (e.g. 'd4') or an absolute path |
- Returns
- true iff the tool resolves to an executable file
- Source code
- provsql.sql line 4067