Install
openclaw skills install neo4j-integrationConnect to Neo4j graph databases and execute Cypher queries for storing, querying, and managing knowledge graph data using the property graph model. Full support for transactions, indexes, bulk operations, and result mapping.
openclaw skills install neo4j-integrationConnect to Neo4j graph databases and execute Cypher queries for efficient knowledge graph management.
This skill enables seamless interaction with Neo4j graph databases using the official Python driver. It provides connection management, query execution, transaction support, and result mapping for the property graph model.
bolt:// - Unencrypted connection
neo4j:// - Standard connection (recommended)
neo4j+s:// - TLS-encrypted connection
neo4j+ssc:// - Self-signed certificate
config = {
"uri": "neo4j://localhost:7687",
"username": "neo4j",
"password": "secure_password",
"encrypted": True,
"trust": "TRUST_ALL_CERTIFICATES"
}
Neo4j uses a property graph model with three core elements:
Represent entities with labels and properties.
CREATE (p:Person {name: "Alice", age: 30, email: "alice@example.com"})
CREATE (c:Company {name: "TechCorp", industry: "Technology"})
Properties:
Connect nodes with typed, directed edges and properties.
CREATE (a:Person)-[:WORKS_AT {since: 2020}]->(c:Company)
CREATE (a:Person)-[:KNOWS {strength: 0.8}]->(b:Person)
Characteristics:
<-Attributes on nodes and relationships.
String: "text value"
Integer: 42
Float: 3.14
Boolean: true/false
DateTime: timestamp
List: [1, 2, 3]
MATCH (p:Person) WHERE p.age > 30 RETURN p.name, p.age
CREATE (p:Person {name: "Bob", age: 25}) RETURN p
MERGE (p:Person {name: "Alice"}) SET p.age = 31 RETURN p
MATCH (a:Person {name: "Alice"}), (b:Person {name: "Bob"})
CREATE (a)-[:KNOWS]->(b) RETURN a, b
MATCH (p:Person {name: "Old Person"}) DELETE p
MATCH (p:Person) RETURN p ORDER BY p.age DESC LIMIT 10
MATCH (p:Person) RETURN COUNT(p), AVG(p.age), MAX(p.age)
MATCH (p:Person)-[:KNOWS]->(friends:Person)
RETURN p.name, COLLECT(friends.name) AS friend_list
MATCH (p:Person)
RETURN p.name, CASE WHEN p.age > 30 THEN "Senior" ELSE "Junior" END AS level
MATCH path = (a:Person)-[:KNOWS*1..3]->(b:Person)
WHERE a.name = "Alice" AND b.name = "Bob"
RETURN path, LENGTH(path) AS hops
MATCH (n:Person) WHERE exists(n.pagerank) RETURN n ORDER BY n.pagerank DESC
BEGIN
CREATE (p:Person {name: "Alice"})
CREATE (c:Company {name: "TechCorp"})
COMMIT
BEGIN
CREATE (p:Person {name: "Alice"})
ROLLBACK
CREATE INDEX person_name FOR (p:Person) ON (p.name)
CREATE INDEX company_id FOR (c:Company) ON (c.id)
LOAD CSV WITH HEADERS FROM "file:///data.csv" AS row
CREATE (p:Person {name: row.name, age: toInteger(row.age)})
UNWIND $nodes AS node
CREATE (n {id: node.id, name: node.name})
UNWIND $updates AS update
MATCH (p:Person {id: update.id})
SET p.age = update.age
MATCH (p:Person) RETURN p.name, p.age
Maps to:
[
{"name": "Alice", "age": 30},
{"name": "Bob", "age": 25}
]
MATCH (p:Person) RETURN p
Maps to Python Node objects with:
MATCH (a)-[r]->(b) RETURN r
Maps to Relationship objects with:
| Error | Cause | Solution |
|---|---|---|
| Connection refused | Neo4j not running | Start Neo4j server |
| Authentication failed | Wrong credentials | Verify username/password |
| Syntax error | Invalid Cypher | Check query syntax |
| Constraint violation | Duplicate/invalid data | Check constraints |
| Timeout | Query too slow | Add indexes, optimize query |
| Out of memory | Too much data | Batch operations, paginate |
✓ Use parameterized queries - Prevent injection attacks
✓ Create appropriate indexes - Improve query performance
✓ Batch large imports - Avoid memory exhaustion
✓ Use transactions - Ensure data consistency
✓ Profile queries - Identify performance bottlenecks
✓ Close connections - Prevent resource leaks
✓ Limit result sets - Avoid network overhead
✓ Normalize node names - Prevent duplicate nodes
✓ Document schemas - Maintain data governance
✓ Monitor database - Track performance metrics
This skill integrates with:
neo4j - Official driver (4.x/5.x)neomodel - Python ORM for Neo4jpy2neo - Pythonic interfacecypher-dsl-python - Build Cypher programmaticallyipython-cypher - Jupyter integrationpandas - Data frame operationspolars - Efficient data loadingnetworkx - Graph analysisgraphistry - Interactive graph visualizationpyvis - Network visualizationneovis.js - Neo4j visualizationVersion: 1.0.0