ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
view_circuit.cpp File Reference

SQL function provsql.view_circuit() – GraphViz DOT circuit visualisation. More...

#include "postgres.h"
#include "fmgr.h"
#include "catalog/pg_type.h"
#include "utils/uuid.h"
#include "executor/spi.h"
#include "provsql_shmem.h"
#include "provsql_utils.h"
#include "DotCircuit.h"
#include <csignal>
#include <utility>
#include <sstream>
#include <algorithm>
Include dependency graph for view_circuit.cpp:

Go to the source code of this file.

Functions

static vector< pair< int, int > > parse_array (string s)
 Parse a PostgreSQL text representation of an array of integer pairs.
 
static std::string view_circuit_internal (Datum token, Datum token2prob, Datum is_debug)
 Build a GraphViz DOT representation of the provenance circuit at token.
 
Datum view_circuit (PG_FUNCTION_ARGS)
 PostgreSQL-callable wrapper for view_circuit().
 

Detailed Description

SQL function provsql.view_circuit() – GraphViz DOT circuit visualisation.

Implements provsql.view_circuit(), which serialises the provenance circuit rooted at a given UUID token to a GraphViz DOT string using the DotCircuit class. The returned string can be rendered to an image with dot(1) or graph-easy(1).

An SPI query retrieves the optional provenance-mapping labels (human- readable identifiers for input gates) and attaches them to the DOT nodes before calling DotCircuit::render().

Definition in file view_circuit.cpp.

Function Documentation

◆ parse_array()

static vector< pair< int, int > > parse_array ( string  s)
static

Parse a PostgreSQL text representation of an array of integer pairs.

Parameters
sString in the form {{a,b},{c,d},...}.
Returns
Vector of (first, second) integer pairs.

Definition at line 40 of file view_circuit.cpp.

Here is the caller graph for this function:

◆ view_circuit()

Datum view_circuit ( PG_FUNCTION_ARGS  )

PostgreSQL-callable wrapper for view_circuit().

Definition at line 177 of file view_circuit.cpp.

Here is the call graph for this function:

◆ view_circuit_internal()

static std::string view_circuit_internal ( Datum  token,
Datum  token2prob,
Datum  is_debug 
)
static

Build a GraphViz DOT representation of the provenance circuit at token.

Parameters
tokenDatum containing the root provenance gate UUID.
token2probDatum with the OID of the probability mapping relation.
is_debugDatum boolean; if true, include debug information.
Returns
DOT string for the circuit.

Definition at line 75 of file view_circuit.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: