Skip to content

Update tinkerpop dependency to 3.6.x #447

@odbuser2

Description

@odbuser2

ArcadeDB Version: 22.6.1

JDK Version: any

OS: any

Expected behavior

arcaded-gremlin should compile with tinkerpop 3.6.0 should compile (well, not really since I assume arcadedb is tracking tp 3.5.x not 3.6.x at the moment). This is necessary to support the very useful gremlin mergeV and mergeE steps (introduced in 3.6.0).

Actual behavior

Compilation fails with:

org/apache/tinkerpop/gremlin/arcadedb/structure/ArcadeGraph.java:[218,43] cannot find symbol
  symbol:   method idArgsMustBeEitherIdOrElement()
  location: class org.apache.tinkerpop.gremlin.structure.Graph.Exceptions
org/apache/tinkerpop/gremlin/arcadedb/structure/ArcadeGraph.java:[221,18] cannot find symbol
  symbol:   method validateMixedElementIds(java.lang.Class<org.apache.tinkerpop.gremlin.structure.Vertex>,java.lang.Object[])
  location: class org.apache.tinkerpop.gremlin.structure.util.ElementHelper
org/apache/tinkerpop/gremlin/arcadedb/structure/ArcadeGraph.java:[285,18] cannot find symbol
  symbol:   method validateMixedElementIds(java.lang.Class<org.apache.tinkerpop.gremlin.structure.Vertex>,java.lang.Object[])
  location: class org.apache.tinkerpop.gremlin.structure.util.ElementHelper
3 errors 

Steps to reproduce

Checkout tag 22.6.1
cd arcadedb-gremlin
mvn clean build

Possible fix

The logic for validating vertex and edge arguments was removed from tinkerpop 3.6.0. I haven't tracked down the reason. It may have been an accidental removal when they did a large merge or it was removed on purpose with no replacement. But the following can be done to fix it on the arcadedb side:

Move the logic that was in tinkerpop 3.5.x to arcadedb-gremlin

Replace pom.xml:[37] with

        <gremlin.version>3.6.0</gremlin.version>

Replace org/apache/tinkerpop/gremlin/arcadedb/structure/ArcadeGraph.java:[218,43] with:

throw new IllegalArgumentException("id arguments must be either ids or Elements");

Replace org/apache/tinkerpop/gremlin/arcadedb/structure/ArcadeGraph.java:[221,18] with:

    if (vertexIds.length > 1) {
        final boolean element = Vertex.class.isAssignableFrom(vertexIds[0].getClass());
        for (int i = 1; i < vertexIds.length; i++) {
            if (Vertex.class.isAssignableFrom(vertexIds[i].getClass()) != element)
                throw new IllegalArgumentException("id arguments must be either ids or Elements");
        }
    }

Replace org/apache/tinkerpop/gremlin/arcadedb/structure/ArcadeGraph.java:[285,18] with:

    if (edgeIds.length > 1) {
        final boolean element = Vertex.class.isAssignableFrom(edgeIds[0].getClass());
        for (int i = 1; i < edgeIds.length; i++) {
            if (Vertex.class.isAssignableFrom(edgeIds[i].getClass()) != element)
                throw new IllegalArgumentException("id arguments must be either ids or Elements");
        }
    }

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions