英文:
Gremlingo: Traverser does not map to value when adding edge between two vertices
问题
我正在使用tinkerpop的gremlin-go库来访问gremlin-server/JanusGraph。在尝试创建两个顶点之间的边时,我遇到了以下错误:
The provided traverser does not map to a value: ...
顶点是通过以下方式添加的:
t.AddV("somenode").Property("some_id", someID).Iterate()
和
t.AddV("someothernode").Property("some_id", someID).Iterate()
其中t
是*gremlingo.GraphTraversal
。顶点成功添加。
边是通过以下方式添加的:
t.AddE("someedge").
From(
__.V().
HasLabel("somenode").
Has("some_id", someID),
).
To(
__.V().
HasLabel("someothernode").
Has("some_id", someID),
).
Iterate()
这里的t
仍然是*gremlingo.GraphTraversal
,__
是gremlingo.T__
的别名。但是边没有创建,并显示上述错误。
在gremlin-console中,通过以下方式添加边g.addE("someedge").from(__.V().hasLabel("somenode").has("some_id","some_id_1")).to(__.V().hasLabel("someothernode").has("some_id","some_id_1"))
,其中g
是遍历器,可以正常工作。
请注意,我省略了go错误处理部分。
英文:
I am using tinkerpop gremling-go to access gremlin-server/JanusGraph. When trying to create an edge between two vertices, I get the following error
The provided traverser does not map to a value: ...
Vertices are added via
t.AddV("somenode").Property("some_id", someID).Iterate()
and
t.AddV("someothernode").Property("some_id", someID).Iterate()
where t
is *gremlingo.GraphTraversal
. Vertices are added successfully.
Edge is added via
t.AddE("someedge").
From(
__.V().
HasLabel("somenode").
Has("some_id", someID),
).
To(
__.V().
HasLabel("someothernode").
Has("some_id", someID),
).
Iterate()
where again t
is *gremlingo.GraphTraversal
and __
is alias for gremlingo.T__
. Edge is not created with error output above.
Using gremlin-console adding edge via g.addE("someedge").from(__.V().hasLabel("somenode").has("some_id","some_id_1")).to(__.V().hasLabel("someothernode").has("some_id","some_id_1"))
where g
is the traversal works just fine.
Note that I left out go error handling.
答案1
得分: 0
你等待异步请求完成了吗?
channel := t.AddV("somenode").Property("some_id", someID).Iterate()
err := <-channel
英文:
Did you wait for async request completion?
channel := t.AddV("somenode").Property("some_id", someID).Iterate()
err := <-channel
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论