Neo4j join table like data

(Joern) #1

Hi everybody,
I'm quite new to Neo4j and doing currently some testing to check if Neo4j can help out in some complicated data modelling.
I have a requirement that I have to show some data in a table like style.
Let's say I have a hierarchy (very much simplified here)
all nodes are also represented in according domain entities
additionally let's assume that :department has much more other relations

now I need to show this data in a table like style,e.g.:,,person.firstname,person.lastname

while it's quite easy to return this data by cypher statement and map it to a List<Map<String,Object>> I also have to consider that I want to manipulate the data. Having the data as List is easy then for UI representation but not for storing back entities in Neo4j
The other way round if I get the data in the domain model, I have to do the 'join' locally traversing down the path and always going back to call next node in Neo4J and also having some JSON pain about circular dependencies in DTOS, etc.

Is there any way to define the exact path that should be loaded in an eager way, so that I do get only those relations that are relevant for me ? Specifying the load depth gives me from my understanding every node in the defined distance so not only those that I'm interested in.
Or is there any other way to traverse the data ?

Any help appreciated from a Neo4j rookie



(Jiropole) #2

I haven't analyzed your larger question, but just wanted to mention there are ways to map back and forth, with e.g. unwind.

Now, if you analyze the Cypher logged by SDN Repository dynamic functions, they are short and rely on pattern comprehension, which is cool (and new to me). Using these patterns, you can fashion your own traversal patterns, using the @Query annotation.