What import do i need for inV() and hasID() in gremlin groovy (3.0.1-incubating) -
i'm trying property value of edge given source , dest vertex ids, , edge label.
in gremlin terminal following worked:
g.v("fromnodeid").oute("edgelabel").where(inv().hasid("tonodeid")).values("edgeprop")
sadly, in groovy, inv() , hasid() aren't recognized, , can't find correct import work.
here imports iv'e tried:
import org.apache.commons.configuration.configuration; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.graphtraversalsource import org.apache.tinkerpop.gremlin.process.* import org.apache.tinkerpop.gremlin.groovy.* import org.apache.tinkerpop.gremlin.groovy.function.* import org.apache.tinkerpop.gremlin.groovy.util.* import org.apache.tinkerpop.gremlin.pipes.filter.* import org.apache.tinkerpop.gremlin.structure.edge import org.apache.tinkerpop.gremlin.structure.vertex import org.apache.tinkerpop.gremlin.structure.edgetest; import org.apache.tinkerpop.gremlin.structure.graph
i'll note other queries s.a. following work fine:
string getpropvaluebyid(long id, string prop){ def result = [] **g.v(id).values(prop).fill(result)** if(result.empty) return null return result.first() }
this described in tinkerpop3 documentation
to reduce verbosity of expression,
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*
. way, instead of doing__.ine()
anonymous traversal, possible writeine()
. aware of language-specific reserved keywords when using anonymous traversals. example, in , reserved keywords in groovy, therefore must use verbose syntax__.in()
,__.as()
avoid collisions.
Comments
Post a Comment