使用 neo4jrestclient 進行匹配
from neo4jrestclient import client
q = 'MATCH (u:User)-[r:likes]->(m:language) WHERE u.name="Marco" RETURN u, type(r), m'
db
如上所定義
results = db.query(q, returns=(client.Node, str, client.Node))
列印結果
for r in results:
print("(%s)-[%s]->(%s)" % (r[0]["name"], r[1], r[2]["name"]))
輸出:
(Marco)-[likes]->(C++)
(Marco)-[likes]->(Python)