我通过GraphDatabaseService访问neo4j数据库。我添加了一些节点和关系,并希望进行查询。我的目标是让所有与呼叫终端有呼叫关系的节点。所以我有整个路径到这个节点。 (例如:node1 -calling-> node2 -calling * - > nodeX -calling-> endnode)
我尝试了这样的事情:
GraphDatabaseService _graphDatabase; // db is running and working fine
Node node;//given by the function call
HashMap properties = Maps.newHashMap();
properties.put("name", getPropertyFromNode(node, "name"));
String query = "MATCH p=(startnode)-[rel:CALLING*]->(endnode) WHERE endnode.name = {name} RETURN p";
Result result = _graphDatabase.execute(query, properties);
while (result.hasNext()) {
Map next = result.next();
next.forEach((k, v) -> {
System.out.println(k + " : " + v.toString());
if (v instanceof PathImpl) {
PathImpl pathImpl = (PathImp