Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1587

Gremlin Server Subgraph Cardinality Not Respected

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.3
    • Fix Version/s: 3.2.4
    • Component/s: io
    • Labels:
      None

      Description

      The subgraph traversal step does not respect the cardinality of properties when executed on a graph remotely accessed from Gremlin Server. When queried, only one value of a multi-value property is returned. The following Java-based traversal illustrates the issue on The Crew graph. Below g is a Graph Traversal Source created using the withRemote() method on the EmptyGraph.

      GraphTraversal<Edge, Object> traversal =g.E().hasLabel("develops").subgraph("subgraph").cap("subgraph");
      
      TinkerGraph subgraph = (TinkerGraph)traversal.next();
      GraphTraversalSource sg = subgraph.traversal();
      
      GraphTraversal<Vertex, Object> locationTraversal = sg.V(1L).values("location");
      while (locationTraversal.hasNext()) {
          System.out.println(locationTraversal.next());
      }
      

      This traversal should return four locations

       {id=1, name=[marko], location=[san diego, santa cruz, brussels, santa fe], label=person} 

      however it only returns santa fe.

        Activity

        Show
        spmallette stephen mallette added a comment - Fixed with https://github.com/apache/tinkerpop/commit/cc918df4e56d468c56e7e0f3ef1aba49c207b03b
        Hide
        spmallette stephen mallette added a comment -

        I tried a bunch of things with this and the only one that ended up making sense was to default the instantiated TinkerGraph with default cardinality of list. I can't think of any reason why this is a bad approach and should only cause trouble if you were mutating the subgraph after it was returned from Gremlin Server and expected the default of property(k,v) to be single and ended up with list instead. The obvious fix would be to specify Cardinality when setting the property.

        I will give it some more thought over night and will likely push the fix tomorrow as CTR as it is a very small change.

        Show
        spmallette stephen mallette added a comment - I tried a bunch of things with this and the only one that ended up making sense was to default the instantiated TinkerGraph with default cardinality of list . I can't think of any reason why this is a bad approach and should only cause trouble if you were mutating the subgraph after it was returned from Gremlin Server and expected the default of property(k,v) to be single and ended up with list instead. The obvious fix would be to specify Cardinality when setting the property. I will give it some more thought over night and will likely push the fix tomorrow as CTR as it is a very small change.
        Hide
        spmallette stephen mallette added a comment -

        I just became aware of this myself last week while doing TINKERPOP-1130 - it's not clear what the fix will be yet.

        Show
        spmallette stephen mallette added a comment - I just became aware of this myself last week while doing TINKERPOP-1130 - it's not clear what the fix will be yet.

          People

          • Assignee:
            spmallette stephen mallette
            Reporter:
            HowIDoozitLarry Michael Margitus
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development