Skip to content

Latest commit

 

History

History

README.md

janusgraph-schema

Prerequisites

  • Docker 20 or newer

Installation

  1. Run a Docker container with JanusGraph:
docker run \
  --name janusgraph \
  -v ~/Development/thesis:/opt/janusgraph/thesis \
  -v ~/janusgraph/data:/opt/janusgraph/mydata \
  -m 6g \
  -it \
  janusgraph/janusgraph:0.6.2 \
  bash
  1. Copy the server configuration to the right location:
cp conf/janusgraph-berkeleyje-server.properties /etc/opt/janusgraph/janusgraph.properties

Re-using the container

If you want to use the container you created with docker run after ending the session, you can start it again using:

docker start -i janusgraph

Data loading

Recommendations

  1. Download the recommendations data and place all CSV files in a directory ~/janusgraph/data/recomendations.

  2. Package the app (locally):

mvn package
  1. Run the app (in the container) with the load command and passnig the path to the directory containing the CSV files. Note that the --drop flag drops all existing data!
java -jar thesis/janusgraph/target/janusgraph-schema-0.1.jar load recommendations mydata/directory --drop

SNB

  1. Download the Social Network Benchmark dataset file social_network-csv_basic-sf$SCALE_FACTOR.tar.zst (where $SCALE_FACTOR is 0.1, 0.3, 1 etc.) from this repository and extract the CSV files using the instructions.

  2. Package the app (locally):

mvn package
  1. Run the app (in the container) with the load command and passnig the path to the directory containing the CSV files. Note that the --drop flag drops all existing data!
java -jar thesis/janusgraph/target/janusgraph-schema-0.1.jar load snb mydata/directory --drop

Schema validation

  1. Package the app (locally):
mvn package
  1. Run the app (in the container) with the validate command:
java -jar thesis/janusgraph/target/janusgraph-schema-0.1.jar validate

Running queries yourself

  1. Run JanusGraph server (in the container):
bin/janusgraph-server.sh conf/janusgraph-server.yaml
  1. Open the Gremlin console, either by installing locally, or using a separate Docker container:
docker run \
    --name janusgraph-client \
    --link janusgraph \
    -e GREMLIN_REMOTE_HOSTS=janusgraph \
    -it \
    janusgraph/janusgraph:0.6.2 \
    bin/gremlin.sh
  1. Connect to the server and start a session:
// Use default configuration to connect to a Gremlin server on localhost
// and start a session (to persist variables)
:remote connect tinkerpop.server conf/remote.yaml session
// Open the remote console so all following commands are sent to the remote
:remote console
  1. Open the graph
graph = JanusGraphFactory.open("conf/janusgraph-berkeleyje-server.properties")
  1. Run queries like g = graph.traversal(), g.V().hasLabel("Movie").count() or do whatever you want.