A web-based interface for querying the SAWGraph knowledge graph — a PFAS contamination dataset linking water samples, industrial facilities, and hydrological features across the United States.
The app lets you ask spatial analysis questions in plain English:
"What water samples are downstream of [22 - Utilities] facilities in Ohio?"
It translates those questions into multi-step SPARQL pipelines, executes them against SAWGraph's knowledge graph endpoints, and renders the results on an interactive map.
- React 19 + TypeScript + Vite 7
- Zustand — application state
- React Query — filter dropdown data with
staleTime: Infinity - react-leaflet — map rendering
- S2 Level 13 cells — spatial bucketing for all geo queries
cd sawgraph-query-editor
npm install --legacy-peer-deps # react-leaflet has a peer dep mismatch with React 19
npm run devOther commands:
npm run build # TypeScript check + Vite build
npm run lint # ESLint
npm run preview # Preview production buildAn Analysis Question has three parts:
[Block A — target entity] [Relationship] [Block C — anchor entity]
water samples downstream facilities in Ohio
When you click Apply, the query engine:
- Plans the question (
engine/planner.ts) → array ofPipelineStep - Executes steps sequentially (
engine/executor.ts), threading S2 cell sets between steps - Renders results as map layers (
resultTransformer.ts→MapFeature[])
Supported entity types: samples, facilities, water bodies Supported relationships: near (~1–2 km), downstream, upstream
All hosted at frink.apps.renci.org:
| Endpoint | Used for |
|---|---|
sawgraph |
Sample data, substances |
fiokg |
Facility industry codes |
federation |
Facility spatial queries (kwg-ont:sfContains) |
spatialkg |
S2 cell lookups, region/county boundaries |
hydrologykg |
Upstream/downstream tracing |
| Dropdown | Data source |
|---|---|
| Industry (NAICS) | Live SPARQL → fiokg, fallback to hardcoded list |
| Substance | Live SPARQL → sawgraph, fallback to hardcoded list |
| Material type | Live SPARQL → sawgraph, fallback to hardcoded list |
| State | Static — all 50 states; 13 with SAWGraph data are selectable |
| County | Live SPARQL → spatialkg, fetched on state selection |
Inside docs/:
| File | Contents |
|---|---|
ARCHITECTURE.md |
System design, module boundaries, data flow |
SCHEMA.md |
Predicate inventories, class counts, endpoint roles |
DEBUGGING.md |
Documented bugs with root causes and fixes |
CONVENTIONS.md |
Coding standards, endpoint selection rules |
changelog/ |
Weekly changelogs (YYYY-Www.md) |
plans/ |
Feature planning: drafts/ → active/ → done/ |