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/04/24 18:09:38 UTC
[jira] [Comment Edited] (TINKERPOP3-626) Better interface for
interval constraints
[ https://issues.apache.org/jira/browse/TINKERPOP3-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14511279#comment-14511279 ]
Marko A. Rodriguez edited comment on TINKERPOP3-626 at 4/24/15 4:09 PM:
------------------------------------------------------------------------
We spent a long time getting rid of {{filter}} steps that can be best represented with {{has(predicate)}}. This way, the language is simple -- "has" is for filtering elements based on properties. Why did we reintroduce {{between}}?
If {{outside}}/{{inside}} are not good (given that they are not "less than/greater than" primitives), then we make them statics and do:
{code}
has('age',between(20,30))
has('age',outside(20,30))
has('age',inside(20,30))
{code}
where these statics are then analyzed by a {{HasContainer}} constructor like we do for {{Contains.within}} and {{Contains.without}}. We shouldn't add yet more steps for people to learn. In fact, it might be smart to do this all around:
{code}
has('name',within("marko","bob","matthias")
has('age',gt(20))
has('age',between(20,30)
has('age',outside(20,30))
{code}
This way we don't need to do static imports for {{Compare}}, {{Contains}}, etc. Only a static import of the "to be created" class methods. Finally, then this makes {{is}} cleaner (which is for objects that are not elements):
{code}
is(gt(20))
is(between(20,30))
etc.
{code}
was (Author: okram):
We spent a long time getting rid of {{filter}} steps that can be best represented with {{has(predicate)}}. This way, the language is simple -- "has" is for filtering elements based on properties. Why did we reintroduce {{between}}?
If {{outside}}/{{inside}} are not good (given that they are not "less than/greater than" primitives), then we make them statics and do:
{code}
has('age',between(20,30))
has('age',outside(20,30))
has('age',inside(20,30))
{code}
where these statics are then analyzed by a {{HasContainer}} constructor like we do for {{Contains.within}} and {{Contains.without}}. We shouldn't add yet more steps for people to learn. In fact, it might be smart to do this all around:
{code}
has('name',within("marko","bob","matthias")
has('age',gt(20))
has('age',between(20,30)
has('age',outside(20,30))
{code}
This way we don't need to do static imports for {{Compare}}, {{Contains}}, etc. Only a static import of the "to be created" class methods. Finally, then this makes {{is}} cleaner:
{code}
is(gt(20))
is(between(20,30))
etc.
{code}
> Better interface for interval constraints
> -----------------------------------------
>
> Key: TINKERPOP3-626
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-626
> Project: TinkerPop 3
> Issue Type: Improvement
> Components: process
> Reporter: Matthias Broecheler
> Assignee: Daniel Kuppitz
> Priority: Minor
> Fix For: 3.0.0.GA
>
>
> In java, one has to specify an interval constraint as:
> {{has('age',within,ImmutableList.of(20,30))}}
> which is quite ugly compared to the old:
> {{between('age',20,30)}}
> A vararg overload should be provided that constructs the list or a dedicated method should be considered.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)