Separators Requirements Class: Text Encoding Rules Requirements Class

OGC 08-094r1 SWE Common Data Model block-separator-chars = Value of the blockSeparator attribute token-separator = [white-space] token-separator-chars [white-space] block-separator = [white-space] block-separator-chars [white-space] White spaces around separators are in fact only allowed when the “collapseWhiteSpaces” attribute is set to ‘true’ which is the default.

9.2.2 Rules for Scalar Components

The value for a scalar component is encoded as its text representation, following XML schema datatypes conventions. scalar-value = xs:bool xs:string xs:double xs:int xs:date xs:dateTime Nil values are included in the stream just like normal scalar values. Since their data type has to match the field data type, there is no special treatment necessary for a decoder or encoder. It is the responsibility of the application to match the data value against the list of registered nil values for a given field in order to detect if it is associated to a nil reason or if it is an actual measurement value.

9.2.3 Rules for Range Components

Range components are encoded as a sequence of two tokens each one representing a scalar value separated by a token separator: min-value = scalar-value max-value = scalar-value range-values = min-value token-separator max-value

9.2.4 Rules for DataRecord and Vector

Values of fields of a “DataRecord” are recursively encoded following rules associated to the type of component used for the field’s description i.e. scalar, record, array, etc. and separated by token separators as expressed by the following grammar: field-count = Number of fields in the record minus one. Greater or equal to 0 any-field-value = scalar-value range-values record-values choice-values array-values mandatory-field-value = any-field-value optional-field-value = “Y” token-separator any-field-value “N” field-value = mandatory-field-value optional-field-value record-values = field-value field-counttoken-separator field-value 120 Copyright © 2011 Open Geospatial Consortium SWE Common Data Model OGC 08-094r1 When a field is marked as optional in the definition, the token ‘Y’ or ‘N’ shall be inserted in the data block. When the field value is omitted, the token ‘N’ is inserted alone. When it is included, the token ‘Y’ is inserted followed by the actual field value. Requirement http:www.opengis.netspecSWE2.0reqtext-encoding-rulesoptional-field-marker-present Req 92. The ‘Y’ or ‘N’ token shall be inserted in a text encoded data block for all fields that have the “optional” attribute set to ‘true’. Coordinate values of “Vector” components are encoded with a similar syntax, but a coordinate value can only be scalar and cannot be omitted: coord-count = Number of coordinates in the vector minus one. Greater or equal to 0 vector-values = scalar-value coord-counttoken-separator scalar-value The following example shows how elements of an array defined as a “DataRecord” are encoded with the text method: swe:DataArray definition = http:sweet.jpl.nasa.gov2.0mathFunction.owlFunction swe:description Measurement error vs. temperature swe:description swe:elementCount swe:Count swe:value 5 swe:value swe:Count swe:elementCount swe:elementType name = point swe:DataRecord swe:label Error vs. Temperature swe:label swe:field name = temp swe:Quantity definition = http:sweet.jpl.nasa.gov2.0physThermo.owlTemperature swe:label Temperature swe:label swe:uom code = Cel swe:Quantity swe:field swe:field name = error swe:Quantity definition = http:sweet.jpl.nasa.gov2.0sciUncertainty.owlError swe:label Relative Error swe:label swe:uom code = swe:Quantity swe:field swe:DataRecord swe:elementType swe:encoding swe:TextEncoding blockSeparator = tokenSeparator = , swe:encoding swe:values 0,5 10,2 50,2 80,5 100,15 swe:values swe:DataArray In this example, each element consists of a record of two values. The array element structure also corresponds to one block so that tuples are separated by block separators here the ‘,’ character. Since the array is of size 5, there are 5 tuples listed sequentially in the data block, each one composed of the two values of the data record separated by the token separator. The pattern is “temp,error temp,error …” since values have to be listed in the same order as the fields. Copyright © 2011 Open Geospatial Consortium 121