problem with repeat query using times

438 views
Skip to first unread message

דניאלה אסף

unread,
Apr 14, 2016, 2:34:07 PM4/14/16
to Gremlin-users
the following query :


g.V(1,7).repeat(both().simplePath()).until(hasId(within(9,8))).path().dedup() 

in :


works but when I add times it fails:

g.V(1,7).repeat(both().simplePath()).times(5).until(hasId(within(9,8))).path().dedup()

in :



in case I have a very large db I would like to do it with limitation on the number of iterations . but times is not like loop . when doing :

g.v(89).as('x').outE.inV.loop('x'){it.loops < 3}.path in previous gremlin version


Daniel Kuppitz

unread,
Apr 14, 2016, 4:02:02 PM4/14/16
to gremli...@googlegroups.com
You can use times() OR until(), not both. See


for an updated example that shows how to use both break conditions.

Side note: You should click "save" before you share a GremlinBin link

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-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/2275d93d-0162-497b-a6bd-ddb0c7c7f889%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

אלה וייס

unread,
Apr 17, 2016, 12:43:42 AM4/17/16
to Gremlin-users
 ,thanks,but the following query has an  infinite loop,

and I would like to end the query in case there is no result after x steps. how can I limit the number of iterations without times 
בתאריך יום חמישי, 14 באפריל 2016 בשעה 21:34:07 UTC+3, מאת דניאלה אסף:

Daniel Kuppitz

unread,
Apr 17, 2016, 3:41:55 AM4/17/16
to gremli...@googlegroups.com
It can't be an infinite loop as it uses .simplePath(). If you want to break out after a certain number of steps, make this your until() condition:

hasId(within(9,8)).or().loops().is(n)

...where n is the max. number of loops.


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-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages