You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Cole Greer (Jira)" <ji...@apache.org> on 2026/07/16 17:18:00 UTC

[jira] [Commented] (TINKERPOP-3184) Please allow the path() step to take an optional from and to label

    [ https://issues.apache.org/jira/browse/TINKERPOP-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18096865#comment-18096865 ] 

Cole Greer commented on TINKERPOP-3184:
---------------------------------------

Building off of Taylor's comment, it doesn't appear there are any actions needed here as the path().from() pattern covers this use case. I agree that discoverability is a challenge, but that's really a separate concern. I have confirmed that the path().from() pattern is at least present in our reference docs, which I think it sufficient for now. I will close this for now. If you believe there further changes in this area would be beneficial to TinkerPop, please feel free to reopen the JIRA or create a new one.

> Please allow the path() step to take an optional from and to label
> ------------------------------------------------------------------
>
>                 Key: TINKERPOP-3184
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3184
>             Project: TinkerPop
>          Issue Type: Wish
>    Affects Versions: 3.7.4
>            Reporter: Martin Häusler
>            Priority: Major
>
> Hello,
> I am once again dealing with paths. I noticed that it is currently possible to do the following:
> {code:java}
> traversal().V()
>    // ... navigation...
>    .path()
>    .unfold()
> {code}
> ... which is very neat. I was wondering if I can also get the path between a label and the current vertex. Turns out, I can:
> {code:java}
> traversal().V()
>    // ... navigation ...
>    .as("from")
>    // ... navigation...
>    .flatMap ( t-> t.path().subPath("from", null).iterator())
> {code}
> That is very useful! But it's a shame that the functionality is locked behind a lambda expression, which is not available in all scenarios. Moreover, gremlin optimizes away the path information tracking if no "path()" step is used in the query, so the lambda solution always requires some additional artificial steps on top.
> My proposal would be to add the following overload to the "path()" method:
> {code:java}
> public default GraphTraversal<S, Path> path(String fromLabel, String toLabel)
> {code}
> ... which behaves exactly like the lambda above. Both "fromLabel" and "toLabel" should accept NULL (same as "subPath(...)") which means start/end of the path respectively. Therefore calling "path()" would be the same as "path(null, null)".



--
This message was sent by Atlassian Jira
(v8.20.10#820010)