Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to store and mantain the dynamic hierarchy tree data ?

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello onas Partner, Aleksa Vukotic, and Nicki Watt,

I had tried out to store dynamic hierarchy tree data in neo4j on last year but i personally found that it's not easy or not possible to store the dynamic hierarchy tree data.

Also, how would you manage inheritance property of one parent node to child node when we store the tree data in neo4j ..

Please let me know if you have any more detail data require for above question.

thanks you ..
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I guess this depends on exactly what you mean by 'dynamic'. With regards to 'managing' inheritance of properties from one node to another, one strategy would be to deal with this as part of your query / traversal gathering the data as you traversed 'up' your hierarchy, where, if a property was not there, you obtain it from the parent otherwise use the one which exists.

If you are thinking of a 'hierarchy' in terms of a Java class hierarchy, for example you have a Person class which has Customer and User as subclasses, this does not generally translate into two distinct nodes within the graph. If you wanted to store the details for the instance 'Bob' as a 'Customer', you would typically only have one node with all the properties (related to both Person and Customer) in this single node. You may well have two Neo4j labels associated with this one 'Bob' node, (a 'Person' and 'Customer' label). This is one of the strategies employed by Spring Data Neo4j (SDN) in terms of representing a Java based hierarchy in Neo4j.
For more info on this you can see the SDN website here:, specifically the section on "Entity Type Representation".

Hope this helps
I'm gonna teach you a lesson! Start by looking at this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic