orientechnologies / orientdb-gremlin

TinkerPop3 Graph Structure Implementation for OrientDB
Apache License 2.0
91 stars 32 forks source link

[BUG/Feature] Light Weight Edge Support #121

Open du00cs opened 7 years ago

du00cs commented 7 years ago

The implementation now will fail if the edge is a lightweight edge. Some configuration of a lightweight flag should be introduced and traverse of edge should take it into consideration.

Some changes below seems work:

// OrientVertex.java, :65
if (fieldValue instanceof ORidBag) {
    if (graph.isLightWeightEdge()) { // light weight branch
        streamVertices.add(asStream(((ORidBag) fieldValue).rawIterator())
                .map(oIdentifiable -> new OrientVertex(graph, oIdentifiable)));
    } else { // original
        streamVertices.add(asStream(((ORidBag) fieldValue).rawIterator())
                .map(oIdentifiable -> new OrientEdge(graph, oIdentifiable.getRecord()))
                .map(edge -> edge.vertices(direction.opposite()))
                .flatMap(vertices -> asStream(vertices)));
    }
}

Any suggestion?