Using group to drop legacy vertex

30 views
Skip to first unread message

Alex LI

unread,
Dec 6, 2017, 11:04:53 PM12/6/17
to Gremlin-users
HIya,

I have some duplicate vertex with same uuid (not the db id) and type, and every time when I lookup a existing vertex I want to drop the legacy vertex as well. I have the following gremlin query to do that but the `range` bit is something I am concern on or want to find a better way to do it.

g.V().has("uuid", "f7405ad2").has("type", "car").order().by("lastModified", decr).values("lastModified").limit(local, 3)

==>1512615609790

==>1512615245766


So basically I want to remove every vertex except the fist vertex because the first vertex is the most up-do-date. (assume only 2 duplicate vertex in this example, but could be more)

And I do:

g.V().has("uuid", "f7405ad2").has("type", "car").order().by("lastModified", decr).range(1, 1000).drop()


this works, but the rang to 1000 is something I want to avoid. is there a better way to do it?

Thanks and regards,
Alex

Robert Dale

unread,
Dec 8, 2017, 10:39:05 AM12/8/17
to gremli...@googlegroups.com
What about it do you want to avoid?    You can do range(1,-1). 3.3 has skip(1).

Robert Dale

--
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/8e2d1217-883d-412c-b164-ea32b668e6f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex LI

unread,
Dec 11, 2017, 11:12:37 PM12/11/17
to Gremlin-users
Thanks Rob,

-1 works here. cannot find it in the doc though

Thanks,
Alex


On Saturday, 9 December 2017 02:39:05 UTC+11, Robert Dale wrote:
What about it do you want to avoid?    You can do range(1,-1). 3.3 has skip(1).

Robert Dale

On Wed, Dec 6, 2017 at 11:04 PM, Alex LI <zhal...@gmail.com> wrote:
HIya,

I have some duplicate vertex with same uuid (not the db id) and type, and every time when I lookup a existing vertex I want to drop the legacy vertex as well. I have the following gremlin query to do that but the `range` bit is something I am concern on or want to find a better way to do it.

g.V().has("uuid", "f7405ad2").has("type", "car").order().by("lastModified", decr).values("lastModified").limit(local, 3)

==>1512615609790

==>1512615245766


So basically I want to remove every vertex except the fist vertex because the first vertex is the most up-do-date. (assume only 2 duplicate vertex in this example, but could be more)

And I do:

g.V().has("uuid", "f7405ad2").has("type", "car").order().by("lastModified", decr).range(1, 1000).drop()


this works, but the rang to 1000 is something I want to avoid. is there a better way to do it?

Thanks and regards,
Alex

--
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