Skip to content

Tutorial for integrating Janusgraph with AWS graph jupyter notebook. Uses ES + Cassandra backend, over docker

License

Notifications You must be signed in to change notification settings

Anant/example-janusgraph-notebook

Repository files navigation

JanusGraph Notebook

A tutorial for running JanusGraph on Cassandra and Elasticsearch, and then integrating within AWS Graph Notebook.

For more information, see the blog post.

Setup

Start everything using docker-compose

docker-compose up -d

You can now find it open in http://localhost:8888

Login using password: tensorflow

Setup a connection in a notebook

Out of the box, the Graph Notebook lib provides dozens of notebooks to try out. Unfortunately those with seed data for loading into your graph mostly don't work since they use custom string ids, and JanusGraph doesn't support that.

However, you can load in the air routes data manually using the commands below, which will allow you to use the Air-Routes-Gremlin notebook

Load seed data

./scripts/load-in-airroutes.sh
docker cp ./tmp jg-notebook-janusgraph:/opt/tmp/

docker exec -it jg-notebook-janusgraph ./bin/gremlin.sh
:remote connect tinkerpop.server conf/remote.yaml
g = traversal().withRemote('conf/remote-graph.properties')
path = "/opt/tmp/air-routes.xml";
g.io(path).read().iterate();

Run this at the top of any notebook that you try. Do it here as well.

%%graph_notebook_config
{
  "host": "janusgraph",
  "port": 8182,
  "ssl": false,
  "gremlin": {
    "traversal_source": "g"
  }
}

Example of how this works is given here: http://localhost:8888/notebooks/notebooks/sample-config.ipynb

Run the notebook!

You can find it here: http://localhost:8888/notebooks/notebooks/sample-config.ipynb

Start a console

Want to just use your standard Gremlin console for whatever reason?

docker exec -it jg-notebook-janusgraph ./bin/gremlin.sh
:remote connect tinkerpop.server conf/remote.yaml
g = traversal().withRemote('conf/remote-graph.properties')

# g.V() or whatever you want to run

TODOs

  • Add script or docs to index into Elasticsearch (we have ES setup - but out of the box it isn't being used!)

Credits:

Based heavily on: