Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-07-2021 07:23 PM
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!
05-07-2021 09:29 PM
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.
05-11-2021 11:38 AM
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:
05-12-2021 02:08 AM
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.
Thank you for your reply and suggestions !
All the sessions of the conference are now available online