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.

Running and aggregating multiple queries

mike
Graph Buddy

Is there a way of running and aggregating very many queries without using the step-wise WITH?

My case is that I need to run x10's or x100's of EXPAND queries and return all of them. As Neo (can) automatically connect result nodes this produces a 'super' expansion limited to those starting nodes.

TIA Mike

MATCH (c:Company)
WHERE c.name ="AFRICA DRIVE (SOUTHAMPTON) LIMITED"
CALL apoc.path.expandConfig(c,{maxLevel:4, relationshipFilter:'CONCERNS|HAS_SURNAME|HAS_FORNAME', labelFilter: '/Surname|/ForeNames', uniqueness:'NODE_GLOBAL'}) YIELD path

WITH path AS path1

MATCH (c:Company)
WHERE c.name ="AIS (MARINE) 2 LIMITED"
CALL apoc.path.expandConfig(c,{maxLevel:4, relationshipFilter:'CONCERNS|HAS_SURNAME|HAS_FORNAME', labelFilter: '/Surname|/ForeNames', uniqueness:'NODE_GLOBAL'}) YIELD path

WITH path AS path2, path1

MATCH (c:Company)
WHERE c.name ="AIS (MARINE) 3 PLC"
CALL apoc.path.expandConfig(c,{maxLevel:4, relationshipFilter:'CONCERNS|HAS_SURNAME|HAS_FORNAME', labelFilter: '/Surname|/ForeNames', uniqueness:'NODE_GLOBAL'}) YIELD path

WITH path AS path3, path2, path1
RETURN path1, path2, path3
LIMIT 100
1 ACCEPTED SOLUTION

12kunal34
Graph Fellow

Hey Mike,

Please try with below query and let us know it solves your query or not

MATCH (c:Company)
WHERE c.name  IN ['AFRICA DRIVE (SOUTHAMPTON) LIMITED', 'AIS (MARINE) 2 LIMITED', 'AIS (MARINE) 3 PLC']
CALL apoc.path.expandConfig(c,{maxLevel:4, relationshipFilter:'CONCERNS|HAS_SURNAME|HAS_FORNAME', labelFilter: '/Surname|/ForeNames', uniqueness:'NODE_GLOBAL'}) YIELD path

WITH path AS path1
RETURN path1
LIMIT 100

View solution in original post

3 REPLIES 3

12kunal34
Graph Fellow

Hey Mike,

Please try with below query and let us know it solves your query or not

MATCH (c:Company)
WHERE c.name  IN ['AFRICA DRIVE (SOUTHAMPTON) LIMITED', 'AIS (MARINE) 2 LIMITED', 'AIS (MARINE) 3 PLC']
CALL apoc.path.expandConfig(c,{maxLevel:4, relationshipFilter:'CONCERNS|HAS_SURNAME|HAS_FORNAME', labelFilter: '/Surname|/ForeNames', uniqueness:'NODE_GLOBAL'}) YIELD path

WITH path AS path1
RETURN path1
LIMIT 100

@12kunal34 yep, sure does and thanks for stepping in to help so quickly.

you are welcome mike