Overview
What the graph is, how to start the Bolt server and how to connect.
Status: in development. A property graph with an openCypher query language and a Bolt server exists and is tested, but it is not part of the released server yet. What works: the Cypher subset on the Cypher page, transactions, and connections from cypher-shell, the Neo4j Java driver and the Neo4j Python driver. A corpus of 575 statements is run against a real Neo4j 5.26 and the answers are compared; the limits page lists every difference. GRAPH_TABLE in the SQL front-ends, replication of a graph and graphs larger than memory are not built.
The model#
- A node has labels and properties. A relationship is directed, has one type, connects two nodes and has properties.
- Properties are integers, floats, strings, booleans and lists of them.
- Several relationships of one type may connect the same two nodes in the same direction, as in Neo4j.
- The graph is kept in memory and is durable through the engine's write-ahead log: a statement is on disk before it is answered.
Starting the server#
raftdb-bolt --db graph.raftdb --listen 127.0.0.1:7687 --user neo4j:SECRET| Option | Meaning |
|---|---|
--db FILE | the graph's log file (created if missing) |
--listen ADDRESS | default 127.0.0.1:7687 |
--user NAME:PASSWORD[:ROLE] | an account; ROLE is readonly, readwrite or admin. Without --user nobody has to log in |
--tls-cert FILE --tls-key FILE | serve bolt+s with this certificate |
--tls-auto | serve TLS with a self-signed certificate made at start (clients use bolt+ssc) |
--load-nodes FILE --label L [--id-property NAME] | bulk-load nodes from a CSV file before serving |
--load-edges FILE --type T | bulk-load relationships from a CSV file |
--index Label.property | create an index if there is none |
--identity neutral | the HELLO server name is RaftDB/<version> (Bolt 5.x compatible) (the only choice; vendor was removed). The official Neo4j Java and Python drivers refuse a server whose name does not start with Neo4j/, so applications that use them do not connect; the JavaScript, Go and .NET drivers work |
--advertise HOST:PORT | the address given to clients that ask for a routing table |
One server holds one graph. Whatever database name a client selects, it gets that graph.
Connecting#
cypher-shell -a bolt://127.0.0.1:7687 -u neo4j -p SECRETDriver driver = GraphDatabase.driver("bolt://127.0.0.1:7687", AuthTokens.basic("neo4j", "SECRET"));
try (Session session = driver.session()) {
session.run("CREATE (a:Person {name: $name})", Map.of("name", "Ann")).consume();
}from neo4j import GraphDatabase
driver = GraphDatabase.driver("bolt://127.0.0.1:7687", auth=("neo4j", "SECRET"))
with driver.session() as session:
print(session.run("MATCH (p:Person) RETURN p.name").value())The protocol details are on the Bolt page.
Loading data#
CSV files are loaded by the server at start (--load-nodes, --load-edges). A node file has a header line; its first column is the node id (an unsigned integer) and every other column is a property, optionally with a type: id,name:string,age:int,score:float,active:bool. A relationship file has two columns: source id and destination id. With --id-property id the id column is also stored as an integer property, which is what a query such as MATCH (p:Person {id: 7}) needs.
Small amounts of data are written with Cypher; many rows in one statement with UNWIND $rows AS row CREATE (...).
Indexes#
CREATE INDEX FOR (p:Person) ON (p.id)
CREATE INDEX person_name IF NOT EXISTS FOR (p:Person) ON (p.name)
SHOW INDEXESAn index is on one property of one label and answers equality ({id: 7}, WHERE p.id = 7). Range predicates are evaluated by scanning the label. There are no constraints.