我正在尝试简化以下遍历:
operation_dict['output_schema'] = g.V(operation_id).outE('uses').inV()\
.project('id','label','attribute_id', 'attribute_name', 'dataType')\
.by(T.id).by(T.label).by('attribute_id').by('attribute_name').by('dataType').toList()
由于我想重用投影遍历,我想从遍历中提取它,如下面的片段:
def extract_attribute(x):
return g.V(x).project('id','label','attribute_id', 'attribute_name', 'dataType')\
.by(T.id).by(T.label).by('attribute_id').by('attribute_name').by('dataType')
operation_dict['input_schema'] = g.V(operation_id).inE('follows').outV().outE('uses').inV()\
.map(lambda x: extract_attribute(x)).toList()
我怎样才能在 Gremlin for Python 中做到这一点?我尝试了 Lambda 功能,但到目前为止没有成功。