返回 cypher 中的地图对象
我需要在一组节点之间创建边,但不能保证该边不存在,我需要知道已创建哪些边,以便可以增加两个连接节点的边计数器。
我想知道每个节点的边数,而无需每次都查询图表。
示例:
MERGE (u:user {id:999049043279872})
MERGE (g1:group {id:346709075951616})
MERGE (g2:group {id:346709075951617})
MERGE (g1)-[m1:member]->(u)
MERGE (g2)-[m2:member]->(u)
有时用户已经是该组的成员,因此在这种情况下我不想增加计数器。
我尝试使用结果统计信息,但它仅返回创建的关系编号,我还考虑使用地图,然后在 MERGE
之后使用 ON CREATE SET
填充内容:
WITH {g1:0, g2:0} as res
MERGE (u:user {id:999049043279872})
MERGE (g1:group {id:346709075951616})
MERGE (g2:group {id:346709075951617})
MERGE (g1)-[m1:member]->(u)
ON CREATE SET res.g1 = 1
MERGE (g2)-[m2:member]->(u)
ON CREATE SET res.g2 = 1
RETURN res
但是它不起作用;执行查询后服务器立即崩溃。
例外:
------ 快速内存测试 ------
17235:M 2022 年 2 月 28 日 16:56:50.016 # 主线程终止
17235:M 2022 年 2 月 28 日 16:56:50.017 # 作业类型 #0 的生物线程已终止
17235:M 2022 年 2 月 28 日 16:56:50.017 # 作业类型 #1 的 Bio 线程已终止
17235:M 2022 年 2 月 28 日 16:56:50.018 # 作业类型 #2 的 Bio 线程已终止快速内存测试已通过,但是您的内存仍然可能会被破坏。
如果可能,请运行几个小时的内存测试。------ 转储 EIP 周围的代码 ------
符号:(null)(基数:(nil))
模块:/lib/x86_64-linux-gnu/libc.so.6(基址 0x7fbfe3dcc000)
$ xxd -r -p /tmp/dump.hex /tmp/dump.bin
$ objdump --调整-vma=(nil) -D -b 二进制 -m i386:x86-64 /tmp/dump.bin=== Redis 错误报告结束。确保包含从 START 到 END 的内容。 ===
请通过在 github 上提出问题来报告崩溃:
http://github.com/redis/redis/issues
怀疑内存错误?使用 redis-server --test-memory 进行验证。
分段错误
有什么想法吗?
提前致谢
I need to create edges between a set of nodes but it is not guaranteed that the edge is not exists already, I need to know which edges has been created so I can increment the edges counter for the two connected nodes.
I want to know the edges count for every node without querying the graph each time.
Example:
MERGE (u:user {id:999049043279872})
MERGE (g1:group {id:346709075951616})
MERGE (g2:group {id:346709075951617})
MERGE (g1)-[m1:member]->(u)
MERGE (g2)-[m2:member]->(u)
Sometimes the user is already a member of the group so I don't want to increment the counter in this case.
I tried to use the result statistics but it returns the created relationships number only, I thought also about using a map and then fill the content using ON CREATE SET
after MERGE
:
WITH {g1:0, g2:0} as res
MERGE (u:user {id:999049043279872})
MERGE (g1:group {id:346709075951616})
MERGE (g2:group {id:346709075951617})
MERGE (g1)-[m1:member]->(u)
ON CREATE SET res.g1 = 1
MERGE (g2)-[m2:member]->(u)
ON CREATE SET res.g2 = 1
RETURN res
But it does not works; the server crashes immediately after executing the query.
Exception:
------ FAST MEMORY TEST ------
17235:M 28 Feb 2022 16:56:50.016 # main thread terminated
17235:M 28 Feb 2022 16:56:50.017 # Bio thread for job type #0 terminated
17235:M 28 Feb 2022 16:56:50.017 # Bio thread for job type #1 terminated
17235:M 28 Feb 2022 16:56:50.018 # Bio thread for job type #2 terminatedFast memory test PASSED, however your memory can still be broken.
Please run a memory test for several hours if possible.------ DUMPING CODE AROUND EIP ------
Symbol: (null) (base: (nil))
Module: /lib/x86_64-linux-gnu/libc.so.6 (base 0x7fbfe3dcc000)
$ xxd -r -p /tmp/dump.hex /tmp/dump.bin
$ objdump --adjust-vma=(nil) -D -b binary -m i386:x86-64 /tmp/dump.bin=== REDIS BUG REPORT END. Make sure to include from START to END. ===
Please report the crash by opening an issue on github:
http://github.com/redis/redis/issues
Suspect RAM error? Use redis-server --test-memory to verify it.
Segmentation fault
Any ideas?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Neo4j 已经在每个节点内存储了一个计数器来计算关系数量并提供快速计数访问。当您想要获取群组中的成员数量时,您可以简单地执行以下操作:
Neo4j stores already a counter inside each node to count the number of relationships and to provide a fast count access. When you want to get the number of members in a group, you can simply do: