【发布时间】:2020-12-29 23:07:09
【问题描述】:
我有一个 Person 对象,我正在将其写入如下图:
gts.addV(newId).label('Person')
.property(single, 'name', 'Alice')
.property(set, 'email', 'alice1@example.invalid')
.property(set, 'email', 'alice2@example.invalid')
现在我想检索顶点的内容。如文档所述,elementMap 不起作用,因为它只为多属性返回一个属性值。我尝试了values('name', 'email'),但它返回了扁平列表中的所有属性,而不是我期望的嵌套结构:
['Alice', 'alice2@example.invalid', 'alice1@example.invalid']
我尝试了 values、project 和 as/select 的各种组合,但我总是得到一个空结果、一个平面列表或多属性上的单个值。
我如何查询一个顶点,以便得到类似这样的结果?
['Alice', ['alice2@example.invalid', 'alice1@example.invalid']]
或
[name:'Alice', email:['alice2@example.invalid', 'alice1@example.invalid']]
【问题讨论】: