2

I would like to store data that is not directly related into seperate named graphs in ArangoDB. However, there might be cases where I would want to query data from more than one of these graphs at a time.

I know that you can perform a graph traversal as below, particularly using the 'GRAPH' keyword, but is it possible to do something like 'GRAPH graphName1, graphName2' to query both at the same time?

FOR vertex[, edge[, path]]
  IN [min[..max]]
  OUTBOUND|INBOUND|ANY startVertex
  GRAPH graphName
  [OPTIONS options]

I know I could "union" the results of multiple of the above graph traversals, but given that only the graphName would be different, it would be great if I could make it concise instead of repeating redundant code.

1 Answer 1

2

You cannot traverse multiple named graphs in a traversal. Instead you can either:

Create anew named graph with all the necessary vertex and edges

Or (better)

Traverse the collections directly without using named graphs. The performance is the same. Here is the syntax:

FOR vertex[, edge[, path]]
  IN [min[..max]]
  OUTBOUND|INBOUND|ANY startVertex
  edgeCollection1, ..., edgeCollectionN
  [PRUNE pruneCondition]
  [OPTIONS options]
Sign up to request clarification or add additional context in comments.

1 Comment

Relevant documentation regarding anonymous graphs / working with collection sets: docs.arangodb.com/3.4/Manual/Graphs/#anonymous-graphs and docs.arangodb.com/3.4/AQL/Graphs/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.