cancel
Showing results forΒ
Did you mean:Β

Head's Up! Site migration is underway. Phase 1: replicate users.

## Modeling exercise on data of college sports meeting

Node

Hi, I'm learning Neo4j modeling, This is an example of an annual sports meeting at a university.
staffs has property of gender and birth date.
Assume that athletes participating in sprint are grouped by sex and age:
group1: young men(Gender=male & age<40)
group2: middle-aged and old men (Gender=male & age>=40)
group3: young women(Gender=female & age<40)
group4: middle-aged and old women (Gender=female & age>=40)

janey is a woman born in 1981-08-08, by group definition she now belongs to Young Woman,
But the 2021 sports meet is held on October 15th, Therefore, she should be divided into the group of middle-aged and old women.
Of course, for chess games, they are grouped by gender only, regardless of age.
Here we need to manage the results of the different events of the participants in each department each year,
How should I establish the data model of such a sports meeting in Neo4j?
What I'm wondering is where do I define this age grouping rule,
and how can we adapt to a dynamically adjusted age cutoff point of 35?
Thank you for any help and advice!

3 REPLIES 3
Graph Maven

You should determine the age of the participant as of the annual event date. You can use APOC library to calculate the age as of the event date.

Graph Steward

Hmmm....

I'm kind of wondering if you've picked a good problem to showcase the Data Modeling abilities of Neo4J.

Graph Databases really shine when you have Nodes that connect (via Relationships) with other Nodes. Like in the Movie-Actor-Director Example DB. This works especially well, when there's a many-to-many relationship between Nodes.

For example, if a participant can be in multiple departments.

I can't tell if you have such a thing from your verbal description. (I'm not always good at converting words to pictures), but it feels (to me) like you don't.

The cut off point would be just a condition in a query, which is no big deal (available in any type of DB.).

You might use this web-based app, to see if you can draw a picture of your data:

https://neo4j-arrows.appspot.com/

Node

Thank you all. I think I've found the solution.
That is, Create a node with a specific date property, (ym :group {name: "youngMen", date: "2021-10-15"})
Then select all male employees whose age<40 by 2021-10-15 οΌCreate a belongTo relationship between this employee and YM Group, the same goes for other date-related groups.