简体   繁体   English

ArangoDB:AQL查询,用于获取两个特定节点之间的所有边缘

[英]ArangoDB: AQL query to get all edges between two specific nodes

I have a document collection 'node' and an edge collection 'attribute'. 我有一个文档集'node'和一个edge collection'属性'。 I am trying to get all edges in 'attribute' collection from: 'node/582148' to: 'node/582016'. 我试图将'attribute'集合中的所有边缘从'node / 582148'变为:'node / 582016'。

The simplest AQL query I've been able to devise is the following: 我能够设计的最简单的AQL查询如下:

FOR v, e, p IN OUTBOUND 'node/582148' `attribute`
    FILTER e._to == 'node/582016'
    RETURN p

Is there really no way to do this in one, like: 真的没有办法在一个方面做到这一点,例如:

FOR v, e, p IN OUTBOUND 'node/582148' TO 'node/582016' `attribute` RETURN p

It's only possible to use the 'TO' keyword with SHORTEST_PATH. 只能在SHORTEST_PATH中使用'TO'关键字。 To clarify: I am only interested in direct paths (1 edge) between the nodes 澄清一下我只对节点之间的直接路径(1个边缘)感兴趣

thanks 谢谢

Using graph traversal i would recommend to use the following AQL query to get all outgoing edges, which is filtering by the target vertex key: 使用图遍历我建议使用以下AQL查询来获取所有传出边,这是由目标顶点键过滤:

FOR v, e IN OUTBOUND 'node/582148' `attribute`
FILTER v._key == '582016'
RETURN e

Another approach is to address the edge as a document with attributes _from and _to without graph traversal: 另一种方法是将边缘作为具有_from和_to属性的文档来处理,而不进行图遍历:

FOR e IN `attribute`
FILTER e._from == 'node/582148' && e._to == 'node/582016'
RETURN e

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM