The use of isEmpty, notEmpty

Copyright © 2014 Open Geospatial Consortium 29

6.6.4 The use of isUnique

isUnique is a special iterator. As with all iterators its left-hand operand its self is a collection. An expression on the members of that collection is tested for uniqueness, which means that the values of that expression must not repeat. The implementation of isUnique in the OCL to Schematron translator is rather restricted and only allows property references as the possible syntax for expressions. See B.1 for a discussion of these issues. General format: x-isUniquey|expry In the case of basic-type values with a cardinality 1, which are being tested for uniqueness, the expression in the iterator body typically is identity. For example, in inv: featureFunction.valuesOrReason.values-isUniquex|x the property featureFunction has a property valuesOrReason, which is a Union, one property of which is values, which has cardinality 1 and is of a basic type. The phrase isUniquex|x needs to be written as shown of course with any other variable identifier in place of x. It is not possible to abbreviate this to isUnique. It is also not possible to rephrase the example above to inv: featureFunction.valuesOrReason-isUniquex|x.values This expresses wrong semantics, because the “collection” valuesOrReason only has one member, which means that the concept of uniqueness does not make any sense. Moreover, this would also be rejected, because there is a restriction in the translation process. This is because the expression x.values leads to a collection, and no sensible way to compare collection valued items had been found, which could be expressed in XPath 1.0.

6.6.5 The effects of navigabilty

Properties, which designate a non-navigable role of an association, cannot be used in OCL constraints. ISO 19103 D.7.2: If this is important to the model, the association should be two-way navigable to make enforcement of the constraint more tenable. In other words, a one-way relation implies a certain “don’t care” attitude towards the non-navigable end. It is usually possible to express the required invariant “from the other side” from the instances of the referenced objects by using the allInstances function. See 6.5.2 for an example.