AnsweredAssumed Answered

Query over Relations

Question asked by schaefse on Jan 12, 2012
Latest reply on Jan 21, 2012 by pedronaranjo
Hi,

I'm looking for a solution for the following problem:
I've designed a simple content model, containing several custom document types and, for some own workflow implementation, a 'workflowcontrol' type. The intitial idea was, the relate a 'workflowcontrol' to each document, since I won't have to change the document meta itself then - for example, if status changes or the responsible editor person is replaced. In addition 'user' and 'team' types (for simplicity all derived from cm:content) have been implemented and are assigned (as relations) to each 'workflowcontrol' object.

[Editor] <1 —- n> [workflowcontrol] <1 —- 1> [document]

Now my problem: I'm using the opencmis api to build a client application, and, for example, I need to count all documents related to an editor object. Since I cannot (or at least think, I can't) join over these relations in queries, I have implemented a very, very slow (but finally working) mechanism, that first gets the 'editor' object and then get it's source(or target) 'workflowcontrol's, counting over the iterator. Of course it becomes even slower, if I want to get the 'documents' with a certain status (i.e. 'new'), which is stored in the 'workflowcontrol'. In this case, for each 'workflowcontrol' retrieved I would have to get relation target documents as well.
Since I'm not sure, if we use alfresco as the final repository (that why we use cmis ;) ), we decided not to use aspects and so this (propably best) way of implementing this kind of logic is not an option. Are there any ideas, how to implement this logic with little more performance?
One possibility would be using weaker links (maybe a string field containing object id's instead of each relation), but maybe there are better ways.

thank you in advance

Sebastian

Outcomes