Reputation: 527
I would like to select Name and Code from 'INS" table and Phone_Number from "MC" table, When I execute this gremlin query this is just returning the last select item which is Phone_Number. Not getting Name and Code from INS table.
How to use two select in a single gremlin query, any help would be really appreciated.
:> graph.traversal().V().hasLabel('Product').has('Product_ID','39401').has('Customer_ID','98833838').out('has_Contact').as('MC').out('has_a_insurance').as('INS').select('INS').valueMap('Name','Code').select('MC').valueMap('Phone_Number')
Expected output is:
==>{INS={Name=[383838], Code=[98]}, MC={Phone_Number=[8383838383]}}
==>{INS={Name=[300333], Code=[32]}, MC={Phone_Number=[4830930303]}}
==>{INS={Name=[748332], Code=[32]}, MC={Phone_Number=[4537373728]}}
Thanks
Upvotes: 1
Views: 1350
Reputation: 1419
You can use project
:
g.V().hasLabel('Product').has('Product_ID','39401').has('Customer_ID','98833838')
.out('has_Contact').as('MC').out('has_a_insurance').as('INS')
.project('INS', 'MC')
.by(select('INS').valueMap('Name','Code'))
.by(select('MC').valueMap('Phone_Number'))
Upvotes: 1