Skip to content
mobr-aiPublic

About

A C++20 ETL pipeline that replays Solana ledger data directly, maps the observed stream into the SAP Solana ontology, and exports the resulting knowledge graph as sharded Turtle (.ttl) files or loads it into QLever through SPARQL Update.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAP ETL - Solana Analytics Platform ETL Pipeline

Solana Analytics Platform Powered by Grounded AI
Semantic Knowledge Graph • Natural Language Analytics • Explainable Insights • Interactive Dashboards

sap-etl is the ETL pipeline for the Solana Analytics Platform.

It is a C++20 pipeline that converts native Jetstreamer local output into RDF aligned with MOBR's Solana ontology and either:

  • writes Turtle (.ttl) files, or
  • sends batched SPARQL INSERT DATA updates to a QLever endpoint.

This repository provides the ingestion, transformation, RDF mapping, loading, checkpointing, and resume logic used to prepare Solana ledger-derived data for SAP's semantic knowledge graph infrastructure.


Related Repositories

The SAP backend repository contains the API, orchestration layer, semantic query integration, authentication flows, and knowledge graph services that consume the outputs produced by this ETL pipeline.

The SAP frontend repository contains the React/Vite SPA used for the user-facing analytics interface, dashboards, onboarding, wallet flows, and product experience.

Together, the repositories form the core SAP stack:

Solana data sources
        │
        ▼
sap-etl
        │
        ▼
Ontology-aligned semantic outputs
        │
        ▼
sap backend + QLever / knowledge graph services
        │
        ▼
sap-frontend

Scope and reality constraints

This project is designed for Jetstreamer’s outputs.

Jetstreamer currently provides:

  • historical replay by slot range or single epoch

  • built-in ClickHouse-backed plugins including:

    • program-tracking
    • instruction-tracking
    • pubkey-stats
  • a ClickHouse-backed server

Accordingly, sap-etl consumes local ClickHouse tables created by Jetstreamer over the ClickHouse HTTP interface. It does not parse internal ClickHouse data files directly, and it does not require any new Jetstreamer plugin.


What sap-etl maps today

Because the built-in plugin outputs are aggregated tables, the RDF generated by sap-etl is limited to concepts that can be mapped from the available data. Currently the loader maps:

  • program_invocations
  • slot_instructions
  • jetstreamer_slot_status when present

This means the current implementation emits RDF for:

  • so:Slot
  • so:Block
  • so:Program
  • selected telemetry-style ledger events grounded in native Jetstreamer aggregates

The codebase is structured so that future source adapters can add richer mappings when new native data sources become available.


Features

  • clean C++20 codebase with separation of concerns
  • source / transform / load layering
  • native ClickHouse-over-HTTP Jetstreamer source adapter
  • TTL output with automatic file rotation
  • QLever SPARQL update loading
  • slot-range chunking
  • checkpoint files for resume support
  • parallel transformation with thread-local triple buffering
  • tests with CTest
  • no shell scripts required
  • integration path for the SAP backend knowledge graph layer
  • ontology-aligned outputs for grounded AI analytics workflows

Repository layout

  • src/config - CLI parsing and runtime configuration
  • src/source - source adapters
  • src/clickhouse - ClickHouse HTTP access
  • src/transform - ontology mapping
  • src/load - TTL and QLever loaders
  • src/checkpoint - checkpoint persistence
  • src/model - shared domain types and slot/epoch selection logic
  • tests - unit tests

Build prerequisites for sap-etl

Linux

Install:

  • C++20 compiler (g++ 12+ or clang++ 15+)
  • CMake 3.24+
  • libcurl development package

Example on Ubuntu / Debian:

sudo apt update
sudo apt install -y build-essential cmake pkg-config libcurl4-openssl-dev

Clone sap-etl from the Git repository:

git clone https://github.com/mobr-ai/sap-etl.git
cd sap-etl

Build

cmake -S . -B build
cmake --build build -j

Run tests

ctest --test-dir build --output-on-failure

Installing and running Jetstreamer

sap-etl expects Jetstreamer-generated local data to already exist.

1. Get Jetstreamer

Clone Jetstreamer from:

git clone https://github.com/anza-xyz/jetstreamer.git

2. Jetstreamer prerequisites

Jetstreamer documents the following setup characteristics that matter here:

  • Rust toolchain / Cargo
  • Clang 16 rather than 17 for RocksDB-related builds
  • local ClickHouse helper support in the workspace

On Ubuntu / Debian, Jetstreamer documents installation using Clang 16 and supporting packages.

3. Build Jetstreamer

Inside the Jetstreamer repository:

cargo build --release

4. Run Jetstreamer for slots or epochs

Jetstreamer’s runner accepts either:

  • a single epoch
  • or a slot range written as <start>:<end>

Examples:

Epoch 900:

cargo run --release -- 900

Slots from 388908000 to 388916000:

cargo run --release -- 388908000:388916000

To enable the built-in native plugins that produce the local tables consumed by sap-etl, use:

cargo run --release -- 900 --with-plugin instruction-tracking --with-plugin program-tracking

Or for slot ranges:

cargo run --release -- 388908000:388916000 --with-plugin instruction-tracking --with-plugin program-tracking

5. Serve ClickHouse

cargo clickhouse-server

How sap-etl reads Jetstreamer data

sap-etl connects to ClickHouse over HTTP, typically:

http://127.0.0.1:8123

It reads native Jetstreamer tables and transforms the rows into RDF.

The generated RDF is intended to support the broader SAP knowledge graph and semantic analytics workflow, where the main sap backend can query indexed data through QLever or related semantic infrastructure.


Usage

TTL output

TTL is the default output mode. To make it explicit:

./build/sap-etl \
  --load-type ttl \
  --scope slots \
  --slots 388908000-388916000

Slot mode default

./build/sap-etl \
  --scope slots \
  --slots 388908000-388916000 \
  --clickhouse-url http://127.0.0.1:8123 \
  --clickhouse-database default \
  --output-dir ./out \
  --output-prefix sap-solana

QLever output

./build/sap-etl \
  --load-type qlever \
  --scope slots \
  --slots 388908000-388916000 \
  --qlever-update-url http://127.0.0.1:7001

Epoch mode

Slot mode is the default. Epoch mode is also supported, but because sap-etl is an external C++ process and not embedded in Solana runtime code, the epoch-to-slot conversion is driven by an explicit epoch schedule passed on the command line.

Example:

./build/sap-etl \
  --scope epochs \
  --epochs 800,801 \
  --slots-per-epoch 432000 \
  --first-normal-epoch 8 \
  --first-normal-slot 8160 \
  --warmup true \
  --clickhouse-url http://127.0.0.1:8123 \
  --output-dir ./out

Use the correct schedule for the ledger you replayed.


Current options

  • --load-type ttl|qlever
  • --scope slots|epochs
  • --slots 1-10,20,30-40
  • --epochs 800,801
  • --clickhouse-url http://127.0.0.1:8123
  • --clickhouse-database default
  • --output-dir ./out
  • --output-prefix sap-etl
  • --checkpoint-dir ./checkpoints
  • --ttl-max-size 50GiB
  • --source-chunk-slots 10000
  • --loader-batch-triples 20000
  • --worker-threads 8
  • --resume true
  • --overwrite false

TTL rotation

Each TTL output file is capped by --ttl-max-size.

The default limit is 50 GiB.

If the output grows past the limit, sap-etl automatically starts the next file:

  • sap-etl-0.ttl
  • sap-etl-1.ttl
  • sap-etl-2.ttl

and so on.


Checkpoint and resume

Checkpoints are written under --checkpoint-dir.

The current implementation stores the last fully completed slot chunk so interrupted runs can continue from the last durable boundary.

If you want a fresh run:

./build/sap-etl ... --resume false --overwrite true

QLever notes

The QLever loader sends batches as SPARQL INSERT DATA updates over HTTP.

You are expected to point --qlever-update-url at a QLever endpoint that accepts SPARQL updates.

Example:

./build/sap-etl \
  --load-type qlever \
  --scope slots \
  --slots 388908000-388916000 \
  --qlever-update-url http://127.0.0.1:7001

In the broader SAP stack, QLever acts as the semantic query layer that can be used by the sap backend to support ontology-backed analytics and grounded AI workflows.


Extending the project

The design is ready for future native sources:

  • add a new source adapter by implementing JetstreamerSource
  • add richer ontology mapping in OntologyMapper
  • keep the existing loaders unchanged

This preserves separation of concerns and avoids code duplication.

Future extensions should continue to keep sap-etl focused on deterministic data ingestion and ontology-aligned transformation, while leaving API orchestration, user-facing flows, authentication, and product logic to the main sap and sap-frontend repositories.


License

Licensed under the GNU GPLv3.

You may use, modify, and distribute the software under the same license.

About

A C++20 ETL pipeline that replays Solana ledger data directly, maps the observed stream into the SAP Solana ontology, and exports the resulting knowledge graph as sharded Turtle (.ttl) files or loads it into QLever through SPARQL Update.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages