cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Create a unique id for set of nodes

How to create a unique id for set of nodes. I know there is a option for uuid, but that is specific to nodes, but I'd prefer to have an id for collection of nodes.

For example:

  1. John, Mohammed, Kandhan and Ranveer are employees of department "Creators";
  2. Annie, Baig, Valli, and Anushka are employees of department "Inventors"
  3. I want a seperate id for creators and inventors.
  4. Also if possible I would like to have all these department under company "X" and a separate id for that as well.
1 ACCEPTED SOLUTION

Instead of two attributes for Mark I'd use two relationships to a Family type of node. This Family node become the common entity linking family members together. In Mark's case he's a member of two families. You can generate UUID for the family node to keep them unique from the other families in your database.


Diagram made by the Arrows tool

View solution in original post

6 REPLIES 6

ameyasoft
Graph Maven

There are couple of ways to do.

  1. Create 'Creators' node and 'Inventors' node. John and others go under 'Creators' as employees and Annie and others go under 'Inventors'

  2. In the employee node add department as a property and insert the appropriate department name.

But what if I have multiple creators department.
A better example could be what if there is two families with 4 people each and all have appropriately same name as the other.

  1. John and Jessy are husband and wife.
  2. Mark and Mona are their children.
  3. An another family with all same names, whom comes under same ancestors (in a family tree).

Here I would like to have a unique difference between families (not by ancestors, theoretically that could also be same to an extent)

You're going to have to find a way to distinguish between the two groups. Forget the database for a second, on paper, given the information, how do you manually keep track of the two groups? Is there something else about them? Yes you can eventually assign a surrogate id, but you know best on how to distinguish them.

Ok. This is my take. For mark, he will have two properties "FAMILY_ID" share with his predecessors and wife. "PART_OF" with his father and mother.

Instead of two attributes for Mark I'd use two relationships to a Family type of node. This Family node become the common entity linking family members together. In Mark's case he's a member of two families. You can generate UUID for the family node to keep them unique from the other families in your database.


Diagram made by the Arrows tool

Less attribute, more relationship.it. Thank you both @ameyasoft and @mike.r.black