tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kuppitz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TINKERPOP3-799) [Proposal] with()-modulator for stream level variable binding.
Date Wed, 05 Aug 2015 03:12:04 GMT

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

Daniel Kuppitz commented on TINKERPOP3-799:
-------------------------------------------

{quote}
Are there other steps that would (reasonably) benefit from with()-modulation?
{quote}

Any filter step. It's always so cumbersome to compare elements by their properties...

{code}
g.V().as("a").repeat(out().hasLabel("l").with("l", select("a").by(label))).path()
{code}

Just try to do that with what we currently have. You'll end up with extra labels for the comparisons
and a filter step that wraps a weird select + where pattern. Something like that:

{code}
g.V().as("a").repeat(out().filter(label().as("l").select("a").by(label).where("a", eq("l")))).path()
{code}


{quote}
Is {{with()}} a good word or is it a reserved word in other programming languages?
{quote}

{{with}} has a special meaning in Groovy.


> [Proposal] with()-modulator for stream level variable binding.
> --------------------------------------------------------------
>
>                 Key: TINKERPOP3-799
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-799
>             Project: TinkerPop 3
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.0.0-incubating
>            Reporter: Marko A. Rodriguez
>
> Arguments for steps are defined by the user and are not changeable for the life of the
traversal. In most situations, this is fine. However, for the graph mutation steps (e.g. {{addV}},
{{addOutE}}, {{property}}), this can be limiting. Many times you want to change an argument
based upon information within the traversal. To do this, I propose the following new modulator
methods:
> 1. {{with(string,traversal)}}
> 2. {{with(string,object)}}
> 3. {{with(string,function)}} 
> How does it work?
> {code}
> // create a bi-directional graph
> g.V().as('a').outE().as('b').inV().
>   addOutE('label','a','weight','w').
>     with('label',select('b').label()).
>     with('a',select('a')).
>     with('w',select('b').values('weight'))
> {code}
> In this way, the edge label and properties are dynamically determined by the respective
{{with()}} variable.
> {code}
> // create a bi-directional graph
> g.V().as('a').outE().as('b').inV().
>   addOutE('label','a','properties').
>     with('label',select('b').label()).
>     with('a',select('a')).
>     with('properties',select('b').valueMap())
> {code}
> I think this will also come into play with the math operators of TINKERPOP3-761. For
instance:
> {code}
> g.V().outE().as('b').inV().values('energy').
>   mult('x').with('x',select('b').values('weight'))
> {code}
> Are there other steps that would (reasonably) benefit from {{with()}}-modulation? Is
{{with()}} a good word or is it a reserved word in other programming languages?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message