Merge branch 'tp31' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7bb0c90a Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7bb0c90a Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7bb0c90a Branch: refs/heads/TINKERPOP-1507 Commit: 7bb0c90a0bfe147ffb0037dfff916e1c6644583b Parents: 3e6433b 52ae785 Author: Stephen Mallette <[email protected]> Authored: Mon Oct 24 06:25:45 2016 -0400 Committer: Stephen Mallette <[email protected]> Committed: Mon Oct 24 06:25:45 2016 -0400 ---------------------------------------------------------------------- docs/src/reference/the-traversal.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7bb0c90a/docs/src/reference/the-traversal.asciidoc ---------------------------------------------------------------------- diff --cc docs/src/reference/the-traversal.asciidoc index c657d01,0c7ffef..c5c30a3 --- a/docs/src/reference/the-traversal.asciidoc +++ b/docs/src/reference/the-traversal.asciidoc @@@ -2647,39 -2403,12 +2647,39 @@@ SubgraphStrateg [gremlin-groovy] ---- -graph = TinkerFactory.createModern() -strategy = SubgraphStrategy.build().edgeCriterion(hasId(8,9,10)).create() -g = GraphTraversalSource.build().with(strategy).create(graph) -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` +<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. + +IMPORTANT: This strategy is implemented such that the vertices attached to an `Edge` must both satisfy the vertex criterion (if present) in order for the `Edge` to be considered a part of the subgraph. + +The example below uses all three filters: vertex, edge, and vertex property. People vertices must have lived in more than three places, +edges must be labeled "develops," and vertex properties must be the persons current location or a non-location property. + +[gremlin-groovy] +---- +graph = TinkerFactory.createTheCrew() +g = graph.traversal().withStrategies(SubgraphStrategy.build(). + vertices(or(hasNot('location'),properties('location').count().is(gt(3)))). + edges(hasLabel('develops')). + vertexProperties(or(hasLabel(neq('location')),hasNot('endTime'))).create()) +g.V().valueMap(true) +g.E().valueMap(true) +g.V().outE().inV(). + path(). + by('name'). + by(). + by('name') - ---- ++----
