Created
August 31, 2012 19:42
-
-
Save drochetti/3558029 to your computer and use it in GitHub Desktop.
Neo4j Cypher query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query.append("START activity = node:__types__(className={activityClass}) ") | |
// .append("MATCH (activity)-[*1..2]->(source), ") | |
// .append("(source)<-[:HAS_SOURCE]-(lastActivities) ") | |
.append("MATCH (activity)-[*1..2]->(source)<-[:HAS_SOURCE]-(lastActivities) ") | |
.append("WHERE source.__type__ in {sourceTypes} ") | |
.append("RETURN source as source, COLLECT(lastActivities) as activities ") | |
// .append("ORDER BY activity.when DESC LIMIT 20"); why can't I use activity anymore? because of second match | |
.append("LIMIT 20"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You cannot use activity anymore because you aggregated on source, so the activities are only in the list. What you want is to sort and limit the collection, which is planned in cypher but there is no implementation date yet.