Skip to content

Instantly share code, notes, and snippets.

@okram
Last active August 29, 2015 14:04
Show Gist options
  • Save okram/35dabdeeaecacee55fbe to your computer and use it in GitHub Desktop.
Save okram/35dabdeeaecacee55fbe to your computer and use it in GitHub Desktop.
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',
gremlin> g.of().as('a').out('created').has('name','lop').as('b'),
gremlin> g.of().as('b').in('created').has('age', 29).as('c'),
gremlin> g.of().as('c').out().jump('c'){it.loops < 2}).select{it.value('name')}
==>[a:marko, b:lop, c:marko]
==>[a:marko, b:lop, c:marko]
==>[a:josh, b:lop, c:marko]
==>[a:josh, b:lop, c:marko]
==>[a:peter, b:lop, c:marko]
==>[a:peter, b:lop, c:marko]
gremlin>
gremlin>
gremlin>
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'),
gremlin> g.of().as('c').out().jump('c'){it.loops < 2}.as('d')).select{it.value('name')}
==>[a:marko, b:lop, c:marko, d:ripple]
==>[a:marko, b:lop, c:marko, d:lop]
==>[a:josh, b:lop, c:marko, d:ripple]
==>[a:josh, b:lop, c:marko, d:lop]
==>[a:peter, b:lop, c:marko, d:ripple]
==>[a:peter, b:lop, c:marko, d:lop]
gremlin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment