Gremlin 查询 return 所有边缘属性以及进出
Gremlin query to return all edge properties and also inV and outV
在新的 ReferenceElementStrategy 默认设置之前,Gremlin 查询 g.E()
将 return 边缘 ID、标签、inV、outV 和所有属性。在启用 ReferenceElementStrategy 的情况下,我应该使用什么查询来 return 相同的数据? g.E().valueMap().with(WithOptions.tokens).by(unfold())
return 除了 inV 和 outV 之外的所有内容。
目前答案是project()
:
gremlin> g.E(12).union(valueMap(true),
......1> project('inV','outV','inVLabel','outVLabel').
......2> by(inV().id()).
......3> by(outV().id()).
......4> by(inV().label()).
......5> by(outV().label())).unfold().
......6> group().
......7> by(keys).
......8> by(select(values))
==>[inV:3,id:12,inVLabel:software,weight:0.2,outVLabel:person,label:created,outV:6]
但对于 3.4.4 的下一个版本,它将是 elementMap()
:
gremlin> g.E(11).elementMap()
==>[id:11,label:created,IN:[id:3,label:software],OUT:[id:4,label:person],weight:0.4]
在新的 ReferenceElementStrategy 默认设置之前,Gremlin 查询 g.E()
将 return 边缘 ID、标签、inV、outV 和所有属性。在启用 ReferenceElementStrategy 的情况下,我应该使用什么查询来 return 相同的数据? g.E().valueMap().with(WithOptions.tokens).by(unfold())
return 除了 inV 和 outV 之外的所有内容。
目前答案是project()
:
gremlin> g.E(12).union(valueMap(true),
......1> project('inV','outV','inVLabel','outVLabel').
......2> by(inV().id()).
......3> by(outV().id()).
......4> by(inV().label()).
......5> by(outV().label())).unfold().
......6> group().
......7> by(keys).
......8> by(select(values))
==>[inV:3,id:12,inVLabel:software,weight:0.2,outVLabel:person,label:created,outV:6]
但对于 3.4.4 的下一个版本,它将是 elementMap()
:
gremlin> g.E(11).elementMap()
==>[id:11,label:created,IN:[id:3,label:software],OUT:[id:4,label:person],weight:0.4]