AllowedValues Element Requirements Class: Basic Types and Simple Components Schemas Requirements Class
SWE Common Data Model OGC 08-094r1
This element is used to specify numerical constraints for the “Count” and “Quantity” elements and the corresponding range components. The XML snippet below illustrates
how to constrain an angular value to the -180180 degrees domain:
swe:Quantity definition
= http:sweet.jpl.nasa.gov2.0spaceDirection.owlAngle
swe:label Planar Angle
swe:label swe:uom
code =
deg swe:constraint
swe:AllowedValues swe:interval
-180 +180 swe:interval
swe:AllowedValues swe:constraint
swe:Quantity
Several intervals can be specified to generate holes with forbidden values. Using several intervals means that the value is constrained to be within one of the intervals:
swe:AllowedValues swe:interval
-INF -20 swe:interval
swe:interval 20 50
swe:interval swe:interval
60 INF swe:interval
swe:AllowedValues
Note that the –Infinity and +Infinity are allowed in order to specify unbounded intervals. The above example indicates that the value must be either less than or equal to -20,
between 20 and 50 included, or greater than or equal to 60. Intervals specified with this element are always inclusive and should not overlap.
Allowed values can also be enumerated as shown in the example below:
swe:Count definition
= http:www.opengis.netdefpropertyOGC0NumberOfPixels
swe:label Image Width
swe:label swe:constraint
swe:AllowedValues swe:value
256 swe:value
swe:value 512
swe:value swe:value
1024 swe:value
swe:AllowedValues swe:constraint
swe:Count
Several allowed intervals and values can also be combined to express a complex constraint even though this is rarely used in practice:
swe:AllowedValues swe:value
5 swe:value
swe:value 10
swe:value swe:interval
20 30 swe:interval
swe:interval 40 60
swe:interval swe:AllowedValues
In the above example, the actual value must be 5, or 10, or between 20 and 30 included, or between 40 and 60 included. All numbers used within “interval” and “value” elements
shall be expressed in the same unit as the enclosing data component Req 36.
Copyright © 2011 Open Geospatial Consortium
87
OGC 08-094r1 SWE Common Data Model
The last option to specify a constraint on a decimal number so only applicable to “Quantity” is to limit the number of significant figures:
swe:AllowedValues swe:significantFigures
5 swe:significantFigures
swe:AllowedValues
Constraining a number to 5 significant figures means that a total of only 5 digits are or can be used for the representation of the value. The numbers 1.2345, 5.4823e-3, 0.98655
and 00235 are all composed of 5 significant figures, but 1.23450 and 658970 have six significant figures leading zeros are ignored.
When decimal values are encoded with a binary floating point data type rather than text, restricting the number of significant figures also means that the lowest order fractional
digits of the mantissa should be ignored even though they may be encoded due to rounding errors.