Skip to content

Instantly share code, notes, and snippets.

@espeed
Created December 10, 2011 00:21
Show Gist options
  • Save espeed/1453966 to your computer and use it in GitHub Desktop.
Save espeed/1453966 to your computer and use it in GitHub Desktop.
Gremlin Script Engine Request
POST url: http://localhost:7474/db/data/ext/GremlinPlugin/graphdb/execute_script
POST body: {"params":{"keys":["name"],"index_name":"test_idxV","data":{"age":34,"name":"James Thornton"}},"script":"manager = g.getRawGraph().index()\nindex = manager.forNodes(index_name)\ng.setMaxBufferSize(0)\ng.startTransaction()\nvertex = g.getRawGraph().createNode()\nfor (entry in data.entrySet()) {\n if (entry.value == null) continue;\n vertex.setProperty(entry.key,entry.value)\n if (keys == null || keys.contains(entry.key))\n index.add(vertex,entry.key,entry.value)\n}\ng.stopTransaction(TransactionalGraph.Conclusion.SUCCESS)\nreturn vertex\n"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment