Backend: PostgreSQL + Apache AGE
Driver: psycopg2
Apache AGE is a PostgreSQL extension that adds graph database functionality, enabling you to run openCypher queries alongside traditional SQL. This backend lets Semantica use AGE as a property graph store with the same interface as Neo4j and FalkorDB.

Prerequisites

Apache AGE must be compiled and installed into your PostgreSQL instance. See the AGE installation guide.

Quick Start

Use GraphStore(backend="age", …): the same interface as Neo4j and FalkorDB:

Configuration

Environment Variables

Programmatic Configuration

Connection & Initialization

On connect(), the store performs idempotent setup: safe to call repeatedly:
1

Load the extension

CREATE EXTENSION IF NOT EXISTS age;
2

Activate AGE in the session

LOAD 'age';
3

Set the search path

SET search_path = ag_catalog, "$user", public;
4

Create the graph

Creates the named graph if it does not already exist.

ID Handling

Apache AGE auto-generates internal vertex/edge IDs (large integers). These are not the same as any semantic or application-level ID you may want to assign.
Never mix AGE internal IDs with semantic IDs. Use node["id"] for graph operations (delete, update, traverse) and node["properties"]["semantica_id"] for application-level lookups.

Label Handling

AGE supports exactly one label per vertex. Semantica handles this transparently:
  • labels[0] → used as the primary AGE vertex label.
  • labels[1:] → stored in a labels property array on the vertex.
When reading nodes, the store reconstructs the full label list automatically.

Cypher Query Execution

All Cypher queries are executed via AGE’s SQL wrapper:

Parameter Substitution

AGE does not support $param style binding inside cypher() calls. The store safely converts parameters to Cypher literals with proper escaping:

Column Specification

For custom queries, pass the cols option to specify the AS clause:
If omitted, the store attempts to infer columns from the RETURN clause.

Transactions

The store uses explicit PostgreSQL transactions:
  • SuccessCOMMIT
  • ExceptionROLLBACK, then re-raise as ProcessingError
  • No silent failures

API Reference

All methods match the standard Semantica graph store backend interface:

Docker Setup

Then connect: