在neo4j WITH语句中使用数组元素

时间:2016-02-13 22:05:42

标签: neo4j

我想从JSON将数据加载到Neo4j中。对于我的:Timeline节点,我需要从id数组属性的第一个元素的events属性计算一个id。

with {json} as data, {json}.service + {json}.events[0].id as timelineId
merge (timeline:Timeline { id: timelineId })
on create set timeline.responseTime = data.responseTime

但是我收到错误:

neo4j.ClientError: [Neo.ClientError.Statement.InvalidSyntax] Invalid input '.': expected whitespace, '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, AS, ',', ORDER, SKIP, LIMIT, WHERE, LOAD CSV, START, MATCH, UNWIND, MERGE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, RETURN, UNION, ';' or end of input (line 1, column 55 (offset: 54)) "with {json} as data, {json}.service + {json}.events[0].id as timelineId"

1 个答案:

答案 0 :(得分:0)

可能只是操作员优先,

你可以尝试

吗?
with {json} as data, {json}.service + ({json}.events[0]).id as timelineId
merge (timeline:Timeline { id: timelineId })
on create set timeline.responseTime = data.responseTime