How to filter edge by source vertex's property?

26 views
Skip to first unread message

Qiu Xiafei

unread,
Jun 26, 2017, 10:31:01 PM6/26/17
to Gremlin-users
Hi, all!

I encounter a problem filtering edge by source vertex's property. Here we have the where step, the gremlin query is like:

g.V().as('a').outE().as('b').where('b', eq('a')).by('time');

But further, I want to filter the edge (labeled as 'b') within a range of source vertex(labeled as 'a')'s time property, say, a.time - 100 < b.time a.time + 100.

I don't know how to express such predication in the where step, do you have any ideas?

Daniel Kuppitz

unread,
Jun 27, 2017, 7:20:18 AM6/27/17
to gremli...@googlegroups.com
Subtract b's time from a's time and check whether the result is > -100 && < 100.

g.V().sack(assign).by('time').
  outE().sack(minus).by('time').
  filter(sack().is(gt(-100).and(lt(100))))

Cheers,
Daniel


--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/5c35cced-7ed4-4a30-b7bc-cbbc641babab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Qiu Xiafei

unread,
Jun 27, 2017, 7:26:55 AM6/27/17
to Gremlin-users
Thanks,that's great!

在 2017年6月27日星期二 UTC+8下午7:20:18,Daniel Kuppitz写道:
Subtract b's time from a's time and check whether the result is > -100 && < 100.

g.V().sack(assign).by('time').
  outE().sack(minus).by('time').
  filter(sack().is(gt(-100).and(lt(100))))

Cheers,
Daniel

On Tue, Jun 27, 2017 at 4:31 AM, Qiu Xiafei <qiux...@gmail.com> wrote:
Hi, all!

I encounter a problem filtering edge by source vertex's property. Here we have the where step, the gremlin query is like:

g.V().as('a').outE().as('b').where('b', eq('a')).by('time');

But further, I want to filter the edge (labeled as 'b') within a range of source vertex(labeled as 'a')'s time property, say, a.time - 100 < b.time a.time + 100.

I don't know how to express such predication in the where step, do you have any ideas?

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages