gremlinpython - How do you select(keys) in a graph_traversal?

痴心易碎 提交于 2019-12-13 03:34:30

问题


In this stackoverflow question a suggestion was made to use the query supplied in the first answer to do a particular gremlin_python traversal. Namely

g.V().has('name', 'USA').limit(1000).hasLabel('Country').
  map(union(project('id','label').
              by(id).
              by(label),
            valueMap()).unfold().
      group().
        by(keys).
        by(select(values)))

I am able to import all but "keys" from the gremlin_python graph traversal library like the following

from gremlin_python.process.graph_traversal import union, project, valueMap, select, key, values, id, label, map

Looking at the gremlin_python repo, I don't see a way to define the portion that is "by(keys)"

Does anyone know how this can be accomplished?


回答1:


keys and values in that context should import from the Column enum - in the source code here. Note the full list of recommended imports in the Reference Documentation.



来源:https://stackoverflow.com/questions/56398259/gremlinpython-how-do-you-selectkeys-in-a-graph-traversal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!