MATCH x
WITH 1 as c,x
MATCH x-->y
WITH c,x.id as x_id,collect(y.id) as y_ids
WHERE NOT any(y_id IN y_ids WHERE y_id IN ['c1','c2'])
AND NOT any(y_id IN y_ids WHERE y_id IN ['c0','c2'])
RETURN c,x_id,y_ids
Basically you first get the results for all "positive" relationships (that is FriendsOf(...) rather than Not(FriendsOf(...))); this is important because these queries control the counts associated with the relationships. Then you need a list of target followers and target friends that you filter with the "negative" relationships.
One difficult consideration is where to get the list of friends and followers for the target. In the example above I directly query for all followers, but in a real query there will be a query prior to the negative part that collects a more concise list of friends and followers. It would be nice to use that if possible.
(Ref https://github.com/JnBrymn/minglbot/issues/25)
Add the Not clause.
Use this query as a clue about how to do this:
Basically you first get the results for all "positive" relationships (that is
FriendsOf(...)
rather thanNot(FriendsOf(...))
); this is important because these queries control the counts associated with the relationships. Then you need a list of target followers and target friends that you filter with the "negative" relationships.One difficult consideration is where to get the list of friends and followers for the target. In the example above I directly query for all followers, but in a real query there will be a query prior to the negative part that collects a more concise list of friends and followers. It would be nice to use that if possible.