Hi Andrey, OrientDB is a GraphDB and a Tree is a kind of graph, so OrientDB well suites this use case. You can use indexes for constraints against field values. About the rest it's a matter to create vertices (nodes) and edges (arcs). You can start from the Tutorial:
https://github.com/orientechnologies/orientdb/wiki/Tutorial:-working-with-graphs Lvc@ On 24 June 2014 02:23, Andrey Kovalev <[email protected]> wrote: > Hi. I want to store the following structure in a database. > System > > Group-1 > > Group-1 > > Document-1 > > Group-2 > > Group-2 > > Document-1 > > Document-2 > > > Initially I was planning to use db4o and to store this hierarchy directly > with java classes. But querying is very poor in db4o so I found OrientDB is > quite promising in this case. > OrientDB is considered as a graph database. On some pages > with documentation I saw that OrientDB had been mentioned as a db for tree > structures as well. > Can anyone share an example (blog post or github) where a simple tree is > stored in OrientDB, easily queried and traversed? > I want to see what is the best approach to maintain a tree in OrientDB or > may be it is better and easier to use another database (mongo?). > Can anyone clarify the following items: > > 1. Is it possible to create an index which will check uniqueness of > nodes' fields' values only on a particular level, so I wouldn't be able to > add Group-2 to a System node but I would easily add it to a System/Group-2 > node? > 2. If I want to load Groups hierarchy at once and to load Documents > lately (lazy) I should store groups as embeddedlist and documents as > linklist. Am I right? > 1. But in that case in order to add a group I will need to load > entire System class manually (in Java) go to a relevant Group, add a > child > and store entire System. Am I right? > 2. If I want to load full hierarchy I can use traverse queries. But > I do not get how I can traverse and build a tree structure. As I > understand > traverse query will return all nodes as a list so again I will need to > build a tree structure in java manually? > > I have much more questions. But depending on how those are answered I may > be clear or not. > Hoping someone already has thought about it. > Thanks in advance. > > > > > > > > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
