【发布时间】:2017-10-05 01:10:18
【问题描述】:
我使用 cassandra 2.1.7 支持的 Titan 1.0.0 作为后端存储。在尝试在 gremlin 控制台和 java 程序上执行相同的查询时,我得到 2 两种不同格式的输出。我正在使用由 titan-1.0.0-hadoop1 提供的 gremlin 控制台,对于 java,我正在使用 TinkerPop Gremlin 3.0.1-incubating。
Gremlin 控制台:
gremlin> g.V().has('msid',within(-2128958273, 2147477890)).as('in').local(outE('hie_child').has('hostid_e',within(153,83)).order().by('hrank',incr).limit(5)).group().by(outV().id()).by(inV().id().fold())
==>[77467688:[1531850904, 4742561976, 1009049792, 1010020408, 1053356264], 73363640:[2060075072, 3698942184, 67767295608, 7038 35401920]]
我得到了预期的输出类型,即Map<VertexId, List<VertexId>>
但是在 java 程序中执行相同的查询时,我得到了Map<VertexId, BulkSet>。 BulkSet 包括一个计数器,指示特定条目在结果集中添加的次数。有人可以告诉我是否有办法在 java 中获得与 gremlin 控制台类似的结果。
Java:
List<Map<Object, Object>> list = g.V().has("msid", P.within(-2128958273,2147477890)).as("in").local(__.outE("hie_child").has("hostid_e", P.within(153,83)).order().by("hrank", Order.incr).limit(5)).group().by(__.outV().id()).by(__.inV().id().fold()).fold().next();
System.out.println(list);
[{77467688={1531850904=1, 4742561976=1, 1009049792=1, 1010020408=1, 1053356264=1}, 73363640={2060075072=1, 3698942184=1, 6776295608=1, 7030726848=1, 35401920=1}}]
【问题讨论】:
标签: java titan gremlin tinkerpop3