Neo4j Cypher query : Club users likes with friends like -


I have a neo4j graph that looks like this:

  (user) - Like- & Gt; (Actor) | ^ | | Like friends | Wei | (User2) -----------   

Who says, user2 and user's user actor and friend (user 2) liked actor also likes .

Now, given actor, when I try to drag the friends of all the users who prefer the actor, then I do something like this:

  Start user = Node (*) match (user) - [: friends] - (friend) - [liked_rela: likes] - (actor) where user.UID = 123 and actor.id = 234 returns different friends, like_rela;   

The above questions have returned friends of all my users, who prefer an actor. It does not return the relationship between the user and the actor. Is there a way that I can club it in the same question?

I am using Neo4j 1.9

thanks

< P> This can happen after you:
  MATCH (user {id: 123}) - [: friends] - (friend) - [f_like_rel: likes] - & gt; (Actor (id: 234)) Alternative match (user) - [u_rel] - (actor) returns different friend, u_rel, f_like_rel;   

Note:

  1. The above (user {id: 123}) - [: friends] - (friend) Pattern < Code> (friend) - [f_like_rel: likes] - & gt; (Actor {1}), which can go any way in friends relationship.
  2. ID: 234}) Pattern is directional, as I believe you do not want to capture any actor who likes your friend (without any realization) the resulting).
  3. u_rel may be of type friends or preference ; Or it may be NULL if the user has no relation with the actor I have left this pattern non-directional, but you want to make it directional.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -