Skip to content

SJSU272Lab/Graphify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Abstract

Graph theory of storage is becoming de facto solution to today’s need of handling big-data, majority of organizations are still using the relational system mainly for one thing ‘Cost’ of migrating to Graph DB from their legacy system. If there was a tool to analyse your current DB structure and create a schema based on the analysis, it would save a lot of time and hence cost. We would like to create a tool that would provide easy to use user interface (drag and drop, buttons to add relationship), generate schema, create nodes and edges by migrate data from existing DB to new one. We would like to start with migrating MySQL to IBM Graph for two reasons, MySQL being one of the most widely used relational DB and IBM Graph as it has exposed APIs to do data and structure manipulations. This would help the organizations who wish to migrate or use graph DB.

#User Stories

  1. As a user I want to be able to migrate my existing relational DB to Graph DB
  2. As a user with no DB background I want to be able to create new Graph DB just by using drag and drop utilities

#Flow diagram

Version 2

#Strategy

There is no one correct one way of designing a database schema even if you follow the industry statndards. Using them doesn't ensure the most optimised design. The most important factor to keep in mind while designing DB schema should be your requirements. Migrating relational DB to other relation DB (MySQL to Oracle) is pretty straight forward, whereas it is not the case with migrating realtional DB to Graph. Graphify provides one basic strategy defined that helps you migrate to Graph using the foreign keys defined in your relational schema. Below is the example of how it works:
Consider a simple 'expense' DB schema:

ER Diagram

Graphify fetches the DB schema from MySQL as json, realtional DB schema and converts to IBM Graph schema
All that Graphify does in this stategy is that it considers the foreign key realtionships in the relational DB and defines them as edges in the Graph between two nodes (which are nothing but the tables in the relational DB). The strategy can be easily understood if these two files are compared.
This is a default strategy that Graphify offers whereas users can define and create their own strategy by making another implementaion of the the interface as per requirement.

#How to deploy to localhost or Docker container

  1. Build DBService
  2. Build Graphify
    Use mvn clean install command to build these modules
    PS: Before building Graphify module make sure that 'BaseUrl' in web.xml has the correct host and port, this should the host and port of the host machine.
  3. Deploy the generated 'war' artifact to any web container or to Docker container, Graphify module already has a Dockerfile, use below command to run the build docker image:
    "docker build -t some-image-name:tag ."
    eg. "docker build -t graphify:1.0 ." and to run the docker image use below command
    "docker run --name app-name -d -p host-port:8080 some-image-name:tag --link some-mysql-container:mysql-service-alias"
    eg. "docker run --name graphify -d -p 8080:8080 --link mysqldb:mysql"

PS: Make sure that the deployed application has access to the MySQL server hosting the DB and the provided user has read access to the schema you wish to convert.

#Demo and resources Watch demo here
MySQL create script
MySQL sample dump

#Validate conversion Once the conversion is done as shown in the demo to validate the conversion you may use IBM Graph's Gremlin API
Make a post request using below details
Post URL = https://ibmgraph-alpha.ng.bluemix.net/cbdaceb1-6e60-4378-bfc5-d0cbd1f24b49/{graph_name}/gremlin
Headers = {"Content-Type": ["application/json"], "Authorization":["Basic NGZhZTZhMTYtYzVlMy00ZTljLTk5MGItMmQ3ZmNmNzczMzY5OmQ4NjMxMmY5LTlhN2QtNDllMi05ZWVkLTRlNDc1NTU3YjQ0ZA=="]}
Sample request body =

{
    "gremlin":
        "def gt = graph.traversal();gt.V().hasLabel(\"status\").has(\"status_id\", \"1\").inE(\"refers_status\").outV().path();"
}

PS: graph_name is the name of the graph you get once the DB is converted successfully.
graph_name for the above demo video would be 1481581976977

Website: http://graphify-64145313.3e92ad2e.svc.dockerapp.io:8080/graphify/
Contact us: [email protected], [email protected], [email protected], [email protected]

#Contributors

  1. Sushant Vairagade
  2. Nakshtra
  3. Sohrab Ali
  4. Swathi Koduri

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •