Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,155 of 9,155 pages
About the help in other languages
All help pages

Graph databases: Neo4j, Amazon Neptune, ArangoDB, SurrealDB

This page is for administrators whose organisation keeps data in a graph or multi-model database and wants that data in Exponential, or wants a data table of Exponential kept there, and for developers who work on the…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/features/6.0/graph-databases.md

On this page

Graph databases: Neo4j, Amazon Neptune, ArangoDB, SurrealDB

This page is for administrators whose organisation keeps data in a graph or multi-model database and wants that data in Exponential, or wants a data table of Exponential kept there, and for developers who work on the drivers. From Exponential 6.0.15 the kernel has one driver per database, expNeo4jDB, expNeptuneDB, expArangoDBDB and expSurrealDBDB in lib/ezdb/classes/, and the import commands exp:neo4j:import, exp:neptune:import, exp:arangodb:import and exp:surrealdb:import.

LevelNeo4jAmazon NeptuneArangoDBSurrealDB
(a) The site's databaseNoNoNoNo (see SurrealQL)
(b) A data table connectionYesYes, not testedYesYes
(c) An import sourceYesYes, not testedYesYes

Amazon Neptune is a service of AWS only; there is no local server of it to test against, so the Neptune driver is written against Neptune's documented openCypher endpoint and marked not tested (expDataConnections::engines() reports it as untested). Its Cypher is the same the Neo4j driver runs and is tested.

Contents

  1. Requirements
  2. A data table connection
  3. Importing a graph
  4. Settings
  5. How the SQL is answered
  6. How a graph becomes tables
  7. What works and what does not
  8. SurrealQL and a site database
  9. How it is built
  10. Tests

Requirements

WhatWhere it comes from
Neo4j 5 or later (Community or Enterprise)Its HTTP API on port 7474 (7473 with TLS); Bolt is not needed
Amazon Neptune (engine 1.2 or later)Its openCypher HTTPS endpoint on port 8182, without IAM database authentication or behind a proxy that signs the requests
ArangoDB 3.11 or laterIts HTTP API on port 8529
SurrealDB 2 or laterIts HTTP endpoint /sql on port 8000
PHP 8.0 or later with curl and sqlite3In every PHP build Exponential runs on; no library and no extension of the databases' own

Why HTTP and not Bolt. Each of the four has an HTTP interface that carries its full query language. Bolt, Neo4j's binary protocol, would need a PHP library; the HTTP API runs the same Cypher in the same transactions.

A data table connection

In the administration, Setup > Data tables > Connections, or in settings/datatable.ini:

[Connection_graph]
Engine=neo4j
Server=graph1.example.com
Port=7474
Database=neo4j
User=exponential
# the name of a secret of the kernel's store (Setup > Secrets), never the password itself
Secret=graph_password

The engines are neo4j, neptune, arangodb and surrealdb. The options of a connection are ssl and ssl_ca, and for SurrealDB namespace. What the database is:

EngineDatabase
neo4jA Neo4j database (Community has the one named neo4j; Enterprise makes others with AutoCreateDatabase)
neptuneA name the rows carry (exp_db): a Neptune cluster holds one graph, so several connections can share it
arangodbAn ArangoDB database; each table is a collection of the same name
surrealdbA SurrealDB database in the namespace of the option namespace (default exp)

A persistent class names the connection in its definition ('connection' => 'graph') and reads and writes there; the data table layer makes its tables, as for any other connection.

Importing a graph

./console exp:neo4j:import --source=graph --list
./console exp:neo4j:import --server=graph1 --database=neo4j --user=reader --secret=env:NEO4J_PASSWORD
./console exp:arangodb:import --source=catalogue --tables=person,knows --prefix=g_ --apply
./console exp:surrealdb:import --server=surreal1 --namespace=shop --database=main --user=root --secret=env:SURREAL_PASSWORD --apply
./console exp:neptune:import --server=https://my-cluster.cluster-xyz.eu-west-1.neptune.amazonaws.com --database=shop --list

Without --apply a command shows the tables it would make and does nothing. --connection=<identifier> imports into a data table connection instead of the site's database; --mode=create|append|replace, --tables, --prefix, --sample and --format=json work as for exp:couchbase:import. The exit code is 0 when done (or planned), 1 when a table or row failed and 2 for wrong options or no connection.

Settings

Each database has a group in site.ini: [Neo4jSettings], [NeptuneSettings], [ArangoDBSettings], [SurrealDBSettings]. They have the names of [CouchDBSettings]:

SettingDefaultWhat it does
TLS, TLSCAFile, TLSVerifyPeerdisabled (Neptune: enabled), empty, enabledHTTPS to the server; a server written https://host:port turns it on
ConnectTimeout, RequestTimeout5, 60Seconds
AutoCreateDatabasedisabledMake the database when it is missing (Neo4j: Enterprise only)
ScanLimit100000The most rows a statement may read; more is refused, never answered from a part
BatchSize1000Rows read or written per request
JournalLimit10000Writes of a transaction a rollback can undo
Namespace (SurrealDB only)expThe namespace of the databases

How the SQL is answered

None of the four answers SQL. The drivers answer it as the CouchDB driver does (see the CouchDB driver page): a statement reads the rows it needs into an in-memory SQLite database and runs there, so its answer is SQLite's (joins, GROUP BY, sub-selects, functions); the rows it changes are written back, each with the revision it was read at. What is sent to the database itself:

Neo4j, Neptune (Cypher)ArangoDB (AQL)SurrealDB (SurrealQL)
A rowA node labelled ExpDoc and its tableA document of the table's collectionA record table:⟨key⟩
By keyUNWIND $ids ... MATCH (n:ExpDoc) WHERE n._id = iFILTER d._key IN @keysSELECT * FROM t:⟨1⟩, t:⟨2⟩
col = literalMATCH (n:ExpDoc:item) WHERE n.name = $c0FILTER d[@f0] == @v0WHERE name = "pear"
A changeMATCH ... WHERE n._rev = $rev SET n = $pFILTER d.exp_rev == o.rev REPLACE dUPDATE ... WHERE exp_rev = "..."
A new rowOPTIONAL MATCH ... WHERE x IS NULL CREATE (unique constraint on ExpDoc._id)INSERT (unique _key)CREATE (a record that exists is an error)

A change whose revision is no longer the row's is a conflict, and the statement fails rather than overwriting another writer's change. The tables' definitions are rows of exp_couchdb_schema, the counters of new ids rows of exp_couchdb_sequence, as in CouchDB. In SurrealDB a column named id is kept as exp_col_id (the record's own id).

How a graph becomes tables

The imports read a graph as it is, not only what the drivers wrote:

SourceTableColumns
A node label (Neo4j, Neptune), a document collection (ArangoDB), a table (SurrealDB)The name in lower casedoc_id (the node's own id: elementId(), id(), _id, the record id), the properties
A relationship type, an edge collection, a relation tableThe name, or rel_<name> when a node table has itdoc_id, from_id, to_id (the ids of the two ends), the properties

The columns and their types come from a sample of each table (--sample, 500 rows): integers, numbers, booleans, text (memo beyond 255 characters), and lists and maps as JSON text. A table the drivers made keeps its definition: its columns, types and key. Rows are read in pages of 1000 in the order of their ids.

What works and what does not

WorksDoes not
Tables made by the data table layer; SELECT of any form SQLite answers; INSERT, UPDATE, DELETE, REPLACE, the upsert of the helpersA statement that needs more rows than ScanLimit (refused)
Revisions: a concurrent change is a conflict, never lostTransactions of the database: writes are sent at once, a rollback writes back what was there (JournalLimit)
Imports of any graph, with nodes and edges as tablesPaging a very large label with SKIP, which slows towards the end
Neptune: one cluster shared by several databases (exp_db)Neptune: IAM signing (Signature Version 4); a unique id (Neptune has no constraints); not tested
SurrealDB 2 and laterSurrealDB 1.x is not tested

SurrealQL and a site database

SurrealQL looks like SQL (SELECT ... FROM ... WHERE ... GROUP BY ... ORDER BY ... LIMIT ... START, functions), so it could be taken further than the other three: a dialect that turns the kernel's SQL into SurrealQL, as the Couchbase driver does for SQL++, would let one-table statements run in SurrealDB itself. A site database needs more than that: the kernel joins tables in most of its statements, and SurrealQL has no JOIN (it follows record links instead), no LEFT JOIN semantics, different NULL/NONE rules and no INSERT ... SELECT. Every join would have to be answered outside the database, as these drivers do now. The honest estimate is the size of the Couchbase dialect (large) for data tables answered in SurrealDB, and more for a site. Until then SurrealDB is at levels (b) and (c), like the others.

How it is built

ClassFileRole
expGraphDBlib/ezdb/classes/expgraphdb.phpThe drivers' base: the CouchDB driver with a store as its transport
expNeo4jDB, expNeptuneDB, expArangoDBDB, expSurrealDBDBlib/ezdb/classes/One per engine: its settings group, ports, store
expGraphDocumentStorelib/ezdb/classes/expgraphdocumentstore.phpAnswers the part of CouchDB's HTTP API the CouchDB driver uses
expCypherStore, expNeo4jStore, expNeptuneStorelib/ezdb/classes/Cypher over Neo4j's tx/commit and Neptune's /openCypher
expArangoDBStore, expSurrealDBStorelib/ezdb/classes/AQL cursors; SurrealQL over /sql
expGraphHttplib/ezdb/classes/expgraphhttp.phpJSON over HTTP with curl, one kept connection
expGraphReaderkernel/classes/graph/expgraphreader.phpThe imports' reader of a graph

The schema handler is the CouchDB driver's (expCouchDBSchema, settings/dbschema.ini).

Tests

php vendor/bin/phpunit --testsuite graph        # without a server: a store in memory
php vendor/bin/phpunit --testsuite graph-live   # against servers named in the environment

graph-live reads EXP_TEST_NEO4J_HOST, _PORT, _USER, _PASSWORD, _DATABASE, the same for ARANGODB and SURREALDB (and EXP_TEST_SURREALDB_NAMESPACE); a database without its variables is skipped. The servers can be the official images:

docker run -d --name neo4j -p 7474:7474 -e NEO4J_AUTH=neo4j/Graph-Test-2026 neo4j:5
docker run -d --name arangodb -p 8529:8529 -e ARANGO_ROOT_PASSWORD=Graph-Test-2026 arangodb:3.12
docker run -d --name surrealdb -p 8000:8000 surrealdb/surrealdb:v2 start --user root --pass Graph-Test-2026 memory

Measured on 2026-11-28 with PHP 8.5 (podman): Neo4j 5.26.34 Community, ArangoDB 3.12.14 and SurrealDB 4.0.1 pass graph-live, 15 tests and 189 assertions: tables made by the schema handler, ids from the counter, selects with joins and aggregates, updates, a changed key, deletes, a rollback, the upsert, a revision conflict, ALTER TABLE, TRUNCATE, DROP TABLE and the import reader of the driver's tables. On Neo4j Community, whose one database is neo4j, a test empties the driver's rows instead of dropping the database. Amazon Neptune stays not tested.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x