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

Marko A. Rodriguez edited comment on TINKERPOP-1098 at 1/25/16 4:53 PM:
------------------------------------------------------------------------

I had a long hard think about this problem while sitting in court room 
listening to lawyers blab in a lexicon I could not parse. (and no, nothing 
serious -- new laws going into place regarding water rights in our valley).

Anywho, here is what I thought. First, its a slippery slope to go down 
{{filter(local)}}. Then, as @dkuppitz notes, what about {{has(local)}}... what 
about {{map(local)}}. Dah!

I was thinking that perhaps we have a more general {{Step}} called something 
like {{InwardStep<S,E>}} and we get rid of the whole {{Scope.local/gobal}} enum 
(though note that this is all backwards compatible with `@Deprecation`).

{code}
g.V().valueMap().inward(select(key).is("name"))
g.V().values("age").fold().inward(is(gt(20).map(age -> age.get() + 10)).unfold()
g.V().values("age").fold().inward(count())
g.V().values("age").fold().inward(sample())
g.V()....groupCount().inward(order().by(keys,decr))
{code}

In short, there would no longer be {{SampleGlobalStep}} and 
{{SampleLocalStep}}. It would all just be {{SampleStep}} (likewise for 
CountStep, OrderStep and DedupStep). What {{InwardStep}} does is:

* Determine the data structure of the current object -- list, map, set, etc.
* Unfold the data structure and pass it through its nested traversal.
* "Fold" up the nested traversal results into the appropriate data structure -- 
list, map, set, etc.
* Emit the new collection data structure.

With this model, every step can be applied to the internals of a collections. 
No need to have sample(local), count(local), filter(local), etc. etc.... 

I don't like the word {{InwardStep}} and {{inward()}], so if someone has a 
better idea that would be great. Realize that "inside" and "within" are taken 
as they are in {{P}}.

Synonyms: nest, innards, deep, pieces, parts, constituents, interior, 
internal....

{code}
g.V().groupCount().pieces(order().by(values,decr))
{code}

...?


was (Author: okram):
I had a long hard think about this problem while sitting in court room 
listening to lawyers blab in a lexicon I could not parse. (and no, nothing 
serious -- new laws going into place regarding water rights in our valley).

Anywho, here is what I thought. First, its a slippery slope to go down 
`filter(local)`. Then, as @dkuppitz notes, what about `has(local)`... what 
about `map(local)`. Dah!

I was thinking that perhaps we have a more general `Step` called something like 
`InwardStep<S,E>` and we get rid of the whole `Scope.local/gobal` enum (though 
note that this is all backwards compatible with `@Deprecation`).

{code}
g.V().valueMap().inward(select(key).is("name"))
g.V().values("age").fold().inward(is(gt(20).map(age -> age.get() + 10)).unfold()
g.V().values("age").fold().inward(count())
g.V().values("age").fold().inward(sample())
g.V()....groupCount().inward(order().by(keys,decr))
{code}

In short, there would no longer be `SampleGlobalStep` and `SampleLocalStep`. It 
would all just be `SampleStep` (likewise for `CountStep`, `OrderStep` and 
`DedupStep`). What `InwardStep` does is:

* Determine the data structure of the current object -- list, map, set, etc.
* Unfold the data structure and pass it through its nested traversal.
* "Fold" up the nested traversal results into the appropriate data structure -- 
list, map, set, etc.
* Emit the new collection data structure.

With this model, every step can be applied to the internals of a collections. 
No need to have `sample(local)`, `count(local)`, `filter(local)`, etc. etc.... 

I don't like the word `InwardStep` and `inward()`, so if someone has a better 
idea that would be great. Realize that `inside` and `within` are taken as they 
are in `P`.

Synonyms: nest, innards, deep, pieces, parts, constituents, interior, 
internal....

{code}
g.V().groupCount().pieces(order().by(values,decr))
{code}

...?

> Local Filters
> -------------
>
>                 Key: TINKERPOP-1098
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1098
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.0.2-incubating
>            Reporter: Daniel Kuppitz
>             Fix For: 3.2.0-incubating
>
>
> We should provide local filter steps. Currently, if you want to filter 
> elements from paths or lists (or maps?), you have to do 
> {{unfold().filter().fold()}}.
> Not sure if that only affects {{filter()}}, or also {{has()}}, {{hasNot()}}, 
> {{where()}}, ...



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

Reply via email to