OpenCypher Tests¶
The tests validate OpenCypher query support, common graph patterns, and recent path-mode semantics.
They also include regression coverage for planner behavior that matters to the
Python bindings, such as UNWIND variables being usable inside WHERE
predicates.
OpenCypher¶
OpenCypher is a declarative graph query language for pattern matching and traversal.
import arcadedb_embedded as arcadedb
with arcadedb.create_database("./opencypher_test_db") as db:
db.command("sql", "CREATE VERTEX TYPE Person")
db.command("sql", "CREATE EDGE TYPE Knows")
with db.transaction():
alice = db.new_vertex("Person")
alice.set("name", "Alice").save()
bob = db.new_vertex("Person")
bob.set("name", "Bob").save()
edge = alice.new_edge("Knows", bob)
edge.save()
result = db.query("opencypher", """
MATCH (p:Person)-[:Knows]->(friend:Person)
RETURN friend.name as name
""")
names = [r.get("name") for r in result]
assert "Bob" in names
Running This Test¶
Notable Regression Coverage¶
- Path modes: default
TRAIL, explicitACYCLIC, andWALK WALKrequires an explicit hop bound on cyclic traversalsUNWINDvariables can be referenced fromWHEREclauses duringMATCH- Aggregations on missing labels still return a single row with
0 - Result property order remains stable for projected OpenCypher values
Path Mode Example¶
This coverage is intentionally test-focused: Python already reaches these features
through db.query("opencypher", ...), so the bindings need semantic verification more
than a dedicated wrapper API.
OpenCypher vs SQL MATCH¶
| Feature | SQL MATCH | OpenCypher |
|---|---|---|
| Style | SQL-like | Declarative graph patterns |
| Focus | Set operations + graph patterns | Pattern matching + paths |
| Learning curve | Easier if you know SQL | Easier if you know Cypher |
| Graph traversal | Strong | Strong |
Example Comparison¶
SQL MATCH:
OpenCypher: