问题描述
我有一个相当简单的图表,但需要注意的是,所有边都标有作为时间戳存储的“to”和“from”日期。
我正在尝试编写一个遍历,该遍历只会遵循与第一个遍历边的 To 和 From 日期重叠的边。
请注意,To-date 可以不存在,表示边缘仍然处于活动状态。
我尝试了各种方法,但迄今为止最接近的是:
g.V('1').outE().as('firstEdge')
.sideEffect(values('To').store('eTo'))
.sideEffect(values('From').store('eFrom'))
.outV()
.repeat(outE().where(
lte('firstEdge')).by('From') // The edge has a from-date less than firstEdge's from-date.
.and(
or(
hasNot('To'),// The edge is still active,OR
has('To',gte('eFrom')) // the edge has a to date after the firstEdge's from-date.
)
)
.and(
or(
select('firstEdge').hasNot('To'),// The first edge does not have a to-date,OR
has('From',lte('eTo')) // The edge has a from date that is less than the first edge's to-date.
)
)
.inV()
)
.emit()
.times(2) // Limit to two edges away.
.where(hasLabel('Person'))
我很确定问题与存储命令和后续使用有关,因为以下查询也不返回任何内容(它应该返回在第一个边之后创建的任何非活动边)。
g.V('1').outE('is_board')
.sideEffect(values('From').store('eFrom'))
.outV()
.repeat(outE().has('To',gte('eFrom')).inV())
.emit()
.times(2)
.where(hasLabel('Person'))
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)