Running and aggregating multiple queries

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

Hey Mike,

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

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
1 Like

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

1 Like

you are welcome mike :slight_smile: