Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@espeed
Last active December 26, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save espeed/7174642 to your computer and use it in GitHub Desktop.
Save espeed/7174642 to your computer and use it in GitHub Desktop.
Bulbs/Rexster server-side Gremlin scripts example.
# Bulbs/Rexster server-side Gremlin script example.
# by James Thornton, http://jamesthornton.com
>>> from bulbs.rexster import Graph, DEBUG
>>> g = Graph()
>>> g.config.server_scripts = True
>>> g.config.set_logger(DEBUG)
>>> james = g.vertices.create(name="James")
POST url: http://localhost:8182/graphs/emptygraph/vertices
POST body: {"name":"James"}
>>> julie = g.vertices.create(name="Julie")
POST url: http://localhost:8182/graphs/emptygraph/vertices
POST body: {"name":"Julie"}
>>> g.edges.create(james, "knows", julie)
POST url: http://localhost:8182/graphs/emptygraph/edges
POST body: {"_label":"knows","_outV":471,"_inV":472}
<Edge: http://localhost:8182/graphs/emptygraph/edges/473>
>>> james.outV("knows")
POST url: http://localhost:8182/graphs/emptygraph/tp/gremlin
POST body: {"load":["gremlin"],"params":{"start":null,"_id":471,"limit":null,"label":"knows"},"script":"outV(_id, label, start, limit)"}
<generator object <genexpr> at 0x1de4140>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment