Skip to content

kazumatsudo/GraphDB2RDB

GraphDB2RDB

generate RDB DDL/DML from GraphDB (Tinkerpop).

Latest GitHub release License codecov workflow

Demo

demo2

Features

  • this script generate 4 SQL files.
    1. [DDL] CREATE TABLE "vertex_${vertex label}"
      • the columns are as follows.
        • id
        • property_${all property keys}
    2. [DDL] CREATE TABLE "edge_${edge label}from${out vertex label}to${in vertex label}"
      • the columns are as follows.
        • id
        • id_in_v (= vertex_{vertex label}.id)
        • id_out_v (= vertex_{vertex label}.id)
        • property_${all property keys}
    3. [DML] INSERT INTO "vertex_${vertex label}"
    4. [DML] INSERT INTO "edge_${edge label}from${out vertex label}to${in vertex label}"

Prerequisites

  • Java 11
  • Scala 2.13
  • sbt 1.9.8

Installation

  1. checkout this repository
    gh repo clone kazumatsudo/GraphDB2RDB

Usage

  1. launch your GraphDB Server

    docker compose up -d
  2. select analysis method
    choose analysis method to search Vertex/Edge algorithm.

    • "by_exhaustive_search" (default)
    • "using_specific_key_list"

    please see following passage if you want to change method.

    % export ANALYSIS_METHOD=by_exhaustive_search
  3. execute the script by sbt

    sbt run
  4. generate SQL files

    • sql/ddl_edge.sql
    • sql/ddl_vertex.sql
    • sql/insert_edge.sql
    • sql/insert_vertex.sql

Analysis method

by_exhaustive_search using_specific_key_list
summary analyze all Vertices and Edges.
Sequence Diagram
analyze specific vertices searched by keys.
Sequence Diagram
pros no advance preparation required faster than by_exhaustive_search (enable to search by index)
cons inefficient (execute full search all vertices and edges count times) required to prepare search condition

How to choose

by_exhaustive_search

no advance preparation required because it's selected by default.

using_specific_key_list
  1. set environment variable "ANALYSIS_METHOD" to "using_specific_key_list"
    % export ANALYSIS_METHOD=using_specific_key_list
  2. set target vertex label, property key, and its values in using_key_list_file.json

Settings

You can define following settings as you like.

  • GraphDB connection settings
  • output SQL directory

The settings you can be changed are summarized in application.conf.

Code of Conduct

Contributing

License

Authors

Contributors

  • xxx