gremlin - When is it appropriate to use g.query()...vertex() vs g.V.has() -
i'm little confused one. several similar examples can found throughout documentation. such :
g.v.has('name','hercules').next() g.query().has("name",equal,"hercules").vertices()
could clarify difference in process between 2 above?
thanks
the first gremlin-groovy syntax:
g.v.has('name','hercules').next()
and either iterates vertices looking vertices have "name" property value of "hercules". in event "name" indexed titan utilize index avoid linear scan find such vertices.
the second java , titan api. above gremlin-groovy code compiles down second statement:
g.query().has("name",equal,"hercules").vertices()
however, in case of second statement returns iterator of vertices match filter , doesn't pop off first 1 shown in gremlin statement (given use of next()).
Comments
Post a Comment