devtools/testlib.py
changeset 2126 a25859917ccc
parent 2058 7ef12c03447c
child 2144 51c84d585456
equal deleted inserted replaced
2123:3e1d2ab5f8c0 2126:a25859917ccc
    42     cardinality
    42     cardinality
    43     """
    43     """
    44     # compute how many entities by type we need to be able to satisfy relation constraint
    44     # compute how many entities by type we need to be able to satisfy relation constraint
    45     relmap = {}
    45     relmap = {}
    46     for rschema in schema.relations():
    46     for rschema in schema.relations():
    47         if rschema.meta or rschema.is_final(): # skip meta relations
    47         if rschema.is_final():
    48             continue
    48             continue
    49         for subj, obj in rschema.iter_rdefs():
    49         for subj, obj in rschema.iter_rdefs():
    50             card = rschema.rproperty(subj, obj, 'cardinality')
    50             card = rschema.rproperty(subj, obj, 'cardinality')
    51             if card[0] in '1?' and len(rschema.subjects(obj)) == 1:
    51             if card[0] in '1?' and len(rschema.subjects(obj)) == 1:
    52                 relmap.setdefault((rschema, subj), []).append(str(obj))
    52                 relmap.setdefault((rschema, subj), []).append(str(obj))