Created
December 6, 2011 23:46
-
-
Save espeed/1440650 to your computer and use it in GitHub Desktop.
Gremlin: Create Automatic Indexed Vertex
This file contains 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
import groovy.json.JsonSlurper | |
def slurper = new JsonSlurper() | |
data = slurper.parseText('{"age":34,"name":"James"}') | |
elementIndex = g.idx('people') | |
verticesIndex = g.idx('vertices') | |
g.setMaxBufferSize(0) | |
g.startTransaction() | |
vertex = g.addVertex(data) | |
AutomaticIndexHelper.addElement(elementIndex,vertex) | |
AutomaticIndexHelper.addElement(verticesIndex,vertex) | |
g.stopTransaction(TransactionalGraph.Conclusion.SUCCESS) | |
return vertex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment