Merge branch 'tp32' Conflicts: gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/cfa93a11 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/cfa93a11 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/cfa93a11 Branch: refs/heads/master Commit: cfa93a11b104edcd1cb0cdf97bfe30353ca5e007 Parents: 73a36da c78d31b Author: Stephen Mallette <sp...@genoprime.com> Authored: Fri Feb 17 14:26:15 2017 -0500 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Fri Feb 17 14:26:15 2017 -0500 ---------------------------------------------------------------------- .../traversal/dsl/graph/GraphTraversal.java | 440 ++++++++++++++----- 1 file changed, 342 insertions(+), 98 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cfa93a11/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java ---------------------------------------------------------------------- diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java index 8e8309a,288e695..06f8070 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java @@@ -535,9 -535,9 +536,9 @@@ public interface GraphTraversal<S, E> e * @param propertyKeys the properties to retrieve * @param <E2> the value type of the returned properties * @return the traversal with an appended {@link PropertyMapStep}. - * @see <a target="_blank" href="http://tinkerpop.apache.org/docs/${project.version}/reference/#valuemap-step">Reference Documentation - ValueMap Step</a> + * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#valuemap-step" target="_blank">Reference Documentation - ValueMap Step</a> */ - public default <E2> GraphTraversal<S, Map<String, E2>> valueMap(final boolean includeTokens, final String... propertyKeys) { + public default <E2> GraphTraversal<S, Map<Object, E2>> valueMap(final boolean includeTokens, final String... propertyKeys) { this.asAdmin().getBytecode().addStep(Symbols.valueMap, includeTokens, propertyKeys); return this.asAdmin().addStep(new PropertyMapStep<>(this.asAdmin(), includeTokens, PropertyType.VALUE, propertyKeys)); } @@@ -1285,16 -1328,38 +1352,38 @@@ new PropertiesStep(propertyTraversal.asAdmin(), PropertyType.VALUE, propertyKey)))); } + /** + * Filters vertices, edges and vertex properties based on the existence of properties. + * + * @param propertyKey the key of the property to filter on for existence + * @return the traversal with an appended {@link HasStep} + * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a> + */ public default GraphTraversal<S, E> has(final String propertyKey) { this.asAdmin().getBytecode().addStep(Symbols.has, propertyKey); - return this.asAdmin().addStep(new TraversalFilterStep<>(this.asAdmin(), __.values(propertyKey))); + return this.asAdmin().addStep(new TraversalFilterStep(this.asAdmin(), __.values(propertyKey))); } + /** + * Filters vertices, edges and vertex properties based on the non-existence of properties. + * + * @param propertyKey the key of the property to filter on for existence + * @return the traversal with an appended {@link HasStep} + * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a> + */ public default GraphTraversal<S, E> hasNot(final String propertyKey) { this.asAdmin().getBytecode().addStep(Symbols.hasNot, propertyKey); - return this.asAdmin().addStep(new NotStep<>(this.asAdmin(), __.values(propertyKey))); + return this.asAdmin().addStep(new NotStep(this.asAdmin(), __.values(propertyKey))); } + /** + * Filters vertices, edges and vertex properties based on their label. + * + * @param label the label of the {@link Element} + * @param otherLabels additional labels of the {@link Element} + * @return the traversal with an appended {@link HasStep} + * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a> + */ public default GraphTraversal<S, E> hasLabel(final String label, final String... otherLabels) { final String[] labels = new String[otherLabels.length + 1]; labels[0] = label; @@@ -1471,6 -1661,6 +1685,18 @@@ : new TailLocalStep<>(this.asAdmin(), limit)); } ++ public default GraphTraversal<S, E> skip(final long skip) { ++ this.asAdmin().getBytecode().addStep(Symbols.skip, skip); ++ return this.asAdmin().addStep(new RangeGlobalStep<>(this.asAdmin(), skip, -1)); ++ } ++ ++ public default <E2> GraphTraversal<S, E2> skip(final Scope scope, final long skip) { ++ this.asAdmin().getBytecode().addStep(Symbols.skip, scope, skip); ++ return this.asAdmin().addStep(scope.equals(Scope.global) ++ ? new RangeGlobalStep<>(this.asAdmin(), skip, -1) ++ : new RangeLocalStep<>(this.asAdmin(), skip, -1)); ++ } ++ /** * Once the first {@link Traverser} hits this step, a count down is started. Once the time limit is up, all remaining traversers are filtered out. *