Arangodb 使用路径过滤的AQL遍历
我正在AQL(arangodb 3.1.22)中编写一个图遍历查询,其中对于返回的一些路径,我在路径对象中得到一个顶点,该顶点未连接到路径对象中返回的任何边(即边的_from/_to属性与顶点_id不匹配)Arangodb 使用路径过滤的AQL遍历,arangodb,aql,Arangodb,Aql,我正在AQL(arangodb 3.1.22)中编写一个图遍历查询,其中对于返回的一些路径,我在路径对象中得到一个顶点,该顶点未连接到路径对象中返回的任何边(即边的_from/_to属性与顶点_id不匹配) 我的工作假设路径对象只返回该路径上的顶点和边。这是一个错误的假设吗 如果以字符串形式传递起点,则遍历时不必存在任何顶点: FOR v, e IN 1..10 OUTBOUND "nodes/non-existing-start" edges RETURN { vertex: v, _
我的工作假设路径对象只返回该路径上的顶点和边。这是一个错误的假设吗 如果以字符串形式传递起点,则遍历时不必存在任何顶点:
FOR v, e IN 1..10 OUTBOUND "nodes/non-existing-start" edges
RETURN { vertex: v, _from: e._from, _to: e._to }
数据(集合节点中的顶点
和边中的边
):
它所做的是使用边索引沿着确实存在的边(\u from
和\u to
属性)进行遍历。集合节点必须存在,但不测试\u from
和\u to
中引用的顶点是否实际存在于该集合中。查询结果为:
[
{
"vertex": null,
"_from": "nodes/non-existing-start",
"_to": "nodes/non-existing-1"
},
{
"vertex": null,
"_from": "nodes/non-existing-1",
"_to": "nodes/non-existing-2"
},
{
"vertex": null,
"_from": "nodes/non-existing-2",
"_to": "nodes/non-existing-3"
}
]
如您所见,顶点是null
,因此它们不存在
您可以在删除顶点时使用托管图和模块来确保一致性。如果以字符串形式传递起点,则遍历时不必存在任何顶点:
FOR v, e IN 1..10 OUTBOUND "nodes/non-existing-start" edges
RETURN { vertex: v, _from: e._from, _to: e._to }
数据(集合节点中的顶点
和边中的边
):
它所做的是使用边索引沿着确实存在的边(\u from
和\u to
属性)进行遍历。集合节点必须存在,但不测试\u from
和\u to
中引用的顶点是否实际存在于该集合中。查询结果为:
[
{
"vertex": null,
"_from": "nodes/non-existing-start",
"_to": "nodes/non-existing-1"
},
{
"vertex": null,
"_from": "nodes/non-existing-1",
"_to": "nodes/non-existing-2"
},
{
"vertex": null,
"_from": "nodes/non-existing-2",
"_to": "nodes/non-existing-3"
}
]
如您所见,顶点是null
,因此它们不存在
您可以在删除顶点时使用托管图和模块来确保一致性。您的假设是正确的,路径上应该只包含顶点和边。你能发布你的查询吗?你的假设是正确的,路径应该只包含路径上的顶点和边。你能提出你的问题吗?