有没有办法始终 return Gremlin 地图列表与 select 匹配查询?

Is there a way to always return a List of Maps for Gremlin match queries with select?

我有以下代码:

    Vertex v = g.addV().property("valueStr", "3").next();
    Vertex v2 = g.addV().property("valueStr", "4").next();
    Vertex v3 = g.addV().property("valueStr", "5").next();
    Edge e = g.V(v.id()).as("a").V(v2.id()).as("b").addE("anEdge").from("a").to("b").property("value", "4").as("e").next();
    Edge e2 = g.V(v.id()).as("a").V(v3.id()).as("b").addE("anEdge").from("a").to("b").property("value", "5").as("e").next();

    List vertices1 = g.V().match(
            __.as("a").hasId(v.id()).outE("anEdge").inV().hasId(v2.id()).as("b"),
            __.as("a").hasId(v.id()).outE("anEdge").inV().hasId(v3.id()).as("c")).toList();
    System.out.println(vertices1);

    List vertices2 = g.V().match(
            __.as("a").hasId(v.id()).outE("anEdge").inV().hasId(v2.id()).as("b"),
            __.as("a").hasId(v.id()).outE("anEdge").inV().hasId(v3.id()).as("c")).select("a","b").toList();
    System.out.println(vertices2);

    List vertices3 = g.V().match(
            __.as("a").hasId(v.id()).outE("anEdge").inV().hasId(v2.id()).as("b"),
            __.as("a").hasId(v.id()).outE("anEdge").inV().hasId(v3.id()).as("c")).select("a").toList();
    System.out.println(vertices3);

基本上是节点a连接到b,节点a连接到c

我正在对该子图进行匹配查询,每次我 return 匹配元素的一个子集..

输出如下:

[{a=v[20], b=v[22], c=v[24]}]
[{a=v[20], b=v[22]}]
[v[20]]

在前两种情况下,我得到 List of Maps..在最后一种情况下,我得到 List.

最后一个案例怎么可能使它也是Maps[{a=v[20}]List?我知道我可以使用 select("a","a") 进行破解,但似乎应该有更简洁的方法。

文档在哪里解释了在哪些情况下我将获得 Vertices/EdgesMapListList Maps 等?

谢谢!

代替select("a")使用project("a").by(select("a"))