Cheers, Michael! -Josh
On Tuesday, June 10, 2014 4:00:26 PM UTC-6, Michael Hunger wrote: > > Perhaps check out Max de Marzi's graph search app that had exactly this > function see his blog maxdemarzi.com > > Sent from mobile device > > Am 11.06.2014 um 00:37 schrieb [email protected] <javascript:>: > > I'm developing an social app that requires the user's Facebook friends > list. > > I'm trying to figure out the best method of importing/comparing and > updating the list to my Neo4j DB. > > For each friend on the user's list, I want to first see if the friend is > in the database... if they are, then I want to create the [:KNOWS] > relationship... if NOT, I want to ignore and move on. > > Options I'm considering: > > 1. Run each query separately, matching the user node and the friend's > node. If the node exists (if the match is found), then create the > relationship. *This seems very inefficient because I'd be redundantly > matching the user's node in each independent query.* > > (foreach loop) > MATCH (u:User { id:{uID} }), (f:User { id:{fID}}) > CREATE (u)-[:KNOWS]->(f) > (end loop) > > 2. Run as a single query. Match the user's node... then Optional Match > the user's friends. If the match exists, create the relationship. > > MATCH (u:User { id:{uID}}) > (start loop) > OPTIONAL MATCH (f:User { id:{fID}) > (if match) > CREATE (u)-[:KNOWS]->(f) > (end loop) > > Is option 2 possible? Am I thinking about this all wrong? > > Thanks for any help! > > Cheers > > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
