0

I'm using Gremlin, and I've got these two queries that return different results and I can't understand why.

gremlin> g.V().
    hasLabel('person').
        has('person','personId', 'd6688539-7773-4126-93bf-bb8ef979e25a').
        bothE('is').
        otherV().
        hasLabel('face').
        bothE('is similar').
        not(inV().bothE('is')).
        otherV().dedup().
        count()
==>3

gremlin> g.V().
    hasLabel('person').
        has('person','personId', 'd6688539-7773-4126-93bf-bb8ef979e25a').
        as('person').
        project('personId','name','count').
        by('personId').
        by('name').
        by(
            bothE('is').
            otherV().
            hasLabel('face').
            bothE('is similar').
            not(inV().bothE('is')).
            otherV().dedup().
            count()
        )
==>{personId=d6688539-7773-4126-93bf-bb8ef979e25a, name=Shawn, count=1}

Why do they return different results? And what do I need to do to the bottom query to get it to correctly return 3?

slooker
  • 1,060
  • 2
  • 9
  • 16
  • 1
    what is returned if you remove the `count()` from the first traversal? – stephen mallette Jun 09 '20 at 13:57
  • I get 3 results: ==>v[fab94a4e-aa4a-e87a-33c8-de3c4ee1ed89] ==>v[58b94a52-8d56-7142-53eb-de9ed81c7e2f] ==>v[b2b94a50-9804-4e1d-6b1e-dd2fb8d7bf91] – slooker Jun 09 '20 at 15:00
  • 1
    i keep coming back to this but don't have a good answer. could you help provide some data that reproduces this issue? a sample data script like this one that demonstrates this issue would help tremendously: https://stackoverflow.com/questions/51388315/gremlin-choose-one-item-at-random – stephen mallette Jun 11 '20 at 17:24
  • 1
    Yup. Let me try and put together a test graph. – slooker Jun 11 '20 at 20:27

0 Answers0