Hey, We are trying to execute the following gremlin query:
g.V().hasLabel('Person').has('names',regex('.*')).as('Person___1') .select('Person___1').outE('EmployeeOf').as('Person__out_employeeOf___1').otherV().as('Person__out_employeeOf__department___1').range(0, 2) .select('Person___1').outE('LivesAt').as('Person__out_livesAt___1').otherV().as('Person__out_livesAt__address___1').range(0, 2) .union(select('Person__out_livesAt__address___1'),select('Person__out_employeeOf__department___1'))
Please consider the range() steps, after each traversal step.
Data Setup:
Person: 1
Departments: 3
Addresses: 3
all addresses and departments are connected with the Person
Current Result:
2 different addresses
2 departments, but the same instance (same id)
Expected Result:
2 different addresses
2 different departments
Questions:
- Is it the right way to do more traversals on one vertex? Is this approach we are doing allowed/ok?
- Why do we get two different addresses but only one unique department, but this is added twice to the result? How to solve this?
Thanks in advance.