You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by Daniel Kuppitz <me...@gremlin.guru> on 2015/01/29 01:21:22 UTC
[TinkerPop3] Is it greater? Is it smaller? Is it ...?
Ladies and Gentlemen,
I'm proud to announce that Gremlin now supports the is()-step, which can be
used to filter scalar values.
gremlin> g = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> g.V().values('age').is(32)
==>32
gremlin> g.V().values('age').is(lte, 30)
==>29
==>27
gremlin> g.V().values('age').is(outside, [30, 40])
==>29
==>27
Now you might say* "Why do we need it? We could do .has('prop',
value).values('prop') to get the same results."*. Right, but now check this
out:
gremlin> g.V().has(__.in('created').count().is(1L)).values('name')
==>ripple
gremlin> g.V().has(__.in('created').count().is(gte, 2L)).values('name')
==>lop
gremlin> g.V().has(__.in('created').values('age').mean().is(inside, [30d,
35d])).values('name')
==>lop
==>ripple
You can find the docs here:
http://www.tinkerpop.com/docs/3.0.0-SNAPSHOT/#is-step
And in case you didn't recognize the brand new predicates: Besides gt, gte,
lt, lte, eq, neq, within and without (chances are high that I missed at
least one), we now support inside and outside. If you have any preference
about the meaning of inside and outside (e.g. are the boundaries included
or excluded?), feel free to add a comment in the corresponding issue
<https://github.com/tinkerpop/tinkerpop3/issues/527>.
Cheers,
Daniel