将Excel或类似CSV的条目插入neo4j图形时,避免重复的整体 [英] Avoid duplicate entires when Inserting Excel or CSV-like entries into a neo4j graph

查看:226
本文介绍了将Excel或类似CSV的条目插入neo4j图形时,避免重复的整体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下.xslx文件:

I have the following .xslx file:

无论使用哪种语言,我的软件都将返回以下图形:

My software regardless tis language will return the following graph:

我的软件逐行迭代,并且每行迭代都会执行以下查询

My software iterates line by line and on each line iteration executes the following query

MERGE (A:POINT {x:{xa},y:{ya}}) MERGE (B:POINT {x:{xb},y:{yb}}) MERGE (C:POINT {x:{xc},y:{yc}}) MERGE (A)-[:LINKS]->(B)-[:LINKS]->(C) MERGE (C)-[:LINKS]->(A)

通过插入重复项可以避免这种情况吗?

Will this avoid by inserting duplicate entries?

推荐答案

根据

According to this question, yes it will avoid writing duplicate entries.

上面的查询将匹配任何现有节点,并且将避免写入重复项.

The query above will match any existing nodes and it will avoid to write duplicates.

每个节点上都有一个很好的经验法则,可以将其复制到单独的MERGE查询中,然后再为2个节点之间的每个关系编写合并语句.

A good rule of thumb is on each node that it may be a duplicate write it into a seperate MERGE query and afterwards write the merge statements for each relationship between 2 nodes.

在使用异步技术(例如

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆