0

我有一个图,其中有两个顶点的 id(s) 'a' 和 'b'。

小鬼> gV()

==>v[b]

==>v[a]

从“a”到“b”有两条边。

小鬼> gE()

==>e[a6b4bead-c161-5a61-d232-abfa2bfad54e][a-LIKES->b]

==>e[10b4bead-a0fc-8d2c-d69f-26b3e9e4c5d8][a-KNOWS->b]

gremlin> gE().valueMap(true)

==>{id=a6b4bead-c161-5a61-d232-abfa2bfad54e,语义=社交,标签=喜欢}

==>{id=10b4bead-a0fc-8d2c-d69f-26b3e9e4c5d8,语义=社交,标签=知道}

我的问题:给定一个边的 id,我想为属性“语义”找到具有相同值的所有其他边。例如,给定 a.LIKES.id,我想执行一个查询,该查询将使用值 a.LIKES.semantics 返回 a.KNOWS。

我开始:

gE('a6b4bead-c161-5a61-d232-abfa2bfad54e') .property('semantics').as('semantics')...这就是我卡住的地方

谢谢,乔尔

4

1 回答 1

3

where()by()调制器一起完成这项工作:

g.E('a6b4bead-c161-5a61-d232-abfa2bfad54e').as('e').
  outV().inE().
  where(eq('e')).by('semantics'). // return edges with the same semantics property value
  where(neq('e'))                 // ... except the one we started with
于 2019-03-14T20:48:09.470 回答