TITLE: From Neo4j graph to Virtual Reality concept map.
I love Graph Theory and VR, I’ve been using Neo4j since March 2020 and Oculus Rift from march 2019.
The first thing I did in Neo4j is the graphdb for my non-profit association: www.Lecco100.it and I worked a bit on it during online Neo4j courses.
GRAPH MODEL
(Association:LECCO100)-[Create:CREATO]->(Course:MASTER)
(Association:LECCO100)-[Realize:REALIZZATO]->(Events::EVENTO)
(Events:EVENTO)-[Done:SVOLTO]->(Location:LOCAZIONE)<-[To:PRESSO]-(Place:LUOGO)
(Lessons:LEZIONE)-[Scheduled:PROGRAMMATO]->(Course:MASTER)
(Person:PERSONA)-[:STAKEHOLDER]->(Association:LECCO100)
(Person:PERSONA)-[Take_part:PARTECIPANTE]->(Course:MASTER)
(Person:PERSONA)-[:SPEAKER]->(Lessons:LEZIONE)
THE GOAL
I would like to export my graph into an immersive VR environment, but... can this be done?
The answer is Yes.
Last Year I bought NODA (https://noda.io/), a Mind Mapping VR software you can buy on Oculus or Steam store.
In NODA you can draw a graph with nodes and relationships. Nodes can have Text (labels) and Image, and relationships can have text only. The nodes can have different shapes and color. We don't have properties on nodes and relationships and we don't have directions on relationships.
But...the NODA files are in Json format, a simple Json file.
THE IMPLEMENTATION PLAN
- reverse engineering of NODA file structure;
- we have Head and tail, nodes section and relationships section. Every node is an object with UUID, compatible with cypher . Every relationship uses the UUID of a start node and the UUID of the end node.
-
export csv data from Neo4j, one file for nodes and one for relationships;
//Nodes list
MATCH (N) RETURN ID(N) AS ID, LABELS(N) AS LABELS, KEYS(N) AS PROPERTIES, N AS DATA
// Relationships list
MATCH (n)-[REL]->(x) RETURN id(n)AS IDA,id(REL) AS IDREL, TYPE(REL) AS RELATION ,KEYS(REL) AS RELPROP, REL AS RELDATA, id(x) AS IDB -
Use Excel for create Json code for every row;
- import .csv file from Neo4j in two different table, Nodes and relationships
- split the Json parameters of NODA in excel column that follow data column and build with string function a new json record
- Test the Json file in NODA.
THE REAL PROBLEMS WE HAVE
- see NODA json records in Excel sheet and discover a need for spatial positioning with three axis, x,y and z;
- define data structure for NODA object, nodes and relationships and match with Neo4j db structure;
- write cypher queries for export nodes and relationships in csv files;
- Import csv files in Excel to test sorting and normalization;
- write the minimum quantities of formulas to create the json rows;
- compose the json file and import in excel to check if it's well shaped;
- run Oculus Rift and open the file in NODA;
- optimizing cypher queries, fields and formulas for Excel, shape, color and spatial positioning for NODA;
The really interesting problem is the first.
- Neo4j show graph in 2D format and explode dynamically nodes and relationships (Force-directed graph drawing - Wikipedia) .
- NODA is a static space where you can place objects and connect them in 3D (NODA VR Mind-Mapping Brainstorming White-Boarding App Trailer - YouTube) .
- NODA space : x-axis from -9,5 to +9,5, y-axis from -1,5 to +9,5, z-axis from -9,5 to +9,5.
I created a lot of tests and one day I realized that I could use the Excel xy chart to preview the result.
I use z-axis as a layer and the result in NODA is really impressive :-)
From the beginning of my journey in Virtual reality technology I have seen a lot of opportunity but the only way for making real business is gaming.
I think that a generic way to export graph in VR can be a useful technology for business purposes too , because virtual reality is not just a game.