Skip to content

Instantly share code, notes, and snippets.

@spmallette
Last active August 29, 2015 14:01
Show Gist options
  • Save spmallette/305b980a70a1f2cd9c74 to your computer and use it in GitHub Desktop.
Save spmallette/305b980a70a1f2cd9c74 to your computer and use it in GitHub Desktop.
Latest TP3 API
gremlin> g = TinkerFactory.createClassic()
==>tinkergraph[vertices:6 edges:6]
gremlin> g.v(1).properties
==>class=class com.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex
gremlin> g.v(1).properties()
==>name=p[name->marko]
==>age=p[age->29]
gremlin> g.v(1).values
==>name=marko
==>age=29
gremlin> g.v(1).values()
==>name=marko
==>age=29
gremlin> g.v(1).property('name')
==>p[name->marko]
gremlin> g.e(9).inV()
==>v[3]
gremlin> g.e(9).outV()
==>v[1]
gremlin> g.e(9).bothV()
==>v[1]
==>v[3]
gremlin> g.e(9).bothV().name
==>marko
==>lop
gremlin> g.e(9).aggregate('e').bothV().bothE.except('e')
==>e[7][1-knows->2]
==>e[8][1-knows->4]
==>e[11][4-created->3]
==>e[12][6-created->3]
gremlin> v = g.addVertex()
==>v[0]
gremlin> v.properties("name","willis","age",12)
==>null
gremlin> v.property(Property.hidden('xxx'), "1C33DX8I")
==>p[xxx->1C33DX8I]
gremlin> v.properties()
==>name=p[name->willis]
==>age=p[age->12]
gremlin> v.hiddens()
==>xxx=p[xxx->1C33DX8I]
gremlin> v.values()
==>name=willis
==>age=12
gremlin> v.keys()
==>name
==>age
gremlin> v.hiddenKeys()
==>xxx
gremlin> v.id()
==>0
gremlin> g.e(9).label
==>created
gremlin> g.v(1).outE.label
==>created
==>knows
==>knows
gremlin> g.v(1).out.out.id
==>5
==>3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment