TinkerPop Gremlin服务器:3.3.3 远程客户端:v 3.3.3 似乎groovy闭包也应用于gremlin查询中的Property Name。这表示查询以仅与标签匹配的所有顶点进行响应。 当我申请以下查询时;我得到
gremlin> client.submit(“ gV()。hasLabel('XYZ')。filter {it.get()。property('SCOPE')。toString()。contains('SCOPE')}} “) ==>结果{object = v [352] class = org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex} ==>结果{object = v [325] class = org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex} ==>结果{object = v [267] class = org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex} ==>结果{object = v [306] class = org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex} ==>结果{object = v [371] class = org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex} ==>结果{object = v [248] class = org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex} ==>结果{object = v [287] class = org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex}
答案 0 :(得分:0)
我不清楚您要在此处完成什么,但是如果“ SCOPE”是所有这些返回顶点上的属性键,则filter()
可以正常工作。在“现代”玩具图的背景下考虑遍历:
gremlin> g.V().hasLabel('person').map{it.get().property('name').toString()}
==>vp[name->marko]
==>vp[name->vadas]
==>vp[name->josh]
==>vp[name->peter]
gremlin> g.V().hasLabel('person').filter{it.get().property('name').toString().contains('name')}
==>v[1]
==>v[2]
==>v[4]
==>v[6]
“名称”属性可用作所有这些折点上的键,因此它允许filter()
之后的所有“个人”折点。