我想从'INS“表中选择名称和代码,从” MC“表中选择Phone_Number,当我执行该gremlin查询时,这只是返回最后一个选择项,是Phone_Number。没有从INS表中获得名称和代码。
如何在单个gremlin查询中使用两个选择,将不胜感激。
:> 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')
预期输出是:
==>{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]}}
感谢
您可以使用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'))