Hi all, I’m generating some templates for testing data validation. While checking my code I realized I might be generating invalid OPTs, since my script is updating the cardinality constraints of each multiple attribute in the OPT (content, events, items, etc.), but was not checking the occurrences in the children objects defined for the multiple attribute.
After discussing a little bit with @pieterbos and @yampeku I ended up with a question:
If there is only ONE child object in the multiple attribute in the OPT, and the attr.cardinality = 1…5, is the attr.children[0].occurrences = 0…1 | 0…3 | 0…5 | 0…10 | 0… valid?*
My interpretation of the spec is: as long as both, cardinality and occurrences, don’t contradict, any combination is allowed, since the goal is runtime validation of the data.
A contradiction would be cardinality = 0…5 and occurrences 10…*
But if we know in the OPT that the cardinality is 1…5, wouldn’t be easier to also constraint the child occurrences accordingly? Like allowing only 1…1, 1…3, 1…5, 3…5, 5…5 (see the cardinality contains the occurrences in this case).
Pieter referenced me to the validity rules in AOM2 which I couldn’t find in AOM1.4 and narrow the space for interpretation of the semantics of cardinality, occurrences and their relationship. Specially VACMCU, VACMCO and WACMCL.
For VACMCU I’m questioning if this part doesn’t make implementation more complex: “where a cardinality with a finite upper bound is stated on an attribute, for all immediate child objects for which an occurrences constraint is stated, the occurrences must either have an open upper bound (i.e. n…*) which is interpreted as the maximum value allowed within the cardinality…”
If we know occurrences 1…* will be interpreted as 1…5 when the cardinality of the parent is 0…5, why not using 1…5 directly?
One last item, in AOM1.4 the only definitions for occurrences are:
-
Members_valid:
members /= Void and then members.for_all(co: C_OBJECT | co.occurrences.upper <= 1)
-
Occurrences of this object node in the data, under the owning attribute. Upper limit can only be greater than 1 if owning attribute has a cardinality of more than 1).
I think 1. is wrong, it should be “>= 1” instead of “<= 1”.
In 2., related to my initial question, can’t the occurrences.upper be whatever for multiple attributes because at runtime that is constrained by the container cardinality?
Also I’m not sure about the meaning of “owning attribute has a cardinality of more than 1”, does it mean the cardinality.lower >= 1? Because cardinality is an interval not an integer. Or it is trying to reference the attribute as a “multiple attribute”?
Besides checking 1. & 2. for correctness in AOM1.4, we need the validity rules from AOM2 applied to AOM1.4 too. Without those rules, IMO there is a lot of space for interpretation, which could affect how data validation is implemented, then having the same data validated in different ways in systems from different verndors.