tinkerpop git commit: Use invariant culture for numeric parsing
Repository: tinkerpop Updated Branches: refs/heads/TINKERPOP-1827 14af8a906 -> dba15319f Use invariant culture for numeric parsing Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/dba15319 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/dba15319 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/dba15319 Branch: refs/heads/TINKERPOP-1827 Commit: dba15319f8b1cab07a51c3ca9932857c273cfdb8 Parents: 14af8a9 Author: Jorge Bay Gondra Authored: Mon Nov 27 09:10:51 2017 +0100 Committer: Jorge Bay Gondra Committed: Mon Nov 27 09:10:51 2017 +0100 -- .../test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs | 7 --- .../Gherkin/TraversalEvaluation/TraversalParser.cs| 6 -- 2 files changed, 8 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dba15319/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs -- diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs index 0011eda..0abc247 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs @@ -24,6 +24,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text.RegularExpressions; using Gherkin.Ast; @@ -66,9 +67,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin { { 'i', s => Convert.ToInt32(s) }, { 'l', s => Convert.ToInt64(s) }, -{ 'f', s => Convert.ToSingle(s) }, -{ 'd', s => Convert.ToDouble(s) }, -{ 'm', s => Convert.ToDecimal(s)} +{ 'f', s => Convert.ToSingle(s, CultureInfo.InvariantCulture) }, +{ 'd', s => Convert.ToDouble(s, CultureInfo.InvariantCulture) }, +{ 'm', s => Convert.ToDecimal(s, CultureInfo.InvariantCulture) } }; [Given("the (\\w+) graph")] http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dba15319/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs -- diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs index 827960d..118fcea 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs @@ -23,6 +23,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; @@ -452,12 +453,13 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation } if (numericText.EndsWith("F")) { -return LiteralParameter.Create(Convert.ToSingle(match.Value.Substring(0, match.Value.Length-1))); +return LiteralParameter.Create(Convert.ToSingle(match.Value.Substring(0, match.Value.Length - 1), +CultureInfo.InvariantCulture)); } if (match.Groups[1].Value != "") { // Captured text with the decimal separator -return LiteralParameter.Create(Convert.ToDecimal(match.Value)); +return LiteralParameter.Create(Convert.ToDecimal(match.Value, CultureInfo.InvariantCulture)); } return LiteralParameter.Create(Convert.ToInt32(match.Value)); }
[1/4] tinkerpop git commit: TINKERPOP-1832 - Fix bug where TraversalHelper.replaceStep sets the steps' previousStep incorrectly. It needs to remove the replaced step before inserting the new step.
Repository: tinkerpop Updated Branches: refs/heads/master 7463b3ae3 -> bb67594cb TINKERPOP-1832 - Fix bug where TraversalHelper.replaceStep sets the steps' previousStep incorrectly. It needs to remove the replaced step before inserting the new step. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8bc4b36f Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8bc4b36f Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8bc4b36f Branch: refs/heads/master Commit: 8bc4b36f52d12e37b7d8f37f7d2240caa233106f Parents: ec1cbda Author: pieter Authored: Wed Nov 22 10:56:43 2017 +0200 Committer: pieter Committed: Wed Nov 22 10:56:43 2017 +0200 -- .../process/traversal/util/TraversalHelper.java | 5 +++-- .../process/util/TraversalHelperTest.java| 19 +++ 2 files changed, 22 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8bc4b36f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java index fd803e4..eda836a 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java @@ -173,8 +173,9 @@ public final class TraversalHelper { * @param traversal the traversal on which the action will occur */ public static void replaceStep(final Step removeStep, final Step insertStep, final Traversal.Admin traversal) { -traversal.addStep(stepIndex(removeStep, traversal), insertStep); -traversal.removeStep(removeStep); +final int i; +traversal.removeStep(i = stepIndex(removeStep, traversal)); +traversal.addStep(i, insertStep); } public static Step insertTraversal(final Step previousStep, final Traversal.Admin insertTraversal, final Traversal.Admin traversal) { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8bc4b36f/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java -- diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java index 23eaa39..df22cd2 100644 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java @@ -32,6 +32,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.filter.LambdaFilterSt import org.apache.tinkerpop.gremlin.process.traversal.step.filter.PathFilterStep; import org.apache.tinkerpop.gremlin.process.traversal.step.filter.TraversalFilterStep; import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WhereTraversalStep; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.NotStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.TraversalFlatMapStep; @@ -47,6 +48,8 @@ import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; import org.junit.Test; import org.mockito.Mockito; +import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -66,6 +69,22 @@ import static org.junit.Assert.assertTrue; public class TraversalHelperTest { @Test +public void shouldSetPreviousStepToEmptyStep() { +final Traversal.Admin traversal = __.V().out().asAdmin(); +//transform the traversal to __.V().not(out()) +//the VertexStep's previousStep should be the EmptyStep +Optional vertexStepOpt = TraversalHelper.getFirstStepOfAssignableClass(VertexStep.class, traversal); +assertTrue(vertexStepOpt.isPresent()); +Traversal.Admin inner = __.start().asAdmin(); +inner.addStep(0, vertexStepOpt.get()); +TraversalHelper.replaceStep(vertexStepOpt.get(), new NotStep<>(__.identity().asAdmin(), inner), traversal); +List vertexSteps = TraversalHelper.getStepsOfAssignableClassRecursively(VertexStep.class, traversal); +assertEquals(1, vertexSteps.size()); +VertexStep vertexStep = vertexSteps.get(0); +assertTrue("
[2/3] tinkerpop git commit: Merge branch 'pr-756' into tp32
Merge branch 'pr-756' into tp32 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/41806595 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/41806595 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/41806595 Branch: refs/heads/tp32 Commit: 41806595c6a2094a8422fab0e6154d557aa91b3a Parents: 691ee9b 8bc4b36 Author: Stephen Mallette Authored: Mon Nov 27 07:34:28 2017 -0500 Committer: Stephen Mallette Committed: Mon Nov 27 07:34:28 2017 -0500 -- .../process/traversal/util/TraversalHelper.java | 5 +++-- .../process/util/TraversalHelperTest.java| 19 +++ 2 files changed, 22 insertions(+), 2 deletions(-) --
[3/3] tinkerpop git commit: Updated changelog CTR
Updated changelog CTR Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/072b0821 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/072b0821 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/072b0821 Branch: refs/heads/tp32 Commit: 072b08214d7e9e3d33d8ef40bfbbd1e6f746ea56 Parents: 4180659 Author: Stephen Mallette Authored: Mon Nov 27 07:36:05 2017 -0500 Committer: Stephen Mallette Committed: Mon Nov 27 07:36:14 2017 -0500 -- CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/072b0821/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 5ba7c70..02c87ca 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -30,6 +30,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima * `TraversalVertexProgram` `profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Returned the `Builder` instance from the `DetachedEdge.Builder` methods of `setOutE` and `setOutV`. * Added test framework for GLVs. +* Fixed bug in `TraversalHelper.replaceStep()` where the step being replaced needed to be removed prior to the new one being added. * Added alias support in the .NET `DriverRemoteConnection`. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only.
[3/4] tinkerpop git commit: Updated changelog CTR
Updated changelog CTR Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/072b0821 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/072b0821 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/072b0821 Branch: refs/heads/master Commit: 072b08214d7e9e3d33d8ef40bfbbd1e6f746ea56 Parents: 4180659 Author: Stephen Mallette Authored: Mon Nov 27 07:36:05 2017 -0500 Committer: Stephen Mallette Committed: Mon Nov 27 07:36:14 2017 -0500 -- CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/072b0821/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 5ba7c70..02c87ca 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -30,6 +30,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima * `TraversalVertexProgram` `profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Returned the `Builder` instance from the `DetachedEdge.Builder` methods of `setOutE` and `setOutV`. * Added test framework for GLVs. +* Fixed bug in `TraversalHelper.replaceStep()` where the step being replaced needed to be removed prior to the new one being added. * Added alias support in the .NET `DriverRemoteConnection`. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only.
[4/4] tinkerpop git commit: Merge branch 'tp32'
Merge branch 'tp32' Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/bb67594c Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/bb67594c Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/bb67594c Branch: refs/heads/master Commit: bb67594cbfebbbe325862c0d9950537f5019b15d Parents: 7463b3a 072b082 Author: Stephen Mallette Authored: Mon Nov 27 07:36:23 2017 -0500 Committer: Stephen Mallette Committed: Mon Nov 27 07:36:23 2017 -0500 -- CHANGELOG.asciidoc | 1 + .../process/traversal/util/TraversalHelper.java | 5 +++-- .../process/util/TraversalHelperTest.java| 19 +++ 3 files changed, 23 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb67594c/CHANGELOG.asciidoc -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb67594c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java --
[1/3] tinkerpop git commit: TINKERPOP-1832 - Fix bug where TraversalHelper.replaceStep sets the steps' previousStep incorrectly. It needs to remove the replaced step before inserting the new step.
Repository: tinkerpop Updated Branches: refs/heads/tp32 691ee9b26 -> 072b08214 TINKERPOP-1832 - Fix bug where TraversalHelper.replaceStep sets the steps' previousStep incorrectly. It needs to remove the replaced step before inserting the new step. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8bc4b36f Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8bc4b36f Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8bc4b36f Branch: refs/heads/tp32 Commit: 8bc4b36f52d12e37b7d8f37f7d2240caa233106f Parents: ec1cbda Author: pieter Authored: Wed Nov 22 10:56:43 2017 +0200 Committer: pieter Committed: Wed Nov 22 10:56:43 2017 +0200 -- .../process/traversal/util/TraversalHelper.java | 5 +++-- .../process/util/TraversalHelperTest.java| 19 +++ 2 files changed, 22 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8bc4b36f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java index fd803e4..eda836a 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java @@ -173,8 +173,9 @@ public final class TraversalHelper { * @param traversal the traversal on which the action will occur */ public static void replaceStep(final Step removeStep, final Step insertStep, final Traversal.Admin traversal) { -traversal.addStep(stepIndex(removeStep, traversal), insertStep); -traversal.removeStep(removeStep); +final int i; +traversal.removeStep(i = stepIndex(removeStep, traversal)); +traversal.addStep(i, insertStep); } public static Step insertTraversal(final Step previousStep, final Traversal.Admin insertTraversal, final Traversal.Admin traversal) { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8bc4b36f/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java -- diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java index 23eaa39..df22cd2 100644 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java @@ -32,6 +32,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.filter.LambdaFilterSt import org.apache.tinkerpop.gremlin.process.traversal.step.filter.PathFilterStep; import org.apache.tinkerpop.gremlin.process.traversal.step.filter.TraversalFilterStep; import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WhereTraversalStep; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.NotStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.TraversalFlatMapStep; @@ -47,6 +48,8 @@ import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; import org.junit.Test; import org.mockito.Mockito; +import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -66,6 +69,22 @@ import static org.junit.Assert.assertTrue; public class TraversalHelperTest { @Test +public void shouldSetPreviousStepToEmptyStep() { +final Traversal.Admin traversal = __.V().out().asAdmin(); +//transform the traversal to __.V().not(out()) +//the VertexStep's previousStep should be the EmptyStep +Optional vertexStepOpt = TraversalHelper.getFirstStepOfAssignableClass(VertexStep.class, traversal); +assertTrue(vertexStepOpt.isPresent()); +Traversal.Admin inner = __.start().asAdmin(); +inner.addStep(0, vertexStepOpt.get()); +TraversalHelper.replaceStep(vertexStepOpt.get(), new NotStep<>(__.identity().asAdmin(), inner), traversal); +List vertexSteps = TraversalHelper.getStepsOfAssignableClassRecursively(VertexStep.class, traversal); +assertEquals(1, vertexSteps.size()); +VertexStep vertexStep = vertexSteps.get(0); +assertTrue("Expe
[2/4] tinkerpop git commit: Merge branch 'pr-756' into tp32
Merge branch 'pr-756' into tp32 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/41806595 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/41806595 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/41806595 Branch: refs/heads/master Commit: 41806595c6a2094a8422fab0e6154d557aa91b3a Parents: 691ee9b 8bc4b36 Author: Stephen Mallette Authored: Mon Nov 27 07:34:28 2017 -0500 Committer: Stephen Mallette Committed: Mon Nov 27 07:34:28 2017 -0500 -- .../process/traversal/util/TraversalHelper.java | 5 +++-- .../process/util/TraversalHelperTest.java| 19 +++ 2 files changed, 22 insertions(+), 2 deletions(-) --
[3/3] tinkerpop git commit: Parse maps and mark scenarios with lambdas as skipped
Parse maps and mark scenarios with lambdas as skipped Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e5bc2c39 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e5bc2c39 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e5bc2c39 Branch: refs/heads/TINKERPOP-1489 Commit: e5bc2c394001998a40d3db6f664601eab113463e Parents: 1f01e23 Author: Jorge Bay Gondra Authored: Mon Nov 27 14:42:26 2017 +0100 Committer: Jorge Bay Gondra Committed: Mon Nov 27 14:42:26 2017 +0100 -- .../test/cucumber/feature-steps.js | 84 ++-- .../gremlin-javascript/test/cucumber/world.js | 2 +- 2 files changed, 78 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e5bc2c39/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js index 6625f29..8ec2bdc 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js @@ -25,6 +25,7 @@ const defineSupportCode = require('cucumber').defineSupportCode; const vm = require('vm'); const expect = require('chai').expect; +const util = require('util'); const graphModule = require('../../lib/structure/graph'); const graphTraversalModule = require('../../lib/process/graph-traversal'); const traversalModule = require('../../lib/process/traversal'); @@ -32,6 +33,10 @@ const Graph = graphModule.Graph; const Path = graphModule.Path; const __ = graphTraversalModule.statics; +// Determines whether the feature maps (m[]), are deserialized as objects (true) or maps (false). +// Use false for GraphSON3. +const mapAsObject = true; + const parsers = [ [ 'd\\[([\\d.]+)\\]\\.[ilfdm]', toNumeric ], [ 'v\\[(.+)\\]', toVertex ], @@ -69,6 +74,8 @@ defineSupportCode(function(methods) { }); methods.Given(/^using the parameter (.+) defined as "(.+)"$/, function (paramName, stringValue) { +// Remove escaped chars +stringValue = stringValue.replace(/\\"/g, '"'); let p = Promise.resolve(); if (this.graphName === 'empty') { p = this.loadEmptyGraphData(); @@ -76,6 +83,11 @@ defineSupportCode(function(methods) { const self = this; return p.then(() => { self.parameters[paramName] = parseValue.call(self, stringValue); +}).catch(err => { + if (err instanceof IgnoreError) { +return 'skipped'; + } + throw err; }); }); @@ -98,14 +110,14 @@ defineSupportCode(function(methods) { const expectedResult = resultTable.rows().map(row => parseRow.call(this, row)); switch (characterizedAs) { case 'ordered': -console.log('--- ordered', expectedResult); expect(this.result).to.have.deep.ordered.members(expectedResult); break; case 'unordered': -console.log('--- unordered expected:', expectedResult); -console.log('--- obtained:', this.result); expect(this.result).to.have.deep.members(expectedResult); break; + case 'of': +expect(this.result).to.include.deep.members(expectedResult); +break; } }); @@ -117,7 +129,22 @@ defineSupportCode(function(methods) { }); methods.Then(/^the result should have a count of (\d+)$/, function (stringCount) { -expect(this.result).to.have.lengthOf(parseInt(stringCount, 10)); +const expected = parseInt(stringCount, 10); +if (!Array.isArray(this.result)) { + let count = 0; + if (this.result instanceof Map) { +count = this.result.size; + } + else if (typeof this.result === 'object') { +count = Object.keys(this.result).length; + } + else { +throw new Error('result not supported: ' + util.inspect(this.result)); + } + expect(count).to.be.equal(expected); + return; +} +expect(this.result).to.have.lengthOf(expected); }); methods.Then('nothing should happen because', _ => {}); @@ -187,7 +214,11 @@ function toVertexIdString(name) { } function toEdge(name) { - return this.getData().edges[name]; + const e = this.getData().edges[name]; + if (!e) { +throw new Error(util.format('Edge with key "%s" not found', name)); + } + return e; } function toEdgeId(name) { @@ -210,6 +241,45 @@ function toArray(stringList) { return stringList.split(',').map(x => parseValue.call(this, x)); } -function toMap() {} +function toMap(stringMap) { + return parseMapValue.call(this,
[1/3] tinkerpop git commit: Support bulk
Repository: tinkerpop Updated Branches: refs/heads/TINKERPOP-1489 affea5a51 -> e5bc2c394 Support bulk Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6d662e5c Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6d662e5c Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6d662e5c Branch: refs/heads/TINKERPOP-1489 Commit: 6d662e5c84780e54e386577b1156e8f997d432f8 Parents: affea5a Author: Jorge Bay Gondra Authored: Mon Nov 27 12:13:28 2017 +0100 Committer: Jorge Bay Gondra Committed: Mon Nov 27 12:16:45 2017 +0100 -- gremlin-javascript/glv/TraversalSource.template | 48 +++-- .../gremlin-javascript/lib/process/traversal.js | 48 +++-- .../test/unit/traversal-test.js | 71 ++-- 3 files changed, 119 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d662e5c/gremlin-javascript/glv/TraversalSource.template -- diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template index dbb7bc4..f75765f 100644 --- a/gremlin-javascript/glv/TraversalSource.template +++ b/gremlin-javascript/glv/TraversalSource.template @@ -22,15 +22,15 @@ */ 'use strict'; -var utils = require('../utils'); -var parseArgs = utils.parseArgs; -var itemDone = Object.freeze({ value: null, done: true }); -var emptyArray = Object.freeze([]); +const utils = require('../utils'); +const parseArgs = utils.parseArgs; +const itemDone = Object.freeze({ value: null, done: true }); function Traversal(graph, traversalStrategies, bytecode) { this.graph = graph; this.traversalStrategies = traversalStrategies; this.bytecode = bytecode; + /** @type {Array} */ this.traversers = null; this.sideEffects = null; this._traversalStrategiesPromise = null; @@ -47,17 +47,13 @@ Traversal.prototype.getBytecode = function () { * @returns {Promise.} */ Traversal.prototype.toList = function () { - var self = this; - return this._applyStrategies().then(function () { -if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) { - return emptyArray; + return this._applyStrategies().then(() => { +const result = []; +let it; +while ((it = this._getNext()) && !it.done) { + result.push(it.value); } -var arr = new Array(self.traversers.length - self._traversersIteratorIndex); -for (var i = self._traversersIteratorIndex; i < self.traversers.length; i++) { - arr[i] = self.traversers[i].object; -} -self._traversersIteratorIndex = self.traversers.length; -return arr; +return result; }); }; @@ -67,13 +63,23 @@ Traversal.prototype.toList = function () { * @returns {Promise.<{value, done}>} */ Traversal.prototype.next = function () { - var self = this; - return this._applyStrategies().then(function () { -if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) { - return itemDone; + return this._applyStrategies().then(() => this._getNext()); +}; + +/** + * Synchronous iterator of traversers including + * @private + */ +Traversal.prototype._getNext = function () { + while (this.traversers && this._traversersIteratorIndex < this.traversers.length) { +let traverser = this.traversers[this._traversersIteratorIndex]; +if (traverser.bulk > 0) { + traverser.bulk--; + return { value: traverser.object, done: false }; } -return { value: self.traversers[self._traversersIteratorIndex++].object, done: false }; - }); +this._traversersIteratorIndex++; + } + return itemDone; }; Traversal.prototype._applyStrategies = function () { @@ -133,7 +139,7 @@ P.prototype.or = function (arg) { function Traverser(object, bulk) { this.object = object; - this.bulk = bulk == undefined ? 1 : bulk; + this.bulk = bulk || 1; } function TraversalSideEffects() { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d662e5c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js index 49c6aef..ebf8755 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js @@ -22,15 +22,15 @@ */ 'use strict'; -var utils = require('../utils'); -var parseArgs = utils.parseArgs; -var itemDone = Object.freeze({ value: null, done: true }); -var emptyArray = Object.freeze([]); +const u
[2/3] tinkerpop git commit: Traversal iterate() method
Traversal iterate() method Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1f01e231 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1f01e231 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1f01e231 Branch: refs/heads/TINKERPOP-1489 Commit: 1f01e231c236c066c08b1af97275a3d18077b775 Parents: 6d662e5 Author: Jorge Bay Gondra Authored: Mon Nov 27 12:22:08 2017 +0100 Committer: Jorge Bay Gondra Committed: Mon Nov 27 12:22:53 2017 +0100 -- gremlin-javascript/glv/TraversalSource.template | 12 +++ .../gremlin-javascript/lib/process/traversal.js | 12 +++ .../javascript/gremlin-javascript/package.json | 2 +- .../test/unit/traversal-test.js | 21 ++-- 4 files changed, 44 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f01e231/gremlin-javascript/glv/TraversalSource.template -- diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template index f75765f..0d45e90 100644 --- a/gremlin-javascript/glv/TraversalSource.template +++ b/gremlin-javascript/glv/TraversalSource.template @@ -58,6 +58,18 @@ Traversal.prototype.toList = function () { }; /** + * Iterates all Traverser instances in the traversal. + * @returns {Promise} + */ +Traversal.prototype.iterate = function () { + return this._applyStrategies().then(() => { +let it; +while ((it = this._getNext()) && !it.done) { +} + }); +}; + +/** * Async iterator method implementation. * Returns a promise containing an iterator item. * @returns {Promise.<{value, done}>} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f01e231/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js index ebf8755..d887fe0 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js @@ -58,6 +58,18 @@ Traversal.prototype.toList = function () { }; /** + * Iterates all Traverser instances in the traversal. + * @returns {Promise} + */ +Traversal.prototype.iterate = function () { + return this._applyStrategies().then(() => { +let it; +while ((it = this._getNext()) && !it.done) { +} + }); +}; + +/** * Async iterator method implementation. * Returns a promise containing an iterator item. * @returns {Promise.<{value, done}>} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f01e231/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json index aae9eb9..7c4a3d6 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json @@ -30,7 +30,7 @@ }, "scripts": { "test": "./node_modules/.bin/mocha test/unit test/integration -t 5000", -"features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/", +"features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/map/AddVertex.feature", "unit-test": "./node_modules/.bin/mocha test/unit" }, "engines": { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f01e231/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js -- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js index 635c7e8..2be504b 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js @@ -32,7 +32,6 @@ const TraversalStrategies = require('../../lib/process/traversal-strategy').Trav describe('Traversal', function () { describe('#getByteCode()', function () { - it('should add steps for with a string parameter', function () { var g = new graph.Graph().traversal(); var bytecode = g.V().out('created').getBytecode(); @@ -61,7 +60,6 @@ describe('Traversa
[07/11] tinkerpop git commit: removed unwanted blank line
removed unwanted blank line Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/80624fcb Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/80624fcb Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/80624fcb Branch: refs/heads/master Commit: 80624fcbe34ffb0d4d2a4033926a198096413ae3 Parents: ed6133e Author: davebshow Authored: Wed Nov 15 10:19:59 2017 -0800 Committer: davebshow Committed: Wed Nov 15 10:19:59 2017 -0800 -- .../src/main/jython/tests/structure/io/test_graphsonV2d0.py | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80624fcb/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py -- diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py index 19448d9..885fa79 100644 --- a/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py +++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py @@ -31,7 +31,6 @@ from gremlin_python.statics import * from gremlin_python.structure.graph import Vertex, Edge, Property, VertexProperty, Graph, Path from gremlin_python.structure.io.graphsonV2d0 import GraphSONWriter, GraphSONReader, GraphSONUtil import gremlin_python.structure.io.graphsonV2d0 - from gremlin_python.process.traversal import P from gremlin_python.process.strategies import SubgraphStrategy from gremlin_python.process.graph_traversal import __
[10/11] tinkerpop git commit: Merge branch 'TINKERPOP-1807-master'
Merge branch 'TINKERPOP-1807-master' Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9d7bb917 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9d7bb917 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9d7bb917 Branch: refs/heads/master Commit: 9d7bb9171f6180f4f634b946dd8addab476455b7 Parents: bb67594 9790574 Author: davebshow Authored: Mon Nov 27 09:46:08 2017 -0800 Committer: davebshow Committed: Mon Nov 27 09:46:08 2017 -0800 -- CHANGELOG.asciidoc | 1 + .../upgrade/release-3.2.x-incubating.asciidoc | 9 ++ .../src/main/jython/gremlin_python/statics.py | 9 ++ .../gremlin_python/structure/io/graphsonV2d0.py | 71 +++- .../gremlin_python/structure/io/graphsonV3d0.py | 75 - .../tests/structure/io/test_graphsonV2d0.py | 86 ++-- .../tests/structure/io/test_graphsonV3d0.py | 83 ++- 7 files changed, 320 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9d7bb917/CHANGELOG.asciidoc --
[01/11] tinkerpop git commit: Implemented support for missing core GraphSON types in gremlin-python
Repository: tinkerpop Updated Branches: refs/heads/master bb67594cb -> 39c6e6566 Implemented support for missing core GraphSON types in gremlin-python Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3b651ff5 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3b651ff5 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3b651ff5 Branch: refs/heads/master Commit: 3b651ff58cdf210a63a0101d0a311c7076de2b0e Parents: f2b4fb9 Author: davebshow Authored: Wed Nov 1 16:31:10 2017 -0700 Committer: davebshow Committed: Wed Nov 1 16:31:10 2017 -0700 -- .../src/main/jython/gremlin_python/statics.py | 9 +++ .../gremlin_python/structure/io/graphson.py | 71 - .../jython/tests/structure/io/test_graphson.py | 81 +++- 3 files changed, 156 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3b651ff5/gremlin-python/src/main/jython/gremlin_python/statics.py -- diff --git a/gremlin-python/src/main/jython/gremlin_python/statics.py b/gremlin-python/src/main/jython/gremlin_python/statics.py index a1abf8e..f98347e 100644 --- a/gremlin-python/src/main/jython/gremlin_python/statics.py +++ b/gremlin-python/src/main/jython/gremlin_python/statics.py @@ -36,6 +36,15 @@ else: from types import LongType from types import TypeType + +class timestamp(float): +""" +In Python a timestamp is simply a float. This dummy class (similar to long), allows users to wrap a float +in a GLV script to make sure the value is serialized as a GraphSON timestamp. +""" +pass + + staticMethods = {} staticEnums = {} default_lambda_language = "gremlin-python" http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3b651ff5/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py -- diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py index 0daeffa..04085ee 100644 --- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py +++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py @@ -16,11 +16,15 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ''' -from aenum import Enum +import datetime import json -import six +import time +import uuid from collections import OrderedDict +import six +from aenum import Enum + from gremlin_python import statics from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType from gremlin_python.process.traversal import Binding, Bytecode, P, Traversal, Traverser, TraversalStrategy @@ -298,6 +302,69 @@ class TypeSerializer(_GraphSONTypeIO): return writer.toDict(typ()) +class UUIDIO(_GraphSONTypeIO): +python_type = uuid.UUID +graphson_type = "g:UUID" +graphson_base_type = "UUID" + +@classmethod +def dictify(cls, obj, writer): +return GraphSONUtil.typedValue(cls.graphson_base_type, str(obj)) + +@classmethod +def objectify(cls, d, reader): +return cls.python_type(d) + + +class DateIO(_GraphSONTypeIO): +python_type = datetime.datetime +graphson_type = "g:Date" +graphson_base_type = "Date" + +@classmethod +def dictify(cls, obj, writer): +# Java timestamp expects miliseconds +if six.PY3: +pts = obj.timestamp() +else: +# Hack for legacy Python +# Taken from: +# https://github.com/jaraco/backports.datetime_timestamp/blob/master/backports/datetime_timestamp/__init__.py +pts = time.mktime((obj.year, obj.month, obj.day, + obj.hour, obj.minute, obj.second, + -1, -1, -1)) + obj.microsecond / 1e6 + +# Have to use int because of legacy Python +ts = int(round(pts * 1000)) +return GraphSONUtil.typedValue(cls.graphson_base_type, ts) + +@classmethod +def objectify(cls, ts, reader): +# Python timestamp expects seconds +return datetime.datetime.fromtimestamp(ts / 1000.0) + + +# Based on current implementation, this class must always be declared before FloatIO. +# Seems pretty fragile for future maintainers. Maybe look into this. +class TimestampIO(_GraphSONTypeIO): +"""A timestamp in Python is type float""" +python_type = statics.timestamp +graphson_type = "g:Timestamp" +graphson_base_type = "Timestamp" + +@classmethod +def dictify(cls, obj, writer): +# Java timestamp expects mil
[02/11] tinkerpop git commit: updated changelog and upgrade docs
updated changelog and upgrade docs Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/46612842 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/46612842 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/46612842 Branch: refs/heads/master Commit: 4661284292306fecb67fbcc46617af97b3b7762f Parents: 3b651ff Author: davebshow Authored: Tue Nov 7 09:40:05 2017 -0800 Committer: davebshow Committed: Tue Nov 7 09:40:05 2017 -0800 -- CHANGELOG.asciidoc | 1 + docs/src/upgrade/release-3.2.x-incubating.asciidoc | 9 + 2 files changed, 10 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/46612842/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index fcba906..acfa892 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima [[release-3-2-7]] === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET) +* Added core GraphSON classes for Gremlin-Python: `UUID`, `Date`, and `Timestamp`. * `TraversalVertexProgram` ``profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/46612842/docs/src/upgrade/release-3.2.x-incubating.asciidoc -- diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc index 60fd320..9be51f9 100644 --- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc +++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc @@ -29,6 +29,15 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima Please see the link:https://github.com/apache/tinkerpop/blob/3.2.7/CHANGELOG.asciidoc#release-3-2-7[changelog] for a complete list of all the modifications that are part of this release. + Gremlin-Python Core Types +With the addition of `UUID`, `Date`, and `Timestamp`, Gremlin-Python now implements serializers for all core GraphSON types. Users +that were using other types to represent this data can now use the Python classes `datetime.datetime` and`uuid.UUID` in GLV traversals. +Since Python does not support a native `Timestamp` object, Gremlin-Python now offers a dummy class `Timestamp`, which allows +users to wrap a float and submit it to the Gremlin Server as a `Timestamp` GraphSON type. `Timestamp` can be found in +`gremlin_python.statics`. + +See: link:https://issues.apache.org/jira/browse/TINKERPOP-1807[TINKERPOP-1807] + Embedded Remote Connection As Gremlin Language Variants (GLVs) expand their usage and use of `withRemote()` becomes more common, the need to mock
[3/4] tinkerpop git commit: added asserts to check values are deserialized as expected
added asserts to check values are deserialized as expected Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c0078cc1 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c0078cc1 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c0078cc1 Branch: refs/heads/tp32 Commit: c0078cc172e918f96460630da27ff04cb4e9478d Parents: 4661284 Author: davebshow Authored: Mon Nov 13 10:11:46 2017 -0800 Committer: davebshow Committed: Mon Nov 13 10:11:46 2017 -0800 -- .../src/main/jython/tests/structure/io/test_graphson.py | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c0078cc1/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py -- diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py index 75e7136..68d14ca 100644 --- a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py +++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py @@ -128,15 +128,18 @@ class TestGraphSONReader(object): def test_datetime(self): dt = self.graphson_reader.readObject(json.dumps({"@type": "g:Date", "@value": 1481750076295})) assert isinstance(dt, datetime.datetime) +assert dt == datetime.datetime(2016, 12, 14, 13, 14, 36, 295000) def test_timestamp(self): dt = self.graphson_reader.readObject(json.dumps({"@type": "g:Timestamp", "@value": 1481750076295})) assert isinstance(dt, timestamp) +assert float(dt) == 1481750076.295 def test_uuid(self): prop = self.graphson_reader.readObject( json.dumps({'@type': 'g:UUID', '@value': "41d2e28a-20a4-4ab0-b379-d810dede3786"})) assert isinstance(prop, uuid.UUID) +assert str(prop) == '41d2e28a-20a4-4ab0-b379-d810dede3786' class TestGraphSONWriter(object): @@ -260,6 +263,7 @@ class TestGraphSONWriter(object): output = self.graphson_writer.writeObject(prop) assert expected == output + class TestFunctionalGraphSONIO(object): """Functional IO tests"""
[03/11] tinkerpop git commit: added asserts to check values are deserialized as expected
added asserts to check values are deserialized as expected Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c0078cc1 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c0078cc1 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c0078cc1 Branch: refs/heads/master Commit: c0078cc172e918f96460630da27ff04cb4e9478d Parents: 4661284 Author: davebshow Authored: Mon Nov 13 10:11:46 2017 -0800 Committer: davebshow Committed: Mon Nov 13 10:11:46 2017 -0800 -- .../src/main/jython/tests/structure/io/test_graphson.py | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c0078cc1/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py -- diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py index 75e7136..68d14ca 100644 --- a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py +++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py @@ -128,15 +128,18 @@ class TestGraphSONReader(object): def test_datetime(self): dt = self.graphson_reader.readObject(json.dumps({"@type": "g:Date", "@value": 1481750076295})) assert isinstance(dt, datetime.datetime) +assert dt == datetime.datetime(2016, 12, 14, 13, 14, 36, 295000) def test_timestamp(self): dt = self.graphson_reader.readObject(json.dumps({"@type": "g:Timestamp", "@value": 1481750076295})) assert isinstance(dt, timestamp) +assert float(dt) == 1481750076.295 def test_uuid(self): prop = self.graphson_reader.readObject( json.dumps({'@type': 'g:UUID', '@value': "41d2e28a-20a4-4ab0-b379-d810dede3786"})) assert isinstance(prop, uuid.UUID) +assert str(prop) == '41d2e28a-20a4-4ab0-b379-d810dede3786' class TestGraphSONWriter(object): @@ -260,6 +263,7 @@ class TestGraphSONWriter(object): output = self.graphson_writer.writeObject(prop) assert expected == output + class TestFunctionalGraphSONIO(object): """Functional IO tests"""
[06/11] tinkerpop git commit: fixed typo in changelog
fixed typo in changelog Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ed6133e5 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ed6133e5 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ed6133e5 Branch: refs/heads/master Commit: ed6133e502e573650a39a6ac96c4a901e168c2e6 Parents: 5031ccd Author: davebshow Authored: Wed Nov 15 10:17:34 2017 -0800 Committer: davebshow Committed: Wed Nov 15 10:17:34 2017 -0800 -- CHANGELOG.asciidoc | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ed6133e5/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 49c9a5b..049c999 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -252,7 +252,6 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima * Fixed an `ArrayOutOfBoundsException` in `hasId()` for the rare situation when the provided collection is empty. * Bump to Netty 4.0.52 * `TraversalVertexProgram` `profile()` now accounts for worker iteration in `GraphComputer` OLAP. -* `TraversalVertexProgram` ``profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only. * Added getters for the lambdas held by `LambdaCollectingBarrierStep`, `LambdaFlatMapStep` and `LambdaSideEffectStep`.
[11/11] tinkerpop git commit: Merge branch 'tp32'
Merge branch 'tp32' Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/39c6e656 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/39c6e656 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/39c6e656 Branch: refs/heads/master Commit: 39c6e6566ce604e056658ee99bb9333a607ac845 Parents: 9d7bb91 3db47e0 Author: davebshow Authored: Mon Nov 27 09:48:33 2017 -0800 Committer: davebshow Committed: Mon Nov 27 09:48:33 2017 -0800 -- CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/39c6e656/CHANGELOG.asciidoc --
[04/11] tinkerpop git commit: added core GraphSON types UUID, Date, and Timestamp for GraphSON 3
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5031ccdb/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py -- diff --cc gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py index 8f6285f,000..19448d9 mode 100644,00..100644 --- a/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py +++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py @@@ -1,294 -1,0 +1,371 @@@ - ''' ++""" +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. - ''' ++""" + +__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' + - import sys ++import datetime +import json ++import uuid ++ +from mock import Mock + +import six + +from gremlin_python.statics import * - from gremlin_python.structure.graph import Vertex, Edge, Property, VertexProperty - from gremlin_python.structure.graph import Path ++from gremlin_python.structure.graph import Vertex, Edge, Property, VertexProperty, Graph, Path +from gremlin_python.structure.io.graphsonV2d0 import GraphSONWriter, GraphSONReader, GraphSONUtil +import gremlin_python.structure.io.graphsonV2d0 ++ +from gremlin_python.process.traversal import P +from gremlin_python.process.strategies import SubgraphStrategy +from gremlin_python.process.graph_traversal import __ + + +class TestGraphSONReader(object): +graphson_reader = GraphSONReader() + +def test_number_input(self): +x = self.graphson_reader.readObject(json.dumps({ +"@type": "g:Int32", +"@value": 31 +})) +assert isinstance(x, int) +assert 31 == x +## +x = self.graphson_reader.readObject(json.dumps({ +"@type": "g:Int64", +"@value": 31 +})) +assert isinstance(x, long) +assert long(31) == x +## +x = self.graphson_reader.readObject(json.dumps({ +"@type": "g:Float", +"@value": 31.3 +})) +assert isinstance(x, float) +assert 31.3 == x +## +x = self.graphson_reader.readObject(json.dumps({ +"@type": "g:Double", +"@value": 31.2 +})) +assert isinstance(x, float) +assert 31.2 == x + +def test_graph(self): +vertex = self.graphson_reader.readObject(""" +{"@type":"g:Vertex", "@value":{"id":{"@type":"g:Int32","@value":1},"label":"person","outE":{"created":[{"id":{"@type":"g:Int32","@value":9},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.4}}}],"knows":[{"id":{"@type":"g:Int32","@value":7},"inV":{"@type":"g:Int32","@value":2},"properties":{"weight":{"@type":"g:Double","@value":0.5}}},{"id":{"@type":"g:Int32","@value":8},"inV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":0},"value":"marko"}],"age":[{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29}}]}}}""") +assert isinstance(vertex, Vertex) +assert "person" == vertex.label +assert 1 == vertex.id +assert isinstance(vertex.id, int) +assert vertex == Vertex(1) +## +vertex = self.graphson_reader.readObject(""" +{"@type":"g:Vertex", "@value":{"id":{"@type":"g:Float","@value":45.23}}}""") +assert isinstance(vertex, Vertex) +assert 45.23 == vertex.id +assert isinstance(vertex.id, FloatType) +assert "vertex" == vertex.label +assert vertex == Vertex(45.23) +## +vertex_property = self.graphson_reader.readObject(""" +{"@type":"g:VertexProperty", "@value":{"id":"anId","label":"aKey","value":true,"vertex":{"@type":"g:Int32","@value":9}}}""") +assert isinstance(vertex_property, VertexProperty) +assert "anId" == vertex_property.id +assert "aKey" == vertex_property.label +assert vertex_property.value +assert vertex_property.vertex == Vertex(9) +## +vertex_property = self.graphson_reader.readObject(""" +{"@type":"g:VertexProperty", "@value
[1/4] tinkerpop git commit: Implemented support for missing core GraphSON types in gremlin-python
Repository: tinkerpop Updated Branches: refs/heads/tp32 072b08214 -> 3db47e016 Implemented support for missing core GraphSON types in gremlin-python Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3b651ff5 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3b651ff5 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3b651ff5 Branch: refs/heads/tp32 Commit: 3b651ff58cdf210a63a0101d0a311c7076de2b0e Parents: f2b4fb9 Author: davebshow Authored: Wed Nov 1 16:31:10 2017 -0700 Committer: davebshow Committed: Wed Nov 1 16:31:10 2017 -0700 -- .../src/main/jython/gremlin_python/statics.py | 9 +++ .../gremlin_python/structure/io/graphson.py | 71 - .../jython/tests/structure/io/test_graphson.py | 81 +++- 3 files changed, 156 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3b651ff5/gremlin-python/src/main/jython/gremlin_python/statics.py -- diff --git a/gremlin-python/src/main/jython/gremlin_python/statics.py b/gremlin-python/src/main/jython/gremlin_python/statics.py index a1abf8e..f98347e 100644 --- a/gremlin-python/src/main/jython/gremlin_python/statics.py +++ b/gremlin-python/src/main/jython/gremlin_python/statics.py @@ -36,6 +36,15 @@ else: from types import LongType from types import TypeType + +class timestamp(float): +""" +In Python a timestamp is simply a float. This dummy class (similar to long), allows users to wrap a float +in a GLV script to make sure the value is serialized as a GraphSON timestamp. +""" +pass + + staticMethods = {} staticEnums = {} default_lambda_language = "gremlin-python" http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3b651ff5/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py -- diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py index 0daeffa..04085ee 100644 --- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py +++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py @@ -16,11 +16,15 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ''' -from aenum import Enum +import datetime import json -import six +import time +import uuid from collections import OrderedDict +import six +from aenum import Enum + from gremlin_python import statics from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType from gremlin_python.process.traversal import Binding, Bytecode, P, Traversal, Traverser, TraversalStrategy @@ -298,6 +302,69 @@ class TypeSerializer(_GraphSONTypeIO): return writer.toDict(typ()) +class UUIDIO(_GraphSONTypeIO): +python_type = uuid.UUID +graphson_type = "g:UUID" +graphson_base_type = "UUID" + +@classmethod +def dictify(cls, obj, writer): +return GraphSONUtil.typedValue(cls.graphson_base_type, str(obj)) + +@classmethod +def objectify(cls, d, reader): +return cls.python_type(d) + + +class DateIO(_GraphSONTypeIO): +python_type = datetime.datetime +graphson_type = "g:Date" +graphson_base_type = "Date" + +@classmethod +def dictify(cls, obj, writer): +# Java timestamp expects miliseconds +if six.PY3: +pts = obj.timestamp() +else: +# Hack for legacy Python +# Taken from: +# https://github.com/jaraco/backports.datetime_timestamp/blob/master/backports/datetime_timestamp/__init__.py +pts = time.mktime((obj.year, obj.month, obj.day, + obj.hour, obj.minute, obj.second, + -1, -1, -1)) + obj.microsecond / 1e6 + +# Have to use int because of legacy Python +ts = int(round(pts * 1000)) +return GraphSONUtil.typedValue(cls.graphson_base_type, ts) + +@classmethod +def objectify(cls, ts, reader): +# Python timestamp expects seconds +return datetime.datetime.fromtimestamp(ts / 1000.0) + + +# Based on current implementation, this class must always be declared before FloatIO. +# Seems pretty fragile for future maintainers. Maybe look into this. +class TimestampIO(_GraphSONTypeIO): +"""A timestamp in Python is type float""" +python_type = statics.timestamp +graphson_type = "g:Timestamp" +graphson_base_type = "Timestamp" + +@classmethod +def dictify(cls, obj, writer): +# Java timestamp expects millise
[05/11] tinkerpop git commit: added core GraphSON types UUID, Date, and Timestamp for GraphSON 3
added core GraphSON types UUID, Date, and Timestamp for GraphSON 3 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/5031ccdb Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/5031ccdb Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/5031ccdb Branch: refs/heads/master Commit: 5031ccdbea28b1384c40fd522e9fec25b5b86818 Parents: d6f031f c0078cc Author: davebshow Authored: Wed Nov 15 10:12:22 2017 -0800 Committer: davebshow Committed: Wed Nov 15 10:12:22 2017 -0800 -- CHANGELOG.asciidoc | 2 + .../upgrade/release-3.2.x-incubating.asciidoc | 9 ++ docs/src/upgrade/release-3.3.x.asciidoc | 9 ++ .../src/main/jython/gremlin_python/statics.py | 9 ++ .../gremlin_python/structure/io/graphsonV2d0.py | 71 +++- .../gremlin_python/structure/io/graphsonV3d0.py | 75 - .../tests/structure/io/test_graphsonV2d0.py | 87 ++-- .../tests/structure/io/test_graphsonV3d0.py | 83 ++- 8 files changed, 331 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5031ccdb/CHANGELOG.asciidoc -- diff --cc CHANGELOG.asciidoc index ce65af6,acfa892..49c9a5b --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@@ -246,11 -23,8 +246,13 @@@ image::https://raw.githubusercontent.co [[release-3-2-7]] === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET) + * Added core GraphSON classes for Gremlin-Python: `UUID`, `Date`, and `Timestamp`. +* Provided a method to configure detachment options with `EventStrategy`. +* Fixed a race condition in `TinkerIndex`. +* Fixed an `ArrayOutOfBoundsException` in `hasId()` for the rare situation when the provided collection is empty. +* Bump to Netty 4.0.52 +* `TraversalVertexProgram` `profile()` now accounts for worker iteration in `GraphComputer` OLAP. + * `TraversalVertexProgram` ``profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only. * Added getters for the lambdas held by `LambdaCollectingBarrierStep`, `LambdaFlatMapStep` and `LambdaSideEffectStep`. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5031ccdb/docs/src/upgrade/release-3.2.x-incubating.asciidoc -- diff --cc docs/src/upgrade/release-3.2.x-incubating.asciidoc index 5564eec,9be51f9..8745ce5 --- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc +++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc @@@ -29,16 -29,15 +29,25 @@@ image::https://raw.githubusercontent.co Please see the link:https://github.com/apache/tinkerpop/blob/3.2.7/CHANGELOG.asciidoc#release-3-2-7[changelog] for a complete list of all the modifications that are part of this release. + Gremlin-Python Core Types + With the addition of `UUID`, `Date`, and `Timestamp`, Gremlin-Python now implements serializers for all core GraphSON types. Users + that were using other types to represent this data can now use the Python classes `datetime.datetime` and`uuid.UUID` in GLV traversals. + Since Python does not support a native `Timestamp` object, Gremlin-Python now offers a dummy class `Timestamp`, which allows + users to wrap a float and submit it to the Gremlin Server as a `Timestamp` GraphSON type. `Timestamp` can be found in + `gremlin_python.statics`. + + See: link:https://issues.apache.org/jira/browse/TINKERPOP-1807[TINKERPOP-1807] + + EventStrategy Detachment + +`EventStrategy` forced detachment of mutated elements prior to raising them in events. While this was a desired +outcome, it may not have always fit every use case. For example, a user may have wanted a reference element or the +actual element itself. As a result, `EventStrategy` has changed to allow it to be constructed with a `detach()` +option, where it is possible to specify any of the following: `null` for no detachment, `DetachedFactory` for the +original behavior, and `ReferenceFactory` for detachment that returns reference elements. + +See: link:https://issues.apache.org/jira/browse/TINKERPOP-1829[TINKERPOP-1829] + Embedded Remote Connection As Gremlin Language Variants (GLVs) expand their usage and use of `withRemote()` becomes more common, the need to mock http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5031ccdb/docs/src/upgrade/release-3.3.x.asciidoc -- diff --cc docs/src/upgrade/release-3.3.x.asciidoc index 80aff8b,00
[08/11] tinkerpop git commit: removed upgrading docs for 3.3.1. Inclusion in 3.2.7 is enough
removed upgrading docs for 3.3.1. Inclusion in 3.2.7 is enough Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/97905748 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/97905748 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/97905748 Branch: refs/heads/master Commit: 979057485fe62d33e754965582bdd687a4babba0 Parents: 80624fc Author: davebshow Authored: Fri Nov 17 09:36:22 2017 -0800 Committer: davebshow Committed: Fri Nov 17 09:36:22 2017 -0800 -- docs/src/upgrade/release-3.3.x.asciidoc | 9 - 1 file changed, 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/97905748/docs/src/upgrade/release-3.3.x.asciidoc -- diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc index 4aaca6a..80aff8b 100644 --- a/docs/src/upgrade/release-3.3.x.asciidoc +++ b/docs/src/upgrade/release-3.3.x.asciidoc @@ -29,15 +29,6 @@ Please see the link:https://github.com/apache/tinkerpop/blob/3.3.1/CHANGELOG.asc === Upgrading for Users - Gremlin-Python Core Types -With the addition of `UUID`, `Date`, and `Timestamp`, Gremlin-Python now implements serializers for all core GraphSON types. Users -that were using other types to represent this data can now use the Python classes `datetime.datetime` and`uuid.UUID` in GLV traversals. -Since Python does not support a native `Timestamp` object, Gremlin-Python now offers a dummy class `Timestamp`, which allows -users to wrap a float and submit it to the Gremlin Server as a `Timestamp` GraphSON type. `Timestamp` can be found in -`gremlin_python.statics`. - -See: link:https://issues.apache.org/jira/browse/TINKERPOP-1807[TINKERPOP-1807] - Gremlin Python path() There was a bug in GraphSON 3.0 serialization that prevented proper handling of results contain `Path` object. As a
[09/11] tinkerpop git commit: Merge branch 'TINKERPOP-1807' into tp32
Merge branch 'TINKERPOP-1807' into tp32 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3db47e01 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3db47e01 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3db47e01 Branch: refs/heads/master Commit: 3db47e0162ef6330fe84e168591e9ab2f51b5725 Parents: 072b082 c0078cc Author: davebshow Authored: Mon Nov 27 09:45:41 2017 -0800 Committer: davebshow Committed: Mon Nov 27 09:45:41 2017 -0800 -- CHANGELOG.asciidoc | 2 + .../upgrade/release-3.2.x-incubating.asciidoc | 9 +++ .../src/main/jython/gremlin_python/statics.py | 9 +++ .../gremlin_python/structure/io/graphson.py | 71 +++- .../jython/tests/structure/io/test_graphson.py | 85 +++- 5 files changed, 171 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3db47e01/CHANGELOG.asciidoc -- diff --cc CHANGELOG.asciidoc index 02c87ca,acfa892..dd971de --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@@ -23,15 -23,8 +23,17 @@@ image::https://raw.githubusercontent.co [[release-3-2-7]] === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET) + * Added core GraphSON classes for Gremlin-Python: `UUID`, `Date`, and `Timestamp`. +* Provided a method to configure detachment options with `EventStrategy`. +* Fixed a race condition in `TinkerIndex`. +* Fixed an `ArrayOutOfBoundsException` in `hasId()` for the rare situation when the provided collection is empty. +* Bump to Netty 4.0.52 +* `TraversalVertexProgram` `profile()` now accounts for worker iteration in `GraphComputer` OLAP. +* Returned the `Builder` instance from the `DetachedEdge.Builder` methods of `setOutE` and `setOutV`. +* Added test framework for GLVs. +* Fixed bug in `TraversalHelper.replaceStep()` where the step being replaced needed to be removed prior to the new one being added. +* Added alias support in the .NET `DriverRemoteConnection`. + * `TraversalVertexProgram` ``profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only. * Added getters for the lambdas held by `LambdaCollectingBarrierStep`, `LambdaFlatMapStep` and `LambdaSideEffectStep`. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3db47e01/docs/src/upgrade/release-3.2.x-incubating.asciidoc -- diff --cc docs/src/upgrade/release-3.2.x-incubating.asciidoc index 1589069,9be51f9..a8b5ad6 --- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc +++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc @@@ -29,16 -29,15 +29,25 @@@ image::https://raw.githubusercontent.co Please see the link:https://github.com/apache/tinkerpop/blob/3.2.7/CHANGELOG.asciidoc#release-3-2-7[changelog] for a complete list of all the modifications that are part of this release. + Gremlin-Python Core Types + With the addition of `UUID`, `Date`, and `Timestamp`, Gremlin-Python now implements serializers for all core GraphSON types. Users + that were using other types to represent this data can now use the Python classes `datetime.datetime` and`uuid.UUID` in GLV traversals. + Since Python does not support a native `Timestamp` object, Gremlin-Python now offers a dummy class `Timestamp`, which allows + users to wrap a float and submit it to the Gremlin Server as a `Timestamp` GraphSON type. `Timestamp` can be found in + `gremlin_python.statics`. + + See: link:https://issues.apache.org/jira/browse/TINKERPOP-1807[TINKERPOP-1807] + + EventStrategy Detachment + +`EventStrategy` forced detachment of mutated elements prior to raising them in events. While this was a desired +outcome, it may not have always fit every use case. For example, a user may have wanted a reference element or the +actual element itself. As a result, `EventStrategy` has changed to allow it to be constructed with a `detach()` +option, where it is possible to specify any of the following: `null` for no detachment, `DetachedFactory` for the +original behavior, and `ReferenceFactory` for detachment that returns reference elements. + +See: link:https://issues.apache.org/jira/browse/TINKERPOP-1829[TINKERPOP-1829] + Embedded Remote Connection As Gremlin Language Variants (GLVs) expand their usage and use of `withRemote()` becomes more common, the need to mock
[4/4] tinkerpop git commit: Merge branch 'TINKERPOP-1807' into tp32
Merge branch 'TINKERPOP-1807' into tp32 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3db47e01 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3db47e01 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3db47e01 Branch: refs/heads/tp32 Commit: 3db47e0162ef6330fe84e168591e9ab2f51b5725 Parents: 072b082 c0078cc Author: davebshow Authored: Mon Nov 27 09:45:41 2017 -0800 Committer: davebshow Committed: Mon Nov 27 09:45:41 2017 -0800 -- CHANGELOG.asciidoc | 2 + .../upgrade/release-3.2.x-incubating.asciidoc | 9 +++ .../src/main/jython/gremlin_python/statics.py | 9 +++ .../gremlin_python/structure/io/graphson.py | 71 +++- .../jython/tests/structure/io/test_graphson.py | 85 +++- 5 files changed, 171 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3db47e01/CHANGELOG.asciidoc -- diff --cc CHANGELOG.asciidoc index 02c87ca,acfa892..dd971de --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@@ -23,15 -23,8 +23,17 @@@ image::https://raw.githubusercontent.co [[release-3-2-7]] === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET) + * Added core GraphSON classes for Gremlin-Python: `UUID`, `Date`, and `Timestamp`. +* Provided a method to configure detachment options with `EventStrategy`. +* Fixed a race condition in `TinkerIndex`. +* Fixed an `ArrayOutOfBoundsException` in `hasId()` for the rare situation when the provided collection is empty. +* Bump to Netty 4.0.52 +* `TraversalVertexProgram` `profile()` now accounts for worker iteration in `GraphComputer` OLAP. +* Returned the `Builder` instance from the `DetachedEdge.Builder` methods of `setOutE` and `setOutV`. +* Added test framework for GLVs. +* Fixed bug in `TraversalHelper.replaceStep()` where the step being replaced needed to be removed prior to the new one being added. +* Added alias support in the .NET `DriverRemoteConnection`. + * `TraversalVertexProgram` ``profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only. * Added getters for the lambdas held by `LambdaCollectingBarrierStep`, `LambdaFlatMapStep` and `LambdaSideEffectStep`. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3db47e01/docs/src/upgrade/release-3.2.x-incubating.asciidoc -- diff --cc docs/src/upgrade/release-3.2.x-incubating.asciidoc index 1589069,9be51f9..a8b5ad6 --- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc +++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc @@@ -29,16 -29,15 +29,25 @@@ image::https://raw.githubusercontent.co Please see the link:https://github.com/apache/tinkerpop/blob/3.2.7/CHANGELOG.asciidoc#release-3-2-7[changelog] for a complete list of all the modifications that are part of this release. + Gremlin-Python Core Types + With the addition of `UUID`, `Date`, and `Timestamp`, Gremlin-Python now implements serializers for all core GraphSON types. Users + that were using other types to represent this data can now use the Python classes `datetime.datetime` and`uuid.UUID` in GLV traversals. + Since Python does not support a native `Timestamp` object, Gremlin-Python now offers a dummy class `Timestamp`, which allows + users to wrap a float and submit it to the Gremlin Server as a `Timestamp` GraphSON type. `Timestamp` can be found in + `gremlin_python.statics`. + + See: link:https://issues.apache.org/jira/browse/TINKERPOP-1807[TINKERPOP-1807] + + EventStrategy Detachment + +`EventStrategy` forced detachment of mutated elements prior to raising them in events. While this was a desired +outcome, it may not have always fit every use case. For example, a user may have wanted a reference element or the +actual element itself. As a result, `EventStrategy` has changed to allow it to be constructed with a `detach()` +option, where it is possible to specify any of the following: `null` for no detachment, `DetachedFactory` for the +original behavior, and `ReferenceFactory` for detachment that returns reference elements. + +See: link:https://issues.apache.org/jira/browse/TINKERPOP-1829[TINKERPOP-1829] + Embedded Remote Connection As Gremlin Language Variants (GLVs) expand their usage and use of `withRemote()` becomes more common, the need to mock
[2/4] tinkerpop git commit: updated changelog and upgrade docs
updated changelog and upgrade docs Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/46612842 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/46612842 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/46612842 Branch: refs/heads/tp32 Commit: 4661284292306fecb67fbcc46617af97b3b7762f Parents: 3b651ff Author: davebshow Authored: Tue Nov 7 09:40:05 2017 -0800 Committer: davebshow Committed: Tue Nov 7 09:40:05 2017 -0800 -- CHANGELOG.asciidoc | 1 + docs/src/upgrade/release-3.2.x-incubating.asciidoc | 9 + 2 files changed, 10 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/46612842/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index fcba906..acfa892 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima [[release-3-2-7]] === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET) +* Added core GraphSON classes for Gremlin-Python: `UUID`, `Date`, and `Timestamp`. * `TraversalVertexProgram` ``profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/46612842/docs/src/upgrade/release-3.2.x-incubating.asciidoc -- diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc index 60fd320..9be51f9 100644 --- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc +++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc @@ -29,6 +29,15 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima Please see the link:https://github.com/apache/tinkerpop/blob/3.2.7/CHANGELOG.asciidoc#release-3-2-7[changelog] for a complete list of all the modifications that are part of this release. + Gremlin-Python Core Types +With the addition of `UUID`, `Date`, and `Timestamp`, Gremlin-Python now implements serializers for all core GraphSON types. Users +that were using other types to represent this data can now use the Python classes `datetime.datetime` and`uuid.UUID` in GLV traversals. +Since Python does not support a native `Timestamp` object, Gremlin-Python now offers a dummy class `Timestamp`, which allows +users to wrap a float and submit it to the Gremlin Server as a `Timestamp` GraphSON type. `Timestamp` can be found in +`gremlin_python.statics`. + +See: link:https://issues.apache.org/jira/browse/TINKERPOP-1807[TINKERPOP-1807] + Embedded Remote Connection As Gremlin Language Variants (GLVs) expand their usage and use of `withRemote()` becomes more common, the need to mock
tinkerpop git commit: CTR removed doubled changelog entry
Repository: tinkerpop Updated Branches: refs/heads/tp32 3db47e016 -> 8a76de7f5 CTR removed doubled changelog entry Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8a76de7f Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8a76de7f Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8a76de7f Branch: refs/heads/tp32 Commit: 8a76de7f5ca68b2f66f666c41c57a27459002dcf Parents: 3db47e0 Author: davebshow Authored: Mon Nov 27 10:11:27 2017 -0800 Committer: davebshow Committed: Mon Nov 27 10:11:27 2017 -0800 -- CHANGELOG.asciidoc | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8a76de7f/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index dd971de..bf865fa 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -33,7 +33,6 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima * Added test framework for GLVs. * Fixed bug in `TraversalHelper.replaceStep()` where the step being replaced needed to be removed prior to the new one being added. * Added alias support in the .NET `DriverRemoteConnection`. -* `TraversalVertexProgram` ``profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only. * Added getters for the lambdas held by `LambdaCollectingBarrierStep`, `LambdaFlatMapStep` and `LambdaSideEffectStep`.
tinkerpop git commit: CTR removed doubled changelog entry
Repository: tinkerpop Updated Branches: refs/heads/master 39c6e6566 -> 78baa86dc CTR removed doubled changelog entry Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/78baa86d Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/78baa86d Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/78baa86d Branch: refs/heads/master Commit: 78baa86dc8d5ca0ed8a54697d078e781c9d357cf Parents: 39c6e65 Author: davebshow Authored: Mon Nov 27 10:13:04 2017 -0800 Committer: davebshow Committed: Mon Nov 27 10:13:04 2017 -0800 -- CHANGELOG.asciidoc | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/78baa86d/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 54bc862..b4c1f2c 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -256,7 +256,6 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima * Added test framework for GLVs. * Fixed bug in `TraversalHelper.replaceStep()` where the step being replaced needed to be removed prior to the new one being added. * Added alias support in the .NET `DriverRemoteConnection`. -* `TraversalVertexProgram` ``profile()` now accounts for worker iteration in `GraphComputer` OLAP. * Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on `BOTH`. * Better respected permissions on the `plugins.txt` file and prevented writing if marked as read-only. * Added getters for the lambdas held by `LambdaCollectingBarrierStep`, `LambdaFlatMapStep` and `LambdaSideEffectStep`.
tinkerpop git commit: if it is an .iterate(), GremlinServer needs to make sure that the traversal side-effects are added to the cache for retrieval.
Repository: tinkerpop Updated Branches: refs/heads/TINKERPOP-1834 2a957bb58 -> f40187497 if it is an .iterate(), GremlinServer needs to make sure that the traversal side-effects are added to the cache for retrieval. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f4018749 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f4018749 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f4018749 Branch: refs/heads/TINKERPOP-1834 Commit: f401874976ebdad697f90f04396be02a906e965b Parents: 2a957bb Author: Marko A. Rodriguez Authored: Mon Nov 27 19:16:27 2017 -0800 Committer: Marko A. Rodriguez Committed: Mon Nov 27 19:16:27 2017 -0800 -- .../gremlin/server/op/traversal/TraversalOpProcessor.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f4018749/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java -- diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java index b9705a6..1c0402f 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java @@ -480,12 +480,16 @@ public class TraversalOpProcessor extends AbstractOpProcessor { final boolean useBinary = ctx.channel().attr(StateKey.USE_BINARY).get(); boolean warnOnce = false; - // we have an empty iterator - happens on stuff like: g.V().iterate() if (!itty.hasNext()) { // as there is nothing left to iterate if we are transaction managed then we should execute a // commit here before we send back a NO_CONTENT which implies success onTraversalSuccess(graph, context); +// if it was a g.V().iterate(), then be sure to add the side-effects to the cache +if (itty instanceof TraverserIterator && + !((TraverserIterator)itty).getTraversal().getSideEffects().isEmpty()) { +cache.put(msg.getRequestId(), ((TraverserIterator)itty).getTraversal().getSideEffects()); +} ctx.writeAndFlush(ResponseMessage.build(msg) .code(ResponseStatusCode.NO_CONTENT) .create());