将一个数组插入Amazon Neptune中的节点属性,使用openCypher。

huangapple go评论51阅读模式
英文:

Insert an array into a node property in Amazon Neptune using openCypher

问题

我正在尝试使用openCypher将数组插入Amazon Neptune节点属性中。有没有办法使用openCypher来实现这个?

我尝试了以下查询:

MERGE (n:Test { name: 'test', colors : ['blue', 'yellow'] })

错误信息:
"detailedMessage": "Expected a simple literal but found List."

如果不支持,那么如果这个基本功能尚不可用,AWS如何发布它用于生产。

英文:

I am trying to insert an array into a node property in Amazon Neptune using openCypher. Is there a way to do this with openCypher ?

I have tried the following query :

MERGE (n:Test { name: 'test', colors : ['blue', 'yellow'] })

Error message :
"detailedMessage": "Expected a simple literal but found List."

If it's not supported how could AWS release it for production if this basic feature is not yet available.

答案1

得分: 0

海王星仅支持基于集合的数组属性,而这在openCypher规范中不受支持。

海王星确实支持与您希望通过split()join()函数实现的可比较功能,如此处所示:https://docs.aws.amazon.com/neptune/latest/userguide/migration-opencypher-rewrites.html#migration-opencypher-rewrites-lists

//用于写入数据
MERGE (n:Test { name: 'test', colors : 'blue, yellow'})

//用于读取数据
MATCH (n:Test)
WITH n, [tag IN split(n.colors, ',') WHERE NOT (color IN ['blue', 'yellow'])] AS colors
RETURN n
英文:

Neptune only supports Set-based array properties, which are not supported in openCypher specification.

Neptune does support comparable functionality to what you are looking to achieve through the split() and join() functions as shown here: https://docs.aws.amazon.com/neptune/latest/userguide/migration-opencypher-rewrites.html#migration-opencypher-rewrites-lists

//For writing data
MERGE (n:Test { name: 'test', colors : 'blue, yellow'})

//For reading data
MATCH (n:Test
    WITH n, [tag in split(n.colors, ',') WHERE NOT (color IN ['blue', 'yellow'])] AS colors
    RETURN n

huangapple
  • 本文由 发表于 2023年2月7日 01:54:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75364885.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定