Case Studies: Overview
The tutorial is the gentle first contact with ProvSQL: it walks through the core workflow – add provenance to a table, run a query, evaluate the result in a semiring – on a single small example. The case studies that follow are longer, self-contained worked examples, each built around a realistic dataset and centred on a different facet of the system. They go well beyond the tutorial in both the breadth of SQL they exercise and the depth to which they push a particular capability.
Each case study is independent: most ship a single self-contained
setup.sql to download and load; case study 3 instead gives
instructions for fetching the large Île-de-France GTFS dataset (not
bundled, due to its size), and case study 4 loads bundled data files
from the source tree under doc/casestudy4/data/. Each states its
scenario and tasks up front and can be read on its own. Read the one whose theme
matches what you want to learn; the coverage matrix at the end of this page is the quickest way to
find which study demonstrates a given feature.
Tip
No install required. Every case study here except case study 3 (whose
GTFS dataset is too large to bundle) runs in the ProvSQL Playground, the browser build of ProvSQL Studio,
on a ready-made database – and all but case studies 3 and 4 also ship as
runnable notebooks; each chapter links
straight to what it has. The Playground bundles no external tools, so
steps that explicitly call an external knowledge compiler (d4,
c2d…) or graph-easy do not run there, but the built-in methods
and everything else do. See the Playground note.
What each case study covers
- Case study 1 – Intelligence Agency
The broadest tour of provenance evaluation: a security-classification scenario over seven agents drives a custom min-clearance semiring, where-provenance, circuit export, and the full probability-method line-up side by side (possible-worlds, Monte-Carlo, tree-decomposition, and knowledge compilation through
d4/c2d/dsharp/minic2d). Start here for a panoramic view.- Case study 2 – Open Science Database
Evidence synthesis over a fictional biomedical corpus – single-source vs. replicated claims, contradictions, strength-of-evidence ranking. The home of Shapley and Banzhaf values, attributing a result to the studies behind it.
- Case study 3 – Île-de-France Public Transit
Boolean provenance at real-world scale. On the STIF GTFS dataset (hundreds of routes, tens of thousands of stops) a result token is true iff every record along the path carries the accessibility flag – which stops are reachable from Bagneux by a fully wheelchair-accessible journey?
- Case study 4 – Government Ministers Over Time
The temporal extension and data-modification tracking. Over French and Singaporean ministers every fact carries a validity interval; the study time-travels, takes history and timeslices, and rolls back an
INSERT/DELETEround-trip withundo.- Case study 5 – Wildlife Photo Archive
Uncertainty from a machine-learning detector: block-correlated alternatives via
repair_keyand themulinputgate, with candidate species per bounding box. It contrasts probabilistic ranking against naive confidence thresholding and computes expected species counts withexpected.- Case study 6 – City Air-Quality Sensor Network
The continuous-distribution surface end to end:
random_variablecolumns (Normal / Uniform / Exponential / Erlang / categorical / mixture), arithmetic and comparison on them, analytic moments with Monte-Carlo fallback, and conditional inference. The first study driven primarily through ProvSQL Studio.- Case study 7 – Peer-Review Assignment and Knowledge Compilation
How a query’s shape, the schema’s keys, and the structure of the data decide which probability method is cheap and which needs a compiler. A peer-reviewing scenario organised by where tractability comes from: the query is safe (the four Dalvi-Suciu routes, including the Möbius-cancellation witness
), the query is
-hard (the knowledge-compilation pipeline), or the data is well-structured (the joint-width compiler and recursive network reliability).
- Case study 8 – ProvSQL as a Probability Calculator
ProvSQL as an exact, correlation-aware probability calculator driven in SQL: five textbook problems – base-rate fallacy, correlation breaking the independence formula, the method portfolio and its cost chooser, a continuous posterior by truncation, the conditional expectation of an aggregate – each a one-line query with the
|(“given”) operator throughout. A compact, notebook-first tour of the probability surface.
Feature coverage matrix
The tables below cross-reference every user-facing feature documented under the User Guide against the tutorial and the eight case studies.
Columns:
T – Tutorial (Who Killed Daphine?)
1 – Case study 1 (Intelligence Agency)
2 – Case study 2 (Open Science Database)
3 – Case study 3 (Île-de-France Public Transit)
4 – Case study 4 (Government Ministers Over Time)
5 – Case study 5 (Wildlife Photo Archive)
6 – Case study 6 (City Air-Quality Sensor Network)
7 – Case study 7 (Peer-Review Assignment and Knowledge Compilation)
8 – Case study 8 (ProvSQL as a Probability Calculator)
Cells: ✓ the feature is exercised; (✓) it is mentioned in
passing but not actually executed; empty means it is not covered.
Setup and basics
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
✓ |
||||||||
|
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
✓ |
✓ |
✓ |
✓ |
✓ |
||||
|
✓ |
||||||||
Hand-built mapping table |
✓ |
||||||||
|
(✓) |
||||||||
|
|||||||||
|
Supported SQL constructs
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
SELECT-FROM-WHERE / inner JOIN |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
Self-join |
✓ |
✓ |
✓ |
✓ |
✓ |
||||
Subqueries in FROM / nested |
✓ |
✓ |
✓ |
||||||
GROUP BY |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|
SELECT DISTINCT |
✓ |
✓ |
✓ |
✓ |
✓ |
||||
EXCEPT (monus) |
✓ |
✓ |
✓ |
||||||
UNION / UNION ALL |
✓ |
✓ |
|||||||
HAVING |
✓ |
✓ |
✓ |
||||||
VALUES |
✓ |
✓ |
|||||||
CTE (WITH) |
✓ |
✓ |
✓ |
||||||
WITH RECURSIVE |
✓ |
||||||||
LATERAL |
✓ |
||||||||
Window functions |
|||||||||
FILTER clause on aggregates |
|||||||||
CREATE TABLE AS SELECT |
✓ |
✓ |
✓ |
✓ |
✓ |
||||
Provenance-bearing VIEW |
✓ |
✓ |
|||||||
INSERT … SELECT (provenance propagation) |
Aggregation
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
COUNT / SUM / MIN / MAX / AVG |
✓ |
✓ |
✓ |
✓ |
✓ |
||||
|
✓ |
||||||||
|
|||||||||
|
|||||||||
Arithmetic / cast on aggregate result |
✓ |
||||||||
Provenance-preserving |
|||||||||
|
|||||||||
|
|||||||||
|
Circuit inspection
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
✓ |
|||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
✓ |
|||||||
|
(✓) |
✓ |
Knowledge compilation and safe queries
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
||||||||
|
✓ |
||||||||
Bounded-treewidth network reliability (recursive reachability) |
✓ |
||||||||
|
✓ |
||||||||
Safe-query rewriter (hierarchical / read-once) |
✓ |
||||||||
Joint-width UCQ compiler (bounded joint treewidth) |
✓ |
||||||||
Möbius-inversion route (safe-by-cancellation UCQ) |
✓ |
||||||||
Tseytin CNF export (DIMACS) |
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
Inversion-free certificate ( |
✓ |
||||||||
External-tool registry ( |
(✓) |
||||||||
|
|||||||||
|
|||||||||
|
Semiring evaluation
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
||||||||
|
✓ |
✓ |
|||||||
|
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|||
|
✓ |
✓ |
|||||||
|
✓ |
(✓) |
|||||||
|
(✓) |
||||||||
|
|||||||||
|
|||||||||
|
|||||||||
|
|||||||||
|
✓ |
||||||||
|
✓ |
||||||||
Custom semiring via |
✓ |
||||||||
|
Probabilities
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
|||
|
✓ |
✓ |
|||||||
|
✓ |
✓ |
✓ |
✓ |
✓ |
||||
Conditioning operator |
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
✓ |
✓ |
||||||
|
✓ |
✓ |
✓ |
||||||
|
(✓) |
✓ |
✓ |
✓ |
✓ |
||||
|
(✓) |
✓ |
✓ |
✓ |
✓ |
||||
|
(✓) |
✓ |
✓ |
||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
|||||||||
|
|||||||||
|
|||||||||
|
|||||||||
Guarantee request ( |
|||||||||
|
|||||||||
Studio benchmark panel |
✓ |
||||||||
|
✓ |
✓ |
✓ |
||||||
|
✓ |
✓ |
✓ |
||||||
|
✓ |
||||||||
|
✓ |
✓ |
|||||||
|
✓ |
Continuous random variables
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
✓ |
|||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
Arithmetic on |
✓ |
||||||||
Comparison |
✓ |
✓ |
|||||||
|
✓ |
✓ |
|||||||
|
✓ |
✓ |
|||||||
|
✓ |
✓ |
|||||||
Conditional inference via |
✓ |
(✓) |
|||||||
|
✓ |
||||||||
|
✓ |
Shapley and Banzhaf values
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
Where-provenance
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
✓ |
|||||||
|
✓ |
✓ |
Data-modification tracking
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
||||||||
INSERT / UPDATE / DELETE tracked |
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
Temporal features
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
✓ |
||||||||
|
Export and visualisation
Feature |
T |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|---|---|---|---|---|---|---|---|---|---|
|
✓ |
||||||||
|
✓ |
||||||||
|
(✓) |
||||||||
ProvSQL Studio (Circuit mode + Where mode) |
✓ |
✓ |
|||||||
ProvSQL Studio (Contributions mode) |
✓ |