小编Dav*_*t D的帖子

Neo4J中嵌套的FOREACH Cypher运行无限

我尝试运行以下查询,其中我在数据库和10个国家/地区拥有10个链.并使用20个地址的数组.然后我循环通过那些为国家,连锁店和地址的每个组合创建一个商店,期待10*10*20组合 - 2000个商店.但相反,查询运行直到创建大约200,000条记录,然后停止并显示未知错误.

MATCH (Chains:Chain), (Countries:Country)
WITH Collect(Chains) as ch, 
     Collect(Countries) as cou, 
['Ullevål','Blindern','Centrum','Kringså','Lysaker','Skøyen','Fornebu','Stortinget','Nationalteatre','KarlJohan',
'Gamle','Grunerløkka','Grønland','Majorstuen','Snarøya','Asker','Sandvika','Drammen','Gothenburg','Stockholm'] as addresses

FOREACH(country in cou |
    FOREACH (c in ch |
            FOREACH (a in addresses |
                CREATE (s:Store {name:c.name+"_"+a, address:a})
                CREATE (s-[:BELONGS_TO]->c)
                CREATE (s-[:IN]->country)               )))
Run Code Online (Sandbox Code Playgroud)

neo4j cypher

1
推荐指数
1
解决办法
1304
查看次数

标签 统计

cypher ×1

neo4j ×1