I've got a query that returns two collection (friends and outer). Is it possible to filter friends with outer? Here is my query: START n=node(127) MATCH(n)-[:friends]->(x) WITH n, collect(distinct x) as friends MATCH(n)-[:outer_only_friends]->(y) RETURN friends, collect(distinct y) as outer I'm thinking of something like
this: START n=node(127) MATCH(n)-[:friends]->(x) WITH n, collect(distinct x) as friends MATCH(n)-[:outer_only_friends]->(y) WITH n, collect(distinct y) as outer, friends RETURN collect(friends + outer) as stuff filter(outer in coll:friends) At this point, this doesn't work. Is there a way to generate two collections and filter one by the other? Any help would be appreciated even if it's just some example of filter in use or a brief explanation. I'm a little confused on the syntax. Thanks. Chris |
I've got a query that returns two collection (friends and outer). Is it possible to filter friends with outer? Here is my query:START n=node(127)MATCH(n)-[:friends]->(x)WITH n, collect(distinct x) as friendsMATCH(n)-[:outer_only_friends]->(y)RETURN friends, collect(distinct y) as outerI'm thinking of something like this:START n=node(127)MATCH(n)-[:friends]->(x)WITH n, collect(distinct x) as friendsMATCH(n)-[:outer_only_friends]->(y)WITH n, collect(distinct y) as outer, friendsRETURN collect(friends + outer) as stuff filter(outer in coll:friends)
START n=node(127)MATCH(n)-[:friends]->(x)WITH n, collect(distinct x) as friendsMATCH(n)-[:outer_only_friends]->(y)WITH n, collect(distinct y) as outer, friends
RETURN filter(x in outer + friends : x in friends)
--
I will work on putting together a blog post. I appreciate everyone's help in getting me this far. I know the use case looks goofy. This is just a smaller example of my ultimate use case. Hopefully when I build it in console it will come out clearer. Chris --- On Sat, 8/18/12, Michael Hunger <michael...@neotechnology.com> wrote: |
|