【发布时间】:2018-09-27 03:28:11
【问题描述】:
示例图:
g.addV('location').property('name','Location A').as('location')
.addV('building').property('totalLetterCapacity',50).as('building')
.sideEffect(addE('has-building').from('location'))
.addV('letter').property('totalLetters',10).as('a')
.sideEffect(addE('has-letter').from('building'))
.addV('letter').property('totalLetters',10).as('b')
.sideEffect(addE('has-letter').from('building'))
.addV('letter').property('totalLetters',10).as('c')
.sideEffect(addE('has-letter').from('building'))
.addV('letter').property('totalLetters',10).as('d')
.sideEffect(addE('has-letter').from('building'))
.addV('letter').property('totalLetters',10).as('e')
.sideEffect(addE('has-letter').from('building'))
在这个示例图中,我想获取所有满是字母的建筑物。因此,在此示例图中,只有一个位置确实满足要求 - 总共有 50 个字母容量和 5 个具有 10 个容量的字母连接到建筑物。
我希望这样的事情会奏效:
g.V().hasLabel('location')
.out('has-building')
.where(values('totalLetterCapacity')
.is(eq(out('has-letter').values('totalLetters').sum())
但似乎 eq 谓词或任何谓词(lte、lt、gte)不允许遍历。我尝试做某种双重 where 子句 - where 中的 where,但最终变得有点疯狂。
我正在使用 azure cosmos db gremlin。在遍历中使用属性作为总和比较的正确方法是什么?
【问题讨论】: