From 86d78e0712da24b08cd824f15de87be4a3369c3c Mon Sep 17 00:00:00 2001 From: saidimu apale Date: Tue, 20 May 2014 13:09:45 -0400 Subject: [PATCH 1/6] Fixed GraphOfTheGods example Replaced non-existent vertex property `getPropertySync` with `getProperty`. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dbb1386..bd460ad 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,9 @@ var g = gremlin.wrap(graph); g.V('name', 'saturn').next(function (err, saturn) { g.start(saturn).in('father').in('father').next(function (err, grandchild) { - var name = grandchild.getPropertySync('name'); - console.log(name); + grandchild.getProperty('name', function(err, name) { + console.log(name); + }); }); }); ``` From b6b38a35bc33d120b704399f47ce0f23f7fe3515 Mon Sep 17 00:00:00 2001 From: saidimu apale Date: Tue, 20 May 2014 14:12:51 -0400 Subject: [PATCH 2/6] Added translated examples from the Titan wiki --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index bd460ad..8c8f3f8 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,26 @@ g.V('name', 'saturn').next(function (err, saturn) { }); }); ``` + +## The Graph of the Gods + +These examples will attempt to mimic [Getting Started](https://github.com/thinkaurelius/titan/wiki/Getting-Started) from the Titan wiki using the graph visualized below. ![The Graph of the Gods](https://raw.githubusercontent.com/wiki/thinkaurelius/titan/images/graph-of-the-gods-2.png) + +Error handling is omitted to keep the code readable. + +```javascript +> g.V('name', 'saturn').next(function (err, vertex) { + saturn = vertex; + console.log(saturn.toJSON()); + }); + +{ id: '4' } + +> g.V('name', 'saturn').map().next(function (err, properties) { + console.log(properties); + }); + +{ name: 'saturn', age: 10000, type: 'titan' } + + +``` From c4ecc215ca82c8fd5102b0cb7e995899fe4057de Mon Sep 17 00:00:00 2001 From: saidimu apale Date: Tue, 20 May 2014 21:20:43 -0400 Subject: [PATCH 3/6] More translated examples from the Titan wiki --- README.md | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8c8f3f8..1572edf 100644 --- a/README.md +++ b/README.md @@ -38,23 +38,44 @@ g.V('name', 'saturn').next(function (err, saturn) { ## The Graph of the Gods -These examples will attempt to mimic [Getting Started](https://github.com/thinkaurelius/titan/wiki/Getting-Started) from the Titan wiki using the graph visualized below. ![The Graph of the Gods](https://raw.githubusercontent.com/wiki/thinkaurelius/titan/images/graph-of-the-gods-2.png) +These examples will attempt to mimic [Getting Started](https://github.com/thinkaurelius/titan/wiki/Getting-Started) from the Titan wiki using the graph visualized below. + +![The Graph of the Gods](https://raw.githubusercontent.com/wiki/thinkaurelius/titan/images/graph-of-the-gods-2.png) Error handling is omitted to keep the code readable. +gremlin> saturn = g.V('name','saturn').next() ```javascript > g.V('name', 'saturn').next(function (err, vertex) { - saturn = vertex; - console.log(saturn.toJSON()); + console.log(vertex.toJSON()); }); { id: '4' } +``` +gremlin> saturn.map() +```javascript > g.V('name', 'saturn').map().next(function (err, properties) { console.log(properties); }); { name: 'saturn', age: 10000, type: 'titan' } +``` +gremlin> saturn.in('father').in('father').name +```javascript +> g.V('name', 'saturn').in('father').in('father').next(function(err, vertex) { + vertex.getProperty('name', function(err, value) { + console.log(value); + }); + }); + +hercules +``` +gremlin> g.E.has('place',WITHIN,Geoshape.circle(37.97,23.72,50)) +```javascript +> g.E().has('place', g.Geo.WITHIN, g.Geoshape.circleSync(37.97,23.72,50)).next(function(err, val) { + console.log(val.toJSON()); + }); ``` From 036bc26b76b28122f9a79a6c2bb9c77ad227855a Mon Sep 17 00:00:00 2001 From: saidimu apale Date: Tue, 20 May 2014 21:21:38 -0400 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1572edf..2938cb8 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ These examples will attempt to mimic [Getting Started](https://github.com/thinka Error handling is omitted to keep the code readable. -gremlin> saturn = g.V('name','saturn').next() +>> gremlin> saturn = g.V('name','saturn').next() ```javascript > g.V('name', 'saturn').next(function (err, vertex) { console.log(vertex.toJSON()); From 55426ab3ad8ee845edaadf3448b934245da2a3eb Mon Sep 17 00:00:00 2001 From: saidimu apale Date: Tue, 20 May 2014 21:24:40 -0400 Subject: [PATCH 5/6] Update README.md --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2938cb8..fd6e7f4 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ These examples will attempt to mimic [Getting Started](https://github.com/thinka Error handling is omitted to keep the code readable. >> gremlin> saturn = g.V('name','saturn').next() + ```javascript > g.V('name', 'saturn').next(function (err, vertex) { console.log(vertex.toJSON()); @@ -53,7 +54,9 @@ Error handling is omitted to keep the code readable. { id: '4' } ``` -gremlin> saturn.map() + +>> gremlin> saturn.map() + ```javascript > g.V('name', 'saturn').map().next(function (err, properties) { console.log(properties); @@ -62,7 +65,9 @@ gremlin> saturn.map() { name: 'saturn', age: 10000, type: 'titan' } ``` -gremlin> saturn.in('father').in('father').name + +>> gremlin> saturn.in('father').in('father').name + ```javascript > g.V('name', 'saturn').in('father').in('father').next(function(err, vertex) { vertex.getProperty('name', function(err, value) { @@ -73,7 +78,9 @@ gremlin> saturn.in('father').in('father').name hercules ``` -gremlin> g.E.has('place',WITHIN,Geoshape.circle(37.97,23.72,50)) + +>> gremlin> g.E.has('place',WITHIN,Geoshape.circle(37.97,23.72,50)) + ```javascript > g.E().has('place', g.Geo.WITHIN, g.Geoshape.circleSync(37.97,23.72,50)).next(function(err, val) { console.log(val.toJSON()); From 3963d9ab1ed3cf05025f601a7a18fdfe092b01fc Mon Sep 17 00:00:00 2001 From: saidimu apale Date: Tue, 20 May 2014 21:25:29 -0400 Subject: [PATCH 6/6] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fd6e7f4..a469a4e 100644 --- a/README.md +++ b/README.md @@ -85,4 +85,6 @@ hercules > g.E().has('place', g.Geo.WITHIN, g.Geoshape.circleSync(37.97,23.72,50)).next(function(err, val) { console.log(val.toJSON()); }); + +{ id: '6J-o-2i' } ```