Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Release 2.3.0 commit.

  • Loading branch information...
commit 24ea68376a6c6eee3dee5762537219c5a73020f5 1 parent 685a25b
@okram okram authored
Showing with 18,824 additions and 18 deletions.
  1. +6 −4 CHANGELOG.textile
  2. +77 −0 doc/Acknowledgments.html
  3. +113 −0 doc/Backtrack-Pattern.html
  4. +119 −0 doc/Basic-Graph-Traversals.html
  5. +93 −0 doc/Defining-a-More-Complex-Property-Graph.html
  6. +84 −0 doc/Defining-a-Property-Graph.html
  7. +103 −0 doc/Depth-First-vs.-Breadth-First.html
  8. +93 −0 doc/Downloads.html
  9. +91 −0 doc/Except-Retain-Pattern.html
  10. +126 −0 doc/Flow-Rank-Pattern.html
  11. +190 −0 doc/Getting-Started.html
  12. +112 −0 doc/Gremlin-Groovy-Path-Optimizations.html
  13. +168 −0 doc/Gremlin-Methods.html
  14. +316 −0 doc/Gremlin-Steps.html
  15. +147 −0 doc/Home.html
  16. +101 −0 doc/JVM-Language-Implementations.html
  17. +88 −0 doc/Learning-Dependencies.html
  18. +251 −0 doc/LinkedData-Sail.html
  19. +140 −0 doc/Loop-Pattern.html
  20. +124 −0 doc/MapReduce-Pattern.html
  21. +125 −0 doc/Path-Pattern.html
  22. +147 −0 doc/Pattern-Match-Pattern.html
  23. +524 −0 doc/Release-Notes.html
  24. +153 −0 doc/SPARQL-vs.-Gremlin.html
  25. +90 −0 doc/Split-Merge-Pattern.html
  26. +84 −0 doc/Step-Closures.html
  27. +80 −0 doc/The-Benefits-of-Gremlin.html
  28. +84 −0 doc/Traversal-Optimization.html
  29. +153 −0 doc/Tree-Pattern.html
  30. +85 −0 doc/Troubleshooting.html
  31. +140 −0 doc/Updating-a-Graph.html
  32. +119 −0 doc/User-Defined-Steps.html
  33. +153 −0 doc/Using-Gremlin-through-Groovy.html
  34. +142 −0 doc/Using-Gremlin-through-Java.html
  35. +142 −0 doc/Using-JUNG.html
  36. +2,467 −0 doc/css/bootstrap.css
  37. +141 −0 doc/css/dialog.css
  38. +537 −0 doc/css/editor.css
  39. +669 −0 doc/css/gollum.css
  40. +69 −0 doc/css/ie7.css
  41. +316 −0 doc/css/template.css
  42. +1,084 −0 doc/javascript/editor/gollum.editor.js
  43. +168 −0 doc/javascript/editor/langs/asciidoc.js
  44. +103 −0 doc/javascript/editor/langs/creole.js
  45. +211 −0 doc/javascript/editor/langs/markdown.js
  46. +173 −0 doc/javascript/editor/langs/org.js
  47. +111 −0 doc/javascript/editor/langs/pod.js
  48. +74 −0 doc/javascript/editor/langs/rdoc.js
  49. +175 −0 doc/javascript/editor/langs/textile.js
  50. +206 −0 doc/javascript/gollum.dialog.js
  51. +191 −0 doc/javascript/gollum.js
  52. +54 −0 doc/javascript/gollum.placeholder.js
  53. +123 −0 doc/javascript/jquery.color.js
  54. +7,179 −0 doc/javascript/jquery.js
  55. +1 −7 gremlin-groovy/pom.xml
  56. +1 −1  gremlin-java/pom.xml
  57. +3 −1 gremlin-java/src/main/java/com/tinkerpop/gremlin/Imports.java
  58. +1 −1  gremlin-java/src/main/java/com/tinkerpop/gremlin/Tokens.java
  59. +1 −1  gremlin-test/pom.xml
  60. +3 −3 pom.xml
View
10 CHANGELOG.textile
@@ -5,19 +5,19 @@ h2. Gremlin 2.y.z
!https://github.com/tinkerpop/gremlin/raw/master/doc/images/gremlin-2.png!
-h3. Version 2.3.0 (NOT OFFICIALLY RELEASE YET)
+h3. Version 2.3.0 (March 20, 2013)
```xml
<dependency>
<groupId>com.tinkerpop.gremlin</groupId>
<artifactId>gremlin-java</artifactId>
- <version>2.3.0-SNAPSHOT</version>
+ <version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.tinkerpop.gremlin</groupId>
<artifactId>gremlin-groovy</artifactId>
- <version>2.3.0-SNAPSHOT</version>
+ <version>2.3.0</version>
</dependency>
```
@@ -27,7 +27,7 @@ h3. Version 2.3.0 (NOT OFFICIALLY RELEASE YET)
* @except()/retain()@ support @String[]@ of named steps to reference as collection
* @GroovyPipeFunction@ provides support for @AsMap@ referencing and closure access to named-steps
* Bumped to support Groovy 1.8.9
-* Added @GremlinPipeline.remove()@ which removes all elements at the end of the pipeline (overrides @Iterator.remove())
+* Added @GremlinPipeline.remove()@ which removes all elements at the end of the pipeline (overrides @Iterator.remove()@)
* Added @LinkPipe@ and @linkOut@, @linkIn@, @linkBoth@ steps to allow for the addition of linking current vertex with past vertex
* Added @orderMap@ step which takes a @Map@ as input, orders its entries, and then emits its keys
* Added @Tokens.T.decr@ and @Tokens.T.incr@ for default ordering in @order@ and @orderMap@ steps
@@ -38,6 +38,8 @@ h3. Version 2.3.0 (NOT OFFICIALLY RELEASE YET)
* The console can be initialized with a script to pre-define steps and initialize other aspects of the environment
* Added @shuffle@ step which gathers all objects into a list and randomizes the order of their output
+==<hr/>==
+
h3. Version 2.2.0 (December 19, 2012)
```xml
View
77 doc/Acknowledgments.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Acknowledgments</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Acknowledgments</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Acknowledgments"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Acknowledgments"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><img src=" images/gremlin-standing-small.png" /></p>
+<p>This section provides a list of the people that have contributed in some way to the creation of Gremlin.</p>
+<ol><li><a href="http://markorodriguez.com">Marko A. Rodriguez</a> &#x2014; designed, developed, tested, and documented Gremlin.</li>
+ <li><a href="http://github.com/xedin">Pavel Yaskevich</a> &#x2014; designed and developed Gremlin 0.5 compiler and virtual machine.</li>
+ <li><a href="http://ofallpossibleworlds.wordpress.com/">Darrick Wiebe</a> &#x2014; inspired many of Gremlin 0.7+ developments.</li>
+ <li><a href="http://www.linkedin.com/in/neubauer">Peter Neubauer</a> &#x2014; aided in the design and the evangelizing of Gremlin.</li>
+ <li><a href="http://fortytwo.net">Joshua Shinavier</a> &#x2014; inspired early design choices.</li>
+ <li><a href="http://www.ketrinayim.com/">Ketrina Yim</a> &#x2014; designed the Gremlin logo.</li>
+ <li><a href="http://www.linkedin.com/in/pierredewilde">Pierre De Wilde</a> &#x2014; designs and tests new features.</li>
+</ol><p>Please review Gremlin&#x2019;s <a href="http://github.com/tinkerpop/gremlin/blob/master/pom.xml">pom.xml</a>. Gremlin would not be possible without the work done by others to create these useful packages.</p>
+<p>Join the Gremlin users group at <a href="http://groups.google.com/group/gremlin-users">http://groups.google.com/group/gremlin-users</a>.</p>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
113 doc/Backtrack-Pattern.html
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Backtrack Pattern</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Backtrack Pattern</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Backtrack-Pattern"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Backtrack-Pattern"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><img src=" images/gremlin-kilt.png" /></p>
+<p>Many times its desirable to traverse a particular path and if some criteria is met along that path, then go back to the element from n-steps ago. Examples of such uses cases include:</p>
+<ul><li>&#x201C;What is the age of my friends who have friends who are older than 30 years old?&#x201D;</li>
+ <li>&#x201C;What other products have my friends purchased who have also purchased a product of type X?&#x201D;</li>
+</ul><pre><code>g = TinkerGraphFactory.createTinkerGraph()</code></pre>
+<p>The query below says, in plain English: &#x201C;What are the ages of the people that know people that are 30+ years old?&#x201D; The call to <code>back(2)</code> refers to the elements 2 steps ago that have paths up to the <code>back(2)</code> step (i.e. back to the <code>V</code> step). In the example below, <code>back(2)</code> &#x201C;wraps&#x201D; <code>out('knows').has('age', T.gt, 30)</code>.</p>
+<pre><code>gremlin&gt; g.V.out('knows').has('age', T.gt, 30).back(2).age
+==&gt;29
+gremlin&gt; g.V.as('x').outE('knows').inV.has('age', T.gt, 30).back('x').age
+==&gt;29</code></pre>
+<p>A more complicated example is provided over the Grateful Dead graph diagrammed in <a class="internal present" href="Defining-a-More-Complex-Property-Graph.html">Defining a More Complex Property Graph</a>.</p>
+<pre><code>g = new TinkerGraph()
+g.loadGraphML('data/graph-example-2.xml')</code></pre>
+<p>The example query below states the following:</p>
+<ul><li>get the song with id <code>89</code> (Dark Star).</li>
+ <li>get all the songs that follow Dark Star in concert. (<strong>A</strong>)</li>
+ <li>get the singers of those songs. (<strong>B</strong>)</li>
+ <li>filter to only those songs that are sung by Jerry Garcia. (<strong>C</strong>)</li>
+ <li>go back 2 steps to yield those songs that follow Dark Star and are sung by Jerry Garcia. (<strong>D</strong>)</li>
+ <li>get the names of those songs that follow Dark Star and are sung by Jerry Garcia.</li>
+</ul><pre><code>gremlin&gt; g.v(89).out('followed_by').out('sung_by').has('name','Garcia').back(2).name
+==&gt;EYES OF THE WORLD
+==&gt;SING ME BACK HOME
+==&gt;MORNING DEW
+==&gt;HES GONE
+==&gt;CHINA DOLL
+==&gt;WHARF RAT
+==&gt;BROKEDOWN PALACE
+==&gt;TERRAPIN STATION
+==&gt;DEAL
+==&gt;ATTICS OF MY LIFE
+==&gt;COMES A TIME
+==&gt;STELLA BLUE
+==&gt;BERTHA</code></pre>
+<p><img src=" images/jerry-followed_by-example.jpg" /></p>
+<p>In order to determine how many steps to go back, the <code>GremlinPipeline.toString()</code> can be handy for displaying all the steps in an expression.</p>
+<pre><code>gremlin&gt; println g.v(89).out('followed_by').out('sung_by').has('name','Garcia')
+[StartPipe, OutPipe(followed_by), OutPipe(sung_by), PropertyFilterPipe(name,EQUAL,Garcia)]
+==&gt;null</code></pre>
+<p>Now, using the <code>back</code> step, notice how <code>back(3)</code> wraps 3 pipes prior to it. The name of the pipe in <a href="../../pipes/2.3.0/Home.html">Pipes</a> is <code>BackFilterPipe</code>.</p>
+<pre><code>gremlin&gt; println g.v(89).out('followed_by').out('sung_by').has('name','Garcia').back(2).name
+[StartPipe, OutPipe(followed_by), BackFilterPipe([OutPipe(sung_by), PropertyFilterPipe(name,EQUAL,Garcia)]), PropertyPipe(name)]
+==&gt;null</code></pre>
+<p>Moreover, you can use <code>as</code> to label a back point.</p>
+<pre><code>gremlin&gt; println g.v(89).out('followed_by').as('x').out('sung_by').has('name','Garcia').back('x').name
+[StartPipe, AsPipe(x,OutPipe(followed_by)), BackFilterPipe([OutPipe(sung_by), PropertyFilterPipe(name,EQUAL,Garcia)]), PropertyPipe(name)]
+==&gt;null</code></pre>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
119 doc/Basic-Graph-Traversals.html
@@ -0,0 +1,119 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Basic Graph Traversals</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Basic Graph Traversals</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Basic-Graph-Traversals"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Basic-Graph-Traversals"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p>This section will present basic graph traversals by way of examples on the simple property graph diagrammed below.</p>
+<p><img src=" images/graph-example-1.jpg" alt="" /></p>
+<pre><code>gremlin&gt; g = TinkerGraphFactory.createTinkerGraph()
+==&gt;tinkergraph[vertices:6 edges:6]
+gremlin&gt; v = g.v(1)
+==&gt;v[1]</code></pre>
+<p>The symbol <code>v</code> denotes that the element is a vertex and <code>1</code> denotes the elements unique identifier. To determine all of the outgoing edges from the vertex, the following statement suffices.</p>
+<pre><code>gremlin&gt; v.outE
+==&gt;e[7][1-knows-&gt;2]
+==&gt;e[9][1-created-&gt;3]
+==&gt;e[8][1-knows-&gt;4]</code></pre>
+<p>As a convenience, Gremlin prints the outgoing and incoming vertex identifiers along with the edge label. To acquire the vertices at the head of these edges (known as the incoming vertices), apply another step in the path.</p>
+<pre><code>gremlin&gt; v.outE.inV
+==&gt;v[2]
+==&gt;v[3]
+==&gt;v[4]</code></pre>
+<p>It is important to note that in Gremlin, vertices are incident to edges and edges are incident to vertices. The reason for this will become apparent later when making use of element properties in path expressions. The reserved terms for denoting adjacency selection are the steps <code>outE</code>, <code>inE</code>, <code>bothE</code>, <code>outV</code>, <code>inV</code>, and <code>bothV</code> (see <a class="internal present" href="Gremlin-Steps.html">Gremlin Steps</a>). The components of a property graph are diagrammed in the example sub-graph below.</p>
+<p><img src=" images/graph-model.jpg" alt="" /></p>
+<p>The process of traversing a graph, in this manner, can continue indefinitely (granted, if there are loops in the graph).</p>
+<pre><code>gremlin&gt; v.outE.inV.outE.inV
+==&gt;v[5]
+==&gt;v[3]</code></pre>
+<p>There are the steps <code>out</code>, <code>in</code>, and <code>both</code> that skip over edges as such to jump from vertex to vertex.</p>
+<pre><code>gremlin&gt; v.out.out
+==&gt;v[5]
+==&gt;v[3]</code></pre>
+<p>Moreover, it is possible to make use of Groovy&#x2019;s language to repeat patterns. For example, the previous example can be denoted as follows.</p>
+<pre><code>gremlin&gt; list = [v]
+gremlin&gt; for(i in 1..2)
+ list = list._().out.collect{it}
+gremlin&gt; list
+==&gt;v[5]
+==&gt;v[3]</code></pre>
+<p>This can also be done using the <code>loop</code> step.</p>
+<pre><code>gremlin&gt; v.out.loop(1){it.loops &lt; 3}
+==&gt;v[5]
+==&gt;v[3]</code></pre>
+<p>If the Gremlin graph data structure was only a directed graph, then outgoing/incoming edges and outgoing/incoming vertices would be the limits of what could be expressed. However, given that vertices and edges can have properties, it is possible to use these properties within a path expression. For example, suppose you want to know the name of vertex 1.</p>
+<pre><code>gremlin&gt; v = g.v(1)
+==&gt;v[1]
+gremlin&gt; v.name
+==&gt;marko</code></pre>
+<p>The <code>name</code> construct denotes the property key <code>name</code> and returns the value of that key. The first component of the path is vertex 1. Thus, the <code>name</code> of vertex 1 is &#x201C;marko.&#x201D; Another, more complex example that uses vertex and edge properties is to determine the <code>name</code> of the vertices that vertex 1 <code>knows</code> and that are older than 30 years of age, is expressed as such.</p>
+<pre><code>gremlin&gt; v.outE('knows').inV.filter{it.age &gt; 30}.name
+==&gt;josh</code></pre>
+<p>In this expression, the <code>filter{ }</code> step serves to filter results of previous step in the path (a closure filter). Thus, <code>v.outE</code> is filtered to only those edges that have a <code>label</code> of &#x201C;knows.&#x201D; With respect to the diagrammed graph, this leaves only two edges. Next, the incoming vertices at the head of these two edges are determined and then filtered to only those whose <code>age</code> property is greater than 30. Given the diagram, this only leaves vertex 4. In the final segment of the path expression, the <code>name</code> of vertex 4 is selected and what is returned is &#x201C;josh.&#x201D;</p>
+<p>To conclude, let&#x2019;s do a more complicated graph traversal that uses backtracking and an in-line regular expression.</p>
+<pre><code>gremlin&gt; v.out('knows').filter{it.age &gt; 21}.name.filter{it.matches('jo.{2}|JO.{2}')}.back(3).age
+==&gt;32</code></pre>
+<p>With the root vertex being vertex 1, this path expression returns the age of those vertices that vertex 1 knows, are older than 21, and whose names are 4 characters and start with a &#x2018;jo&#x2019; or &#x2018;JO&#x2019;. While contrived, it demonstrates using closures to call functions on properties as well as backtracking to a vertex previously visited.</p>
+<p>This expression does the same thing without backtracking. Both are provided in order to demonstrate the many ways in which to express the same thing.</p>
+<pre><code>gremlin&gt; v.out('knows').filter{it.age &gt; 21 &amp; it.name.matches('jo.{2}|JO.{2}')}.age
+==&gt;32</code></pre>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
93 doc/Defining-a-More-Complex-Property-Graph.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Defining a More Complex Property Graph</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Defining a More Complex Property Graph</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Defining-a-More-Complex-Property-Graph"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Defining-a-More-Complex-Property-Graph"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p>The documentation up to this point has been using examples from a simple toy graph of 6 vertices and 6 edges. For this section, a more complicated graph structure is used in the examples. A clipped representation (i.e. low weighted edges removed) of this graph is diagrammed below. This graph is a representation of the American band, the <a href="http://en.wikipedia.org/wiki/Grateful_Dead">Grateful Dead</a>.</p>
+<p><img src=" images/graph-example-2.jpg" alt="" /></p>
+<p>More information about this data set can be found in the following article.</p>
+<p>Rodriguez, M.A., Gintautas, V., Pepe, A., <a href="http://arxiv.org/abs/0807.2466">A Grateful Dead Analysis: The Relationship Between Concert and Listening Behavior</a>, First Monday, volume 14, number 1, University of Illinois at Chicago Library, January 2009.</p>
+<pre><code>g = new TinkerGraph()
+g.loadGraphML('data/graph-example-2.xml')</code></pre>
+<p>In the above Grateful Dead graph, there are vertices and there are edges. The vertices are broken into two sets: songs (e.g. <a href="http://en.wikipedia.org/wiki/Dark_Star_%28song%29">Dark Star</a>, <a href="http://en.wikipedia.org/wiki/China_Cat_Sunflower">China Cat Sunflower</a>) and artists (e.g. <a href="http://en.wikipedia.org/wiki/Jerry_Garcia">Jerry Garcia</a>, <a href="http://en.wikipedia.org/wiki/Robert_Hunter_%28lyricist%29">Robert Hunter</a>). The following itemization describes the properties associated with vertices and edges.</p>
+<ol><li>vertices
+ <ul><li>song vertices
+ <ul><li>type (string): always &#x2018;song&#x2019; for song vertices.</li>
+ <li>name (string): the name of the song.</li>
+ <li>performances (integer): the number of times the song was played in concert.</li>
+ <li>song_type (string): whether the song is a &#x2018;cover&#x2019; song or an &#x2018;original&#x2019;.</li>
+ </ul></li>
+ <li>artist vertices
+ <ul><li>type (string): always &#x2018;artist&#x2019; for artist vertices.</li>
+ <li>name (string): the name of the artist.</li>
+ </ul></li>
+ </ul></li>
+ <li>edges
+ <ul><li>followed_by (song &#x2192; song): if the tail song was followed by the head song in concert.
+ <ul><li>weight (integer): the number of times these two songs were paired in concert.</li>
+ </ul></li>
+ <li>sung_by (song &#x2192; artist): if the tail song was primarily sung by the head artist.</li>
+ <li>written_by (song &#x2192; artist): if the tail song was written by the head artist.</li>
+ </ul></li>
+</ol>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
84 doc/Defining-a-Property-Graph.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Defining a Property Graph</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Defining a Property Graph</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Defining-a-Property-Graph"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Defining-a-Property-Graph"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p>Gremlin was designed specifically for the analysis and manipulation of key/value-based, directed, multi-relational graphs. This long term refers to a type of graph data structure that has certain features. These features are described as follows. The first term, key/value, refers to the fact that both vertices and edges can have any number of properties associated with them. The second term, directed, refers to the fact that the edges in the graph have a directionality &#x2014; that is, there is a tail and head to each edge. Finally, the third term, multi-relational, refers to the fact that there can many types of edges and thus, many types of relationships can exist between the vertices. For the remainder of this documentation, and for the sake of brevity, these types of graphs will be called <strong>property graphs</strong>. A property graph is demonstrated in the following example. This diagrammed property graph comes with the Gremlin distribution in <a href="http://graphml.graphdrawing.org/">GraphML</a> format at <code>data/graph-example-1.xml</code> (see <a href="https://github.com/tinkerpop/gremlin/blob/master/data/graph-example-1.xml">graph-example-1.xml</a>) or GraphSON at <code>data/graph-example-1.json</code> (see <a href="https://github.com/tinkerpop/gremlin/blob/master/data/graph-example-1.json">graph-example-1.json</a>)</p>
+<p><img src=" images/graph-example-1.jpg" alt="" /></p>
+<p>A property graph has these elements:</p>
+<ol><li>a set of vertices
+ <ul><li>each vertex has a unique identifier.</li>
+ <li>each vertex has a set of outgoing edges.</li>
+ <li>each vertex has a set of incoming edges.</li>
+ <li>each vertex has a collection of properties defined by a map from key to value.</li>
+ </ul></li>
+ <li>a set of edges
+ <ul><li>each edge has a unique identifier.</li>
+ <li>each edge has an outgoing tail vertex.</li>
+ <li>each edge has an incoming head vertex.</li>
+ <li>each edge has a label that denotes the type of relationship between its two vertices.</li>
+ <li>each edge has a collection of properties defined by a map from key to value.</li>
+ </ul></li>
+</ol><p>Learn more about the property graph data model from <a href="../../blueprints/2.3.0/Home.html">Blueprints</a>.</p>
+<p><a href="../../blueprints/2.3.0/Home.html"><img src="https://github.com/tinkerpop/blueprints/raw/master/doc/images/blueprints-logo.png" alt="" /></a></p>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
103 doc/Depth-First-vs.-Breadth-First.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Depth First vs. Breadth First</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Depth First vs. Breadth First</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Depth-First-vs.-Breadth-First"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Depth-First-vs.-Breadth-First"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><img src="http://www.cse.unsw.edu.au/~billw/Justsearch1.gif" alt="" /><br />
+[ <strong>Note</strong>: Image linked to from <a href="http://www.cse.unsw.edu.au/~billw/Justsearch.html">original webpage</a> ]</p>
+<p><a href="http://en.wikipedia.org/wiki/Depth-first_search">Depth-first traverse</a> traverses down an entire path as specified by a path expression before turning to the next legal path. On the other hand <a href="http://en.wikipedia.org/wiki/Breadth-first_search">breadth-first traverse</a> traverses legal paths &#x201C;in parallel,&#x201D; where at each step, all legal objects are computed before moving onto the next step of the path. Gremlin provides support for both types of traversals.</p>
+<ul><li><a href="#depth">Depth-First Traversal</a></li>
+ <li><a href="#breadth">Breadth-First Traversal</a></li>
+</ul><p><a name="depth" id="depth"></a></p>
+<h2>Depth-First Traversal</h2>
+<p>Gremlin is naturally a depth-first traversal language/engine. Typical path expression (as used in this documentation) evaluate in a depth-first manner. The following &#x201C;co-created&#x201D; expression is a depth-first expression.</p>
+<pre><code>gremlin&gt; g = TinkerGraphFactory.createTinkerGraph()
+==&gt;tinkergraph[vertices:6 edges:6]
+gremlin&gt; g.v(1).outE('created').inV.inE('created').outV
+==&gt;v[1]
+==&gt;v[4]
+==&gt;v[6]</code></pre>
+<p>In the expression above, the following occurs in the Gremlin evaluator (see <a class="internal present" href="Defining-a-Property-Graph.html">Defining a Property Graph</a> for diagram of graph).</p>
+<ol><li>Vertex <code>1</code> is passed to step <code>outE</code> which yields three outgoing edges.</li>
+ <li>The first of these outgoing edges is then passed into the label filter and goes through since its a <code>created</code> edge.</li>
+ <li>The edge then goes to the next step <code>inV</code> which produces vertex <code>3</code>.</li>
+ <li>Vertex <code>3</code> is then passed to <code>inE</code> which yields three edges.</li>
+ <li>The first edge is passed to the label filter and passes through because its a <code>created</code> edge.</li>
+ <li>The edge is passed to <code>outV</code> which yields vertex <code>1</code>.</li>
+</ol><p>At this point, the path expression is complete for the full <strong>depth</strong> of the expression (thus, depth-first). The evaluator then goes onto the remaining two edges created from the first <code>outE</code> and the process continues until all legal branches of the path expression have been evaluated.</p>
+<p><a name="breadth" id="breadth"></a></p>
+<h2>Breadth-First Traversal</h2>
+<p><img src="http://upload.wikimedia.org/wikipedia/commons/4/46/Animated_BFS.gif" alt="" /><br />
+[ <strong>Note</strong>: Image linked to from <a href="http://en.wikipedia.org/wiki/Breadth-first_search">original webpage</a> ]</p>
+<p>In a breadth-first traversal, all results for each step of the process are gathered before the next step is evaluated. The equivalent breadth-first traversal for the previous &#x201C;co-created&#x201D; expression is as follows.</p>
+<pre><code>gremlin&gt; g.v(1).outE('created').gather.scatter.inV.gather.scatter.inE('created').gather.scatter.outV.gather.scatter
+==&gt;v[1]
+==&gt;v[4]
+==&gt;v[6]</code></pre>
+<p>The <code>gather</code> step is used to aggregate all the results of the previous step into a list. Given that <code>gather</code> exhausts all the objects of the previous step and emits a list. The <code>scatter</code> step is used to unroll that list and pass it to the next step.</p>
+<p>With <code>gather</code>, the generated list can be analyzed by a step to determine some desired property that is a function of all current objects in the breadth of the path. For example.</p>
+<pre><code>gremlin&gt; g.v(1).outE.gather{ println "processing: ${it}"; return it.get(0) }.inV
+processing: [e[7][1-knows-&gt;2], e[8][1-knows-&gt;4], e[9][1-created-&gt;3]]
+==&gt;v[2]</code></pre>
+<p>Note that with breadth-first traverse being controlled by the <code>gather</code> step, its possible to intermix the use of depth- and breadth-first traversing in a single path expression. In other words, its not necessary to gather all results from the previous step at every step. In fact, its only necessary when all objects of a particular part of the path expression are needed in a computation.</p>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
93 doc/Downloads.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Downloads</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Downloads</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Downloads"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Downloads"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><img src=" images/gremlin-logo.png" alt="" /><br /><a class="internal present" href="Release-Notes.html">Release Notes</a> for all versions<br /></p><hr /><ul><li><strong>Gremlin 2.x</strong>
+ <ul><li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-groovy-2.2.0.zip">Gremlin 2.2.0</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-groovy-2.2.0.zip">Gremlin 2.2.0</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-groovy-2.1.0.zip">Gremlin 2.1.0</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-groovy-2.0.0.zip">Gremlin 2.0.0</a></li>
+ </ul></li>
+</ul><ul><li><strong>Gremlin 1.x</strong>
+ <ul><li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-groovy-1.5.zip">Gremlin 1.5</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-groovy-1.4.zip">Gremlin 1.4</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-1.3.zip">Gremlin 1.3</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-1.2.zip">Gremlin 1.2</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-1.1.zip">Gremlin 1.1</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-1.0.zip">Gremlin 1.0</a></li>
+ </ul></li>
+</ul><ul><li><strong>Gremlin 0.x</strong>
+ <ul><li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.9.zip">Gremlin 0.9</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.8.zip">Gremlin 0.8</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.7.zip">Gremlin 0.7</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.6.zip">Gremlin 0.6</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.5.5.zip">Gremlin 0.5.5</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.5.zip">Gremlin 0.5</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.2.2.zip">Gremlin 0.2.2</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.2.1.zip">Gremlin 0.2.1</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.2.zip">Gremlin 0.2</a></li>
+ <li><a href="http://tinkerpop.com/downloads/gremlin/gremlin-0.1.zip">Gremlin 0.1</a></li>
+ </ul></li>
+</ul>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
91 doc/Except-Retain-Pattern.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Except Retain Pattern</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Except Retain Pattern</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Except-Retain-Pattern"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Except-Retain-Pattern"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><img src=" images/gremlin-kilt.png" /></p>
+<p>In many instances its desirable to traverse to only those elements that have not been seen in a previous step. Specific use cases are:</p>
+<ul><li>&#x201C;Who are my friends friends that are not already my friends?&#x201D;</li>
+ <li>&#x201C;What is liked by the people that like the same things as me that I don&#x2019;t already like?&#x201D;</li>
+</ul><p>The solution to these types of problems is provided by the except pattern. Its opposite is the retain pattern&#x2014;only traverse to those vertices that have been seen in a previous step.</p>
+<pre><code>gremlin&gt; g = TinkerGraphFactory.createTinkerGraph()
+==&gt;tinkergraph[vertices:6 edges:6]
+gremlin&gt; g.v(1).out
+==&gt;v[2]
+==&gt;v[3]
+==&gt;v[4]
+gremlin&gt; g.v(1).out.out
+==&gt;v[5]
+==&gt;v[3]</code></pre>
+<p>Both the first and the second emit <code>v[3]</code>. To ensure that <code>v[3]</code> is not traversed to on the second step, its necessary to save the results seen after the first <code>out</code>. There are three high-level pipes called <code>aggregate</code>, <code>except</code>, and <code>retain</code>. In the examples below, <code>x</code> stores all the values seen up to the <code>aggregate</code> step. Note that, everything in <code>out</code> is &#x201C;drained&#x201D; into <code>x</code> before going to the next <code>out</code>.</p>
+<pre><code>gremlin&gt; x = []
+gremlin&gt; g.v(1).out.aggregate(x).out.except(x)
+==&gt;v[5]</code></pre>
+<pre><code>gremlin&gt; x = []
+gremlin&gt; g.v(1).out.aggregate(x).out.retain(x)
+==&gt;v[3]</code></pre>
+<p>With named steps it is possible to <code>except</code> and <code>retain</code> previously (and actually forward) objects in the pipeline.</p>
+<pre><code>gremlin&gt; g.v(1).as('x').out('created').in('created').except('x')
+==&gt;v[4]
+==&gt;v[6]</code></pre>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
126 doc/Flow-Rank-Pattern.html
@@ -0,0 +1,126 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Flow Rank Pattern</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Flow Rank Pattern</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Flow-Rank-Pattern"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Flow-Rank-Pattern"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><img src=" images/gremlin-kilt.png" /></p>
+<p>Many times its important to determine how many times a particular element is traversed over. That is, determine the flow through an element. Particular examples include:</p>
+<ul><li>&#x201C;Rank my friends friends by how many friends we share in common.&#x201D;</li>
+ <li>&#x201C;Rank items by how many people, who like the same things I like, like them.&#x201D;</li>
+</ul><pre><code>gremlin&gt; software = []
+gremlin&gt; g.V('lang','java').fill(software)
+==&gt;v[3]
+==&gt;v[5]
+gremlin&gt; software
+==&gt;v[3]
+==&gt;v[5]</code></pre>
+<p>Vertices <code>v[3]</code> and <code>v[5]</code> are software projects. Lets determine who is on the most software projects. In other words, lets traverse out of these vertices and see which developer vertices get the most flow.</p>
+<pre><code>gremlin&gt; software._().in('created').name.groupCount.cap
+==&gt;{marko=1, peter=1, josh=2}</code></pre>
+<p>Josh received the most traversals through him. The <code>groupCount</code> step maintains an internal <code>Map&lt;Object,Number&gt;</code>. The <code>cap</code> step is used to &#x201C;cap&#x201D; <code>groupCount</code> and have it emit its internal map, not the elements that flow through it. The following example better explains &#x201C;capping&#x201D; by demonstrating what happens when its not used.</p>
+<pre><code>gremlin&gt; m = [:]
+gremlin&gt; software._().in('created').name.groupCount(m)
+==&gt;marko
+==&gt;josh
+==&gt;peter
+==&gt;josh
+gremlin&gt; m
+==&gt;marko=1
+==&gt;josh=2
+==&gt;peter=1</code></pre>
+<p><img src=" images/grateful-dead-concert2.jpg" /></p>
+<p>Here is a more complicated example using the <code>loop</code> step and the Grateful Dead graph diagrammed in <a class="internal present" href="Defining-a-More-Complex-Property-Graph.html">Defining a More Complex Property Graph</a>.</p>
+<pre><code>g = new TinkerGraph()
+g.loadGraphML('data/graph-example-2.xml')</code></pre>
+<p>The example below will continue to loop until a counter reaches 1000 (so the loop doesn&#x2019;t continue indefinitely). The loop will walk the outgoing edges of a vertex and update the flow map <code>m</code>. What is returned is how many times each song is traversed when starting from vertex <code>12</code> (Me and My Uncle). Note that <code>g.v(12)</code> is not a pipe, so the looping only happens over <code>outE.inV.name.groupCount(m).back(2)</code>. Finally <code>iterate()</code> is appended so no results are outputted to the terminal.</p>
+<pre><code>gremlin&gt; c = 0
+==&gt;0
+gremlin&gt; m = [:]
+gremlin&gt; g.v(12).out.groupCount(m){it.name}.loop(2){c++ &lt; 1000}.iterate()
+gremlin&gt; m
+==&gt;CHINA CAT SUNFLOWER=518
+==&gt;RAMBLE ON ROSE=527
+==&gt;WHARF RAT=213
+==&gt;HES GONE=439
+==&gt;HURTS ME TOO=112
+==&gt;SHIP OF FOOLS=345
+==&gt;FRIEND OF THE DEVIL=378
+==&gt;IT MUST HAVE BEEN THE ROSES=371
+==&gt;JACK STRAW=540
+==&gt;MEXICALI BLUES=369
+==&gt;CANDYMAN=345
+==&gt;LOOKS LIKE RAIN=471
+==&gt;DIRE WOLF=341
+==&gt;HELP ON THE WAY=245
+...
+gremlin&gt; println g.v(12).out.groupCount(m){it.name}.loop(2){c++ &lt; 1000}
+[StartPipe, LoopPipe([OutPipe, GroupCountFunctionPipe])]
+==&gt;null</code></pre>
+<p>Finally, you can sort your rankings and, for example, get the top 5 results.</p>
+<pre><code>gremlin&gt; m.sort{a,b -&gt; b.value &lt;=&gt; a.value}[0..4]
+==&gt;PLAYING IN THE BAND=587
+==&gt;ME AND MY UNCLE=570
+==&gt;JACK STRAW=540
+==&gt;EL PASO=532
+==&gt;RAMBLE ON ROSE=527</code></pre>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
190 doc/Getting-Started.html
@@ -0,0 +1,190 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Getting Started</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Getting Started</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Getting-Started"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Getting-Started"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p>Welcome to Gremlin. Gremlin is a <a href="http://en.wikipedia.org/wiki/Domain-specific_language">domain specific language</a> for traversing <a href="http://en.wikipedia.org/wiki/Graph_%28mathematics%29">graphs</a>. Graphs are data structures where there exists vertices (i.e. dots, nodes) and edges (i.e. lines, arcs). Gremlin was designed to work with a type of graph called a property graph. Property graphs are defined, in detail, in the <a class="internal present" href="Defining-a-Property-Graph.html">Defining a Property Graph</a> section of this documentation. By using Gremlin, it is possible make use of a <a href="http://en.wikipedia.org/wiki/Read-eval-print_loop"><span class="caps">REPL</span></a> (command line/console) to interactively traverse a graph.</p>
+<h2>Installing Gremlin</h2>
+<p>Here are the steps to get Gremlin up and running. Either <code>git clone</code> from <code>http://github.com/tinkerpop/gremlin.git</code> and build the latest version of Gremlin or you can download a pre-built version. For the latter, follow the steps below.</p>
+<ol><li>Download the latest distribution of Gremlin from <a href="../../gremlin/2.3.0/Downloads.html">downloads</a>.</li>
+ <li>Unzip the downloaded <code>gremlin-xx.zip</code> and <code>cd</code> to the <code>gremlin-xx/</code> directory it creates.</li>
+ <li>Run <code>gremlin.sh</code> (unix) or <code>gremin.bat</code> (windows) in the <code>bin</code> directory to start the Gremlin console.</li>
+</ol><h2>Using the Gremlin Console</h2>
+<pre><code>marko$ ./bin/gremlin.sh
+ \,,,/
+ (o o)
+-----oOOo-(_)-oOOo-----
+gremlin&gt;</code></pre>
+<p>Note that using the <code>gremlin.bat</code> requires backslashes instead of forwardslashes at the command line.</p>
+<p>Thats it. The default Gremlin Groovy console is loaded and ready for commands. Please review Groovy for help on Groovy-related constructs. In short, Groovy is a superset of Java. What works in Java, works in Groovy. However, Groovy provides many shorthands to make it easier to interact with the Java <span class="caps">API</span>. Moreoever, Gremlin provides many neat shorthands to make it easier to express paths through a property graph.</p>
+<pre><code>gremlin&gt; i = 'goodbye'
+==&gt;goodbye
+gremlin&gt; j = 'self'
+==&gt;self
+gremlin&gt; i + " " + j
+==&gt;goodbye self
+gremlin&gt; "${i} ${j}"
+==&gt;goodbye self</code></pre>
+<p>We will use a simple, 6 vertex/6 edge, graph that is provided with Gremlin and is fully diagrammed in <a class="internal present" href="Defining-a-Property-Graph.html">Defining a Property Graph</a>. This graph is used so much throughout the documentation that it is hard coded and can be constructed using the <code>TinkerGraphFactory.createTinkerGraph()</code> factory method.</p>
+<pre><code>gremlin&gt; g = TinkerGraphFactory.createTinkerGraph()
+==&gt;tinkergraph[vertices:6 edges:6]
+gremlin&gt; g.class
+==&gt;class com.tinkerpop.blueprints.impls.tg.TinkerGraph
+gremlin&gt; // lets look at all the vertices
+gremlin&gt; g.V
+==&gt;v[3]
+==&gt;v[2]
+==&gt;v[1]
+==&gt;v[6]
+==&gt;v[5]
+==&gt;v[4]
+gremlin&gt; // lets look at all the names of those vertices
+gremlin&gt; g.V.name
+==&gt;lop
+==&gt;vadas
+==&gt;marko
+==&gt;peter
+==&gt;ripple
+==&gt;josh
+gremlin&gt; // lets look at all the properties of those vertices
+gremlin&gt; g.V.map
+==&gt;{name=lop, lang=java}
+==&gt;{name=vadas, age=27}
+==&gt;{name=marko, age=29}
+==&gt;{name=peter, age=35}
+==&gt;{name=ripple, lang=java}
+==&gt;{name=josh, age=32}
+gremlin&gt; // lets look at all the edges
+gremlin&gt; g.E
+==&gt;e[10][4-created-&gt;5]
+==&gt;e[7][1-knows-&gt;2]
+==&gt;e[9][1-created-&gt;3]
+==&gt;e[8][1-knows-&gt;4]
+==&gt;e[11][4-created-&gt;3]
+==&gt;e[12][6-created-&gt;3]
+gremlin&gt; v = g.v(1)
+==&gt;v[1]
+gremlin&gt; v.name + ' is ' + v.age + ' years old.'
+==&gt;marko is 29 years old.
+gremlin&gt; // lets do a traversal from the '1' marko vertex to the adjacent outgoing vertices.
+gremlin&gt; v.out
+==&gt;v[2]
+==&gt;v[3]
+==&gt;v[4]
+gremlin&gt; // lets only take 'knows' labeled edges
+gremlin&gt; v.out('knows')
+==&gt;v[2]
+==&gt;v[4]
+gremlin&gt; // lets do a traversal from the '1' marko vertex to its outgoing edges.
+gremlin&gt; // in the property graph world, edges are first class citizens that can be traversed to.
+gremlin&gt; v.outE
+==&gt;e[7][1-knows-&gt;2]
+==&gt;e[9][1-created-&gt;3]
+==&gt;e[8][1-knows-&gt;4]
+gremlin&gt; v.outE('knows')
+==&gt;e[7][1-knows-&gt;2]
+==&gt;e[8][1-knows-&gt;4]
+gremlin&gt; // what are the weight values on all outgoing edges
+gremlin&gt; v.outE.weight
+==&gt;0.5
+==&gt;0.4
+==&gt;1.0
+gremlin&gt; // lets only traverse to the head vertices of those edges
+gremlin&gt; // that have a weight that is less than 1.0
+gremlin&gt; v.outE.has('weight', T.lt, 1.0f).inV
+==&gt;v[2]
+==&gt;v[3]
+gremlin&gt; // lets do the same, but with a more general "filter closure"
+gremlin&gt; v.outE.filter{it.weight &lt; 1.0}.inV
+==&gt;v[2]
+==&gt;v[3]
+gremlin&gt; // lets get the property maps of these vertices.
+gremlin&gt; v.outE.filter{it.weight &lt; 1.0}.inV.map
+==&gt;{name=vadas, age=27}
+==&gt;{name=lop, lang=java}
+gremlin&gt; // lets traverse to marko's 30+ year old friends' created projects
+gremlin&gt; v.out('knows').filter{it.age &gt; 30}.out('created').name
+==&gt;ripple
+==&gt;lop</code></pre>
+<p>What was presented is some of the basic functionality in Gremlin. The remainder of this documentation will discuss path construction and their use in performing graph algorithms on property graph structures.</p>
+<h2>Tips on the Gremlin Console</h2>
+<p>Its always handy to add the following to the <code>.bash_profile</code>.</p>
+<pre><code>alias gremlin="Users/marko/software/gremlin/bin/gremlin.sh.html"</code></pre>
+<p>If you are a Windows user, you can do the following.</p>
+<pre><code>doskey gremlin=cd C:\Users\marko\software\gremlin\bin\$tgremlin.bat</code></pre>
+<pre><code>~$ gremlin
+
+ \,,,/
+ (o o)
+-----oOOo-(_)-oOOo-----
+gremlin&gt;</code></pre>
+<p>Finally, Gremlin scripts can be executed from the command line. To do so, simply create a Gremlin script file (e.g. in Groovy).</p>
+<pre><code>for(i in 1..3)
+ println i</code></pre>
+<p>Now you can evaluate the script using <code>gremlin.sh</code> with the parameter for <code>-e</code> being set to the script to execute.</p>
+<pre><code>marko$ ./bin/gremlin.sh -e example.groovy
+1
+2
+3
+marko$</code></pre>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
112 doc/Gremlin-Groovy-Path-Optimizations.html
@@ -0,0 +1,112 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Gremlin Groovy Path Optimizations</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Gremlin Groovy Path Optimizations</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Gremlin-Groovy-Path-Optimizations"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Gremlin-Groovy-Path-Optimizations"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><span class="float-left"><span><img src=" images/gremlin-running.png" width="125px" /></span></span></p>
+<p>There are numerous ways to denote the same path expression. The trade off is between readability and speed. To maximize readability, <a href="http://groovy.codehaus.org/Closures">Groovy closures</a> are usually the way to go. While using Groovy closures may make a path expression easier to read, unfortunately, its slower than the corresponding <code>Pipe</code>. However, when no corresponding <code>Pipe</code> exists, then a closure is the appropriate solution. This section demonstrates the various ways to express the same path and provides some timing statistics on the graph described in <a class="internal present" href="Defining-a-More-Complex-Property-Graph.html">Defining a More Complex Property Graph</a>.</p>
+<pre><code>g = new TinkerGraph()
+g.loadGraphML('data/graph-example-2.xml')</code></pre>
+<p>All the examples make use of the following code snippet to determine timing:</p>
+<pre><code>t = System.currentTimeMillis(); ...expression... ; System.currentTimeMillis() - t</code></pre>
+<h2>Avoid Element Property Selection using Key</h2>
+<p>Gremlin provides field support for grabbing property values of elements (e.g. vertices/edge) by simply providing the property key as a field selector of the instance. However, while this is convenient, it is slow as it requires Java reflection to resolve the field. If performance is the concern, it is always best to use the raw <a href="../../blueprints/2.3.0/Home.html">Blueprints</a> <span class="caps">API</span> methods even though they tend to be more verbose and less attractive. In general, for <a href="http://en.wikipedia.org/wiki/Read-eval-print_loop">REPLing</a> around a graph, use the more concise representation. For production traversals, use native Blueprints <span class="caps">API</span> calls and avoid reflection.</p>
+<pre><code>~50ms: g.E.sideEffect{it.weight}.iterate()
+~5ms: g.E.sideEffect{it.getProperty('weight')}.iterate()</code></pre>
+<p>The method call <code>it.getProperty('weight')</code> is much faster as a direct reference to the appropriate Java method is known. Using <code>it.weight</code> is a convenient, but slow convention.</p>
+<pre><code>~1750ms: g.V.outE.filter{it.weight&gt;0}.inV.outE.filter{it.weight&gt;0}.inV.iterate()
+~100ms: g.V.outE.filter{it.getProperty('weight')&gt;0}.inV.outE.filter{it.getProperty('weight')&gt;0}.inV.iterate()
+~60ms: g.V.outE.has('weight',T.gt,0).inV.outE.has('weight',T.gt,0).inV.iterate()</code></pre>
+<p>Note that this <code>Element.key</code> is not the same as <code>Pipe.key</code>. For instance, <code>g.E.weight</code> is fast as its applied to a Pipe, not to a specific element.</p>
+<h2>Using Loops</h2>
+<pre><code>~850ms: g.v(89).out.loop(1){it.loops &lt; 5}.iterate()
+~225ms: g.v(89).out.out.out.out.iterate()</code></pre>
+<p>The <code>loop</code> step takes a function that determine whether to loop an object or not (i.e. a &#x201C;while&#x201D;). &#x201C;Unrolling&#x201D; the loop is more efficient than using <code>loop</code>. In many situations, knowing how many times to loop is not known and as such, <code>loop</code> is required. A nifty trick to use is to use code to construct the expression:</p>
+<pre><code>gremlin&gt; pipe = g.v(89)._(); null
+==&gt;null
+gremlin&gt; (1..3).each{
+ pipe = pipe.out;
+}; null
+==&gt;null
+gremlin&gt; pipe
+==&gt;v[81]
+==&gt;v[264]
+==&gt;v[153]
+==&gt;v[160]
+==&gt;v[164]
+...
+gremlin&gt; pipe.toString()
+==&gt;[StartPipe, OutPipe, OutPipe, OutPipe]</code></pre>
+<h2>Method Notation vs. Property Notation</h2>
+<p>In many situations, a step looks like an object property from a Java/Groovy perspective. In fact, each step is a method. However, by using the <a href="http://en.wikipedia.org/wiki/Metaprogramming">metaprogramming</a> facilities offered by Groovy, its possible to &#x201C;trick&#x201D; Groovy into thinking that a property is a method. For example, assume the following pipeline:</p>
+<pre><code>v.outE.inV.name</code></pre>
+<p>This can be re-written in more Java/Groovy friendly syntax as:</p>
+<pre><code>v.outE().inV().name</code></pre>
+<p>In the first example, when Groovy realizes that <code>outE</code> is not a property of <code>v</code>, it calls the <code>propertyMissing</code> method of the <code>MetaClass</code> of <code>Vertex</code>. Gremlin uses this method to say &#x201C;oh, <code>outE</code> is not a property, its a method. Let me resolve that method and return its value.&#x201D; At which point, Gremlin returns the running <code>Pipeline</code> with the new <code>OutEdgePipe</code> appended to it. What makes this possible is dynamic programming in Groovy and the ability to make a property return the evaluation of a method.</p>
+<pre><code>Pipe.metaClass.propertyMissing = {final String name -&gt;
+ if (Gremlin.isStep(name)) {
+ return delegate."$name"();
+ }
+ ...
+}</code></pre>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
168 doc/Gremlin-Methods.html
@@ -0,0 +1,168 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Gremlin Methods</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Gremlin Methods</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Gremlin-Methods"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Gremlin-Methods"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><strong><span class="caps">IMPORTANT</span></strong>: The full <a href="http://download.oracle.com/javase/6/docs/api/">Java <span class="caps">API</span></a> can be seamlessly accessed by Gremlin. Thus, both the <a href="../../blueprints/2.3.0/Home.html">Blueprints</a> and <a href="../../pipes/2.3.0/Home.html">Pipes</a> APIs can be accessed from within Gremlin. For behaviors that are commonly used in Gremlin, Gremlin Groovy adds <code>MetaClass</code> methods/operators to make it easier and faster to work with the Blueprints and Pipes APIs. These <code>MetaClass</code> methods/operators are provided in the table below.</p>
+<p>The <a href="http://groovy.codehaus.org/groovy-jdk/">Groovy <span class="caps">API</span></a> extends many of the Java <span class="caps">API</span> classes with methods that are useful for iteration. Its possible to use these methods with Gremlin as well. Two Groovy classes that are worth looking at are:</p>
+<ul><li><a href="http://groovy.codehaus.org/groovy-jdk/java/util/Iterator.html">Groovy Iterator</a></li>
+ <li><a href="http://groovy.codehaus.org/groovy-jdk/java/util/Collection.html">Groovy Collection</a></li>
+</ul><p><strong>Developer Note</strong>: If you come up a with a generally useful method and would like to include it into the main Gremlin distribution, please make an <a href="https://github.com/tinkerpop/gremlin/issues">issue</a> or provide the appropriate pull request.</p>
+<table><tr><th>method/operator </th>
+ <th>equivalence </th>
+ <th>description </th>
+ </tr><tr><td> <code>Graph.v(Object...)</code> </td>
+ <td> no simple representation </td>
+ <td> get vertices by provided ids </td>
+ </tr><tr><td> <code>Graph.e(Object...)</code> </td>
+ <td> no simple representation </td>
+ <td> get edges by provided ids </td>
+ </tr><tr><td> <code>Graph.idx(String)</code> </td>
+ <td> <code>Graph.getIndex(String, Class)</code> </td>
+ <td> get an index by its name </td>
+ </tr><tr><td> <code>Graph.addVertex()</code> </td>
+ <td> <code>Graph.addVertex(null)</code> </td>
+ <td> add a vertex </td>
+ </tr><tr><td> <code>Graph.addVertex(Object, Map)</code> </td>
+ <td> no simple representation </td>
+ <td> add a vertex with property map </td>
+ </tr><tr><td> <code>Graph.addVertex(Map)</code> </td>
+ <td> no simple representation </td>
+ <td> add a vertex with property map </td>
+ </tr><tr><td> <code>Graph.addEdge(Object, Vertex, Vertex, String, Map)</code> </td>
+ <td> no simple representation </td>
+ <td> add an edge with property map </td>
+ </tr><tr><td> <code>Graph.addEdge(Vertex, Vertex, String, Map)</code> </td>
+ <td> no simple representation </td>
+ <td> add an edge with property map </td>
+ </tr><tr><td> <code>Graph.loadGML(String or File)</code> </td>
+ <td> <code>GMLReader.inputGraph(...)</code> </td>
+ <td> load <a href="http://www.fim.uni-passau.de/en/fim/faculty/chairs/theoretische-informatik/projects.html"><span class="caps">GML</span></a> file into graph </td>
+ </tr><tr><td> <code>Graph.saveGML(String or File)</code> </td>
+ <td> <code>GMLWriter.outputGraph(...)</code> </td>
+ <td> save graph to a <a href="http://www.fim.uni-passau.de/en/fim/faculty/chairs/theoretische-informatik/projects.html"><span class="caps">GML</span></a> file </td>
+ </tr><tr><td> <code>Graph.loadGraphML(String or File)</code> </td>
+ <td> <code>GraphMLReader.inputGraph(...)</code> </td>
+ <td> load <a href="http://graphml.graphdrawing.org/">GraphML</a> file into graph </td>
+ </tr><tr><td> <code>Graph.saveGraphML(String or File)</code> </td>
+ <td> <code>GraphMLWriter.outputGraph(...)</code> </td>
+ <td> save graph to a <a href="http://graphml.graphdrawing.org/">GraphML</a> file </td>
+ </tr><tr><td> <code>Graph.loadGraphSON(String or File)</code> </td>
+ <td> <code>GraphSONReader.inputGraph(...)</code> </td>
+ <td> load GraphSON file into graph </td>
+ </tr><tr><td> <code>Graph.saveGraphSON(String or File, boolean?)</code> </td>
+ <td> <code>GraphSONWriter.outputGraph(...)</code> </td>
+ <td> save graph to a GraphSON file </td>
+ </tr><tr><td> <code>Index[Map.Entry]</code> </td>
+ <td> <code>Index.get(String, Object)</code> </td>
+ <td> get an element by its key/value </td>
+ </tr><tr><td> <code>Element.key</code> </td>
+ <td> <code>Element.getProperty(key)</code> </td>
+ <td> get the value of a property by key </td>
+ </tr><tr><td> <code>Element.key = value</code> </td>
+ <td> <code>Element.setProperty(key,value)</code> </td>
+ <td> set the value of a property </td>
+ </tr><tr><td> <code>Element.keys()</code> </td>
+ <td> <code>Element.getPropertyKeys()</code> </td>
+ <td> get the property keys of the element </td>
+ </tr><tr><td> <code>Element.values()</code> </td>
+ <td> no simple representation </td>
+ <td> get the property values of the element </td>
+ </tr><tr><td> <code>Element.map()</code> </td>
+ <td> no simple representation </td>
+ <td> get the property map of the element </td>
+ </tr><tr><td> <code>Element.remove()</code> </td>
+ <td> <code>Element.remove()</code> </td>
+ <td> remove the element from the graph </td>
+ </tr><tr><td> <code>Vertex.addEdge(String, Vertex)</code> </td>
+ <td> <code>Vertex.addEdge(String, Vertex)</code> </td>
+ <td> add outgoing string-labeled edge to vertex </td>
+ </tr><tr><td> <code>Vertex.addEdge(String, Vertex, Map)</code> </td>
+ <td> no simple representation </td>
+ <td> add outgoing string-labeled edge to vertex with provided properties </td>
+ </tr><tr><td> <code>Pipe.next()</code> </td>
+ <td> <code>Iterator.next()</code> </td>
+ <td> get the next object in the pipe </td>
+ </tr><tr><td> <code>Pipe.next(int)</code> </td>
+ <td> no simple representation </td>
+ <td> get the next <code>n</code> objects in pipe and return as a list </td>
+ </tr><tr><td> <code>Pipe.iterate()</code> </td>
+ <td> <code>PipeHelper.iterate(Pipe)</code> </td>
+ <td> <code>next()</code> all the objects out of the pipe </td>
+ </tr><tr><td> <code>Pipe.fill(collection)</code> </td>
+ <td> <code>PipeHelper.fillCollection(...)</code> </td>
+ <td> add all the pipe objects to the collection </td>
+ </tr><tr><td> <code>Pipe.toList()</code> </td>
+ <td> no simple representation </td>
+ <td> return a list of all the objects in the pipe </td>
+ </tr><tr><td> <code>Pipe.count()</code> </td>
+ <td> <code>PipeHelper.counter(Pipe)</code> </td>
+ <td> count objects in the pipe </td>
+ </tr><tr><td> <code>Pipe.mean()</code> </td>
+ <td> no simple representation </td>
+ <td> the average of the objects in the pipe </td>
+ </tr><tr><td> <code>Map[IntRange]</code> </td>
+ <td> no simple representation </td>
+ <td> create a map of the entry range of the provided map </td>
+ </tr></table><p><strong>Note</strong>: Most all of the <code>Pipe</code> methods/operators also work for <code>Iterator</code> and <code>Iterable</code>.</p>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
316 doc/Gremlin-Steps.html
@@ -0,0 +1,316 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Gremlin Steps</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Gremlin Steps</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Gremlin-Steps"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Gremlin-Steps"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><img src=" images/gremlin-pipe.png" alt="" /></p>
+<p>Gremlin comes with a collection of predefined steps. Gremlin steps map to a particular <code>Pipe</code> in <a href="../../pipes/2.3.0/Home.html">Pipes</a>. A <code>Pipe&lt;S,E&gt;</code> extends <code>Iterator&lt;E&gt;</code> and <code>Iterable&lt;E&gt;</code>. It takes an object of type <code>S</code> and emits and object of type <code>E</code>. Chaining pipes together creates a <code>Pipeline</code>. In essence, Gremlin is a <a href="http://en.wikipedia.org/wiki/Domain-specific_language"><span class="caps">DSL</span></a> for constructing <code>Pipeline</code> objects. Finally, be sure to look at <a class="internal present" href="User-Defined-Steps.html">User Defined Steps</a> to learn how to define your own custom steps.</p>
+<h1>Step Library</h1>
+<p>Even link in a pipeline is called a step. Steps can be categorized as either being transform-, filter-, sideEffect-, or branch- based.</p>
+<ul><li><code>step</code>: a generic, general-purpose computational step.
+ <ul><li><code>transform</code>: take an object and emit a transformation of it.</li>
+ <li><code>filter</code>: decide whether to allow an object to pass or not.</li>
+ <li><code>sideEffect</code>: pass the object, but yield some side effect.</li>
+ <li><code>branch</code>: decide which step to take.</li>
+ </ul></li>
+</ul><h2>Step</h2>
+<table><tr><th>step </th>
+ <th>description </th>
+ <th>pipe </th>
+ </tr><tr><td> <code>step{closure}</code> </td>
+ <td> an anonymous/lambda step defined by a closure </td>
+ <td> <code>FunctionPipe(closure)</code> </td>
+ </tr></table><h2>Transform-Based Steps</h2>
+<table><tr><th>step </th>
+ <th>description </th>
+ <th>pipe </th>
+ </tr><tr><td> <code>transform{closure}</code> </td>
+ <td> emit the result of the closure </td>
+ <td> <code>TransformFunctionPipe(closure)</code> </td>
+ </tr><tr><td> <code>_</code> </td>
+ <td> emit the incoming object unchanged </td>
+ <td> <code>IdentityPipe()</code> </td>
+ </tr><tr><td> <code>V</code> </td>
+ <td> the vertex iterator of the graph (with key indices, <code>V(key,value)</code> possible) </td>
+ <td> <code>VerticesPipe()</code> </td>
+ </tr><tr><td> <code>E</code> </td>
+ <td> the edge iterator of the graph (with key indices, <code>E(key,value)</code> possible) </td>
+ <td> <code>EdgesPipe()</code> </td>
+ </tr><tr><td> <code>id</code> </td>
+ <td> the identifier of the element </td>
+ <td> <code>IdPipe()</code> </td>
+ </tr><tr><td> <code>label</code> </td>
+ <td> the label of the edge </td>
+ <td> <code>LabelPipe()</code> </td>
+ </tr><tr><td> <code>out(labels...?)</code> </td>
+ <td> out adjacent vertices to the vertex </td>
+ <td> <code>VerticesVerticesPipe(out,labels...?)</code> </td>
+ </tr><tr><td> <code>outE(labels...?)</code> </td>
+ <td> the outgoing edges of the vertex </td>
+ <td> <code>VerticesEdgesPipe(out,labels...?)</code> </td>
+ </tr><tr><td> <code>in(labels...?)</code> </td>
+ <td> in adjacent vertices to the vertex </td>
+ <td> <code>VerticesVerticesPipe(in,labels...?)</code> </td>
+ </tr><tr><td> <code>inE(labels...?)</code> </td>
+ <td> the incoming edges of the vertex </td>
+ <td> <code>VerticesEdgesPipe(in,labels...?)</code> </td>
+ </tr><tr><td> <code>both(labels...?)</code> </td>
+ <td> both adjacent vertices of the vertex </td>
+ <td> <code>VerticesVerticesPipe(both,labels...?)</code> </td>
+ </tr><tr><td> <code>bothE(labels...?)</code> </td>
+ <td> both incoming and outgoing edges of the vertex </td>
+ <td> <code>VerticesEdgesPipe(both,labels...?)</code> </td>
+ </tr><tr><td> <code>outV</code> </td>
+ <td> the outgoing tail vertex of the edge </td>
+ <td> <code>EdgesVerticesPipe(out)</code> </td>
+ </tr><tr><td> <code>inV</code> </td>
+ <td> the incoming head vertex of the edge </td>
+ <td> <code>EdgesVerticesPipe(in)</code> </td>
+ </tr><tr><td> <code>bothV</code> </td>
+ <td> both incoming and outgoing vertices of the edge </td>
+ <td> <code>EdgesVerticesPipe(both)</code> </td>
+ </tr><tr><td> <code>['key']</code> </td>
+ <td> get the property value of an element </td>
+ <td> <code>PropertyPipe('key')</code> </td>
+ </tr><tr><td> <code>key</code> </td>
+ <td> get the property value of an element </td>
+ <td> <code>PropertyPipe(key)</code> </td>
+ </tr><tr><td> <code>map(strings..?)</code> </td>
+ <td> get the property map of an element (for provided keys?) </td>
+ <td> <code>PropertyMapPipe(strings..?)</code> </td>
+ </tr><tr><td> <code>memoize(string, map?)</code> </td>
+ <td> <a href="http://en.wikipedia.org/wiki/Memoization">memoize</a> a named section with optional map being a cache </td>
+ <td> <code>MemoizePipe()</code> </td>
+ </tr><tr><td> <code>memoize(integer, map?)</code> </td>
+ <td> <a href="http://en.wikipedia.org/wiki/Memoization">memoize</a> <code>n</code>-steps ago with optional map being a cache </td>
+ <td> <code>MemoizePipe()</code> </td>
+ </tr><tr><td> <code>gather{closure?}</code> </td>
+ <td> collect all objects up to that step and process with provided closure </td>
+ <td> <code>GatherPipe()</code> or <code>GatherFunctionPipe(closure)</code> </td>
+ </tr><tr><td> <code>scatter</code> </td>
+ <td> unroll all objects in the iterable at that step </td>
+ <td> <code>ScatterPipe()</code> </td>
+ </tr><tr><td> <code>path(closures..?)</code> </td>
+ <td> the path through the pipeline up to this point, where closures are post-processing for each object in the path </td>
+ <td> <code>PathPipe()</code> or <code>PathFunctionPipe(closures...?)</code> </td>
+ </tr><tr><td> <code>cap</code> </td>
+ <td> emits the side effect of the pipe prior </td>
+ <td> <code>SideEffectCapPipe(pipe)</code> </td>
+ </tr><tr><td> <code>select(list?,closures..?)</code> </td>
+ <td> select the named steps to emit after select with post-processing closures </td>
+ <td> <code>SelectPipe(list?, closures..?)</code> </td>
+ </tr><tr><td> <code>shuffle</code> </td>
+ <td> collect all objects up to that step and randomize their order </td>
+ <td> <code>ShufflePipe()</code> </td>
+ </tr><tr><td> <code>order(closure?)</code> </td>
+ <td> order the items in the stream according to the closure if provided </td>
+ <td> <code>OrderPipe(closure?)</code> </td>
+ </tr><tr><td> <code>order(T)</code> </td>
+ <td> order the items in the stream according to <code>T</code> where <code>T</code> is <code>T.decr</code> or <code>T.incr</code> </td>
+ <td> <code>OrderPipe(T)</code> </td>
+ </tr><tr><td> <code>orderMap(closure)</code> </td>
+ <td> for every incoming map, sort and emit keys </td>
+ <td> <code>OrderMapPipe(closure)</code> </td>
+ </tr><tr><td> <code>orderMap(T)</code> </td>
+ <td> for every incoming map, sort by <code>T</code> and emit keys where <code>T</code> is <code>T.decr</code> or <code>T.incr</code> </td>
+ <td> <code>OrderMapPipe(T)</code> </td>
+ </tr><tr><td> <code>linkOut(string,vertex)</code> </td>
+ <td> for every incoming vertex, create an outgoing <code>label</code>-edge to provided vertex </td>
+ <td> <code>LinkPipe(string,vertex)</code> </td>
+ </tr><tr><td> <code>linkIn(string,vertex)</code> </td>
+ <td> for every incoming vertex, create an incoming <code>label</code>-edge to provided vertex </td>
+ <td> <code>LinkPipe(string,vertex)</code> </td>
+ </tr><tr><td> <code>linkBoth(string,vertex)</code> </td>
+ <td> for every incoming vertex, create an incoming and outgoing <code>label</code>-edge to provided vertex </td>
+ <td> <code>LinkPipe(string,vertex)</code> </td>
+ </tr><tr><td> <code>linkOut(string,string)</code> </td>
+ <td> for every incoming vertex, create an outgoing <code>label</code>-edge to provided vertex </td>
+ <td> <code>LinkPipe(string,AsPipe)</code> </td>
+ </tr><tr><td> <code>linkIn(string,string)</code> </td>
+ <td> for every incoming vertex, create an incoming <code>label</code>-edge to provided vertex </td>
+ <td> <code>LinkPipe(string,AsPipe)</code> </td>
+ </tr><tr><td> <code>linkBoth(string,string)</code> </td>
+ <td> for every incoming vertex, create an incoming and outgoing <code>label</code>-edge to provided vertex </td>
+ <td> <code>LinkPipe(string,AsPipe)</code> </td>
+ </tr></table><h2>Filter-Based Steps</h2>
+<table><tr><th>step </th>
+ <th>description </th>
+ <th>pipe </th>
+ </tr><tr><td> <code>filter{closure}</code> </td>
+ <td> return true to allow the object to pass </td>
+ <td> <code>FilterFunctionPipe(closure)</code> </td>
+ </tr><tr><td> <code>[i]</code> </td>
+ <td> emit the particular indexed object </td>
+ <td> <code>RangeFilterPipe(i,i)</code> </td>
+ </tr><tr><td> <code>[i..j]</code> </td>
+ <td> emit the objects indexed by the range </td>
+ <td> <code>RangeFilterPipe(i,j)</code> </td>
+ </tr><tr><td> <code>has('key',value)</code> </td>
+ <td> allow element if has property </td>
+ <td> <code>PropertyFilterPipe('key',value,Filter.EQUALS)</code> </td>
+ </tr><tr><td> <code>has('key',T,value)</code> </td>
+ <td> allow element if property is T related to value, where T is <code>T.eq</code>, <code>T.neq</code>, <code>T.lt</code>, <code>T.lte</code>, <code>T.gt</code>, or <code>T.gte</code> </td>
+ <td> <code>PropertyFilterPipe('key',value,T)</code> </td>
+ </tr><tr><td> <code>hasNot('key',value)</code> </td>
+ <td> filter element if has property </td>
+ <td> <code>PropertyFilterPipe('key',value,Filter.NOT_EQUALS)</code> </td>
+ </tr><tr><td> <code>hasNot('key',T,value)</code> </td>
+ <td> filter element if property is not T related to value </td>
+ <td> <code>PropertyFilterPipe('key',value,!T)</code> </td>
+ </tr><tr><td> <code>back(integer)</code> </td>
+ <td> go back to the results from n-steps ago </td>
+ <td> <code>BackFilterPipe(Pipe)</code> </td>
+ </tr><tr><td> <code>back(string)</code> </td>
+ <td> go back to the results as the named step </td>
+ <td> <code>BackFilterPipe(Pipe)</code> </td>
+ </tr><tr><td> <code>and(pipes...)</code> </td>
+ <td> emit the incoming object if all pipes emit results </td>
+ <td> <code>AndFilterPipe(pipes...)</code> </td>
+ </tr><tr><td> <code>or(pipes...)</code> </td>
+ <td> emit the incoming object if any pipe emit results </td>
+ <td> <code>OrFilterPipe(pipes...)</code> </td>
+ </tr><tr><td> <code>random(double)</code> </td>
+ <td> emit the incoming object if biased coin toss is heads </td>
+ <td> <code>RandomFilterPipe(double)</code> </td>
+ </tr><tr><td> <code>dedup(closure?)</code> </td>
+ <td> emit only incoming objects that have not been seen before with optional closure being object to check on </td>
+ <td> <code>DuplicateFilterPipe(closure?)</code> </td>
+ </tr><tr><td> <code>simplePath</code> </td>
+ <td> emit the object only if the current path has no repeated elements </td>
+ <td> <code>CyclicPathFilterPipe()</code> </td>
+ </tr><tr><td> <code>except(collection)</code> </td>
+ <td> allow everything to pass except what is in <code>collection</code> </td>
+ <td> <code>ExceptFilterPipe(collection)</code> </td>
+ </tr><tr><td> <code>except(string...)</code> </td>
+ <td> allow everything to pass except what is at named steps </td>
+ <td> <code>ExceptFilterPipe(asmap, string...)</code> </td>
+ </tr><tr><td> <code>retain(collection)</code> </td>
+ <td> allow everything to pass except what is not in <code>collection</code> </td>
+ <td> <code>RetainFilterPipe(collection)</code> </td>
+ </tr><tr><td> <code>retain(string...)</code> </td>
+ <td> allow everything to pass except what is not at named steps </td>
+ <td> <code>RetainFilterPipe(asmap, string...)</code> </td>
+ </tr><tr><td> <code>interval(key,start,end)</code> </td>
+ <td> allow elements to pass that have their property in provided start/end interval </td>
+ <td> <code>IntervalFilterPipe(key,start,end)</code> </td>
+ </tr></table><h2>SideEffect-Based Steps</h2>
+<table><tr><th>step </th>
+ <th>description </th>
+ <th>pipe </th>
+ </tr><tr><td> <code>sideEffect{closure}</code> </td>
+ <td> emits input, but calls a side effect closure on each input </td>
+ <td> <code>SideEffectFunctionPipe(closure)</code> </td>
+ </tr><tr><td> <code>groupBy(map?){closure}{closure}</code> </td>
+ <td> emits input, but groups input after processing it by provided key-closure and value-closure </td>
+ <td> <code>GroupByPipe(map?, closure, closure)</code> </td>
+ </tr><tr><td> <code>groupCount(map?){closure?}{closure?}</code> </td>
+ <td> emits input, but updates a map for each input, where closures provides generic map update </td>
+ <td> <code>GroupCountFunctionPipe(map?,closure?,closure?)</code> </td>
+ </tr><tr><td> <code>aggregate(collection?,closure?)</code> </td>
+ <td> emits input, but adds input in collection, where provided closure processes input prior to insertion (greedy) </td>
+ <td> <code>AggregatePipe(collection?,closure?)</code> </td>
+ </tr><tr><td> <code>table(table?,strings..?,closures..?)</code> </td>
+ <td> emits input, but stores row of <code>as</code> values (constrained by column names if provided) </td>
+ <td> <code>TablePipe(table?,strings..?,closures..?)</code> </td>
+ </tr><tr><td> <code>tree(map?, closures..?)</code> </td>
+ <td> emit input, but stores the tree formed by the traversal as a map </td>
+ <td> <code>TreePipe(map?, closures..?)</code> </td>
+ </tr><tr><td> <code>as(string)</code> </td>
+ <td> emits input, but names the previous step </td>
+ <td> <code>AsPipe(string, Pipe)</code> </td>
+ </tr><tr><td> <code>optional(integer)</code> </td>
+ <td> go back to the results from n-steps ago </td>
+ <td> <code>OptionalPipe(Pipe)</code> </td>
+ </tr><tr><td> <code>optional(string)</code> </td>
+ <td> go back to the results as the named step </td>
+ <td> <code>OptionalPipe(Pipe)</code> </td>
+ </tr><tr><td> <code>store(collection?,closure?)</code> </td>
+ <td> emits input, but adds input to collection, where provided closure processes input prior to insertion (lazy) </td>
+ <td> <code>StorePipe(collection?, closure?)</code> </td>
+ </tr></table><h2>Branch-Based Steps</h2>
+<table><tr><th>step </th>
+ <th>description </th>
+ <th>pipe </th>
+ </tr><tr><td> <code>loop(integer){whileClosure}{emitClosure?}</code> </td>
+ <td> if whileClosure true for emitted object, put object back at start (emit object mid-loop if emitClosure is true) </td>
+ <td> <code>LoopPipe(Pipe,whileC,emitC?)</code> </td>
+ </tr><tr><td> <code>loop(string){whileClosure}{emitClosure?}</code> </td>
+ <td> if whileClosure true for emitted object, put object back at start (emit object mid-loop if emitClosure is true) </td>
+ <td> <code>LoopPipe(Pipe,whileC,emitC?)</code> </td>
+ </tr><tr><td> <code>ifThenElse{ifClosure}{thenClosure}{elseClosure}</code> </td>
+ <td> if/then/else branch </td>
+ <td> <code>IfThenElsePipe(ifC,thenC,elseC)</code> </td>
+ </tr><tr><td> <code>copySplit(pipes...)</code> </td>
+ <td> copies incoming object to internal pipes </td>
+ <td> <code>CopySplitPipe(pipes...)</code> </td>
+ </tr><tr><td> <code>fairMerge</code> </td>
+ <td> round-robin merges internal pipe objects </td>
+ <td> <code>FairMergePipe()</code> </td>
+ </tr><tr><td> <code>exhaustMerge</code> </td>
+ <td> exhaustively merges internal pipe objects </td>
+ <td> <code>ExhaustMergePipe()</code> </td>
+ </tr></table><h3>Notes</h3>
+<ul><li>If a pipe&#x2019;s argument is postfixed with a <code>?</code>, then the argument is optional. When no argument is provided, a reasonable default argument is created.</li>
+ <li>If you come up a with a generally useful step/pipe and would like to include it into the main Gremlin distribution, please make an <a href="https://github.com/tinkerpop/gremlin/issues">issue</a> or provide the appropriate pull request.</li>
+</ul>
+ </div>
+ </div>
+ </div>
+
+</div>
+<div id="footer">
+ <p id="last-edit">Last edited by <b>okram</b>, 2013-03-20 04:28:53</p>
+</div>
+</div>
+
+<script type="text/javascript" src=" css/MathJax/MathJax.js"></script>
+
+
+</body>
+</html>
View
147 doc/Home.html
@@ -0,0 +1,147 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" type="text/css" href=" css/gollum.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/editor.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/dialog.css" media="all">
+ <link rel="stylesheet" type="text/css" href=" css/template.css" media="all">
+
+ <!--[if IE 7]>
+ <link rel="stylesheet" type="text/css" href=" css/ie7.css" media="all">
+ <![endif]-->
+
+ <script type="text/javascript" src=" css/jquery.js"></script>
+ <script type="text/javascript" src=" css/gollum.js"></script>
+ <script type="text/javascript" src=" css/gollum.dialog.js"></script>
+ <script type="text/javascript" src=" css/gollum.placeholder.js"></script>
+
+ <script type="text/javascript"
+ src=" css/editor/gollum.editor.js"></script>
+ <title>Home</title>
+</head>
+<body>
+
+<div id="wiki-wrapper" class="page">
+<div id="head"><h3><a href="../../index.html">TinkerPop 2.3.0</a> - <a href="Home.html">Gremlin</a></h3>
+ <h1>Home</h1>
+ <ul class="actions">
+ <li class="minibutton"><a href="/pages"
+ class="action-all-pages">All Pages</a></li>
+ <li class="minibutton" class="jaws">
+ <a href="#" id="minibutton-new-page">New Page</a></li>
+ <li class="minibutton"><a href="/edit/Home"
+ class="action-edit-page">Edit Page</a></li>
+ <li class="minibutton"><a href="/history/Home"
+ class="action-page-history">Page History</a></li>
+ </ul>
+ <div id="searchbar">
+ <form action="/search" method="get" id="search-form">
+ <div id="searchbar-fauxtext">
+ <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
+ <a href="#" id="search-submit" title="Search this wiki">
+ <span>Search</span>
+ </a>
+ </div>
+ </form>
+ </div></div>
+<div id="wiki-content">
+ <div class="wrap">
+ <div id="wiki-body" class="gollum-textile-content">
+ <div id="template">
+ <p><img src=" images/gremlin-logo.png" height="143px" /><a href="../../gremlin/2.3.0/Downloads.html"><span class="float-right"><span><img src="https://github.com/tinkerpop/blueprints/raw/master/doc/images/tinkerpop-download.png" /></span></span></a></p>
+<p>Gremlin is a graph traversal language. The documentation herein will provide all the information necessary to understand how to use Gremlin for graph query, analysis, and manipulation. Gremlin works over those graph databases/frameworks that implement the <a href="../../blueprints/2.3.0/Home.html">Blueprints</a> property graph data model. Gremlin is a style of graph traversal that can be used in various <a href="http://en.wikipedia.org/wiki/List_of_JVM_languages"><span class="caps">JVM</span> languages</a>. This distribution of Gremlin provides support for Java and <a href="http://groovy.codehaus.org/">Groovy</a>. Except where otherwise stated, the documentation herein is respective of the Groovy implementation (minor syntactic tweaks are required to map the ideas over to other <span class="caps">JVM</span> implementations).</p>
+<p>Please join the Gremlin users group at <a href="http://groups.google.com/group/gremlin-users">http://groups.google.com/group/gremlin-users</a> for all <a href="../../index.html">TinkerPop</a> related discussions. <sup <