For the migration project, I play with graph databases stuff.

As in most areas, this is rather an ecosystem than a project.

These are the very basics which I have asked during 1st hour.

 

What's the difference between TinkerPop and Titan?

Titan is an implementation of graph database.

TinkerPop is a set of APIs and libraries.

The most important is BluePrints, which is an API to query a database. Something like JDBC for graph dbs.

TitanGraph implements the BluePrints API.

 

Minimal dependencies?

 

<dependency>
    <groupId>com.thinkaurelius.titan</groupId>
    <artifactId>titan-core</artifactId>
    <version>0.4.4</version>
</dependency>
<dependency>
    <groupId>com.thinkaurelius.titan</groupId>
    <artifactId>titan-berkeleyje</artifactId>
    <version>0.4.4</version>
</dependency>

 

Titan has the BluePrints API as dependency, so no need to include extra.

Titan comes with

Berkeley DB is the database used by default. You can change this by some System property (TODO).

So you need to add the titan-berkeleyje, otherwise you'd get:

 

Could not find implementation class: com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager
    at com.thinkaurelius.titan.diskstorage.Backend.instantiate(Backend.java:347)
    at com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:367)
    at com.thinkaurelius.titan.diskstorage.Backend.getStorageManager(Backend.java:311)
    at com.thinkaurelius.titan.diskstorage.Backend.<init>(Backend.java:121)
    at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:1173)
    at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.<init>(StandardTitanGraph.java:75)
    at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:40)
    at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:29)
    at cz.oz.tinkerpoptry.Main.main(Main.java:21)

 

Other option is to use titan-all, but that might make the deps go big.

 

Minimal code example

 

TitanGraph g = TitanFactory.open("/tmp/titan-rodokmen");

// Manipulation through BluePrints API.

Vertex oz = g.addVertex(null);
oz.setProperty("name", "Ondrej Zizka");

Vertex sz = g.addVertex(null);
sz.setProperty("name", "Stanislava Zizkova");

Edge e = g.addEdge( null, sz, oz, "parent");
Edge e = g.addEdge( null, sz, oz, "parent");
jz0.setProperty("name", "Josef Zizka");
jz0.setProperty("man", true);

 

Voila, this should be enough. You'll get:

 


--- exec-maven-plugin:1.2.1:exec (default-cli) @ TinkerpopTry ---
0    [main] INFO  com.thinkaurelius.titan.diskstorage.Backend  - Initiated backend operations thread pool of size 8
83   [main] INFO  com.thinkaurelius.titan.graphdb.database.serialize.kryo.KryoSerializer  - Kryo serializer enabled with utf8: false
------------------------------------------------------------------------
BUILD SUCCESS