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/09/01 22:49:45 UTC

[jira] [Created] (TINKERPOP3-825) [Proposal] SetBulkStep (sideEffectStep)

Marko A. Rodriguez created TINKERPOP3-825:
---------------------------------------------

             Summary: [Proposal] SetBulkStep (sideEffectStep)
                 Key: TINKERPOP3-825
                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-825
             Project: TinkerPop 3
          Issue Type: Improvement
          Components: process
            Reporter: Marko A. Rodriguez
            Assignee: Marko A. Rodriguez
             Fix For: 3.1.0-incubating


I think we need to have

{code}
g.V...bulk(1)
{code}

which would be a {{SideEffectStep}} that simply sets the bulk to the provided value. Why? If you are using Gremlin sacks to denote energy values then your "bulk" is really in the sack, not in the bulk. However, when your computation is complete and you get back your results, your results will have multiple of the "same sack" for each bulk, where in fact, you want one sack cause you want the bulk to be one.

Example:

So this is good. We split the sack value of 1.0 amongst the two people that marko knows.

{code}
gremlin> g.withSack(1.0d,sum).V(1).local(out('knows').barrier(normSack)).sack()
==>0.5
==>0.5
{code}

However, this is bad. When the two sacks merge, they are 1.0 (sum). However, the bulk is now 2 as two traversers merged. Thus, the output is two traversers (that are the same) with each having a sack of 1.0.

{code}
gremlin> g.withSack(1.0d,sum).V(1).local(out('knows').barrier(normSack)).in('knows').barrier().sack()
==>1.0
==>1.0
{code}

Instead, we want this:

{code}
gremlin> g.withSack(1.0d,sum).V(1).local(out('knows').barrier(normSack)).in('knows').barrier().sideEffect{it.setBulk(1)}.sack()
==>1.0
{code}

...where that {{sideEffect}}-lambda would be {{bulk(1)}}.

Its sort of confusing.... and perhaps I have convoluted sack and bulk where perhaps bulk should be a "Number" and not just {{Long}}, but........ seems a bit late for that now.



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