With ArangoDB 2.2 the new graph API was released featuring multi collection graphs (see blog). With the new version (2.2.1) of arangodb-java-driver the new graph API is supported. In the following you can find a small example of creating a graph with Java.

For the import via maven and configuring the driver, please read the Basics and Driver Setup. For the following we assume, that arangodbDriver is a configured instance of the driver.

So let’s start the whole thing…

In the database we need a graph containing collections for the vertices and edges (defined in edge definitions).

Now we have a graph Academical where edges are defined from vertex collection Person to vertex collection Publication and stored in edge collection HasWritten. Collections will be created automatically if they do not already exist. Let’s add another edge definition to the graph:

In this second part only the collection HasCited is created, the collection Publication already exists and was used automatically.

Let us play a little with our graph. A first step would be, to fill it with vertices and edges. Therefore we should define, which information a vertex contains. So let’s define some classes for the different vertices:

Fill the graph with vertices…

… and edges:

Click here for part 2.