[英]A vertex added using addV() to gremlin-server is not visible when executing a subsequent traversal
I run official gremlin-server
image in docker:我在 docker 中运行官方
gremlin-server
映像:
docker run -p 8182:8182 tinkerpop/gremlin-server:3.4.10
It starts on port 8182.它从端口 8182 开始。
Then I execute the following code:然后我执行以下代码:
try (RemoteConnection connection = openConnection();
GraphTraversalSource g = openRemoteTraversalSource(connection)) {
g.V().addV("Test").property("a", "b").iterate();
System.out.println(g.V().toList().size());
}
where在哪里
private DriverRemoteConnection openConnection() {
return DriverRemoteConnection.using("localhost", 8182);
}
private GraphTraversalSource openRemoteTraversalSource(RemoteConnection connection) {
return AnonymousTraversalSource.traversal().withRemote(connection);
}
I have gremlin-driver
on classpath:我在类路径上有
gremlin-driver
:
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-driver</artifactId>
<version>3.4.10</version>
</dependency>
This code outputs 0. But as I added a vertex using addV()
step, I expect to get one result.此代码输出 0。但是当我使用
addV()
步骤添加一个顶点时,我希望得到一个结果。
I also tried to switch to janusgraph/janusgraph:0.5.3
and get the same result, so I suppose the problem is with my code and not gremlin-server
.我还尝试切换到
janusgraph/janusgraph:0.5.3
并获得相同的结果,所以我想问题出在我的代码上,而不是gremlin-server
。
But what is missing?但是缺少什么? Why isn't the added vertex visible?
为什么添加的顶点不可见?
This line这条线
g.V().addV("Test").property("a", "b").iterate();
needs to change to需要更改为
g.addV("Test").property("a", "b").iterate();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.