What can GBAD2Neo4J library do?
- It helps to convert GBAD graph file to Neo4J cypher cql file and then it can be dumped into Neo4J.
- 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:
-
Download "apoc-3.3.0.2-all.jar" and copy to "plugin" folder in your neo4j home folder.
-
Setup the plugin folder in neo4j.conf.
dbms.directories.plugins=<path_for_plugin_folder>
-
Setup the import file configuration in neo4j.conf.
apoc.import.file.enabled=true
-
Restart neo4j service.
Download:
Download the jar file from here.
Usage:
java -jar gbad2neo4j.jar <Option> <ConfigFile>
Steps:
-
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.
-
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>
-
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:
Sample graph inside Neo4J which is generated using GBAD2Neo4J: