[Cubicweb] ComputedRelation

Sylvain Thénault sylvain.thenault at logilab.fr
Tue Mar 31 08:02:40 CEST 2015

On 30 mars 23:05, Christophe de Vienne wrote:
> Hi everyone,

Hi Christophe,

> I just did a few tests with ComputedRelation, and I have a some issues:
> -   I could not find a documentation outside the CWEP 2 which is a bit
>     light on the matter.

There is though some documentation in the book about that.

[syt at orion ~]$ rgrep ComputedRel src/cubicweb/doc/
src/cubicweb/doc/3.20.rst:* virtual relations: a new ComputedRelation class can be used in
src/cubicweb/doc/book/en/devrepo/datamodel/definition.rst:    class illustrator_of(ComputedRelation):
src/cubicweb/doc/book/en/devrepo/datamodel/definition.rst:* nothing else may be defined on the `ComputedRelation` subclass beside
But I don't remember if there are much more content than in the CWEP...

> -   The '__permissions__' attribute is ignored. Whatever the value I
>     set for the 'read' permission, DBG_SEC reveals that the match is
>     always done against `set(['managers', 'users', 'guests'])`.

According to the CWEP, this is a bug
> -   The expression I would like to use requires a 'HAVING'
>     clause, which gets lost in the final request. And it is, imo, a big
>     limitation if not a bug.
>     Is there any chance to add support for the 'HAVING' clause in a
>     rule ? If so what delay can I expect it, given that I do not think
>     I am in capacity to work on it ?

One could ask if the problem is not rather the need for a HAVING clause in RQL,
rather than allowing such restrictions in the WHERE clause...

Anyway, I agree we want this in computed relation but unfortunatly can't commit
on any time devoted to this topic for now.

> -   As far as I know there is not, currently, any caching done on these
>     computed relations. In our case, it would probably prove useful to
>     have one (performance-wise).
>     Is there any plan to add such a capability ?

Yes, it was in the initial plans but we decided to not handle it at a first
glance to keep things simple, because such a cache is somewhat hard to maintain
(I suspect there are bugs in the computed attribute implementation for
instance). Once we get the current implementation of computed relations and
attributes properly working and some feedback, we may think again about that.

Sylvain Thénault, LOGILAB, Paris ( - Toulouse (
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org

More information about the Cubicweb mailing list