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
Thanks 2015-09-21 18:19 GMT+02:00 camilo casadiego <[email protected]>: > > 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 in.in.size() 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? > > -- > > --- > 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.
