You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2020/01/02 17:35:40 UTC

[tinkerpop] branch master updated (33c67ac -> 2e5d31b)

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.


    from 33c67ac  Merge branch 'tp34'
     add e396048  TINKERPOP-2315 Implement clone() for all GLVs
     new 7a2b41a  Merge branch 'TINKERPOP-2315' into tp33
     new b1d0ab3  Merge branch 'tp33' into tp34
     new 2e5d31b  Merge branch 'tp34'

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGELOG.asciidoc                                 |  1 +
 docs/src/upgrade/release-3.3.x.asciidoc            | 30 ++++++++++++++++++++++
 gremlin-dotnet/glv/GraphTraversal.template         |  8 ++++++
 .../Process/Traversal/GraphTraversal.cs            |  8 ++++++
 .../DriverRemoteConnection/GraphTraversalTests.cs  | 13 ++++++++++
 .../glv/GraphTraversalSource.template              |  8 ++++++
 .../lib/process/graph-traversal.js                 |  8 ++++++
 .../test/integration/traversal-test.js             | 14 ++++++++++
 gremlin-python/glv/GraphTraversalSource.template   |  3 +++
 .../gremlin_python/process/graph_traversal.py      |  3 +++
 .../tests/driver/test_driver_remote_connection.py  |  7 +++++
 11 files changed, 103 insertions(+)


[tinkerpop] 01/03: Merge branch 'TINKERPOP-2315' into tp33

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 7a2b41ad3a37d6e85b901d620a59745e2795144b
Merge: 062693d e396048
Author: stephen <sp...@gmail.com>
AuthorDate: Thu Jan 2 12:10:25 2020 -0500

    Merge branch 'TINKERPOP-2315' into tp33

 CHANGELOG.asciidoc                                 |  1 +
 docs/src/upgrade/release-3.3.x.asciidoc            | 30 ++++++++++++++++++++++
 gremlin-dotnet/glv/GraphTraversal.template         |  8 ++++++
 .../Process/Traversal/GraphTraversal.cs            |  8 ++++++
 .../DriverRemoteConnection/GraphTraversalTests.cs  | 13 ++++++++++
 .../glv/GraphTraversalSource.template              |  8 ++++++
 .../lib/process/graph-traversal.js                 |  8 ++++++
 .../test/integration/traversal-test.js             | 14 ++++++++++
 gremlin-python/glv/GraphTraversalSource.template   |  3 +++
 .../gremlin_python/process/graph_traversal.py      |  3 +++
 .../tests/driver/test_driver_remote_connection.py  |  8 ++++++
 11 files changed, 104 insertions(+)

diff --cc CHANGELOG.asciidoc
index 9bdcaca,3209db9..2ab50f9
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -25,12 -25,10 +25,13 @@@ image::https://raw.githubusercontent.co
  
  * Improved error messaging for a `Cluster` with a bad `Channelizer` configuration in the Java driver.
  * Made `Cluster` be able to open configuration file on resources directory.
+ * Implemented `Traversal.clone()` operations for all language variants.
  * Bump to Tornado 5.x for gremlin-python.
 +* Started keep-alive polling on `Connection` construction to ensure that a `Connection` doesn't die in the pool.
  * Deprecated `TraversalStrategies.applyStrategies()`.
  * Deprecated Jython support in `gremlin-python`.
 +* Deprecated `NioChannelizer` and related classes in `gremlin-driver` and `gremlin-server`.
 +* Fixed a bug in the `ClassCacheRequestCount` metric for `GremlinGroovyScriptEngine` which wasn't including the cache hit count, only the misses.
  * Reverted: Modified Java driver to use IP address rather than hostname to create connections.
  
  [[release-3-3-9]]


[tinkerpop] 02/03: Merge branch 'tp33' into tp34

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit b1d0ab31242a249a5e9ed39f44c498190f2ebfa2
Merge: 2d511a0 7a2b41a
Author: stephen <sp...@gmail.com>
AuthorDate: Thu Jan 2 12:23:25 2020 -0500

    Merge branch 'tp33' into tp34

 CHANGELOG.asciidoc                                 |  1 +
 docs/src/upgrade/release-3.3.x.asciidoc            | 30 ++++++++++++++++++++++
 gremlin-dotnet/glv/GraphTraversal.template         |  8 ++++++
 .../Process/Traversal/GraphTraversal.cs            |  8 ++++++
 .../DriverRemoteConnection/GraphTraversalTests.cs  | 13 ++++++++++
 .../glv/GraphTraversalSource.template              |  8 ++++++
 .../lib/process/graph-traversal.js                 |  8 ++++++
 .../test/integration/traversal-test.js             | 14 ++++++++++
 gremlin-python/glv/GraphTraversalSource.template   |  3 +++
 .../gremlin_python/process/graph_traversal.py      |  3 +++
 .../tests/driver/test_driver_remote_connection.py  |  8 ++++++
 11 files changed, 104 insertions(+)

diff --cc gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index f65276b,910c6e8..3169be5
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@@ -1751,32 -1677,13 +1751,40 @@@ namespace Gremlin.Net.Process.Traversa
              return Wrap<S, E>(this);
          }
  
 +        /// <summary>
 +        ///     Adds the with step to this <see cref="GraphTraversal{SType, EType}" />.
 +        /// </summary>
 +        public GraphTraversal<S, E> With (string key)
 +        {
 +            Bytecode.AddStep("with", key);
 +            return Wrap<S, E>(this);
 +        }
 +
 +        /// <summary>
 +        ///     Adds the with step to this <see cref="GraphTraversal{SType, EType}" />.
 +        /// </summary>
 +        public GraphTraversal<S, E> With (string key, object value)
 +        {
 +            Bytecode.AddStep("with", key, value);
 +            return Wrap<S, E>(this);
 +        }
 +
 +        /// <summary>
 +        ///     Adds the write step to this <see cref="GraphTraversal{SType, EType}" />.
 +        /// </summary>
 +        public GraphTraversal<S, E> Write ()
 +        {
 +            Bytecode.AddStep("write");
 +            return Wrap<S, E>(this);
 +        }
 +
+ 
+         /// <summary>
+         /// Make a copy of a traversal that is reset for iteration.
+         /// </summary>
+         public GraphTraversal<S, E> Clone()
+         {
+             return new GraphTraversal<S, E>(this.TraversalStrategies, this.Bytecode);
+         }
      }
  }


[tinkerpop] 03/03: Merge branch 'tp34'

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 2e5d31bf76fe8e35337a7134aab8ca5bcbe6de34
Merge: 33c67ac b1d0ab3
Author: stephen <sp...@gmail.com>
AuthorDate: Thu Jan 2 12:35:26 2020 -0500

    Merge branch 'tp34'

 CHANGELOG.asciidoc                                 |  1 +
 docs/src/upgrade/release-3.3.x.asciidoc            | 30 ++++++++++++++++++++++
 gremlin-dotnet/glv/GraphTraversal.template         |  8 ++++++
 .../Process/Traversal/GraphTraversal.cs            |  8 ++++++
 .../DriverRemoteConnection/GraphTraversalTests.cs  | 13 ++++++++++
 .../glv/GraphTraversalSource.template              |  8 ++++++
 .../lib/process/graph-traversal.js                 |  8 ++++++
 .../test/integration/traversal-test.js             | 14 ++++++++++
 gremlin-python/glv/GraphTraversalSource.template   |  3 +++
 .../gremlin_python/process/graph_traversal.py      |  3 +++
 .../tests/driver/test_driver_remote_connection.py  |  7 +++++
 11 files changed, 103 insertions(+)

diff --cc gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
index 41fc3d1,0000000..48d1224
mode 100644,000000..100644
--- a/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
@@@ -1,190 -1,0 +1,197 @@@
 +#
 +# Licensed to the Apache Software Foundation (ASF) under one
 +# or more contributor license agreements.  See the NOTICE file
 +# distributed with this work for additional information
 +# regarding copyright ownership.  The ASF licenses this file
 +# to you under the Apache License, Version 2.0 (the
 +# "License"); you may not use this file except in compliance
 +# with the License.  You may obtain a copy of the License at
 +#
 +# http://www.apache.org/licenses/LICENSE-2.0
 +#
 +# Unless required by applicable law or agreed to in writing,
 +# software distributed under the License is distributed on an
 +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 +# KIND, either express or implied.  See the License for the
 +# specific language governing permissions and limitations
 +# under the License.
 +#
 +import pytest
 +
 +from tornado import ioloop, gen
 +
 +from gremlin_python import statics
 +from gremlin_python.driver.protocol import GremlinServerError
 +from gremlin_python.statics import long
 +from gremlin_python.driver.driver_remote_connection import (
 +    DriverRemoteConnection)
 +from gremlin_python.process.traversal import Traverser
 +from gremlin_python.process.traversal import TraversalStrategy
 +from gremlin_python.process.traversal import P
 +from gremlin_python.process.graph_traversal import __
 +from gremlin_python.process.anonymous_traversal import traversal
 +from gremlin_python.structure.graph import Vertex
 +from gremlin_python.process.strategies import SubgraphStrategy, ReservedKeysVerificationStrategy
 +
 +__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
 +
 +
 +class TestDriverRemoteConnection(object):
 +    def test_traversals(self, remote_connection):
 +        statics.load_statics(globals())
 +        g = traversal().withRemote(remote_connection)
 +
 +        assert long(6) == g.V().count().toList()[0]
 +        # #
 +        assert Vertex(1) == g.V(1).next()
 +        assert 1 == g.V(1).id().next()
 +        assert Traverser(Vertex(1)) == g.V(1).nextTraverser()
 +        assert 1 == len(g.V(1).toList())
 +        assert isinstance(g.V(1).toList(), list)
 +        results = g.V().repeat(out()).times(2).name
 +        results = results.toList()
 +        assert 2 == len(results)
 +        assert "lop" in results
 +        assert "ripple" in results
 +        # #
 +        assert 10 == g.V().repeat(both()).times(5)[0:10].count().next()
 +        assert 1 == g.V().repeat(both()).times(5)[0:1].count().next()
 +        assert 0 == g.V().repeat(both()).times(5)[0:0].count().next()
 +        assert 4 == g.V()[2:].count().next()
 +        assert 2 == g.V()[:2].count().next()
 +        # #
 +        results = g.withSideEffect('a', ['josh', 'peter']).V(1).out('created').in_('created').values('name').where(P.within('a')).toList()
 +        assert 2 == len(results)
 +        assert 'josh' in results
 +        assert 'peter' in results
 +        # #
 +        results = g.V().out().profile().toList()
 +        assert 1 == len(results)
 +        assert 'metrics' in results[0]
 +        assert 'dur' in results[0]
 +        # #
 +        results = g.V().has('name', 'peter').as_('a').out('created').as_('b').select('a', 'b').by(
 +            __.valueMap()).toList()
 +        assert 1 == len(results)
 +        assert 'peter' == results[0]['a']['name'][0]
 +        assert 35 == results[0]['a']['age'][0]
 +        assert 'lop' == results[0]['b']['name'][0]
 +        assert 'java' == results[0]['b']['lang'][0]
 +        assert 2 == len(results[0]['a'])
 +        assert 2 == len(results[0]['b'])
 +        # #
 +        results = g.V(1).inject(g.V(2).next()).values('name').toList()
 +        assert 2 == len(results)
 +        assert 'marko' in results
 +        assert 'vadas' in results
 +        # #
 +        results = g.V().has('person', 'name', 'marko').map(lambda: ("it.get().value('name')", "gremlin-groovy")).toList()
 +        assert 1 == len(results)
 +        assert 'marko' in results
 +        # #
 +        # this test just validates that the underscored versions of steps conflicting with Gremlin work
 +        # properly and can be removed when the old steps are removed - TINKERPOP-2272
 +        results = g.V().filter_(__.values('age').sum_().and_(
 +            __.max_().is_(gt(0)), __.min_().is_(gt(0)))).range_(0, 1).id_().next()
 +        assert 1 == results
 +
 +    def test_lambda_traversals(self, remote_connection):
 +        statics.load_statics(globals())
 +        assert "remoteconnection[ws://localhost:45940/gremlin,gmodern]" == str(remote_connection)
 +        g = traversal().withRemote(remote_connection)
 +
 +        assert 24.0 == g.withSack(1.0, lambda: ("x -> x + 1", "gremlin-groovy")).V().both().sack().sum().next()
 +        assert 24.0 == g.withSack(lambda: ("{1.0d}", "gremlin-groovy"), lambda: ("x -> x + 1", "gremlin-groovy")).V().both().sack().sum().next()
 +
 +        assert 48.0 == g.withSack(1.0, lambda: ("x, y ->  x + y + 1", "gremlin-groovy")).V().both().sack().sum().next()
 +        assert 48.0 == g.withSack(lambda: ("{1.0d}", "gremlin-groovy"), lambda: ("x, y ->  x + y + 1", "gremlin-groovy")).V().both().sack().sum().next()
 +
 +    def test_iteration(self, remote_connection):
 +        statics.load_statics(globals())
 +        g = traversal().withRemote(remote_connection)
 +
 +        t = g.V().count()
 +        assert t.hasNext()
 +        assert t.hasNext()
 +        assert t.hasNext()
 +        assert t.hasNext()
 +        assert t.hasNext()
 +        assert 6 == t.next()
 +        assert not(t.hasNext())
 +        assert not(t.hasNext())
 +        assert not(t.hasNext())
 +        assert not(t.hasNext())
 +        assert not(t.hasNext())
 +
 +        t = g.V().has('name', P.within('marko', 'peter')).values('name').order()
 +        assert "marko" == t.next()
 +        assert t.hasNext()
 +        assert t.hasNext()
 +        assert t.hasNext()
 +        assert t.hasNext()
 +        assert t.hasNext()
 +        assert "peter" == t.next()
 +        assert not(t.hasNext())
 +        assert not(t.hasNext())
 +        assert not(t.hasNext())
 +        assert not(t.hasNext())
 +        assert not(t.hasNext())
 +
 +        try:
 +            t.next()
 +            assert False
 +        except StopIteration:
 +            assert True
 +
 +    def test_strategies(self, remote_connection):
 +        statics.load_statics(globals())
 +        g = traversal().withRemote(remote_connection). \
 +            withStrategies(TraversalStrategy("SubgraphStrategy",
 +                                             {"vertices": __.hasLabel("person"),
 +                                              "edges": __.hasLabel("created")},
 +                                              "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy"))
 +        assert 4 == g.V().count().next()
 +        assert 0 == g.E().count().next()
 +        assert 1 == g.V().label().dedup().count().next()
 +        assert 4 == g.V().filter(lambda: ("x -> true", "gremlin-groovy")).count().next()
 +        assert "person" == g.V().label().dedup().next()
 +        #
 +        g = traversal().withRemote(remote_connection). \
 +            withStrategies(SubgraphStrategy(vertices=__.hasLabel("person"), edges=__.hasLabel("created")))
 +        assert 4 == g.V().count().next()
 +        assert 0 == g.E().count().next()
 +        assert 1 == g.V().label().dedup().count().next()
 +        assert "person" == g.V().label().dedup().next()
 +        #
 +        g = traversal().withRemote(remote_connection). \
 +            withStrategies(SubgraphStrategy(edges=__.hasLabel("created")))
 +        assert 6 == g.V().count().next()
 +        assert 4 == g.E().count().next()
 +        assert 1 == g.E().label().dedup().count().next()
 +        assert "created" == g.E().label().dedup().next()
 +        #
 +        g = g.withoutStrategies(SubgraphStrategy). \
 +            withComputer(vertices=__.has("name", "marko"), edges=__.limit(0))
 +        assert 1 == g.V().count().next()
 +        assert 0 == g.E().count().next()
 +        assert "person" == g.V().label().next()
 +        assert "marko" == g.V().name.next()
 +        #
 +        g = traversal().withRemote(remote_connection).withComputer()
 +        assert 6 == g.V().count().next()
 +        assert 6 == g.E().count().next()
 +        #
 +        g = traversal().withRemote(remote_connection). \
 +            withStrategies(ReservedKeysVerificationStrategy(throw_exception=True))
 +        try:
 +            g.addV("person").property("id", "please-don't-use-id").iterate()
 +            assert False
 +        except GremlinServerError as gse:
 +            assert gse.status_code == 500
++
++    def test_clone(self, remote_connection):
++        g = traversal().withRemote(remote_connection)
++        t = g.V().count()
++        assert 6 == t.next()
++        assert 6 == t.clone().next()
++        assert 6 == t.clone().next()