英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论