{"id":15056577,"url":"https://github.com/ibm/janusgraph-utils","last_synced_at":"2025-10-04T16:30:59.218Z","repository":{"id":50632993,"uuid":"89129284","full_name":"IBM/janusgraph-utils","owner":"IBM","description":"Develop a graph database app using JanusGraph","archived":true,"fork":false,"pushed_at":"2019-05-28T09:09:56.000Z","size":949,"stargazers_count":207,"open_issues_count":9,"forks_count":93,"subscribers_count":35,"default_branch":"master","last_synced_at":"2024-12-20T23:33:59.266Z","etag":null,"topics":["datamodel","graphson","groovy","ibmcode","janusgraph","janusgraph-instance","java","schema"],"latest_commit_sha":null,"homepage":"https://developer.ibm.com/patterns/develop-graph-database-app-using-janusgraph/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IBM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-23T08:56:06.000Z","updated_at":"2024-08-22T06:57:51.000Z","dependencies_parsed_at":"2022-09-17T13:51:14.072Z","dependency_job_id":null,"html_url":"https://github.com/IBM/janusgraph-utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2Fjanusgraph-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2Fjanusgraph-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2Fjanusgraph-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2Fjanusgraph-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IBM","download_url":"https://codeload.github.com/IBM/janusgraph-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235274436,"owners_count":18963920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datamodel","graphson","groovy","ibmcode","janusgraph","janusgraph-instance","java","schema"],"created_at":"2024-09-24T21:53:36.256Z","updated_at":"2025-10-04T16:30:58.807Z","avatar_url":"https://github.com/IBM.png","language":"Java","readme":"[![Build Status](https://api.travis-ci.org/IBM/janusgraph-utils.svg?branch=master)](https://travis-ci.org/IBM/janusgraph-utils)\n\n# Develop a graph database app using JanusGraph\n\nThis Code Pattern contains sample data and code for running a Twitter-like application in JanusGraph. The utility code illustrates how to use OLTP APIs to define schema, ingest data, and query graph. Developers can use or modify the code to build and operate their custom graph applications, or create similar java and groovy files to interact with JanusGraph.\n\nWhen the reader has completed this Code Pattern, they will understand how to:\n* Generate a synthetic graph dataset\n* Load a graph schema from json\n* Import graph data in csv files into JanusGraph database\n* Query and update graph data using Console and REST API\n* Setup and configure a distributed JanusGraph system\n\n![](doc/source/images/architecture.png)\n\n## Flow\nPrerequisites:\nInstall and configure JanusGraph, Cassandra, ElasticSearch, janusgraph-utils\n\n1. The user generates Twitter sample schema and data using JanusGraph utilities\n2. The user loads schema and imports data in backend servers using JanusGraph utilities\n3. The user makes search and update requests in a REST/custom client\n4. The client app sends the REST requests to JanusGraph server\n5. The JanusGraph server interacts with backend to process and return graph data\n\n## Included components\n\n* [Apache Cassandra](https://cassandra.apache.org/): An open source, scalable, high availability database.\n* [JanusGraph](http://janusgraph.org/): A highly scalable graph database optimized for storing and querying large graphs. JanusGraph v0.1.1 was used for this code pattern development and test.\n\n## Featured technologies\n* [Databases](https://en.wikipedia.org/wiki/IBM_Information_Management_System#.22Full_Function.22_databases): Repository for storing and managing collections of data.\n* [Java](https://java.com/en/): A secure, object-oriented programming language for creating applications.\n\n# Watch the Video\n\n[![](https://img.youtube.com/vi/1TQcPWgPvF8/0.jpg)](https://www.youtube.com/watch?v=1TQcPWgPvF8)\n\n# Steps\n## Run locally\n1. [Install prerequisites](#1-install-prerequisites)\n2. [Clone the repo](#2-clone-the-repo)\n3. [Generate the graph sample](#3-generate-the-graph-sample)\n4. [Load schema and import data](#4-load-schema-and-import-data)\n5. [Run interactive remote queries](#5-run-interactive-remote-queries)\n\n### 1. Install prerequisites\n\u003e NOTE: These prerequisites can be installed on one server. The instructions are written for Cassandra 3.10 and ElasticSearch 5.3.0 on Linux. Newer versions should work, but might not have been tested. The folder structures on Mac can be different. Check Cassandra and ElasticSearch official documentations for details.\n\nInstall Cassandra 3.10 on the storage server. Make the following changes in `/etc/cassandra/cassandra.yaml` and restart Cassandra.\n\n```\nstart_rpc: true\nrpc_address: 0.0.0.0\nrpc_port: 9160\nbroadcast_rpc_address: x.x.x.x (your storage server ip)\n```\n\nInstall ElasticSearch 5.3.0 on the index server. Make the following changes in `/etc/elasticsearch/elasticsearch.yml` and restart ElasticSearch.\n\n```\nnetwork.host: x.x.x.x (your index server ip)\n```\n\nInstall JanusGraph on the graph server:\n* Install java (1.8), maven (3.3.9, newer should work), git (2.7.5, newer should work)\n* Run `git clone https://github.com/JanusGraph/janusgraph.git`\n* Run the following commands in the `janusgraph` folder:\n```\ngit checkout 4609b6731a01116e96e554140b37ad589f0ae0ca\nmvn clean install -DskipTests=true\ncp conf/janusgraph-cassandra-es.properties conf/janusgraph-cql-es.properties\n```\n* Make the following changes in conf/janusgraph-cql-es.properties:\n```\nstorage.backend=cql\nstorage.hostname=x.x.x.x (your storage server ip)\nindex.search.hostname=x.x.x.x (your index server ip)\n```\n\nInstall a REST client, such as RESTClient add-on for Firefox, on the client machine.\n\n### 2. Clone the repo\n\nClone the `janusgraph-utils` on the graph server and run `mvn package`.\n\n```\ngit clone https://github.com/IBM/janusgraph-utils.git\ncd janusgraph-utils/\nmvn package\n```\n\n### 3. Generate the graph sample\n\nRun the command in `janusgraph-utils` folder to generate data into `/tmp` folder.\n```\n./run.sh gencsv csv-conf/twitter-like-w-date.json /tmp\n```\nModify the generated user file under `/tmp` so the sample queries will return with data.\n```\nsed -i -e '2s/.*/1,Indiana Jones/' /tmp/User.csv\n```\n### 4. Load schema and import data\n\nA graph schema can be loaded from either the Gremlin console or a java utility. You can check the\ndoc [doc/users_guide.md](doc/users_guide.md) for details. Alternatively, just run one command in `janusgraph-utils` folder to\nload schema and import data.\n```\nexport JANUSGRAPH_HOME=~/janusgraph\n./run.sh import ~/janusgraph/conf/janusgraph-cql-es.properties /tmp /tmp/schema.json /tmp/datamapper.json\n```\n\n### 5. Run interactive remote queries\n\nConfigure JanusGraph server by running these commands:\n\n```\ncd ~/janusgraph/conf/gremlin-server\ncp ~/janusgraph-utils/samples/date-helper.groovy ../../scripts\ncp ../janusgraph-cql-es.properties janusgraph-cql-es-server.properties\ncp gremlin-server.yaml rest-gremlin-server.yaml\n```\n\nAdd this line to janusgraph-cql-es-server.properties:\n```\ngremlin.graph=org.janusgraph.core.JanusGraphFactory\n```\n\nChange the following four lines in rest-gremlin-server.yaml:\n```\nhost: x.x.x.x (your server ip)\nchannelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer\ngraph: conf/gremlin-server/janusgraph-cql-es-server.properties}\nscripts: [scripts/empty-sample.groovy,scripts/date-helper.groovy]}}\n```\n\nStart JanusGraph server:\n```\ncd ~/janusgraph; ./bin/gremlin-server.sh ./conf/gremlin-server/rest-gremlin-server.yaml\n```\n\nNow you can query and update graph data using REST. For example, send REST requests using RESTClient\nin browser with following:\n```\nMethod: POST\nURL: http://x.x.x.x:8182\nBody: {\"gremlin\":“query_to_run\"}\n```\nYou can find sample search and insert queries in [samples/twitter-like-queries.txt](samples/twitter-like-queries.txt).\n\n# Sample output\n\n![Sample output for \"Find Indiana Jones' tweets that his followers retweeted\"](doc/source/images/sample_output.png)\n\n# Links\n* [Demo on Youtube](https://www.youtube.com/watch?v=1TQcPWgPvF8): Watch the video.\n* [JanusGraph](https://docs.janusgraph.org/): Learn more about this highly scalable graph database optimized for storing and querying large graphs distributed across a multi-machine cluster.\n* [Data and Analytics Reference Architecture](https://www.ibm.com/cloud/garage/architectures/dataAnalyticsArchitecture): Learn how this Journey fits into the Data and Analytics Reference Architecture\n\n# Learn more\n\n* **Data Analytics Code Patterns**: Enjoyed this Code Pattern? Check out our other [Data Analytics Code Patterns](https://developer.ibm.com/technologies/data-science/)\n* **AI and Data Code Pattern Playlist**: Bookmark our [playlist](https://www.youtube.com/playlist?list=PLzUbsvIyrNfknNewObx5N7uGZ5FKH0Fde) with all of our Code Pattern videos\n* **JanusGraph Performance Evaluation:** [On-boarding with JanusGraph Performance](https://www.slideshare.net/ChinHuang4/onboarding-with-janusgraph-performance).\n\n# License\nThis code pattern is licensed under the Apache Software License, Version 2.  Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the [Developer Certificate of Origin, Version 1.1 (DCO)](https://developercertificate.org/) and the [Apache Software License, Version 2](https://www.apache.org/licenses/LICENSE-2.0.txt).\n\n[Apache Software License (ASL) FAQ](https://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibm%2Fjanusgraph-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibm%2Fjanusgraph-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibm%2Fjanusgraph-utils/lists"}