Skip to content

Instantly share code, notes, and snippets.

@jjaderberg
Forked from libja/lisa_task.adoc
Last active April 24, 2017 17:11
Show Gist options
  • Save jjaderberg/a3c75a50054d628a4dab6cc7583b22b7 to your computer and use it in GitHub Desktop.
Save jjaderberg/a3c75a50054d628a4dab6cc7583b22b7 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}))
MATCH (wod {name:'WOD'})-[:LIKES]->(crossfit)
RETURN wod, crossfit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment