Search code examples
gremlintinkerpopazure-cosmosdb-gremlinapi

Which symbols are forbidden for Gremlin vertex label name?


I am stuck on searching this info. Are there any forbidden symbols for creating vertex labels in gremlin?

Especially, I am interested if label name with spaces and brackets like g.addV("New node (1)") is valid?

I'm using gremlin with tinkerpop and Cosmos DB

Thanks in advance


Solution

  • From a TinkerPop/Gremlin perspective it is best to avoid keys and labels that start with a tilda (~) as that prefix has special meaning in some cases. By convention it is also best to avoid "id" and "label" as key names as they are easily confused with T.id and T.label. As for CosmosDB in particular, I'm not aware of any particular character limitations on the vertex label (I base that on this question/answer which I happened to recall coming across a while ago), however with graphs in the TinkerPop-space the general convention tends to be a simple Pascal case without special characters.