Skip to content

Convert GBAD formatted graph files into Neo4J graphs using neo4j-shell/cypher-shell.

Notifications You must be signed in to change notification settings

leninworld/GBAD2Neo4J

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GBAD2Neo4J

What can GBAD2Neo4J library do?

  1. It helps to convert GBAD graph file to Neo4J cypher cql file and then it can be dumped into Neo4J.
  2. It helps to convert GBAD graph file into JSON file format.

Introduction to GBAD: GBAD is a graph-based library developed by Dr. William (Bill) Eberle from Tennessee Tech University. It takes graph input files and outputs anomalies (i.e., edges and vertices) found using minimum descriptive length approach. Related paper using this library can be found here and here. You dont need GBAD to run the scripts in this repository, but in case you just want it, you can be downloaded from here.

Neo4J related setting:

  1. Download "apoc-3.3.0.2-all.jar" and copy to "plugin" folder in your neo4j home folder.

  2. Setup the plugin folder in neo4j.conf.

    dbms.directories.plugins=<path_for_plugin_folder>

  3. Setup the import file configuration in neo4j.conf.

    apoc.import.file.enabled=true

  4. Restart neo4j service.

Download:

Download the jar file from here.

Usage:

java -jar gbad2neo4j.jar <Option> <ConfigFile>

Steps:

  1. Change the values in the config file for inputFilename , outputFilename , and baseFolder. Sample configuration file is located in "GBAD2Neo4J/conf/application.conf".

    a) Configuration under Source.GBAD2Neo4J is used when converting GBAD to Neo4J cypher .cql file.

    b) Configuration under Source.GBAD2JSON is used when converting GBAD to JSON file.

  2. We assume you have "gbad2neo4j.jar" in current directory.

    a) Run below command for converting GBAD to Neo4J .cql.

         java -jar gbad2neo4j.jar 1 <path_to_config_file>
    

    b) Run below command for converting GBAD to JSON file.

         java -jar gbad2neo4j.jar 2 <path_to_config_file>
    
  3. Dumping into Neo4J: Take the .cql file from baseFolder and run it using neo4j-shell (or) cypher-shell. In my experiment, neo4j-shell is faster than cypher-shell.

    Example:

    ./neo4j-shell -c < /pathToOutputFile/outputFile.cql

    ./cypher-shell -u username -p password "call apoc.cypher.runFile('/pathToOutputFile/outputFile.cql')"

Sample: Sample GBAD graph file format for a triangle that has three nodes named "Integrity", "Intelligent", and "Energy" and edges with label "with" among them (see file "triangle.g" under src/data):

XP # 1

v 1 "Integrity"

v 2 "Intelligent"

v 3 "Energy"

d 1 2 "with"

d 2 3 "with"

d 3 1 "with"


==================================================================================== Sample Triangle graph inside Neo4J which is generated using GBAD2Neo4J:

Triangle

Sample graph inside Neo4J which is generated using GBAD2Neo4J:

Sample

About

Convert GBAD formatted graph files into Neo4J graphs using neo4j-shell/cypher-shell.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published