This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gremlin> g = TinkerFactory.createClassic() | |
| ==>tinkergraph[vertices:6 edges:6] | |
| gremlin> g.V.out.out.match('a', | |
| gremlin> g.of().as('b').out('created').as('a'), | |
| gremlin> g.of().as('a').in('knows').as('b')) | |
| The provided traversal set contains a cycle due to 'a' | |
| Display stack trace? [yN] | |
| gremlin> 1+2 | |
| gremlin> 1+2 | |
| groovysh_parse: 5: expecting ')', found '1' @ line 5, column 1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gremlin> g.V.match('a', | |
| gremlin> g.of().as('a').out('created').has('name','lop').as('b'), | |
| gremlin> g.of().as('b').in('created').has('age', 29).as('c')).select{it.value('name')} | |
| ==>[a:marko, b:lop, c:marko] | |
| ==>[a:josh, b:lop, c:marko] | |
| ==>[a:peter, b:lop, c:marko] | |
| gremlin> | |
| gremlin> | |
| gremlin> | |
| gremlin> g.V.match('a', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| g.V.as('x').both.groupCount('m'){it.value('name')}.jump('x',10).cap('m') | |
| OR | |
| g.V.as('x').both.groupCount{it.value('name')}.as('m').jump('x',10).cap('m') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gremlin> g = TinkerGraphFactory.createTinkerGraph() | |
| ==>tinkergraph[vertices:6 edges:6] | |
| gremlin> myVertices = g.v(1,2,3).toList() // here are my vertices as a collection | |
| ==>v[1] | |
| ==>v[2] | |
| ==>v[3] | |
| gremlin> myVertices._().out // what are the adjacent vertices to this collection? | |
| ==>v[2] | |
| ==>v[4] | |
| ==>v[3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Testing: [Neo4jGraphStep@x, VertexStep(OUT), GroupCountStep@a, JumpStep(x,2), SideEffectCapStep(a)] | |
| [Neo4jGraphStep@x, VertexStep(OUT), GroupCountStep@a, VertexStep(OUT), GroupCountStep@a, SideEffectCapStep(a)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @author Marko A. Rodriguez (http://markorodriguez.com) | |
| */ | |
| public class GraphComputerTest extends AbstractGremlinTest { | |
| @Test | |
| public void shouldComputeSomeBusiness() { | |
| // temporary placetraverser as the test previously in here has been moved to FeatureSupportTest. | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GraphComputerTest extends AbstractGremlinTest { | |
| @Test | |
| @FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_COMPUTER) | |
| public void shouldHaveStandardStringRepresentation() { | |
| final GraphComputer computer = g.compute(); | |
| assertEquals(StringFactory.computerString(computer), computer.toString()); | |
| } | |
| @Test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gremlin> result = g.compute().program(LambdaVertexProgram.build(). | |
| gremlin> execute(new GSTriConsumer("a.property('counter', c.isInitialIteration() ? 1 : ++a.value('counter'))")). | |
| gremlin> terminate(new GSPredicate('a.iteration > 9')). | |
| gremlin> elementComputeKeys('counter',VARIABLE).create()).submit().get() | |
| ==>result[tinkergraph[vertices:6 edges:6],sideEffects[size:0]] | |
| gremlin> result.graph.V.counter | |
| ==>10 | |
| ==>10 | |
| ==>10 | |
| ==>10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.tinkerpop.gremlin.structure.strategy; | |
| import com.tinkerpop.gremlin.AbstractGremlinTest; | |
| import com.tinkerpop.gremlin.LoadGraphWith; | |
| import com.tinkerpop.gremlin.structure.Edge; | |
| import com.tinkerpop.gremlin.structure.Vertex; | |
| import org.junit.Test; | |
| import java.util.NoSuchElementException; | |
| import java.util.function.Predicate; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ~/software/tinkerpop/tinkerpop3/gremlin-console/target/gremlin-console-3.0.0-SNAPSHOT-standalone$ bin/gremlin.sh | |
| \,,,/ | |
| (o o) | |
| -----oOOo-(3)-oOOo----- | |
| plugin activated: server | |
| plugin activated: utilities | |
| gremlin> :install com.tinkerpop giraph-gremlin 3.0.0-SNAPSHOT==>loaded: [com.tinkerpop, giraph-gremlin, 3.0.0-SNAPSHOT] - restart the console to use [giraph] | |
| gremlin> :q | |
| ~/software/tinkerpop/tinkerpop3/gremlin-console/target/gremlin-console-3.0.0-SNAPSHOT-standalone$ bin/gremlin.sh |