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

TraversalSource should be fluent like GraphComputer

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.0-incubating
    • 3.2.0-incubating
    • process

    Description

      I just realized something so obvious. TraversalSource should be fluent and not this awkward TraversalSource.Builder model we use. You should be able to do this:

      graph = GraphFactory.open(...)
      g = graph.traversal()
      g = g.withStrategy(MyStrategy.class)
      g = g.withSack(1.0,sum)
      ...
      g.V().out().sack()
      g.V().out().out().drop()
      

      Thus, TraversalSource methods return a TraversalSource.

      g = graph.traversal(computer(GiraphGraphComputer)).withStrategy(MyStrategy.class).withSack(1.0,sum).withBulk(false)
      

      That g is then "locked" with those parameterizations and any V()/addV()/etc. off of it will spawn traversal with that parameterization.

      This solves:
      TINKERPOP3-862
      TINKERPOP3-960 (makes more elegant)

      This would be backwards compatible. Though, deprecation would occur.

      Finally, DSLs are still respected.

      g = graph.traversal(SocialTraversal.class)
      

      A fleeting thought...

      g = graph.traversal().using(GiraphGraphComputer)
      g = graph.traversal().via(GremlinServerConnection).using(GiraphGraphComputer)
      

      So much cleaner than all that Builder-crap....

      Attachments

        Issue Links

          Activity

            People

              okram Marko A. Rodriguez
              okram Marko A. Rodriguez
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: