Blueprints-ArangoDB-Graph

An implementation of the Blueprints API for ArangoDB

License

License

GroupId

GroupId

com.arangodb
ArtifactId

ArtifactId

blueprints-arangodb-graph
Last Version

Last Version

1.0.15
Release Date

Release Date

Type

Type

jar
Description

Description

Blueprints-ArangoDB-Graph
An implementation of the Blueprints API for ArangoDB
Project URL

Project URL

http://maven.apache.org
Project Organization

Project Organization

ArangoDB GmbH
Source Code Management

Source Code Management

https://github.com/arangodb/blueprints-arangodb-graph

Download blueprints-arangodb-graph

How to add to project

<!-- https://jarcasting.com/artifacts/com.arangodb/blueprints-arangodb-graph/ -->
<dependency>
    <groupId>com.arangodb</groupId>
    <artifactId>blueprints-arangodb-graph</artifactId>
    <version>1.0.15</version>
</dependency>
// https://jarcasting.com/artifacts/com.arangodb/blueprints-arangodb-graph/
implementation 'com.arangodb:blueprints-arangodb-graph:1.0.15'
// https://jarcasting.com/artifacts/com.arangodb/blueprints-arangodb-graph/
implementation ("com.arangodb:blueprints-arangodb-graph:1.0.15")
'com.arangodb:blueprints-arangodb-graph:jar:1.0.15'
<dependency org="com.arangodb" name="blueprints-arangodb-graph" rev="1.0.15">
  <artifact name="blueprints-arangodb-graph" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.arangodb', module='blueprints-arangodb-graph', version='1.0.15')
)
libraryDependencies += "com.arangodb" % "blueprints-arangodb-graph" % "1.0.15"
[com.arangodb/blueprints-arangodb-graph "1.0.15"]

Dependencies

compile (4)

Group / Artifact Type Version
com.arangodb : arangodb-java-driver jar 2.6.11
com.tinkerpop.blueprints : blueprints-core jar 2.6.0
com.tinkerpop.rexster : rexster-core jar 2.6.0
org.apache.commons : commons-lang3 jar 3.4

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
com.tinkerpop.blueprints : blueprints-test jar 2.6.0
ch.qos.logback : logback-classic jar 1.1.3

Project Modules

There are no modules declared in this project.

ArangoDB-Logo

arangodb-tinkerpop-provider

An implementation of the Apache TinkerPop OLTP Provider API for ArangoDB

Compatibility

This Provider supports:

  • Apache TinkerPop 3.3
  • ArangoDB 3.3+ (via ArangoDB Java Driver 5.0.0).

ArangoDB

Please check the ArangoDB Installation Manual for guides on how to install ArangoDB.

Maven

To add the provider to your project via maven you need to add the following dependency (shown is the latest version - you can replace the version with the one you need)

<dependencies>
  <dependency>
    <groupId>org.arangodb</groupId>
    <artifactId>arangodb-tinkerpop-provider</artifactId>
    <version>2.0.3</version>
  </dependency>
    ....
</dependencies>

The same coordinates can be used with Gradle and any other build system that uses maven repositories.

Using ArangoDBGraph via the TinkerPop API

This example is based on the TinkerPop documentation (Creating a graph):

ArangoDBConfigurationBuilder builder = new ArangoDBConfigurationBuilder();
builder.graph("modern")
    .withVertexCollection("software")
    .withVertexCollection("person")
    .withEdgeCollection("knows")
    .withEdgeCollection("created")
    .configureEdge("knows", "person", "person")
    .configureEdge("created", "person", "software");

// use the default database (and user:password) or configure a different database
// builder.arangoHosts("172.168.1.10:4456")
//     .arangoUser("stripe")
//     .arangoPassword("gizmo")

// create a ArangoDB graph
BaseConfiguration conf = builder.build();
Graph graph = GraphFactory.open(conf);
GraphTraversalSource gts = new GraphTraversalSource(graph);

// Clone to avoid setup time
GraphTraversalSource g = gts.clone();
// Add vertices
Vertex v1 = g.addV("person").property(T.id, "1").property("name", "marko")
    .property("age", 29).next();
g = gts.clone();
Vertex v2 = g.addV("software").property(T.id, "3").property("name", "lop")
    .property("lang", "java").next();

// Add edges
g = gts.clone();
Edge e1 = g.addE("created").from(v1).to(v2).property(T.id, "9")
    .property("weight", 0.4).next();

// Graph traversal 
// Find "marko" in the graph
g = gts.clone();
Vertex rv = g.V().has("name","marko").next();
assert v1 == rv;

// Walk along the "created" edges to "software" vertices
g = gts.clone();
Edge re = g.V().has("name","marko").outE("created").next();
assert re == e1;

g = gts.clone();
rv = g.V().has("name","marko").outE("created").inV().next();
// If the edge is irrelevant
// rv = g.V().has("name","marko").out("created").next();
assert rv == v2;


// Select the "name" property of the "software" vertices
g = gts.clone();
String name = (String) g.V().has("name","marko").out("created").values("name").next();
assert name.equals("lop");

// close the graph and the traversal source
gts.close();
graph.close();

A note on element IDs

The provider implementation supports user supplied IDs, i.e. provide an id property for graph elements, but currently we only support String ids, that is:

Vertex v1 = g.addV("person").property(T.id, "1");

will create a vertex with id "1". However, implementation wise, in ArangoDB we are only allowed to manipulate the documents name, not its id. For this reason, providing a TinkerPop vertex id (T.id) actually sets the vertex's ArangoDB name. As a result, retrieving the vertex by the given id will fail:

Vertex v2 = g.V("1");
assert v2 == null;

Since we know that documents IDs are created by concatenating (with a slash) the document's collection and its name, then we can find the vertex like so:

Vertex v2 = g.V("person/1");
assert v2 == v1;

Contributing

We welcome bug reports (bugs, feature requests, etc.) as well as patches. When reporting a bug try to include as much information as possible (expected behaviour, seen behaviour, steps to reproduce, etc.).

More

Please visit our Wiki for additional information on how to use the latest version, build locally, run tests, etc.

com.arangodb

ArangoDB

the multi-model NoSQL database

Versions

Version
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10