Search code examples
orientdbgremlin

How to enable user supplied vertex id in OrientDb?


I am trying to understand if it is possible to have user supplied vertex ids?

I found this, but I am inexperienced in Java so I can't really understand this for sure. https://github.com/orientechnologies/orientdb-gremlin/blob/master/driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/OrientGraph.java#L177

For JanusGraph there is graph.set-vertex-id=true, but is there similar for OrientDb? Or with Tinkergraph gremlin.tinkergraph.vertexIdManager=ANY


Solution

  • OrientDb do not support user supplied vertex id, as you can tell it from the code: https://github.com/orientechnologies/orientdb-gremlin/blob/master/driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/OrientGraph.java#L182

    @Override
    public Vertex addVertex(Object... keyValues) {
        ...
            if (ElementHelper.getIdValue(keyValues).isPresent()) throw Vertex.Exceptions.userSuppliedIdsNotSupported();
    

    You can also tell it from the code of ODBFeatures, the implement of interface supportsUserSuppliedIds:

    https://github.com/orientechnologies/orientdb-gremlin/blob/master/driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/ODBFeatures.java