非常感谢,它与这些导入运行良好:
import org.apache.tinkerpop.gremlin.tinkergraph.structure.*
import org.apache.tinkerpop.gremlin.groovy.loaders.*
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*
import static org.apache.tinkerpop.gremlin.process.traversal.P.*
import static org.apache.tinkerpop.gremlin.process.traversal.Order.*
GremlinLoader.load()
SugarLoader.load()
def graph = TinkerFactory.createModern()
def g = graph.traversal()
def results = []
def v4=g.V(4).next()
def v6=g.V(6).next()
v4.addEdge("knows", v6, "id" , 13, "weight", 0.4)
def subGraph = g.E().hasLabel('knows').subgraph('subGraph').cap('subGraph').next()
def sg = subGraph.traversal()
sg.E().fill(results)
println "sg.E() =>[e[7][1-knows->2], e[8][1-knows->4], e[12][4-knows->6]] ==>" + results
results = []
g.V(1).outE('knows').inV().values('name').fill(results)
println "g.V(1).outE('knows').inV().values('name') =>[vadas, josh] ==>" + results
results = []
g.V(4).outE('knows').inV().values('name').fill(results)
println "g.V(4).outE('knows').inV().values('name') =>[peter] ==>" + results
results = []
g.V(1).outE('knows').fill(results)
println "g.V(1).outE('knows') =>[e[7][1-knows->2], e[8][1-knows->4]] ==>" + results
results = []
g.V().has('name','marko').out('created').fill(results)
println "g.V(1).outE('knows') =>[v[3]] ==>" + results
results = []
g.V().has('name','marko').out('created').in('created').values('name').fill(results)
println "g.V().has('name','marko').out('created').in('created').values('name') =>[marko, josh, peter] ==>" + results
results = []
g.V().range(0, 2).fill(results)
println "g.V().range(0, 2) =>[v[1], v[2]] ==>" + results
results = []
g.V().values('name').order().fill(results)
println "g.V().values('name').order() =>[josh, lop, marko, peter, ripple, vadas] ==>" + results
results = []
g.V().values('name').order().tail().fill(results)
println "g.V().values('name').order().tail() =>[vadas] ==>" + results
results = []
g.V().hasLabel('person').fill(results)
println "g.V().hasLabel('person') =>[v[1], v[2], v[4], v[6]] ==>" + results
results = []
g.V().hasLabel('person').out().has('name','josh').fill(results) //
println "g.V().hasLabel('person').out().has('name','josh') =>[v[4]] ==>" + results
results = []
g.V().out('knows').map{it.get().value('name') + ' is the friend name'}.fill(results)
println "g.V().out('knows').map{it.get().value('name') + ' is the friend name'} =>[vadas is the friend name, josh is the friend name, peter is the friend name] ==>" + results
results = []
g.V().values('name').order().fill(results)
println "g.V().values('name').order() =>[josh, lop, marko, peter, ripple, vadas] ==>" + results
results = []
g.V().values('age').is(32).fill(results)
println "g.V().values('age').is(32) =>[32] ==>" + results
results = []
g.V().values('age').mean().fill(results)
println "g.V().values('age').mean() =>[30.75] ==>" + results
results = []
g.V(1).property('country','usa').fill(results)
println "g.V(1).property('country','usa') =>[v[1]] ==>" + results
results = []
g.V(1).out('created').aggregate('x').fill(results)
println "g.V(1).out('created').aggregate('x') =>[v[3]] ==>" + results
results = []
g.V().as('a').out('created').as('b').select('a','b').fill(results)
println "g.V().as('a').out('created').as('b').select('a','b') =>[[a:v[1], b:v[3]], [a:v[4], b:v[5]], [a:v[4], b:v[3]], [a:v[6], b:v[3]]] ==>" + results
results = []
g.V().hasLabel('person').count().fill(results)
println "g.V().hasLabel('person').count() =>[4] ==>" + results
results = []
g.V().coin(0.5).fill(results)
println "g.V().coin(0.5) =>some random vertices ==>" + results
results = []
g.withSack(1.0f).V().sack().fill(results)
println "g.withSack(1.0f).V().sack() =>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ==>" + results
results = []
g.V().outE().sample(1).values('weight').fill(results)
println "g.V().outE().sample(1).values('weight') =>[0.5] ==>" + results
results = []
g.V().values('age').sum().fill(results)
println "g.V().values('age').sum() =>[123] ==>" + results
results = []
g.V().as('a').both().both().as('b').count().fill(results)
println "g.V().as('a').both().both().as('b').count() =>[40] ==>" + results
results = []
g.V().as('a').both().both().as('b').where('a',neq('b')).count().fill(results)
println "g.V().as('a').both().both().as('b').where('a',neq('b')) =>[26] ==>" + results
results = []
g.V().hasLabel('person').out().has('name',within('vadas','josh')).fill(results)
println "g.V().hasLabel('person').out().has('name',within('vadas','josh')) =>[v[2], v[4]] ==>" + results
results = []
g.V().values('age').is(lte(30)).fill(results)
println "g.V().values('age').is(lte(30)) =>[29, 27] ==>" + results
results = []
g.V().group().by(bothE().count()).fill(results)
println "g.V().group().by(bothE().count()) =>[[1:[v[2], v[5]], 2:[v[6]], 3:[v[1], v[3]], 4:[v[4]]]] ==>" + results
results = []
g.V(1).repeat(out()).times(2).fill(results)
println "g.V(1).repeat(out()).times(2) =>[v[5], v[3], v[6]] ==>" + results
results = []
g.V(1).repeat(out()).times(2).path().by('name').fill(results)
println "g.V(1).repeat(out()).times(2).path().by('name') =>[[marko, josh, ripple], [marko, josh, lop], [marko, josh, peter]] ==>" + results
results = []
g.V(1).repeat(out().simplePath()).until(hasId(6)).path().limit(1).fill(results)
println "g.V(1).repeat(out().simplePath()).until(hasId(6)).path().limit(1) =>[[v[1], v[4], v[6]]] ==>" + results
results = []
g.V().until(has('name','ripple')).repeat(out()).fill(results)
println "g.V().until(has('name','ripple')).repeat(out()) =>[v[5], v[5], v[5]] ==>" + results
results = []
g.V().until(has('name','ripple')).repeat(out()).path().by('name').fill(results)
println "g.V().until(has('name','ripple')).repeat(out()).path().by('name') =>[[marko, josh, ripple], [josh, ripple], [ripple]] ==>" + results
results = []
g.V(1).until(has('name','josh')).repeat(out('knows')).path().by('name').fill(results)
println "g.V(1).until(has('name','josh')).repeat(out('knows')).path().by('name') =>[[marko, josh]] ==>" + results
results = []
g.V(1).until(outE('knows').count().is(0)).repeat(out('knows')).path().by('name').fill(results)
println "g.V(1).until(outE('knows').count().is(0)).repeat(out('knows')).path().by('name') =>[[marko, vadas], [marko, josh, peter]] ==>" + results
results = []
g.V(2).optional(out('knows')).fill(results)
println "g.V(1).optional(out('knows')) =>[v[2]] ==>" + results
results = []
g.V().where(outE('created').and().outE('knows')).values('name').fill(results)
println "g.V().where(outE('created').and().outE('knows')).values('name') =>[marko, josh] ==>" + results
results = []
g.V().values('name').order().by(decr).fill(results)
println "g.V().values('name').order().by(decr) =>[vadas, ripple, peter, marko, lop, josh] ==>" + results
results = []
g.V().hasLabel('person').order().by(shuffle).fill(results)
println "g.V().hasLabel('person').order().by(shuffle) =>some random order of v[1], v[2], v[4], v[6] ==>" + results
results = []