简体   繁体   中英

ArangoDB: Traversals where edges are connected to other edges

I recently read that ArangoDB is capable of connecting edges to other edges in a graph. In this situation, how would querying the path work? For example:

car <-------- part
        ^
        |
        |
installationEvidence

In this case, installationEvidence is a node connecting to the edge between the part to the car. Starting from the car node, what is the AQL to return installationEvidence but not part ? Are both installationEvidence and part considered at the p.vertices[1] layer?

In ArangoDB edges are a special type of Documents. That is why you can store edges pointing to other edges. From a query point of view there are two directions for this edges: A) The traversal leads to the target edge . In this case it is assumed to be the general type of document and the traversal will not follow any direction of the target edge . Which means you would have to write 2 traversals steps in the statement. The first ending in the edge. The second starting at _from or _to of the edge. In your case the query could look like this:

FOR edge IN 1 OUTBOUND @installationEvidece @@edges1
  LET car = DOCUMENT(edge._to)
  RETURN car

B) A traversal walks through an edge which has other edges pointing to it. This case is more complicated. In ArangoDB's architecture the "vertex" does not know anything about it's attached edges, the edges know their vertices. What you could do in this case is to again write two traversal statements where the second starts with the edge encountered, eg:

FOR part,edge IN 1 INBOUND @car @@edges1
  FOR installationEvidence IN 1 INBOUND edge @@edges2
    [...]

For the time being we did not encounter any use-case of customers to make the above traversal more transparent. If this is critical for you please contact us and we can increase the priority to make these kind of queries easier to formulate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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