You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Kevin Gallardo (JIRA)" <ji...@apache.org> on 2017/08/02 21:03:00 UTC

[jira] [Commented] (TINKERPOP-1740) Add vertex parameter overload to to() and from()

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

Kevin Gallardo commented on TINKERPOP-1740:
-------------------------------------------

I think it'd be worth having the {{addE()}} step on the TraversalSource so that you can simply call for adding an edge without having to initiate a Traversal with {{g.V(vertex)}}. Considering you have already fetched 2 vertices earlier you may want to simply add an edge between the two:

{code}
Vertex a = g.addV().next();
Vertex b = g.addV().next();

g.addE("knows").from(a.id()).to(b.id()).next();

// or combined with this proposed solution
g.addE("knows").from(a).to(b).next()
{code}

> Add vertex parameter overload to to() and from()
> ------------------------------------------------
>
>                 Key: TINKERPOP-1740
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1740
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>            Reporter: Marko A. Rodriguez
>            Assignee: Marko A. Rodriguez
>
> Make it possible to do this:
> {code}
> a = g.V(1).next()
> b = g.V(2).next()
> g.V(a).addE("friend").to(b)
> {code}
> This will work {{withRemote()}} given that detached elements are re-attached prior to usage with {{AddEdgeStep}}.
> Right now you have to do the above with the ugly {{withSideEffects}} prefix appendage.
> {code}
> a = g.addV().next()
> b = g.addV().next()
> g.withSideEffect('b',b).V(a).addE('friend').to('b')
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)