The JanusGraph examples show the basics of how to configure and construct a graph application. It uses Apache Maven to manage the numerous dependencies required to build the application. The common application will:
- Open and initialize the graph
- Define the schema
- Build the graph
- Run traversal queries to get data from the graph
- Make updates to the graph
- Close the graph
By using different graph configurations, the same example code can run against the various supported storage and indexing backends.
- Java 8 Development Kit, update 40 or higher. Oracle Java and OpenJDK have been tested successfully.
- Apache Maven, version 3.3 or higher
Download the latest JanusGraph release distribution zip file and unzip it.
The examples are packaged with the JanusGraph distribution zip file in the
examples
directory. Run the Maven build command from the examples
directory.
mvn clean install
These commands can be run from the examples
or project's directory.
Please refer to the specific directions for each project as there may be
additional setup and configuration required.
mvn exec:java -pl :example-common
mvn exec:java -pl :example-berkeleyje
mvn exec:java -pl :example-cassandra
mvn exec:java -pl :example-cql
mvn exec:java -pl :example-hbase
mvn exec:java -pl :example-hbase -Dexample.config="\${project.basedir}/conf/jgex-hbase-solr-http.properties"
mvn exec:java -pl :example-remotegraph
mvn exec:java -pl :example-tinkergraph
After running an example, you may want to drop the graph from storage. Make
sure to stop the application before dropping the graph. These commands can
be run from the examples
or the project's directory, but please refer to
the specific directions for each project as there may be additional steps
for clean up.
mvn exec:java -pl :example-berkeleyje -Dcmd=drop
mvn exec:java -pl :example-cassandra -Dcmd=drop
mvn exec:java -pl :example-cql -Dcmd=drop
mvn exec:java -pl :example-hbase -Dcmd=drop
mvn exec:java -pl :example-hbase -Dexample.config="\${project.basedir}/conf/jgex-hbase-solr-http.properties" -Dcmd=drop