In OrientDB, each vertex has connected edges attached. This means that it possible to explicitly walk nodes from a collection by using nested "select" statements.
As an example: Given a path of node attributes, find the matching end node.
The path consists of a list of node attributes (for example, the kind
is unique in the nodes in a path).
Now, suppose I had a tree:
kind=site, name=site1
-- kind=project, name=project1
-- kind=library, name=library1
kind=site, name=site2
-- kind=project, name=project2
-- kind=library, name=library1
A user wants the information from a library called library1 with the path:
[{kind=site},{kind=project,name=project1},{kind=library,name=library1}]
Not having each node fully qualified for traversal is okay as long as the result is a single node.
In OrientDB, the process would be:
- start with all nodes of kind=site
- walk through the "child" edge and collect all objects that are of kind=project and name=project1
- walk through the child edge and collect all objects that are of kind=library and name=library1
This can be done in a nested select statement. The kind field is indexed so the starting nodes are collected quickly from a large number of objects. To further improve performance, I know which kinds are in which tables (collections) so I could scope the number of objects to select from (select from <table> where kind=site).
In ArrangoDB, only the edges have the node binding information so having a node I can't directly walk through a connected edge. In the GRAPH_TRAVERSAL function, I can specify the starting collection by example. So the example would be {kind=site}. Doesn't that mean the starting list of nodes has to be gleaned by scanning all of the graph edges, basically looking at every node connected to the input of each edge in the entire graph?
How would such a query be formulated (in AQL and/or arangojs) so it wouldn't have to start with a full scan of the objects connected to the edges?
I also don't see how to send an example vertex into the arangojs traversal function. It seems to always want an explicit starting vertex.