Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

resource

Germlin core steps

来自TinkerPop Documentation (apache.org) graph-traversal-steps

As Step

provide a label to the step that can later be accessed by steps and data structures

AddEdge Step

https://tinkerpop.apache.org/docs/3.5.3/reference/#addedge-step

add edge

eg: Add co-developer edge with a year-property between marko and his collaborators.

gremlin> 
g.V(1).as('a').out('created').in('created').where(neq('a')).addE('co-developer').from('a').property('year',2009) 
==>e[13][1-co-developer->4]
==>e[14][1-co-developer->6]

Graph Step (V E)

read vertices, V(), or edges, E(), from the graph

Has Step

https://tinkerpop.apache.org/docs/3.5.3/reference/#has-step

filter vertices, edges, and vertex properties based on their properties

Select Step

https://tinkerpop.apache.org/docs/3.5.3/reference/#select-step

select() select an element based on

  • a/many static key
  • a traversal that emits a key

eg: a static key

gremlin> g.V().out().out()
==>v[5]
==>v[3]
gremlin> g.V().out().out().path()
==>[v[1],v[4],v[5]]
==>[v[1],v[4],v[3]]
gremlin> g.V().as('x').out().out().select('x')
==>v[1]
==>v[1]
gremlin> g.V().out().as('x').out().select('x')
==>v[4]
==>v[4]
gremlin> g.V().out().out().as('x').select('x') // pointless
==>v[5]
==>v[3]

eg: many static keys

gremlin> g.V().as('a').out().as('b').out().as('c').select('a','b','c')
==>[a:v[1],b:v[4],c:v[5]]
==>[a:v[1],b:v[4],c:v[3]]

评论