简体   繁体   中英

Neo4j order by relationship count

I'm new to neo4j and tried to implement a graph with some success. Now I'm trying to make a query ordered by the number of relationships.

For example.

START n=node(*) MATCH (n->[r]->()) ORDER BY Count(r)

is this the right syntax and how do I fire of this question in Java?

The query can be like that

START n=node(*) MATCH n-[r]->()
 RETURN n, r, count(r) 
 ORDER BY count(r)

And you can simply use REST appi to fire the query and execute it in java code.. This link may help you Execute Cypher Queries from Java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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