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.

Automatic Relationships

Hi,

This is my first question on here, so I hope I'm in the right place! 

I want to ask whether it is possible to "auto-generate" relationships between nodes based on some. 

For instance, lets say I have a "Person" node  that has a firstName property Bob a lastName property Johnson and an address property Penny Lane 1. Now what I want is to setup is that if a different Person Alice gets created with the same lastName og address values I want to have a relation created between Alice and Bob automatically. Is this possible, perhaps via. some apoc scripts or something or do I have to implement this in my own application logic?

Kind regards
\Peter

1 ACCEPTED SOLUTION

glilienfield
Ninja
Ninja
3 REPLIES 3

glilienfield
Ninja
Ninja

You can look into the apoc trigger methods.

https://neo4j.com/labs/apoc/4.1/overview/apoc.trigger/

ameyasoft
Graph Maven

Try using apoc.text similarity functions (https://neo4j.com/labs/apoc/4.1/misc/text-functions/) like apoc.text.jaroWinklerDistance(text1, text2). Here text1 = Person A's address and text2 = Person B's address and depending on  the similarity strength you can decide. You need to check this every time a Person node created or updated.

 

 

  

Thanks for the suggestions guys!

@glilienfield I think your suggestion is right up the alley of what I'm looking for! especially since you can trigger on both nodes add/remove and even properties add/update/remove which is perfect!

\Peter