Specific Graph Configurations

stephen mallette edited this page May 6, 2015 · 17 revisions

This page outlines the graph configurations for specific Blueprints implementations. There are both TinkerPop Configurations and External Configurations maintained by third-parties.

TinkerPop Configurations

The following sections define the common settings for each available graph type supported by TinkerPop.

DEX

A DEX graph would be configured as follows:

<graph>
  <graph-name>dexsample</graph-name>
  <graph-type>dexgraph</graph-type>
  <graph-location>/tmp/graph.dex</graph-location>
  <properties>
    <config-file>dex-config/dex.properties</config-file>
  </properties>
  <extensions>...</extensions>
</graph>

The <graph-type> could also be explicitly specified as:

<graph-type>com.tinkerpop.rexster.config.DexGraphConfiguration</graph-type>

The <graph-location> element contains the path to the DEX file name. The <properties> section is optional and allows for the <config-file> element which should contain a pointer to a separate properties file for Dex.

Neo4j 1.x

Rexster comes packaged with Neo4j 1.x and would be configured as follows:

<graph>
  <graph-name>neo4jsample</graph-name>
  <graph-type>neo4jgraph</graph-type>
  <graph-location>/tmp/rexster-graph</graph-location>
  <extensions>...</extensions>
  <properties>
    <!-- Memory mapped I/O settings -->
    <!-- For high traversal speed it is important to have the nodestore.db and relationshipstore.db files. -->
    <neostore.nodestore.db.mapped_memory>285M</neostore.nodestore.db.mapped_memory>
    <neostore.relationshipstore.db.mapped_memory>285M</neostore.relationshipstore.db.mapped_memory>
    <neostore.propertystore.db.mapped_memory>100M</neostore.propertystore.db.mapped_memory>
    <neostore.propertystore.db.strings.mapped_memory>100M</neostore.propertystore.db.strings.mapped_memory>
    <neostore.propertystore.db.arrays.mapped_memory>10M</neostore.propertystore.db.arrays.mapped_memory>
    <neostore.propertystore.db.index.mapped_memory>10M</neostore.propertystore.db.index.mapped_memory>
    <neostore.propertystore.db.index.keys.mapped_memory>10M</neostore.propertystore.db.index.keys.mapped_memory>
    ...
    </properties>
</graph>

The <graph-type> could also be explicitly specified as:

<graph-type>com.tinkerpop.rexster.config.Neo4jGraphConfiguration</graph-type>

The <properties> element contains neo4j specific configuration values. Any entries placed here will be converted to name/value pairs to be passed into Neo4j for its configuration. Set properties here as would be done in a neo4j.properties file.

Neo4j High Availability Cluster

The configuration for Neo4j HA 1.x is quite similar to setting up a standard Neo4j configuration within Rexster. Once a cluster is established, there are just two exceptions to consider when doing the Rexster-side configuration.

First, in the <graph> element include the <graph-high-availability> element to tell Rexster to use HA connectivity:

<graph>
  <graph-name>neo4jsample</graph-name>
  <graph-type>neo4jgraph</graph-type>
  <graph-location>/tmp/rexster-graph</graph-location>
  <graph-high-availability>true</graph-high-availability>
  ...
</graph>

If this element is not present, Rexster assumes this value to be false.

Second, include the Neo4j HA settings in the <properties> section:

<graph>
  ...
  <properties>
    <neostore.nodestore.db.mapped_memory>285M</neostore.nodestore.db.mapped_memory>
    <neostore.relationshipstore.db.mapped_memory>285M</neostore.relationshipstore.db.mapped_memory>
    <neostore.propertystore.db.mapped_memory>100M</neostore.propertystore.db.mapped_memory>
    ...
    <ha.machine_id>1</ha.machine_id>
    <ha.server>localhost:6001</ha.server>
    <ha.initial_hosts>localhost:2181,localhost:2182,localhost:2183</ha.initial_hosts>
  </properties>
</graph>

You may need to provide the following dependencies to Rexster in the classpath:

<dependency>
  <groupId>org.neo4j</groupId>
  <artifactId>neo4j-ha</artifactId>
  <version>1.3</version>
</dependency>
<dependency>
  <groupId>org.neo4j</groupId>
  <artifactId>neo4j-management</artifactId>
  <version>1.3</version>
</dependency>

Neo4j2

Blueprints 2.5.0 introduces support for Neo4j 2.×. Rexster does not package that implementation (due to conflicts with naming given continued support for Neo4j 1.x) and therefore it must be installed “manually”. At this time, Neo4j2Graph and its related dependencies are most easily compiled by building Blueprints with Maven.

$ git clone https://github.com/tinkerpop/blueprints.git
$ cd blueprints
$ git checkout tags/2.5.0
$ mvn clean install -DskipTests

Once the build is successful then issue the following commands where $BLUEPRINTS_HOME is the root of the directory that was cloned for Blueprints and $REXSTER_HOME is the Rexster install directory.

$ rm $REXSTER_HOME/lib/neo4j*.jar
$ cp -r $BLUEPRINTS_HOME/blueprints-neo4j2-graph/target/lib $REXSTER_HOME/ext
$ cp $BLUEPRINTS_HOME/blueprints-neo4j2-graph/target/blueprints-neo4j2-graph-2.5.0.jar $REXSTER_HOME/ext

Note that the above steps will remove Neo4j 1.x files preventing the ability to host that version of Neo4j in Rexster.

The rexster.xml settings for both Neo4j2Graph and Neo4jHA2Graph are identical to the previous version with the exception of the <graph-type> which must be set as follows:

<graph-type>com.tinkerpop.blueprints.impls.neo4j2.rexster.Neo4j2GraphConfiguration</graph-type>

OrientDB

As of Rexster 2.5.0, OrientDB is no longer packaged with Rexster and must be installed manually by copying OrientDB jars to Rexster prior to Rexster start-up. An OrientDB graph would be configured as follows:

<graph>
  <graph-name>orientdbsample</graph-name>
  <graph-type>com.tinkerpop.rexster.OrientGraphConfiguration</graph-type>
  <graph-location>plocal:C:/data/graph/graph</graph-location>
  <extensions>...</extensions>
  <properties>
    <username>admin</username>
    <password>admin</password>
  </properties>
</graph>

The <graph-location> element is the URI to the OrientDB database Rexster is expected to connect to. The <properties> element requires two elements <username> and <password> to access the OrientDB graph instance.

RexsterGraph

A RexsterGraph graph would be configured as follows:

<graph>
  <graph-name>remotetinkergraph</graph-name>
  <graph-type>rexstergraph</graph-type>
  <graph-buffer-size>100</graph-buffer-size>
  <graph-location>http://remoterexsterserver:8182/tinkergraph</graph-location>
  <extensions>...</extensions>
</graph>

The <graph-type> could also be explicitly specified as:

<graph-type>com.tinkerpop.rexster.config.RexsterGraphGraphConfiguration</graph-type>

The <graph-location> element contains the URI to the specific graph hosted within the remote Rexster instance.

The <graph-buffer-size> element defines the buffer size property for the RexsterGraph.

Sail

There are several Sail configurations available: Memory Store, Native Store and SPARQL Repository.

Memory Store

<graph>
  <graph-name>sailsample</graph-name>
  <graph-type>memorystoresailgraph</graph-type>
  <extensions>...</extensions>
</graph>

The <graph-type> could also be explicitly specified as:

<graph-type>com.tinkerpop.rexster.config.MemoryStoreSailGraphConfiguration</graph-type>

Native Store Sail Graph

<graph>
  <graph-name>sailsample</graph-name>
  <graph-type>nativestoresailgraph</graph-type>
  <graph-location>tmp/data/sail</graph-location>
  <extensions>...</extensions>
</graph>

The <graph-type> could also be explicitly specified as:

<graph-type>com.tinkerpop.rexster.config.NativeStoreSailGraphConfiguration</graph-type>

The <graph-location> element is location of the directory containing the Sail data which will be loaded to Rexster . This value is a required element of configuration.

LinkedDataSail Graph

<graph>
  <graph-name>basesail</graph-name>
  <graph-type>[any other type of sail graph]</graph-type>
</graph>

<graph>
  <graph-name>linkeddata</graph-name>
  <graph-type>linkeddatasailgraph</graph-type>
  <graph-location>basesail</graph-location>
</graph>

LinkedDataSail provides a dynamic view of the web of Linked Data by fetching RDF documents from the Web and storing them in another, base Sail. In Rexster, the base SailGraph must be configured before the LinkedDataSailGraph. The wrapper graph convention in Rexster is that the base graph’s name is passed in as <graph-location>.

SPARQL Repository Sail Graph

<graph>
  <graph-name>sailsample</graph-name>
  <graph-type>sparqlrepositorysailgraph</graph-type>
  <graph-location>http://dbpedia.org/sparql</graph-location>
  <extensions>...</extensions>
</graph>

The <graph-type> could also be explicitly specified as:

<graph-type>com.tinkerpop.rexster.config.SparqlRepositorySailGraphConfiguration</graph-type>

The <graph-location> element is URI to the SPARQL repository which will be loaded to Rexster . This value is a required element of configuration.

TinkerGraph

A TinkerGraph would be configured as follows:

<graph>
  <graph-name>gratefulgraph</graph-name>
  <graph-type>tinkergraph</graph-type>
  <graph-location>data/graph-example-2</graph-location>
  <graph-mock-tx>true</graph-mock-tx>
  <graph-storage>graphson</graph-storage>
  <extensions>...</extensions>
</graph>

The <graph-type> could also be explicitly specified as:

<graph-type>com.tinkerpop.rexster.config.TinkerGraphGraphConfiguration</graph-type>

The <graph-location> element contains the location of the TinkerGraph. If this value is not specified, then the TinkerGraph will behave as an in-memory graph only. The </graph-mock-tx> element allows the TinkerGraph to behave as a mock TransactionalGraph. This implementation is NOT actually transactional. It is for testing purposes only.

The <graph-storage> element maybe one of the following:

  • gml
  • graphml
  • graphson
  • java

and corresponds to the different graph serialization types that TinkerGraph has. If the value is not present or otherwise not recognized, the graph will be configured for Java serialization.

IdGraph

<graph>
  <graph-name>basegraph</graph-name>
  <graph-type>[any KeyIndexableGraph]</graph-type>
</graph>

<graph>
  <graph-name>basegraph-idgraph</graph-name>
  <graph-type>idgraph</graph-type>
  <graph-location>basegraph</graph-location>
  <properties>
      <supportVertexIds>true</supportVertexIds>
      <supportEdgeIds>true</supportEdgeIds>
  </properties>
</graph>

IdGraph wraps any KeyIndexableGraph implementation, adding the ability to use custom ids for vertices, edges, or both. As with the LinkedDataSailGraph configuration, the name of the base graph is passed in with <graph-location>. The two arguments of IdGraph’s overloaded constructor are provided as properties; if not specified, they will default to true (i.e. IdGraph will support index-based ids for both vertices and edges).

External Configurations

In addition to graph configurations managed by TinkerPop, Rexster can also be configured for other Blueprints graph configurations.