Semantica Polyglot Graph Storage: Neo4j, FalkorDB, and AGE Support Explained

Semantica supports three polyglot graph storage backends: Neo4j, FalkorDB, and AgensGraph (AGE), all accessed through a unified GraphStore interface.

The Semantica framework provides a flexible, backend-agnostic approach to graph data management. Rather than locking users into a single database, its architecture abstracts storage behind a common interface—enabling teams to choose the right engine for their workload or migrate between systems without rewriting application logic.

What Is Polyglot Graph Storage in Semantica?

Polyglot persistence in Semantica means one codebase can target multiple graph databases with identical high-level APIs. The GraphStore façade class in semantica/graph_store/graph_store.py exposes methods like create_node, create_relationship, and execute_query. Concrete implementations translate these calls into backend-specific protocols.

This design pattern appears throughout the codebase:

  • Neo4jStore wraps the official Bolt driver for Cypher-native operations
  • FalkorDBStore interfaces with Redis-backed OpenCypher queries
  • AGEStore bridges PostgreSQL's AgensGraph extension

Supported Graph Storage Backends

Neo4j: Enterprise Property-Graph with GDS

The Neo4j backend delivers full property-graph capabilities with native Cypher support, ACID transactions, and integrated Graph Data Science (GDS) algorithms.

Implementation lives in semantica/graph_store/neo4j_store.py. This store handles:

  • Bolt protocol connections
  • Cypher query execution
  • Transaction batching
  • GDS procedure calls
from semantica.graph_store import GraphStore

neo4j_store = GraphStore(
    backend="neo4j",
    uri="bolt://localhost:7687",
    user="neo4j",
    password="secret"
)

neo4j_store.create_node(
    labels=["Person"],
    properties={"name": "Alice", "role": "engineer"}
)

FalkorDB: High-Performance Redis-Based Graph

FalkorDB provides ultra-fast property-graph operations built on Redis. It uses OpenCypher syntax and leverages sparse-matrix representations for analytical queries.

The FalkorDBStore class in semantica/graph_store/falkordb_store.py implements this backend, optimized for:

  • In-memory speed with Redis persistence options
  • Vector similarity search alongside graph traversals
  • Horizontal scaling via Redis Cluster
falkordb_store = GraphStore(
    backend="falkordb",
    host="localhost",
    port=6379,
    graph_name="demo"
)

falkordb_store.create_node(
    labels=["Device"],
    properties={"id": "sensor-01", "status": "active"}
)

AgensGraph (AGE): PostgreSQL Native Graph Extension

AgensGraph (Apache AGE) extends PostgreSQL with property-graph features, enabling hybrid relational-graph workloads within a mature RDBMS.

The AGEStore implementation in semantica/graph_store/age_store.py connects through standard PostgreSQL drivers:

age_store = GraphStore(
    backend="age",
    host="localhost",
    port=5432,
    user="age_user",
    password="age_pass",
    database="graphdb"
)

age_store.create_node(
    labels=["City"],
    properties={"name": "Paris", "country": "France"}
)

How the Unified Interface Works

All three backends expose identical methods through the GraphStore constructor. The backend parameter determines which concrete class instantiates:

Parameter Module Loaded Typical Use Case
"neo4j" Neo4jStore Complex analytics, enterprise deployments
"falkordb" FalkorDBStore High-throughput, real-time applications
"age" AGEStore Existing PostgreSQL infrastructure, hybrid data

Method calls dispatch to backend-specific implementations while maintaining consistent return types and exception handling.

Key Implementation Files

Understanding the source structure helps extend or debug polyglot operations:

Summary

  • Semantica's polyglot graph storage supports Neo4j, FalkorDB, and AgensGraph (AGE) through a unified API
  • The GraphStore façade in graph_store.py enables backend-agnostic application code
  • All backends implement identical methods: create_node, create_relationship, execute_query
  • Switching storage requires only changing the backend parameter and connection credentials
  • Source implementations reside in dedicated modules under semantica/graph_store/

Frequently Asked Questions

Can I use multiple graph backends simultaneously in one Semantica application?

Yes. Instantiate separate GraphStore objects with different backend values. Each maintains independent connections, allowing reads from FalkorDB for speed and writes to Neo4j for persistence, or similar hybrid patterns.

Does Semantica support schema migration tools across these backends?

The unified interface handles CRUD operations consistently, but schema-specific features (indexes, constraints) require backend-native commands through execute_query. No automatic cross-backend migration tool ships with the core framework.

What performance differences should I expect between these polyglot options?

FalkorDB excels at high-velocity ingestion and simple traversals in memory. Neo4j optimizes for complex analytical queries with GDS integration. AgensGraph performs best when graph data must coexist with relational tables, avoiding ETL overhead.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →