0
我有一個密集節點問題並解決了這個問題我一直在使用索引來執行一些使用本機Java API的匹配,但是我一直給Cypher第二眼看,並希望知道這是否可以完成。目前我的模式看起來像這樣在Java代碼:通過索引查找與密碼執行匹配
Node startNode = db.getNodeById(1);
Index<Relationship> relationshipIndex = db.index.forRelationships("relationships");
for(Relationship relationship1 : startNode.getRelationships(Direction.OUT)) {
Node otherNode = relationship.getOtherNode(startNode);
String indexValue = (String)otherNode.getProperty("indexValue");
for(Relationship relationship2 : relationshipIndex.get("indexKey", indexValue)){
Node endNode = relationship.getOtherNode(startNode);
//Processing on the endNode
}
}
我該如何翻譯這個密碼?就像:
START startNode=node(1)
MATCH startNode-[r1]->otherNode
WITH node:relationships("indexValue:" + otherNode.indexValue) as r2
RETURN r2.endNode //Notation for getting node off relationship?
我真的沒有看到任何地方只是得到一個關係,然後通過像這樣的關係得到最終節點。
你可以在開始之外做索引查找嗎?我已更新我的代碼以顯示我的意思,但我在第一部分進行遍歷,然後進行關係索引查找。 – Nicholas
顯然不是。實際上有一個功能請求:https://github.com/neo4j/neo4j/issues/93和https://github.com/neo4j/neo4j/issues/389 –
這就是我所設想的,我更新了問題再次反映Cypher類型的我想要的,但是看起來公開的問題也想要我所要求的。 – Nicholas