Neo4j 2.0转储与双类型 [英] Neo4j 2.0 dump with double type

查看:116
本文介绍了Neo4j 2.0转储与双类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Neo4j 2.0(社区)上,当我转储带有某些具有Double类型属性的节点的数据库时,我获得了一个具有科学计数法的值的文件:ex 1.43524185E8

On Neo4j 2.0 (community) when I dump a db with some nodes with Double type properties, I obtain a file with value in scientific notation : ex 1.43524185E8

导入此文件时,neo4j-shell失败,并显示以下错误:

On import of this file, the neo4j-shell fail with the following error :

Invalid input 'E': expected Digit, whitespace, '.', node labels, '[', "=~", IN, IS, '*', '/', '%', '^', '+', '-', '<', '>', "<=", ">=", '=', "<>", "!=", AND, XOR, OR, ',' or '}' (line 167, column 153)
"create (_30015:`organization`:`fr` {`capital`:1.43524185E8, })"
                                                         ^
    at org.neo4j.cypher.internal.compiler.v2_0.parser.CypherParser$$anonfun$parse$1.apply(CypherParser.scala:53)
    at org.neo4j.cypher.internal.compiler.v2_0.parser.CypherParser$$anonfun$parse$1.apply(CypherParser.scala:43)

似乎Double类型没有正确解析.

It seem Double type are not correctly parsed.

用于转储数据库的命令:

Command used for dumping the db :

$ neo4j-shell -c "dump" > ito3.graph

用于导入它们的命令(在一个空的graph.db中):

Command used to import them (in an empty graph.db) :

$ neo4j-shell -file ito3.graph

受影响的属性的详细信息:

Detail of affected properties :

neo4j-sh (__value_deleted__,30015)$ ls -v
...
*capital                  =[1.43524185E8] (double)     
...

推荐答案

通常,在Java中,科学计数法不会解析为双精度. 这里是一个相关的论坛帖子,描述了如何使用DecimalFormat来解决问题.

In java generally, scientific notation numbers don't parse to doubles. Here's a related forum posting describing how to use DecimalFormat to fix the issue.

我认为最重要的是,您给cypher的不是双精度字,而是字符串,并且由于您没有在字符串周围加上引号,所以它快要死了.您需要在此处提供有效的数字格式.

I think the bottom line is that what you're giving cypher isn't a double, but a string, and since you're not putting quotes around the string, it's dying. You need to give it a valid numeric format there.

这篇关于Neo4j 2.0转储与双类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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