You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/06/20 11:53:58 UTC

[tinkerpop] branch master updated (44498a7 -> 0b89ec6)

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

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


    from 44498a7  The tp32 branch is no longer maintained
     new 11b1235  TINKERPOP-2228 Added tests for valueMap on Path CTR
     new 4143487  Merge branch 'tp33' into tp34
     new 0b89ec6  Merge branch 'tp34'

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


Summary of changes:
 .../test/integration/traversal-test.js             | 15 ++++++-
 .../gremlin-javascript/test/unit/graphson-test.js  | 52 ++++++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletion(-)


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

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

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

commit 0b89ec69152368b919a3aab421a47f67beda3d4a
Merge: 44498a7 4143487
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Jun 20 07:53:46 2019 -0400

    Merge branch 'tp34'

 .../test/integration/traversal-test.js             | 15 ++++++-
 .../gremlin-javascript/test/unit/graphson-test.js  | 52 ++++++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletion(-)


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

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

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

commit 41434877da85338613f09f7b9c8a6d9d812834df
Merge: d7daf2a 11b1235
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Jun 20 07:47:11 2019 -0400

    Merge branch 'tp33' into tp34

 .../test/integration/traversal-test.js             | 15 ++++++-
 .../gremlin-javascript/test/unit/graphson-test.js  | 52 ++++++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletion(-)



[tinkerpop] 01/03: TINKERPOP-2228 Added tests for valueMap on Path CTR

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

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

commit 11b1235410a651ca40407ed71cd5e0a04c5766e8
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Jun 20 07:43:59 2019 -0400

    TINKERPOP-2228 Added tests for valueMap on Path CTR
---
 .../gremlin-javascript/lib/structure/graph.js      |  4 ++
 .../test/integration/traversal-test.js             | 15 ++++++-
 .../gremlin-javascript/test/unit/graphson-test.js  | 52 ++++++++++++++++++++++
 3 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
index cb0d29f..98d9c77 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
@@ -129,6 +129,10 @@ class Path {
     this.objects = objects;
   }
 
+  toString() {
+    return 'path[' + this.objects.join(", ") +  ']';
+  }
+
   equals(other) {
     if (!(other instanceof Path)) {
       return false;
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
index 5c2ef01..e413f21 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
@@ -26,9 +26,10 @@ const assert = require('assert');
 const { Vertex } = require('../../lib/structure/graph');
 const { traversal } = require('../../lib/process/anonymous-traversal');
 const { GraphTraversalSource } = require('../../lib/process/graph-traversal');
-const { GraphTraversal } = require('../../lib/process/graph-traversal');
+const { GraphTraversal, statics } = require('../../lib/process/graph-traversal');
 const Bytecode = require('../../lib/process/bytecode');
 const helper = require('../helper');
+const __ = statics;
 
 let connection;
 
@@ -114,4 +115,16 @@ describe('Traversal', function () {
       });
     });
   });
+  describe("more complex traversals", function() {
+    it('should return paths of value maps', function() {
+      var g = traversal().withRemote(connection);
+      return g.V(1).out().in_().limit(1).path().by(__.valueMap('name')).toList().then(function (list) {
+        assert.ok(list);
+        assert.strictEqual(list.length, 1);
+        assert.strictEqual(list[0].objects[0].get('name')[0], "marko");
+        assert.strictEqual(list[0].objects[1].get('name')[0], "lop");
+        assert.strictEqual(list[0].objects[2].get('name')[0], "marko");
+      });
+    });
+  });
 });
\ No newline at end of file
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
index 261baf6..e5b509d 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
@@ -121,6 +121,58 @@ describe('GraphSONReader', function () {
     assert.strictEqual(result.objects[0].label, 'person');
     assert.strictEqual(result.objects[1].label, 'software');
   });
+  it('should parse paths from GraphSON3', function () {
+    const obj = {
+      "@type" : "g:Path",
+      "@value" : {
+        "labels" : {
+          "@type" : "g:List",
+          "@value" : [ {
+            "@type" : "g:Set",
+            "@value" : [ ]
+          }, {
+            "@type" : "g:Set",
+            "@value" : [ ]
+          }, {
+            "@type" : "g:Set",
+            "@value" : [ ]
+          } ]
+        },
+        "objects" : {
+          "@type" : "g:List",
+          "@value" : [ {
+            "@type" : "g:Vertex",
+            "@value" : {
+              "id" : {
+                "@type" : "g:Int32",
+                "@value" : 1
+              },
+              "label" : "person"
+            }
+          }, {
+            "@type" : "g:Vertex",
+            "@value" : {
+              "id" : {
+                "@type" : "g:Int32",
+                "@value" : 10
+              },
+              "label" : "software"
+            }
+          }, "lop" ]
+        }
+      }
+    };
+    const reader = new GraphSONReader(obj);
+    const result = reader.read(obj);
+    assert.ok(result);
+    assert.ok(result.objects);
+    assert.ok(result.labels);
+    assert.strictEqual(result.objects[2], 'lop');
+    assert.ok(result.objects[0] instanceof graph.Vertex);
+    assert.ok(result.objects[1] instanceof graph.Vertex);
+    assert.strictEqual(result.objects[0].label, 'person');
+    assert.strictEqual(result.objects[1].label, 'software');
+  });
 });
 describe('GraphSONWriter', function () {
   it('should write numbers', function () {