You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/09/28 17:38:19 UTC

[19/41] tinkerpop git commit: added a better example to SugraphStategy in the reference docs. Also added an explain() so people can see whats going on.

added a better example to SugraphStategy in the reference docs. Also added an explain() so people can see whats going on.


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

Branch: refs/heads/TINKERPOP-790
Commit: 7a228ca5f63011ec0ef5f5eeba7b33a03937c7f2
Parents: 95e5e1f
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Sep 23 12:11:46 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Sep 27 12:45:49 2016 -0600

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a228ca5/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index d6d89b1..5d2c915 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -2610,17 +2610,25 @@ ReadOnlyStrategy
 SubgraphStrategy
 ~~~~~~~~~~~~~~~~
 
-`SubgraphStrategy` is quite similar to `PartitionStrategy` in that it restrains a `Traversal` to certain vertices
-and edges as determined by a `Traversal` criterion defined individually for each.
+`SubgraphStrategy` is similar to `PartitionStrategy` in that it constrains a `Traversal` to certain vertices, edges,
+ and vertex properties as determined by a `Traversal`-based criterion defined individually for each.
 
 [gremlin-groovy]
 ----
-graph = TinkerFactory.createModern()
-strategy = SubgraphStrategy.build().edgeCriterion(hasId(8,9,10)).create()
-g = graph.traversal().withStrategies(strategy)
-g.V() // shows all vertices as no filter for vertices was specified
-g.E() // shows only the edges defined in the edgeCriterion
+graph = TinkerFactory.createTheCrew()
+g = graph.traversal()
+g.V().as('a').values('location').as('b').  <1>
+  select('a','b').by('name').by()
+g = g.withStrategies(SubgraphStrategy.build().vertexProperties(hasNot('endTime')).create()) <2>
+g.V().as('a').values('location').as('b').  <3>
+  select('a','b').by('name').by()
+g.V().as('a').values('location').as('b').
+  select('a','b').by('name').by().explain()
 ----
 
 This strategy is implemented such that the vertices attached to an `Edge` must both satisfy the `vertexCriterion`
 (if present) in order for the `Edge` to be considered a part of the subgraph.
+
+<1> Get all vertices and their vertex property locations.
+<2> Create a `SubgraphStrategy` where vertex properties must not have an `endTime`-property (thus, the current location).
+<3> Get all vertices and their current vertex property locations.
\ No newline at end of file