tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject tinkerpop git commit: TINKERPOP-1976 Added pageRank() test for GLVs
Date Tue, 07 Aug 2018 12:54:01 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1976 dc95de489 -> 44ab592c6


TINKERPOP-1976 Added pageRank() test for GLVs


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/44ab592c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/44ab592c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/44ab592c

Branch: refs/heads/TINKERPOP-1976
Commit: 44ab592c608bcc456ef5c152c53e3a8ecf790fcb
Parents: dc95de4
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Tue Aug 7 08:53:32 2018 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Tue Aug 7 08:53:32 2018 -0400

----------------------------------------------------------------------
 .../ModernGraphTypeInformation.cs               |   3 +
 .../test/cucumber/feature-steps.js              |  11 +-
 .../glv/GraphTraversalSource.template           |   2 +-
 .../gremlin_python/process/graph_traversal.py   |   2 +-
 gremlin-test/features/map/PageRank.feature      | 142 +++++++++++++++++++
 .../gremlin/process/FeatureCoverageTest.java    |   3 +-
 6 files changed, 159 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/44ab592c/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index 7489b44..75dd37c 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -38,6 +38,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             {"name", typeof(string)},
             {"lang", typeof(string)},
             {"weight", typeof(float)},
+            {"gremlin.pageRankVertexProgram.pageRank", typeof(double)},
+            {"friendRank", typeof(double)},
+            {"pageRank", typeof(double)},
             {"foo", typeof(object)}, // used when for invalid property key lookups
             {"friendWeight", typeof(float)},  // used in an AddVertex.feature test
             {"performances", typeof(int)} // grateful dead graph

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/44ab592c/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 3976348..3f76052 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
@@ -55,12 +55,21 @@ const parsers = [
 
 const ignoreReason = {
   lambdaNotSupported: 'Lambdas are not supported on gremlin-javascript',
+  computerNotSupported: "withComputer() is not supported on gremlin-javascript",
   needsFurtherInvestigation: '',
 };
 
 const ignoredScenarios = {
   // An associative array containing the scenario name as key, for example:
-  // 'g_V_asXa_bX_out_asXcX_path_selectXkeysX': new IgnoreError(ignoreReason.embeddedListAssertion),
+  'g_V_pageRank': new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_outXcreatedX_pageRank_byXbothEX_byXprojectRankX_timesX0X_valueMapXname_projectRankX':
new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_pageRank_order_byXpageRank_decrX_name': new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_pageRank_order_byXpageRank_decrX_name_limitX2X': new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_pageRank_byXoutEXknowsXX_byXfriendRankX_valueMapXname_friendRankX': new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_hasLabelXpersonX_pageRank_byXpageRankX_order_byXpageRankX_valueMapXname_pageRankX':
new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_pageRank_byXpageRankX_asXaX_outXknowsX_pageRank_asXbX_selectXa_bX': new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_hasLabelXsoftwareX_hasXname_rippleX_pageRankX1X_byXinEXcreatedXX_timesX1X_byXpriorsX_inXcreatedX_unionXboth__identityX_valueMapXname_priorsX':
new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_byXpageRankX_byXinEX_timesX1X_inXcreatedX_groupXmX_byXpageRankX_capXmX':
new IgnoreError(ignoreReason.computerNotSupported),
 };
 
 defineSupportCode(function(methods) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/44ab592c/gremlin-python/glv/GraphTraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-python/glv/GraphTraversalSource.template b/gremlin-python/glv/GraphTraversalSource.template
index 54b339e..d7ef973 100644
--- a/gremlin-python/glv/GraphTraversalSource.template
+++ b/gremlin-python/glv/GraphTraversalSource.template
@@ -52,9 +52,9 @@ class GraphTraversalSource(object):
         source = self.get_graph_traversal_source()
         source.traversal_strategies.add_strategies([RemoteStrategy(remote_connection)])
         return source
+
     def withComputer(self,graph_computer=None, workers=None, result=None, persist=None, vertices=None,
edges=None, configuration=None):
         return self.withStrategies(VertexProgramStrategy(graph_computer,workers,result,persist,vertices,edges,configuration))
-
 <% sourceSpawnMethods.each { method -> %>
     def <%= method %>(self, *args):
         traversal = self.get_graph_traversal()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/44ab592c/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index b1056f0..b515e95 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -77,10 +77,10 @@ class GraphTraversalSource(object):
         source = self.get_graph_traversal_source()
         source.traversal_strategies.add_strategies([RemoteStrategy(remote_connection)])
         return source
+
     def withComputer(self,graph_computer=None, workers=None, result=None, persist=None, vertices=None,
edges=None, configuration=None):
         return self.withStrategies(VertexProgramStrategy(graph_computer,workers,result,persist,vertices,edges,configuration))
 
-
     def E(self, *args):
         traversal = self.get_graph_traversal()
         traversal.bytecode.add_step("E", *args)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/44ab592c/gremlin-test/features/map/PageRank.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/PageRank.feature b/gremlin-test/features/map/PageRank.feature
new file mode 100644
index 0000000..76af1ed
--- /dev/null
+++ b/gremlin-test/features/map/PageRank.feature
@@ -0,0 +1,142 @@
+# 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.
+
+Feature: Step - pageRank()
+                
+  Scenario: g_V_pageRank
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().pageRank()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+      | v[vadas] |
+      | v[lop] |
+      | v[josh] |
+      | v[ripple] |
+      | v[peter] |
+    And the graph should return 6 for count of "g.withComputer().V().pageRank().has(\"gremlin.pageRankVertexProgram.pageRank\")"
+
+  Scenario: g_V_outXcreatedX_pageRank_byXbothEX_byXprojectRankX_timesX0X_valueMapXname_projectRankX
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().out("created").pageRank().by(__.bothE()).by("projectRank").times(0).valueMap("name",
"projectRank")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"name": ["lop"], "projectRank": [3.0]}] |
+      | m[{"name": ["lop"], "projectRank": [3.0]}] |
+      | m[{"name": ["lop"], "projectRank": [3.0]}] |
+      | m[{"name": ["ripple"], "projectRank": [1.0]}] |
+
+  Scenario: g_V_pageRank_order_byXpageRank_decrX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().pageRank().order().by("gremlin.pageRankVertexProgram.pageRank",
Order.decr).values("name")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | lop    |
+      | ripple |
+      | vadas  |
+      | josh   |
+      | marko  |
+      | peter  |
+
+  Scenario: g_V_pageRank_order_byXpageRank_decrX_name_limitX2X
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().pageRank().order().by("gremlin.pageRankVertexProgram.pageRank",
Order.decr).values("name").limit(2)
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | lop    |
+      | ripple |
+
+  Scenario: g_V_pageRank_byXoutEXknowsXX_byXfriendRankX_valueMapXname_friendRankX
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().pageRank().by(__.outE("knows")).by("friendRank").valueMap("name",
"friendRank")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"name": ["marko"], "friendRank": [0.15000000000000002]}] |
+      | m[{"name": ["vadas"], "friendRank": [0.21375000000000002]}] |
+      | m[{"name": ["lop"], "friendRank": [0.15000000000000002]}] |
+      | m[{"name": ["josh"], "friendRank": [0.21375000000000002]}] |
+      | m[{"name": ["ripple"], "friendRank": [0.15000000000000002]}] |
+      | m[{"name": ["peter"], "friendRank": [0.15000000000000002]}] |
+
+  Scenario: g_V_hasLabelXpersonX_pageRank_byXpageRankX_order_byXpageRankX_valueMapXname_pageRankX
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().hasLabel("person").pageRank().by("pageRank").order().by("pageRank").valueMap("name",
"pageRank")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"name": ["marko"], "pageRank": [0.15000000000000002]}] |
+      | m[{"name": ["vadas"], "pageRank": [0.19250000000000003]}] |
+      | m[{"name": ["josh"], "pageRank": [0.19250000000000003]}] |
+      | m[{"name": ["peter"], "pageRank": [0.15000000000000002]}] |
+
+  Scenario: g_V_pageRank_byXpageRankX_asXaX_outXknowsX_pageRank_asXbX_selectXa_bX
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().pageRank().by("pageRank").as("a").out("knows").values("pageRank").as("b").select("a",
"b")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"a": "v[marko]", "b": 0.19250000000000003}] |
+      | m[{"a": "v[marko]", "b": 0.19250000000000003}] |
+
+  Scenario: g_V_hasLabelXsoftwareX_hasXname_rippleX_pageRankX1X_byXinEXcreatedXX_timesX1X_byXpriorsX_inXcreatedX_unionXboth__identityX_valueMapXname_priorsX
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().hasLabel("software").has("name", "ripple").pageRank(1.0).by(__.inE("created")).times(1).by("priors").in("created").union(__.both(),
__.identity()).valueMap("name", "priors")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"name": ["josh"], "priors": [1.0]}] |
+      | m[{"name": ["marko"], "priors": [0.0]}] |
+      | m[{"name": ["lop"], "priors": [0.0]}] |
+      | m[{"name": ["ripple"], "priors": [0.0]}] |
+
+  Scenario: g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_byXpageRankX_byXinEX_timesX1X_inXcreatedX_groupXmX_byXpageRankX_capXmX()
+    Given an unsupported test
+    Then nothing should happen because
+      """
+      The result returned is not supported under GraphSON 2.x and therefore cannot be properly
asserted. More
+      specifically it has long keys which basically get toString()'d under GraphSON 2.x.
This test can be supported
+      with GraphSON 3.x.
+      """

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/44ab592c/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
index 503df77..6a45d38 100644
--- a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
+++ b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
@@ -53,6 +53,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.MaxTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.MeanTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.MinTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.PageRankTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.PathTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProjectTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesTest;
@@ -140,7 +141,7 @@ public class FeatureCoverageTest {
                 MeanTest.class,
                 MinTest.class,
                 OrderTest.class,
-                //PageRankTest.class,
+                PageRankTest.class,
                 PathTest.class,
                 // PeerPressureTest.class,
                 // ProfileTest.class,


Mime
View raw message