使用带有整数 ID 的 neo4j 导入工具

Using neo4j import tool with integer IDs

我是 Neo4j 的新手,我正在尝试使用它的 import tool 将一堆遗留数据导入新数据库。此数据的主要 ID 将是整数。不过好像一个节点的:ID 属性 默认是字符串类型?我知道我可以在其他属性上使用 :int 使它们成为整数类型,但似乎无法将其与 :ID.

结合使用

例如,这里是节点类型 1:

node1_int_id:ID(node1)|other_prop|another_prop
12345                 |foo       |bar

节点类型 2:

node2_int_id:ID(node2)|other_prop|another_prop
67890                 |foo       |bar

和关系

:START_ID(node1)      |:END_ID(node2)
12345                 |67890

这似乎可行,但结果是基于两个字符串类型字段的关系。所以我想我有两个问题:

1)我这样做对吗?有什么方法可以使我没有看到的 ID 字段变成整数吗?

2)如果我必须这样做,它们是字符串有问题吗?这最终会产生一个包含约 1 亿个节点和关系的相当大的数据库,因此基于字符串比较来寻找关系似乎是个坏主意。

neo4j 导入工具的 Command line usage 页面记录了这个命令行选项:

--id-type <id-type>

One out of [STRING, INTEGER, ACTUAL] and specifies how ids in node/relationship input files are treated.

STRING: arbitrary strings for identifying nodes. INTEGER: arbitrary integer values for identifying nodes. ACTUAL: (advanced) actual node ids.

The default option is STRING.

所以,当运行导入工具时,您应该在命令行中指定--id-type INTEGER