Object-Oriented Modeling for Neo4j Graph Databases
- مشاركة هذه المناقشة
- نسخ الرابط
- مشاركة على X (Twitter)
ملخص
This Neo4j community discussion explores a new approach to graph database modeling using object-oriented concepts. By implementing abstract classes and property inheritance, users can simplify the transition from relational databases to graph structures. The thread provides a practical graphical toy model to demonstrate how these design patterns can be applied to data imports, offering a valuable resource for those looking to optimize their database architecture.
I am working on OO flavoured modelling for graph DB, having fleshed out that using abstract classes and inheritance of properties through taxonomical cascades, as well as relationship inheritance alongside these, purely graphical notation conventions and a fixed protocol to transfer the model to an actual Neo4j DB while importing (or entering) instances is a very plausible strategy for those migrating to graphs from relational approaches and, above all, for newbies in database design 🙂
Would really welcome comments on this !!
Really cool Tang. How would a newbie in database design adopt what you are suggesting?
Thanks for your answer !! I would like to provide an example of how it works, for that I should upload a graphical toy model here and then go on explaining how it is built and how to use it while importing data from a .csv, for example. Only, I don't know if i am entitled to upload an image into this thread ... Could you tell me please ?
I don't know - please try 🙂
I post an excerpt of a toy model, will comment on it tomorrow (very late now here) Hope it gets through !
Discord sent us an expired image link.
Just say before going that dotted line rectangles represent the only type of classes for which new instances can be created. As for the solid line ones, if the label is in parentheses ("asset", for example), they stand for an abstract class; if it is not (here, "Usage"), for a class having pre-determined instances as enumerated by the attached property (type= | ...).
Hi again Ari, do you think I should elaborate on this ?
wooo, i have the feeling that this subject is not precisely a blockbuster 😅 I wonder if its right to go into it further myself here, or if I should pause and see if questions or challenges arrive before ... If anyone has an advice on the best strategy, please let me know 🙂
Good topic - but people are enjoying the summer 🙂
thanks for your encouragement, Ari !! So, for the moment, I carry on 🙂
I pick up on the last class type I mentioned before; those with pre-determined instances (here, "Usage"). What the diagram says is that one instance of it will be connecting via the PURPOSE relationship with every instance of "Building" and "Vehicle", as both these are concrete subclasses of the "(registered asset)" abstract class. In practice, if I have an instance of Building that has "housing" as its PURPOSE, it will appear in Cypher as "(a:Building) -[:PURPOSE]->(b:Usage {type: "housing"})". Worth to note is that the abstract class will not surface in the DB: it is only there to flow down the PURPOSE relationship onto Building and Vehicle, thus avoiding the need to repeat it for both these in the model.