【发布时间】:2020-12-25 11:35:49
【问题描述】:
我将参数化脚本发送到远程 gremlin-server,但有些脚本成功,有些脚本错误。
比如下面的testcase是成功的,gremlin服务器返回期望的结果
List<Long> ids = Lists.newArrayList(19496288L, 40076200L, 8717992L, 36070256L, 39303024L, 53232552L);
Map<String, Object> parameters = new HashMap<>();
parameters.put("ids1", ids);
parameters.put("ret", new String[]{"linkid", "locnwid", "remnwid"});
String strIds = "19496288,40076200,8717992,36070256,39303024,53232552";
String script = String.format("g.V(ids1).outE('L2_LINK').where(otherV().hasId(%s)).valueMap(ret).by(unfold())", strIds)
// this query script is also ok
// String.format("g.V().hasId(ids1).outE('L2_LINK').where(otherV().hasId(%s)).valueMap(ret).by(unfold())", strIds)
client.submit(script, parameters).all().get()
但是下面的测试用例是错误的,gremlin 服务器什么也没返回
List<Long> ids = Lists.newArrayList(19496288L, 40076200L, 8717992L, 36070256L, 39303024L, 53232552L);
Map<String, Object> parameters = new HashMap<>();
parameters.put("ids1", ids);
parameters.put("ret", new String[]{"linkid", "locnwid", "remnwid"});
String strIds = "19496288,40076200,8717992,36070256,39303024,53232552";
String script = String.format("g.V(%s).outE('L2_LINK').where(otherV().hasId(ids1)).valueMap(ret).by(unfold())", strIds)
client.submit(script, parameters).all().get()
我的第二个查询脚本有什么问题吗?如何解决?
另一个问题:
我想查询连接组中节点的边,节点数超过255,如何构造查询脚本一次搜索得到边?
【问题讨论】:
标签: gremlin janusgraph gremlin-server