generate RDB DDL/DML from GraphDB (Tinkerpop).
- this script generate 4 SQL files.
- [DDL] CREATE TABLE "vertex_${vertex label}"
- the columns are as follows.
- id
- property_${all property keys}
- the columns are as follows.
- [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}
- the columns are as follows.
- [DML] INSERT INTO "vertex_${vertex label}"
- [DML] INSERT INTO "edge_${edge label}from${out vertex label}to${in vertex label}"
- [DDL] CREATE TABLE "vertex_${vertex label}"
- Java 11
- Scala 2.13
- sbt 1.9.8
- checkout this repository
gh repo clone kazumatsudo/GraphDB2RDB
-
launch your GraphDB Server
docker compose up -d
-
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
-
execute the script by sbt
sbt run
-
generate SQL files
- sql/ddl_edge.sql
- sql/ddl_vertex.sql
- sql/insert_edge.sql
- sql/insert_vertex.sql
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 |
no advance preparation required because it's selected by default.
- set environment variable "ANALYSIS_METHOD" to "using_specific_key_list"
% export ANALYSIS_METHOD=using_specific_key_list
- set target vertex label, property key, and its values in using_key_list_file.json
- json schema: using_key_list_file_schema.json
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.
- xxx