Can I access Cluster/s name for objects during a query

Skip to first unread message

camilo casadiego

Sep 21, 2015, 12:19:10 PM9/21/15
to OrientDB

Maybe this could be due a poor design, so any advice will be appreciated.

I got a graph database that helps me model associations of objects based on Inheritance, for example

class:Element <----- class:Car

So if I get a new car, I just insert it into car class

Later I added the requirement, to keep a "metamodel", or a vision of all the data that stars getting into the model, while mantaining data separation for users, to achieve this, I decided that the data for each user, should go to separate set of clusters.

So if personA tries to insert something inside car, the system is going to create automatically the new cluster, and put the element on the right cluster.

class:Element <----- class:Car ------ cluster:personA_Car

This model applies the same for relationships and other kind of elements.

At the same level of class:Car, resides other classes that are going to be later related with car, for example, lawnmower, bike, all this classes are created dynamically, as are the clusters for the data and the relationships.

Bottom line, the model looks like a tree, where using relationships, I associate different kind of objects, and to differentiate from user A to user B, I use cluster, but when querying I only have the prefix of the cluster names, but the actual cluster where my root element resides is unknown for me.

To generalize, I need to find a way to be able to do something like this for personA:

 select * from Element e where is null (and 'e' resides on cluster starting with personA)

Besides doing the first part on the orientEngine, and coding the second part to get the clusterName, and get the correct one, is there another better approach?

Luigi Dell'Aquila

Sep 22, 2015, 4:23:23 AM9/22/15
Hi Camilo,

at this stage there is no way to access cluster name inside a query. You can define a custom javascript function that retrieves a cluster name based on a record (using native APIs) and then use this function in your queries.
Anyway, the idea of using a cluster per user will probably lead to some problems: in current release you have a limitation to max 32.000 clusters per database, so you will probably run out of available clusters in short.
I suggest you to adopt a different strategy, eg. adding a User entity and linking it from your Element records. This way your queries will be straight forward



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
For more options, visit

camilo casadiego

Sep 22, 2015, 11:52:40 AM9/22/15
Thank you very much!

Camilo Casadiego Espitia
Skype: cce982
Bogotá D.C. - Colombia


You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
Reply all
Reply to author
0 new messages