创建顶点后添加边失败(Neptune InternalFailureException)
Add an edge failing after creating a vertex (Neptune InternalFailureException)
我正在尝试创建一个用户顶点和一个城市顶点(如果它们不存在于图中),然后在它们两者之间添加一条边。当我在同一个遍历中执行命令时,我运行变成了这个InternalFailureException
from Neptune.
g.V("user12345").
fold().
coalesce(unfold(),addV("user").property(id, "user-12345")).as('user').
V("city-ATL").
fold().
coalesce(unfold(), addV("city").property(id, "city-ATL")).as("city").
addE("lives_in").
from("user").
to("city")
{"code":"InternalFailureException","detailedMessage":"An unexpected error has occurred in Neptune.","requestId":"xxx"}
(请注意,在上述情况下,图中 user-12345
和 city-ATL
都不存在)。
但是,当我在执行命令之前创建城市时,它工作得很好:
gremlin> g.V("city-ATL").
fold().
coalesce(unfold(),
addV("city").property(id, "city-ATL"))
==>v[city-ATL]
gremlin> g.V("user-12345").
fold().
coalesce(unfold(),addV("user").property(id, "user-12345")).as('user').
V("city-ATL").
fold().
coalesce(unfold(), addV("city").property(id, "city-ATL")).as("city").
addE("lives_in").from("user").to("city")
==>e[1abd87d6-6f54-9e42-ae0a-47401c9dcfe6][user-12345-lives_in-city-ATL]
我正在尝试构建一个可以同时执行这两个操作的遍历。有谁知道为什么当城市不存在时海王星可能会抛出这个 InternalFailureException
?
我将进一步调查为什么您没有收到更有用的错误消息,但我可以看到 Gremlin 查询需要更改。在 fold
步骤之后,任何先前的 as
标签都将丢失,因为 fold
将遍历器减少到一个。 fold
既是屏障又是地图。在这种情况下,您应该能够使用 store
或 aggregate(local)
而不是 as
,因为您必须为每个 coalesce
.
使用 fold
gremlin> g.V('user-1234').
......1> fold().
......2> coalesce(unfold(),addV('person').property(id,'user-1234')).store('a').
......3> V('city-ATL').
......4> fold().
......5> coalesce(unfold(),addV('city').property(id,'city-ATL')).store('b').
......6> addE('lives_in').
......7> from(select('a').unfold()).
......8> to(select('b').unfold())
==>e[0][user-1234-lives_in->city-ATL]
我正在尝试创建一个用户顶点和一个城市顶点(如果它们不存在于图中),然后在它们两者之间添加一条边。当我在同一个遍历中执行命令时,我运行变成了这个InternalFailureException
from Neptune.
g.V("user12345").
fold().
coalesce(unfold(),addV("user").property(id, "user-12345")).as('user').
V("city-ATL").
fold().
coalesce(unfold(), addV("city").property(id, "city-ATL")).as("city").
addE("lives_in").
from("user").
to("city")
{"code":"InternalFailureException","detailedMessage":"An unexpected error has occurred in Neptune.","requestId":"xxx"}
(请注意,在上述情况下,图中 user-12345
和 city-ATL
都不存在)。
但是,当我在执行命令之前创建城市时,它工作得很好:
gremlin> g.V("city-ATL").
fold().
coalesce(unfold(),
addV("city").property(id, "city-ATL"))
==>v[city-ATL]
gremlin> g.V("user-12345").
fold().
coalesce(unfold(),addV("user").property(id, "user-12345")).as('user').
V("city-ATL").
fold().
coalesce(unfold(), addV("city").property(id, "city-ATL")).as("city").
addE("lives_in").from("user").to("city")
==>e[1abd87d6-6f54-9e42-ae0a-47401c9dcfe6][user-12345-lives_in-city-ATL]
我正在尝试构建一个可以同时执行这两个操作的遍历。有谁知道为什么当城市不存在时海王星可能会抛出这个 InternalFailureException
?
我将进一步调查为什么您没有收到更有用的错误消息,但我可以看到 Gremlin 查询需要更改。在 fold
步骤之后,任何先前的 as
标签都将丢失,因为 fold
将遍历器减少到一个。 fold
既是屏障又是地图。在这种情况下,您应该能够使用 store
或 aggregate(local)
而不是 as
,因为您必须为每个 coalesce
.
fold
gremlin> g.V('user-1234').
......1> fold().
......2> coalesce(unfold(),addV('person').property(id,'user-1234')).store('a').
......3> V('city-ATL').
......4> fold().
......5> coalesce(unfold(),addV('city').property(id,'city-ATL')).store('b').
......6> addE('lives_in').
......7> from(select('a').unfold()).
......8> to(select('b').unfold())
==>e[0][user-1234-lives_in->city-ATL]