Storage Backends

SemanticSpacetime.jl supports three categories of storage backend:

MemoryStore

An in-memory graph store with no external dependencies. Data lives only in the Julia process and is lost when the session ends.

store = MemoryStore()
n1 = mem_vertex!(store, "concept A", "chapter1")
n2 = mem_vertex!(store, "concept B", "chapter1")
mem_edge!(store, n1, "leadsto", n2)

Key functions: mem_vertex!, mem_edge!, mem_get_node, mem_search_text, node_count, link_count.

DBStore (SQLite, DuckDB)

A portable SQL store that works with any DBInterface.jl-compatible database. SQLite and DuckDB are supported via package extensions — load the backend package to activate the extension.

using SemanticSpacetime, SQLite
store = open_sqlite("my_graph.db")

# Use the same API as MemoryStore
db_vertex!(store, "concept A", "chapter1")

Key functions: open_sqlite, open_duckdb, close_db, db_vertex!, db_edge!, db_get_node, db_search_nodes.

Schema

DBStore automatically creates the required tables on first use via create_db_schema!. The schema stores nodes, links, arrows, contexts, and page map events in normalized relational tables.

Arrow and Context Persistence

Arrows and contexts can be uploaded to the database for persistence and shared across sessions:

db_upload_arrows!(store)    # save current arrow directory
db_load_arrows!(store)      # restore from database
db_upload_contexts!(store)  # save context directory
db_load_contexts!(store)    # restore from database

SSTConnection (PostgreSQL)

The original PostgreSQL backend using LibPQ.jl. This is suitable for large-scale, multi-user deployments. It uses PostgreSQL-specific features including array columns and full-text search via tsvector.

sst = open_sst(; host="localhost", port=5432)
configure!(sst)  # create schema and load arrows/contexts

Key functions: open_sst, close_sst, configure!, vertex!, edge!, graph_to_db!.

Choosing a Backend

BackendBest forPersistenceDependencies
MemoryStoreTesting, scripting, small graphsNone (in-process)None
DBStore + SQLiteSingle-user, file-based, portableFileSQLite.jl
DBStore + DuckDBAnalytics, columnar workloadsFileDuckDB.jl
SSTConnectionMulti-user, large-scaleServerLibPQ.jl + PostgreSQL