Gremlin CosmosDB 尝试从节点列表中查询节点列表并将两者都返回

Gremlin CosmosDB trying to query for a list of nodes from a list of nodes and give both back

graph image

enter code here
(Query to find owner)
.inE().hasLabel('OwnedBy').outV().not(inE().hasLabel('AssignedTo').has('Status', 'InUse'))
.not(
inE()
.hasLabel('AssignedTo')
.has('Status', 'InUse')
).as('cards')

.inE()
.hasLabel('AssignedTo')
.has('Status', 'FutureUse')
.as('OwnedByRequestEdges')

.outV()
.as('OwnedByRequests')

.Select('card', 'OwnedByRequests', 'OwnedByRequestEdges', 'Owner')

我真的希望它能给我一张卡片列表和请求列表。

我的用户可以有多张卡,卡可以有多个未来的预订。

为了在遍历过程中存储所有的值,你应该使用"store"而不是"as"。

因为要"select"到运行一次,所以需要在前面加上fold()

有一个冗余 "not" 过滤器(同一个过滤器)。

(Query to find owner)
.inE().hasLabel('OwnedBy').outV()
.not(inE().hasLabel('AssignedTo').has('Status','InUse'))
.store('Cards')
.inE().hasLabel('AssignedTo').has('Status', 'FutureUse').outV()
.store('OwnedByRequests')
.fold()
.select('Cards', 'OwnedByRequests')