SutraDB

A lean RDF-star triplestore with native HNSW vector indexing. Graph traversal and vector similarity in a single SPARQL query.

Written in Rust Apache 2.0 Superset of W3C Standards Developer Preview
Download Latest View on GitHub

AI Agent?

SutraDB is serverless by default, like SQLite. Just open a .sdb file — no server needed. Install, configure, and query entirely from the command line.

Agent Setup Guide

Why SutraDB?

🔗 Vectors Are Triples

Vector embeddings are stored as RDF triples and indexed by HNSW. Not a sidecar — a first-class part of the graph. One query language for both.

🔍 Hybrid SPARQL

VECTOR_SIMILAR and VECTOR_SCORE extend standard SPARQL. Traverse the graph, jump into vector space, come back — all in one query.

📦 Serverless by Default

Like SQLite for graph+vector data. Open a .sdb file, query it. No daemon, no config. Server mode is opt-in when you need HTTP access.

RDF-star Native

Triples about triples, natively. Annotate edges with confidence scores, embeddings, provenance — no reification hacks.

Lean & Fast

SPO/POS/OSP indexes on interned u64 IDs. HNSW with cosine/euclidean/dot product. No bloat, no ORMs, no magic.

🌐 Standards Compatible

A superset of RDF 1.2 and SPARQL 1.1. Any valid standard query works. Extensions add what the standards can't express.

A Superset, Not a Fork

Everything the W3C standards do, plus what they can't.

Data Model

RDF 1.2: triple terms in object position only

+ SutraDB: triple terms in any position (RDF-star)

+ Native vector literals (sutra:f32vec)

+ HNSW index per vector predicate

Query Language

SPARQL 1.1: SELECT, FILTER, OPTIONAL, UNION...

+ VECTOR_SIMILAR() — ANN search in graph patterns

+ VECTOR_SCORE() — similarity ranking in ORDER BY

+ ef:= and k:= query hints for HNSW tuning

Graph + Vector in One Query

Find academic papers similar to a query vector that cite papers by a specific author:

PREFIX ex: <http://example.org/>

SELECT ?paper ?title WHERE {
  # Jump into vector space: find similar papers
  VECTOR_SIMILAR(?paper ex:hasEmbedding
    "0.23 -0.11 0.87 ..."^^sutra:f32vec, 0.85)

  # Back to graph: filter by citation chain
  ?paper ex:cites ?cited .
  ?cited ex:author <http://example.org/Vaswani> .
  ?paper ex:title ?title .
} ORDER BY DESC(VECTOR_SCORE(?paper ex:hasEmbedding
    "0.23 -0.11 0.87 ..."^^sutra:f32vec))
LIMIT 10

Get SutraDB

SutraDB is in Developer Preview. Download the latest build or compile from source.

Windows

x86_64

Download .zip

macOS

Apple Silicon (ARM64)

Download .tar.gz

macOS

Intel (x64)

Download .tar.gz

Linux

x86_64

Download .tar.gz

From Source

Any platform with Rust

cargo install --git https://github.com/EmmaLeonhart/SutraDB sutra-cli

File format: .sdb — a superset of RDF containing triples + HNSW vector indexes.
Query directly (no server needed): sutra query "SELECT * WHERE { ?s ?p ?o } LIMIT 10"  |  Optional server: sutra serve --port 3030

Need replication, clustering, or multi-tenant deployments? Ask about RamaDB for larger installations.