Best practise for Java-based dynamic graph data model building

Hi folks,

i am currently working on a project where i want to use neo4j database as persistence layer. The project consists of a Java backend based on Spring as well as a frontend written in VueJS. At the moment i am figuring out the best practise to fit my needs.

Within the application, it is envisioned that the graph model is created by some kind of super-user supported via the web frontend. Here, the user should be able to create the graph (nodes, relations and potentially tags) on his own totally.

My main question now is if there exist library support to do this. Since i am working already a lot with Spring, my first direction was the Spring Data Neo4j extension. The POJO and transaction support seems nice, but the issue with the not existing graph model at compile time still exists.

At the moment i can only think of the following solutions, but i am totally unsure if they are the way to go:

  • Create a very abstract meta-model following the Spring Data extension (abstract node, abstract relation) to form the triples. Sure, i would need to have lots of properties holding the actual semantics. Following this approach i could reuse the controlled Spring methods but i am not sure if i would loose database efficiency.
  • Direct implementation of interaction with neo4j via own routines without framework support. Passing over the needed information from the frontend to the backend in order to generate nodes, relations and further properties seems straight forward, but there again might be issues in the detail.

I would be more than happy, if anybody could share her/his thoughts on this. Thank you in advance!