I have an Account object that has a "Incoming" relation with other Account 
Objects.  


I need a couple of cypher queries that retrieve a complete list of accounts 
sorted by the number of followers each Account. 


Query 1: If, Account One has to 200 followers and Account Two has 100, then 
Account One will be at the top of the list. The parameter resultSize will 
be the size of the top n result.


@Query("...")

List<Account> findSortedAccountByFollowers(int resultSize)


Query 2: Same as above this takes a maxCount as a param, to return return 
only those accounts that have followers less than maxCount.

e.g. if maxCount is 200 then return those accounts that have followers less 
200 sorted by highest to low.


Here is the Model Class


@NodeEntity
public class Account implements Serializable{

   @GraphId
   private Long id;
...

@Fetch
@RelatedTo(type="follows",
      direction= Direction.OUTGOING,
      elementClass = Account.class)
private Set<Account> following = new HashSet<Account>;



@Fetch
@RelatedTo(type="follows",
direction= Direction.INCOMING,
elementClass = Account.class)
private Set<Account> followers = new HashSet<Account>;

...

}

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to