ADL2 VACMCO validity rule
Description
Activity

Pablo Pazos August 11, 2021 at 3:06 AM
I think I understood what you said and just faced this example:
Occurrences of sibling children in a parent multiple attribute:
In that case, the cardinality.lower of the parent should be at least 4 not 5, because at runtime we could have objects: 1,2,3,4 or 1,2,3,5
Is something like that what you meant?

Pieter Bos August 10, 2021 at 2:11 PM
For the mandatory case, I agree, that could be better defined for the case that occurrences.lower > 1.
However I do not agree for the optional case: the optional nodes can be used to model a choice: fill in all mandatory elements, and perhaps one of these three optional elements, but only one, not two or three. So to cover that, VACMCO really must be one instance of one optional child object, even if more optional objects exists.
And indeed, WACMCL should probably lower than or equal to - that’s actually how it’s implemented in Archie.

Pablo Pazos August 10, 2021 at 2:41 AMEdited
Re-reading the current rules, if the VACMCO is fixed, if my interpretation is correct, VACMCO might actually include this other rule, though there is a difference that might be a contradiction:
WACMCL: cardinality/occurrences lower bound validity: 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 sum of occurrences lower bounds should be lower than the cardinality upper limit.
This is my rationale: for VACMCO if the sum of all child.occurrences.lower (sum_lower) + the count of all child with occurrences.lower = 0 (count_optional) should be in parent.cardinality, then sum_lower + count_optional <= cardinality.upper (being upper finite or not).
Then WACMCL applies only when parent.cardinality.upper is finite, but only considers sum_lower <= parent.cardinality.upper. In this case, this is not enough since, because of VACMCO, the cardinality.upper should also accommodate one instance of each optional child. This might be a contradiction between WACMCL and VACMCO, when VACMCO is fixed.
A border case:
parent.cardinality = 5..11
child1.occurrences = 0..*
child2.occurrences = 10..*
child3.occurrences = 0..*
Applying fixed VACMCO:
sum_lower = 10, count_optional = 2
parent.cardinality.has(12) // violated!
Applying WACMCL: (note the rule is sum_lower is ‘lower’ not ‘lower or equals’ than parent.cardinality.upper)
sum_lower = 10
parent.cardinality.upper = 11 > 10 // passes
Not sure if WACMCL is also missing the count of the optional objects.
I think WACMCL might be a subcase of VACMCO but not sure about what to do with the objects with occurrences.lower = 0. What do you think ?
Another border case, just for discussion:
A border case:
parent.cardinality = 5..11
child1.occurrences = 0..*
child2.occurrences = 1..*
child3.occurrences = 0..*
Applying fixed VACMCO:
sum_lower = 1, count_optional = 2
parent.cardinality.has(3) // violated!
I’m not sure about if this should really be a violation, since it is saying at runtime there are more objects required in the multiple attribute than the minimal stated by the occurrences. Why should that be prevented?
Lastly a related question:
“WACMCL: cardinality/occurrences lower bound validity: 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 sum of occurrences lower bounds should be lower than the cardinality upper limit”
Should that be “lower than” or “lower or equals to”?
in AOM2, for the VACMCO validity rule:
it must be possible for at least one instance of one optional child object (i.e. an object for which the occurrences lower bound is 0) and one instance of every mandatory child object (i.e. object constraints for which the occurrences lower bound is >= 1) to be included within the cardinality range.
I think this part is not totally correct “one instance of every mandatory child object”, since objects with occurrences.lower = 3 would need 3 instances not one, so the cardinality of the parent container should be able to contain at least the number of instances equals to the occurrences.lower of mandatory objects plus one if there are optional objects.