Skip to content

Instantly share code, notes, and snippets.

@libja
Forked from jexp/graph_gist_template.adoc
Last active April 24, 2017 17:07
Show Gist options
  • Save libja/bbe9dca6380b4d523838b6a39a02fab6 to your computer and use it in GitHub Desktop.
Save libja/bbe9dca6380b4d523838b6a39a02fab6 to your computer and use it in GitHub Desktop.
CHANGEME: GraphGist Template. Fork to make your own, view source to see instruction comments

Create the optimal WOD (in work)

Let’s make it easy to find out what exercises to include when you gather your Crossfit friends. First create a list of exercises, then find out what favorite exercises you share to create the optimal WOD (Workout of the day).

CREATE (lisa:Person {name: 'Lisa'}),
       (fredrik:Person {name: 'Fredrik'}),
       (filippa:Person {name: 'Filippa'}),
       (crossfit:Workout {name:'Crossfit'}),
       (burpee:Exercise {name:'Burpee'}),
       (pistols:Exercise {name: 'Pistols'}),
       (squats:Exercise {name: 'Air squats'}),
       (hspu:Exercise {name: 'HSPU'}),
       (pushups:Exercise {name: 'Push ups'}),
       (wod:Goal {name: 'WOD'}),
       (lisa)-[:WANTS]->(crossfit),
       (fredrik)-[:WANTS]->(crossfit),
       (filippa)-[:WANTS]->(crossfit),
       (lisa)-[:LIKES]->(burpee),
       (lisa)-[:LIKES]->(pistols),
       (lisa)-[:LIKES]->(squats),
       (fredrik)-[:LIKES]->(burpee),
       (fredrik)-[:LIKES]->(pistols),
       (fredrik)-[:LIKES]->(pushups),
       (filippa)-[:LIKES]->(burpee),
       (filippa)-[:LIKES]->(hspu),
       (filippa)-[:LIKES]->(squats),
       (crossfit)-[:CREATE]->(wod)

RETURN lisa, fredrik, filippa, crossfit, burpee, pistols, squats, hspu, pushups, wod

Create the WOD

Based on your lists, find out what exercises that are most popular among the team.

---
MATCH (burpee:Exercise {name:'Burpee'})
FOREACH (name in ['Lisa', 'Fredrik, 'Filippa'] |
CREATE (burpee)-[:LIKE]->(:Exercise {name:name}))
---
//graph_result
---
MATCH (wod {name:'WOD'})-[:LIKES]->(crossfit)
RETURN wod, crossfit
---
//graph_result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment