Clone this wiki locally

Blueprints is the default Java API for OrientDB, so you don’t need to include additional modules. For more information look at OrientDB Blueprints API.

// OPEN THE GRAPH 'tinkerpop' ON LOCAL FILE SYSTEMGraph localGraph =newOrientGraph("local:/tmp/tinkerpop");
// OPEN THE GRAPH 'tinkerpop' ON REMOTE SERVER (localhost). THE SERVER COULD RUN IN DISTRIBUTED MODEGraph remoteGraph =newOrientGraph("remote:localhost/tinkerpop");
// OPEN THE GRAPH 'tinkerpop' CREATING IN MEMORY ONLYGraph memoryGraph =newOrientGraph("memory:tinkerpop");

GraphFactory Settings

If using GraphFactory to instantiate a OrientGraph, the following properties will apply:

key

description

blueprints.graph

com.tinkerpop.blueprints.impls.orient.OrientGraph

blueprints.orientdb.url

The connection URL for the OrientGraph instance.

blueprints.orientdb.username

Username to connect to OrientGraph instance.

blueprints.orientdb.password

Password to connect to OrientGraph instance.

OrientGraph Feature List

OrientGraph is transactional. This means that as soon as the graph is modified (add and remove vertex/edges, set properties) a new transaction is started automatically and it’s committed manually or at the graph shutdown.

Notes on Caching and Concurrency

By default, OrientDB keeps a per-database instance cache of vertices and their properties. This can cause issues with concurrent access to the database where different threads will receive inconsistent results when querying the database after writes.

A way around this is to disable OrientDB’s L1 cache. This option can slow performance when doing certain graph operations. You can do this in code, before you create your graph with:

OGlobalConfiguration.CACHE_LEVEL1_ENABLED.setValue(false);

A more fine grained option is to have Orient force reload vertices when appropriate using ODocument’s reload() command:

((ODocument)((OrientVertex)vertex).getRawElement()).reload();

Custom Types

OrientDB supports custom types for vertices and edges in an Object Oriented manner. Even if this isn’t supported directly by Blueprints there are some tricks to use them. For more information look at Custom types.

Other Graph types

Non Transactional Graph: OrientGraphNoTx

OrientGraphNoTx is non transactional. This means that every non idempotent operations against the graph is atomic. Use this implementation to massive import graphs. Example:

// OPEN THE GRAPH 'tinkerpop' ON LOCAL FILE SYSTEMGraph localGraph =newOrientGraphNoTx("local:/tmp/tinkerpop");

Retro compatibility

Since Blueprints 2.4.x the underlying structure used for graphs is changed to be much more lightweight. To open databases created with Blueprints 2.3.x or minor disable the new optimizations right after opened the graph: