dedup in an optional step not working as (I) expected

90 views
Skip to first unread message

Paul Jackson

unread,
Jan 10, 2017, 2:28:15 PM1/10/17
to Gremlin-users
The following is using the classic graph and shows that I can use dedup to filter out multiple copies of an edge, and that I can use a combination of optional and choose to return partial traversals.

// b:e[7][1-knows->2] is output twice, once with a:v[1] and again with a:v[2]
gremlin> g.V(1,2).as('a').
           bothE().as('b').
           select('a','b')

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]
==>[a:v[2],b:e[7][1-knows->2]]

// v[2] has no out() edges. Can still output it using optional/choose
gremlin> g.V(1,2).as('a').
           optional(outE().as('b')).
           choose(select('b'), select('a','b'), project('a').by(select('a')))

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]
==>[a:v[2]] // If optional 'b' step returns nothing, 'a' is still output, as desired

// Use dedup() to filter out
[a:v[2],b:e[7][1-knows->2]]
gremlin> g.V(1,2).as('a').
           bothE().dedup().as('b').
           select('a','b')

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]

// Filter out [a:v[1],b:e[7][1-knows->2]]
gremlin> g.V(2,1).as('a').
           bothE().dedup().as('b').
           select('a','b')

==>[a:v[2],b:e[7][1-knows->2]]
==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[8][1-knows->4]]

All that was good.

Here I try to combine dedup with optional/choose. Without removing PathRetractionStrategy I get no output. I've seen cases where I've needed to remove LazyBarrierStrategy so I'm doing that as well, even if not necessary. Still, (it seems) the dedup in the optional step is preventing the a:v[2] from the prior step from being output. Should this work? Any work around?

// Filter out 2nd copy of b:e[7][1-knows->2] (but still output a:v[2])
gremlin> g.withoutStrategies(LazyBarrierStrategy,PathRetractionStrategy).V(1,2).as('a').
           optional(bothE().dedup().as('b')).
           choose(select('b'), select('a','b'), project('a').by(select('a')))

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]

Thanks,
-Paul

Daniel Kuppitz

unread,
Jan 10, 2017, 3:33:28 PM1/10/17
to gremli...@googlegroups.com
Hi Paul,

which version is that? Looks like everything works as expected in the current master.

gremlin> g.withoutStrategies(PathRetractionStrategy, LazyBarrierStrategy).
           V(1,2).as("a").optional(bothE().as("b")).choose(select("b"), select("a","b"), project("a").by(select("a")))

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]
==>[a:v[2],b:e[7][1-knows->2]]
gremlin> g.withoutStrategies(PathRetractionStrategy, LazyBarrierStrategy).
           V(1,2).as("a").optional(bothE().dedup().as("b")).choose(select("b"), select("a","b"), project("a").by(select("a")))

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]
==>[a:v[2]]
gremlin> Gremlin.version()
==>3.3.0-SNAPSHOT

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/988b71fa-9399-463b-af78-665ec61c819a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul Jackson

unread,
Jan 10, 2017, 3:49:37 PM1/10/17
to Gremlin-users

Hi Daniel,


It is 3.2.3.

 

Is there a date planned for 3.3.0 release?

 

Thanks,

-Paul

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.

Paul Jackson

unread,
Jan 10, 2017, 4:25:56 PM1/10/17
to Gremlin-users
3.2.4 seems to have the problem as well.

gremlin> g.withoutStrategies(PathRetractionStrategy, LazyBarrierStrategy).V(1,2).as("a").optional(bothE().as("b")).choose(select("b"), select("a","b"), project("a").by(select("a")))

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]
==>[a:v[2],b:e[7][1-knows->2]]
gremlin> g.withoutStrategies(PathRetractionStrategy, LazyBarrierStrategy).V(1,2).as("a").optional(bothE().dedup().as("b")).choose(select("b"), select("a","b"), project("a").by(select("a")))

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]
gremlin> Gremlin.version()
log4j:WARN No appenders could be found for logger (com.jcabi.manifests.Manifests).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
==>3.2.4-SNAPSHOT


As a sanity check I built the master and got the same results as you.

gremlin> g.withoutStrategies(PathRetractionStrategy, LazyBarrierStrategy).V(1,2).as("a").optional(bothE().as("b")).choose(select("b"), select("a","b"), project("a").by(select("a")))

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]
==>[a:v[2],b:e[7][1-knows->2]]
gremlin> g.withoutStrategies(PathRetractionStrategy, LazyBarrierStrategy).V(1,2).as("a").optional(bothE().dedup().as("b")).choose(select("b"), select("a","b"), project("a").by(select("a")))

==>[a:v[1],b:e[9][1-created->3]]
==>[a:v[1],b:e[7][1-knows->2]]
==>[a:v[1],b:e[8][1-knows->4]]
==>[a:v[2]]
gremlin> Gremlin.version()
log4j:WARN No appenders could be found for logger (com.jcabi.manifests.Manifests).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
==>3.3.0-SNAPSHOT

Cheers,
-Paul

Marko Rodriguez

unread,
Jan 10, 2017, 4:55:18 PM1/10/17
to gremli...@googlegroups.com
Hi,

There is a bug with optional() in the 3.2.4 line and in 3.3.0, a new OptionalStep was added. I forget why we couldn’t put OptionalStep into 3.2.4, but it had to do with backwards compatibility (I believe the GraphTraversal.optional() signature changed).

Marko.

Paul Jackson

unread,
Jan 10, 2017, 4:58:39 PM1/10/17
to Gremlin-users
Thanks, Marko.

Where is 3.3.0 in the release cycle? Is there a date planned and how squishy is it?

-Paul

Marko Rodriguez

unread,
Jan 10, 2017, 5:09:12 PM1/10/17
to gremli...@googlegroups.com
Hello,

I don’t know. @Stephen?

Marko.

Stephen Mallette

unread,
Jan 12, 2017, 7:05:08 AM1/12/17
to Gremlin-users
A release date for 3.3.0 (or any release) has not yet been discussed. We do have a pretty good body of code in all the release lines at this point. 3.3.0 however will likely be released in milestone releases as there are many changes required for it and it will take some time to get that all right.

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.

--
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/3CAF73B9-BCA5-4778-BEFE-18AF312D1EE7%40gmail.com.

Jamie Lawson

unread,
May 7, 2017, 7:37:24 PM5/7/17
to Gremlin-users
Are there any ballpark estimates. Nothing official. My customer wants to be able to plan. Can we plan for there being a Tinkerpop 3.3 official release in 4 months? How about 8 months? How about a year? A ballpark estimate would be extremely useful in allocating resources.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.

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

Stephen Mallette

unread,
May 8, 2017, 7:32:49 AM5/8/17
to Gremlin-users
I don't think we would release 3.3.0 this year. We had talked about doing milestone releases of it, but I don't think we've even hit a point where a first milestone could be released.

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/d156f81f-7085-4410-9b25-940ea0889092%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages