i using gremlin 2.5.0 / groovy 2.3.7.
i have hashmap contains key-value pairs of parameters/values want filter. example, have
[param1:val1, param2:val2:, param3:val] the type of query want make is:
g.v.filter{it.param1=='val1' && it.param2=='val2' && it.param3=='val3'} is there straightforward gremlin/groovy way of using hashmap make query?
you should avoid use of filter in gremlin when possible, titan , on large scale graphs. use of filter prevent titan making proper use of indices. should prefer use of has when possible.
i attempt build pipeline map:
gremlin> g = tinkergraphfactory.createtinkergraph() ==>tinkergraph[vertices:6 edges:6] gremlin> params = [name:'josh',age:32] ==>name=josh ==>age=32 gremlin> pipeline = g.v();null ==>null gremlin> params.each{k,v->pipeline=pipeline.has(k,v)} ==>name=josh ==>age=32 gremlin> pipeline ==>v[4]
Comments
Post a Comment