[
https://issues.apache.org/jira/browse/TINKERPOP-1387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15928426#comment-15928426
]
ASF GitHub Bot commented on TINKERPOP-1387:
-------------------------------------------
Github user okram commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/574#discussion_r106472194
--- Diff:
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Path.java
---
@@ -238,10 +239,53 @@ public default boolean popEquals(final Pop pop, final
Object other) {
isPresent();
}
+ /**
+ * Isolate a sub-path from the path object. The isolation is based
solely on the path labels.
+ * The to-label is inclusive. Thus, from "b" to "c" would isolate the
example path as follows {@code a,[b,c],d}.
+ *
+ * @param fromLabel The label to start recording the sub-path from.
+ * @param toLabel The label to end recording the sub-path to.
+ * @return the isolated sub-path.
+ */
+ public default Path subPath(final String fromLabel, final String
toLabel) {
+ if (null == fromLabel && null == toLabel)
+ return this;
+ else {
+ Path subPath = MutablePath.make();
+ int size = this.size();
--- End diff --
Done.
> from and to modulators for path steps
> -------------------------------------
>
> Key: TINKERPOP-1387
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1387
> Project: TinkerPop
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.2.1
> Reporter: Daniel Kuppitz
> Assignee: Marko A. Rodriguez
>
> Just had this crazy idea of {{from}} and {{to}} modulators for path steps.
> {code}
> g.V(1).as("a").
>
> repeat(both("knows").simplePath().from("a")).emit().out("created").as("p").in("created").
>
> repeat(both("knows").simplePath().from("p")).emit(hasId(6)).out("created").as("b").
> path().from("a").to("p").as("pathFromMarkoToProject").
> path().from("p").to("b").as("pathFromProjectToPeter").
> match(
> __.as("pathFromMarkoToProject").count(local).is(lte(3)),
> __.as("pathFromProjectToPeter").count(local).is(lte(3))
> ).select("p", "pathFromMarkoToProject", "pathFromProjectToPeter")
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)