You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Marko A. Rodriguez (JIRA)" <ji...@apache.org> on 2015/08/05 04:45:05 UTC

[jira] [Updated] (TINKERPOP3-799) [Proposal] with()-modulator for stream level variable binding.

     [ https://issues.apache.org/jira/browse/TINKERPOP3-799?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marko A. Rodriguez updated TINKERPOP3-799:
------------------------------------------
    Description: 
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?

  was:
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?


> [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
>            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)