Last active
August 29, 2019 09:11
-
-
Save mneedham/c152b44252247881c243b6b6f98f6803 to your computer and use it in GitHub Desktop.
Football Transfers Graph GRANDstack App
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
type Query { | |
spendingByLeague(countrySubstring: String = ""): [SpendingByLeague] | |
@cypher( | |
statement: """MATCH (league:League)-[:IN_COUNTRY]->(country:Country) | |
WHERE country.name CONTAINS $countrySubstring | |
WITH country, league, | |
apoc.coll.sumLongs([(league)<-[:IN_LEAGUE]-(club)<-[:TO_CLUB]-(t) | t.value]) AS moneyOut, | |
apoc.coll.sumLongs([(league)<-[:IN_LEAGUE]-(club)<-[:FROM_CLUB]-(t) | t.value]) AS moneyIn | |
RETURN { league: league.name, leagueImage: league.image, country: country.name, countryImage: country.image, moneySpent: moneyOut, moneyReceived: moneyIn, profit: moneyIn - moneyOut}""" | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment