cubicweb #3244054 support constraints on EntityType [open]

My current use case, given:

class rel_1(RelationDefinition):
  subject = ('A', 'B')
  object  = 'C'
  cardinality = '?*' # cannot put '1*'

class rel_2(RelationDefinition):
  subject = 'A'
  object = 'B'

I'd like to express a constraint saying that:

  • either A rel_1 C or
  • A rel_2 B and B rel_1 C,

hence ensuring that there's always a link (direct or indirect) between A and C, through the rel_1 relation, before creating A.

Something like:

class A(EntityType):
  ...
  constraints = [RQLConstraint('X rel_1 Y OR (X rel_2 Z, Z rel_1 Y)')]
prioritynormal
typeenhancement
done in<not specified>
closed by<not specified>