Skip to content

Commit 715d459

Browse files
docs: add db_neo4j node usage guide with practical examples (#490)
* docs: add db_neo4j node usage guide with real examples Adds docs/nodes/db-neo4j-usage.md with: - Configuration reference - Read/write/graph-algorithm Cypher patterns - Two-node (read then write) pipeline pattern - Neo4j Aura connection notes and GDS availability * update docs and address CR comments --------- Co-authored-by: ryan-t-christensen <ryan.christensen@rocketride.ai>
1 parent 199ee56 commit 715d459

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

docs/nodes/db-neo4j-usage.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# db_neo4j Node — Usage Guide
2+
3+
The `db_neo4j` node accepts natural-language questions, uses a connected LLM to
4+
generate read-only Cypher queries, executes them against a Neo4j database, and
5+
returns results to the pipeline. Write operations (CREATE, MERGE, SET, DELETE,
6+
etc.) are blocked by design.
7+
8+
## Requirements
9+
10+
A connected LLM node is required — the db_neo4j node uses it to translate
11+
questions into Cypher. Connect an LLM via the node's **LLM** invoke port.
12+
13+
## Configuration
14+
15+
```json
16+
{
17+
"id": "query_node",
18+
"type": "db_neo4j",
19+
"label": "Query Neo4j",
20+
"config": {
21+
"neo4jdb.uri": "neo4j+s://your-instance.databases.neo4j.io",
22+
"neo4jdb.auth_method": "userpass",
23+
"neo4jdb.user": "your_username",
24+
"neo4jdb.password": "your_password",
25+
"neo4jdb.database": "neo4j",
26+
"neo4jdb.db_description": "Portfolio company graph with risk signals and founder relationships"
27+
}
28+
}
29+
```
30+
31+
### Configuration fields
32+
33+
| Field | Default | Description |
34+
| ------------------------ | ------------------------ | -------------------------------------------------------------------------------------- |
35+
| `neo4jdb.uri` | `neo4j://localhost:7687` | Bolt URI. Use `neo4j+s://` for TLS (e.g. Aura). |
36+
| `neo4jdb.auth_method` | `userpass` | `userpass` or `token` (bearer). |
37+
| `neo4jdb.user` | `neo4j` | Username (userpass only). |
38+
| `neo4jdb.password` || Password (userpass only). |
39+
| `neo4jdb.token` || Bearer token (token auth only). |
40+
| `neo4jdb.database` | `neo4j` | Target database name. |
41+
| `neo4jdb.db_description` || Plain-English description of the graph — helps the LLM generate accurate Cypher. |
42+
| `neo4jdb.max_attempts` | `5` | How many times to retry if the LLM generates invalid Cypher (validated via `EXPLAIN`). |
43+
44+
## How it works
45+
46+
1. Receives a natural-language question on the **questions** lane.
47+
2. Reflects the live graph schema (labels, properties, relationship types).
48+
3. Sends the question + schema to the connected LLM, which returns a Cypher
49+
`MATCH`/`RETURN` query.
50+
4. Validates the query with `EXPLAIN` and retries up to `max_attempts` times if
51+
Neo4j rejects it.
52+
5. Executes the query and emits results on the **table**, **text**, and
53+
**answers** output lanes.
54+
55+
Only read-only Cypher is permitted (`MATCH`, `OPTIONAL MATCH`, `WITH`, `WHERE`,
56+
`RETURN`, `ORDER BY`, `SKIP`, `LIMIT`). Write clauses are rejected before
57+
execution.
58+
59+
## Example queries (natural language → Cypher)
60+
61+
The LLM generates these — you send the natural-language form as input.
62+
63+
### Fetch related nodes
64+
65+
```cypher
66+
MATCH (c:Company)-[:FOUNDED_BY]->(f:Founder)
67+
RETURN f.name, f.email, c.name AS company
68+
ORDER BY c.overall_severity ASC
69+
LIMIT 250
70+
```
71+
72+
### Graph algorithm (Cypher-based Louvain fallback)
73+
74+
```cypher
75+
MATCH (c:Company)-[r:PATTERN_MATCH]->(other:Company)
76+
WITH c, r.shared_signal AS signal, count(r) AS cnt
77+
ORDER BY cnt DESC
78+
WITH c, collect(signal)[0] AS dominant
79+
RETURN c.name, dominant
80+
LIMIT 250
81+
```
82+
83+
## Neo4j Aura
84+
85+
For cloud Neo4j (Aura), use the `neo4j+s://` URI scheme in `neo4jdb.uri`:
86+
87+
```text
88+
neo4j+s://xxxxxxxx.databases.neo4j.io
89+
```
90+
91+
Note: GDS algorithms require AuraDS or self-managed Neo4j with the GDS plugin.
92+
The free Aura tier supports standard Cypher but not `gds.*` procedure calls.

0 commit comments

Comments
 (0)