Repository: tinkerpop Updated Branches: refs/heads/TINKERPOP-1456 23a4e86b2 -> 37f0606c2
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/37f0606c Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/37f0606c Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/37f0606c Branch: refs/heads/TINKERPOP-1456 Commit: 37f0606c29533555b699ea34c0a8aed402e2e0cb Parents: 23a4e86 Author: Marko A. Rodriguez <[email protected]> Authored: Fri Sep 23 12:11:46 2016 -0600 Committer: Marko A. Rodriguez <[email protected]> Committed: Fri Sep 23 12:11:46 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/37f0606c/docs/src/reference/the-traversal.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc index e8d40e5..2fafbd9 100644 --- a/docs/src/reference/the-traversal.asciidoc +++ b/docs/src/reference/the-traversal.asciidoc @@ -2599,17 +2599,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
