1
votes

Using Arangodb 3.2, have a set of collections (arangoimp + CSV):

  • user (documents)
  • profile (documents)
  • user_profile (edges)

I'd like create a graph from listed above. Was unable to find in the documentation about composing graph from already existent collections of vertices and edges, or didn't get how to.

In [1] there is an example how to add relation (e.g. create edges collection, linking vertices), but what if I already have one?

It would be nice to understand how to compose a graph from existent collections via (AND/OR):

  • PHP (triagens/arangodb)
  • HTTP API
  • Bash

Links:

  1. https://docs.arangodb.com/3.2/Manual/Graphs/GeneralGraphs/
2

2 Answers

0
votes

Have you tried to create the graph via the web interface (https://docs.arangodb.com/devel/Manual/Administration/WebInterface/Graphs.html)?

If you want to create the graph just once this is an easy solution.

0
votes

Finally I found a PHP solution myself:

$edgeDefinition = new \triagens\ArangoDb\EdgeDefinition(
   'user_profile',
   'user',
   'profile'
);

$graphName = 'testGraph';
$graph = new \triagens\ArangoDb\Graph($graphName);
$graph->addEdgeDefinition($edgeDefinition);

$graphHandler = new \triagens\ArangoDb\GraphHandler($connection);

if (!$graphHandler->getGraph($graphName)) {
    $graphHandler->createGraph($graph);
}

I'd propose update official docs (see [1]) with more explicit explanation of graph_module._relation parameters.

It's a pity, but there is no ArangoDb HTTP API solution yet.