I want to create a vertex with a given label and some properties. Since the g.addVertexWithLabel()
method only takes the label as an argument and I cannot find any v.addLabel()
method, it seems that I have to add the properties one by one after creating the vertex.
Or am I missing something here?
No. As of Titan 0.5.4, there is no API that allows you to add it all at once. In fact, even the Gremlin Groovy sugar of:
g.addVertex([name:"stephen"])
just calls Element.setProperty(k,v)
for each key/value pair in the Map
. In TinkerPop3 and Titan 0.9/1.0, you can do:
g.addVertex(T.label,"person","name","stephen")
so it is a bit nicer assuming you are using the newer version.