简体   繁体   English

遍历Java中关系属性排序的Neo4J节点

[英]Traverse Neo4J nodes ordered by relation property in Java

Is it possible to traverse nodes ordered by a property given by relations in the Java API? 是否可以遍历由Java API中的关系给出的属性排序的节点?

Source node *--- 4 ---> * Node 1
            |
            +--- 3 ---> * Node 2
            |
            +--- 2 ---> * Node 3
            |
            '--- 1 ---> * Node 4

Where *'s are nodes and the numbers between -'s are relation properties. 其中*是节点,-s之间的数字是关系属性。 Such that the above would give the nodes 4, 3, 2 and 1. 这样,上面将给出节点4,3,2和1。

You would have to get all those relationships and sort them first then. 你必须首先得到所有这些关系并对它们进行排序。 If you're using that in a traversal then such a behaviour can be encoded in a RelationshipExpander. 如果您在遍历中使用它,那么这种行为可以在RelationshipExpander中编码。

There are some examples that you can work from at http://docs.neo4j.org/chunked/snapshot/tutorial-traversal-java-api.html#_relationshipexpander . 您可以在http://docs.neo4j.org/chunked/snapshot/tutorial-traversal-java-api.html#_relationshipexpander中找到一些示例。 Does that help? 这有帮助吗? You can go to the GIThub source and work your way from there? 你可以去GIThub源并从那里开始工作吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM