Skip to content

Instantly share code, notes, and snippets.

@spmallette
Last active October 21, 2019 23:48
Show Gist options
  • Save spmallette/c4b1feb1f63347dd22358157afc60ba2 to your computer and use it in GitHub Desktop.
Save spmallette/c4b1feb1f63347dd22358157afc60ba2 to your computer and use it in GitHub Desktop.
Gremlin.version()
g = TinkerGraph.open().traversal()
g.addV('bolt').property(set,'xyz','1-1-1').property(set,'xy','1-1').property('val', 12).as('A').
addV('bolt').property(set,'xyz','2-1-2').property(set,'xyz','3-1-1').property(set,'xy','2-1').property(set, 'xy','3-1').property('val', 10).as('B').
addV('bolt').property(set,'xyz','3-1-2').property(set,'xy','3-1').property('val', 15).as('C').
addV('bolt').property(set,'xyz','2-1-1').property(set,'xy','2-1').property('val', 5).as('D').
addE('link').from('A').to('B').
addE('link').from('A').to('C').
addE('link').from('A').to('D').
addE('link').from('B').to('A').
addE('link').from('C').to('A').
addE('link').from('C').to('D').
addE('link').from('D').to('A').
addE('link').from('D').to('C').iterate()
g.V().has('xyz', '1-1-1').property(set, 'xy', '2-1').iterate()
g.V().has('xyz', '1-1-1').as('a').
out().
filter(map(values('xy').fold()).as('b').
select('a').values('xy').
where(within('b'))).
valueMap(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment