无法创建CONSTRAINT ON(___ neo4jgraphs:___ neo4jgraphs)

时间:2018-08-08 00:42:18

标签: apache-spark neo4j

我正在尝试将使用项目Cypher-for-Apache-Spark Spark-dataframes 创建的图形存储到 neo4j < / strong>。

运行代码时:which you can find it in the last comment in an issue in github

我收到此错误:

Exception in thread "main" org.neo4j.driver.v1.exceptions.DatabaseException: Unable to create CONSTRAINT ON ( ___neo4jgraphs874:___neo4jgraphs874 ) ASSERT ___neo4jgraphs874.___morpheusID IS UNIQUE:
Both Node(57) and Node(74) have the label `___neo4jgraphs874` and property `___morpheusID` = 4

有人知道为什么会这样吗?

1 个答案:

答案 0 :(得分:0)

已解决here 我已经找出了问题所在: 发生此错误是因为数据框具有相同的ID号:

df1||df2||df3
 0L||0L ||0L
 1L||1L ||1L
 2L||2L ||2L

要修复,每个数据帧都需要具有与其他数据帧不同的ID:

df1||df2||df3
0L||3L  ||6L
1L||4L  ||7L
2L||5L  ||8L