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 23:57:46 UTC

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

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

Marko A. Rodriguez commented on TINKERPOP3-825:
-----------------------------------------------

Another idea is we extend {{GraphTraversalSource}} to support {{withBulk(BinaryOperator)}}, where {{Operator.sum}} is the default. For instance:

{code}
g.withBulk(sum) // default
g.withBulk(unity) // on merge, bulks don't sum, they simply stay 1.
{code}

Given that, "energy diffusions" are possible via:

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

Finally, we are starting to have lots of {{withXXX}}. Perhaps we can make a strategy where people can set the {{withXXX}} at the creation of the {{GraphTraversal}}.

{code}
gremlin> g = graph.traversal(StandardTraversal.build().with(WithParameters.build().withSack(1.0d,sum).withBulk(unity).create()))
...
gremlin> g.V(1).local(out('knows').barrier(normSack)).in('knows').barrier().sack()
==>1.0
{code}

Just some more ideas....

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